Giter Site home page Giter Site logo

svelte-utterances's People

Contributors

amr3k avatar shinokada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

saweima12

svelte-utterances's Issues

Some feedback

Hey there, was looking through your package and noticed a few things that could be potentially improved:

  1. Usage of $app/env - The $app alias is SvelteKit-specific and thus means that this component will not work properly on non-SvelteKit projects. This can be fixed by manually implementing your own browser check by reassigning a local browser variable in an onMount to be true.
  2. Usage of element IDs - The usage of the utterances id (as well as document.getElementById) means that only once instance of the component can properly be mounted per page, since all IDs must be unique. Rather than using an ID, it might be more suitable to use the bind:this directive on the div to obtain an instance-specific reference to the node.
  3. getElementsByTagName usage - In the theme switcher code, the call to document.getElementsByTagName('iframe')[0] will retrieve the first <iframe /> element throughout the entire page, meaning that the iFrame.contentWindow.postMessage call will fail if the website has any iframe elements placed before the component in the document.

[BUG]: Currently released NPM package does not work

Description of the bug

The currently released NPM package is out of date, and you cannot set a theme with it.

Steps To Reproduce

  1. Install currently released NPM package (0.2.2)
  2. Attempt to add theme="github-dark"
  3. See that no theme has been applied.

Additional Information

Could you please post a new release that has the latest code? Thanks!

err TypeError: Cannot read properties of undefined (reading 'contentWindow')

The following code returns error:

...
const iFrame = document.getElementsByTagName("iframe")[0];
        iFrame.contentWindow.postMessage(
...

err TypeError: Cannot read properties of undefined (reading 'contentWindow')
at Object.u.$$.update (doc.svelte-98be7cc1.js:1:1097)
at ve (vendor-60873d7e.js:1:7294)
at new be (doc.svelte-98be7cc1.js:1:1258)
at de (doc.svelte-98be7cc1.js:1:3349)
at ve (vendor-60873d7e.js:1:7340)
at new $e (doc.svelte-98be7cc1.js:1:5518)
at zt (index.md-070d2b67.js:18:3876)
at ve (vendor-60873d7e.js:1:7340)
at new Kt (index.md-070d2b67.js:18:4295)
at Array.Ve (start-7fe98c40.js:1:2515)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.