Bytemd 1.12.4 svelte does not seem to work
See original GitHub issueSomehow adding the Editor (see component code below) does not work, and breaks any page with the editor included:
<script>
import { Editor } from "bytemd";
import gfm from "@bytemd/plugin-gfm";
import bytemdLocaleDe from "bytemd/lib/locales/de.json";
import bytemdLocaleEn from "bytemd/lib/locales/en.json";
import { get } from "svelte/store";
import { stores } from "@sapper/app";
const { session } = stores();
const plugins = [gfm()];
function handleChange(e) {
content = e.detail.value;
}
function changeLocale(locale) {
if (locale === "de") {
return bytemdLocaleDe;
}
return bytemdLocaleEn;
}
$: currentLocale = changeLocale(get(session).locale);
export let content;
let tempContent;
function initContent() {
if (content && content !== tempContent) {
tempContent = content;
}
}
$: initContent(content);
</script>
<div class="mb-3">
<Editor
value={tempContent}
plugins={plugins}
on:change={handleChange}
locale={currentLocale}
/>
</div>
This error is shown in the console output
TypeError: Cannot read properties of undefined (reading '$$')
at init$1 (index.esm.js:258:46)
at new Editor (index.esm.js:35629:5)
at create_fragment (index.esm.js:4897:1)
we use:
- svelte 3.46.4
- sapper 0.29.3
- rollup 2.70.1
Issue Analytics
- State:
- Created a year ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Cant get this working in Svelte Kit #96 - bytedance/bytemd
Hi I can't seem to get this working in Svelte Kit. Like all my other modules: [vite] Error when evaluating SSR module ...
Read more >SvelteKit + ByteMD : r/sveltejs - Reddit
But, I have an error when trying to use ByteMD: Uncaught (in… ... The problem seems to be just on SvelteKit, so do...
Read more >bytemd - npm
ByteMD is a Markdown editor component built with Svelte. ... You can also write your own plugin if these ones don't meet your...
Read more >Simple Markdown Editor • REPL • Svelte
import sanitizeHtml from 'https://cdnjs.cloudflare.com/ajax/libs/sanitize-html/1.27.5/sanitize-html-es2015.min.js';. 4.
Read more >bytemd - bytemeta
bytemd repo issues. ... @bytemd/plugin-highlight-ssr插件无法高亮代码 ... Bytemd 1.12.4 svelte does not seem to work. goodforever. goodforever CLOSED.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution for me was to import it directly from node_modules:
@vujovicigor thanks for the workaround. Same issue for me.