Closed mudcube closed 4 hours ago
Hi @mudcube ,
It is working fine with pnpm
which I have been using for this project. That's why I didn't come across this issue.
In my testing, the Prism undefined
issue happens with npm
dev build (production build works fine). The reason seems to be Prism.js
package being CJS (not supporting ESM). We need to check if there is any ESM build available for Prism.js
to resolve this issue.
Regarding live coding, it works with pnpm
as the project is set up as a monorepo
(You will have run build on svelte-lexical for the changes to be picked up automatically by HMR).
Yeah, not all plugins support SvelteKlt at the moment. I will fix the one you pointed out on priority.
That you so much for your thoughtful response 😊.
It sounds like PrismJS v2.0 is planned to have ESM support, but no word when that will be. Since PrismJS is included in the Lexical package, if there was an ESM version, would we need to get the commit upstream in Lexical proper to sort out the issue, or do you think there'd be another way around?
Do you happen to have a Patreon, or somewhere to send a thank you for your hard work on this project?
Hi @mudcube ,
There is an ESM wrapper for Prism.js that I found in lexical repo. I will give it a go and share the update here later this week. I believe it is better to commit upstream but there is always an option to fork a particular plugin into svelte-lexical if need be.
Regarding Patreon, I have enabled the Sponsor Me
in my GItHub profile. thanks :)
Removed the 'svelte-lexical` references from MarkdownShortcutPlugin, instead using local references. 26e52caf97112fe7950c2905650c1c78ed2777c4
MarkdownShortcutPlugin
now supports SvelteKit 1d5d16352b6405e46692e5a16e6473c9351d6da9
npm
is used as a package manager is resolved by adding npm workspaces
Internal server error
500 error is thrown when running
demos/sveltekit
package usingvite dev
.The following error is logged in the browsers console:
Live svelte-lexical codebase
Next, I tried to debug the issue with live code.
I could not find instruction on how to do this, so booted up
packages/svelte-lexical
usingvite dev
, and rewrote thesrc/routes/+page.svelte
to use the same code as thedemos/sveltekit
. Is there a better way to live debug?Unfortunately, ran into this issue:
The solution to this was, rewriting
MarkdownShortcutPlugin.svelte
references tosvelte-lexical
to use the local copies ofgetEditor
and theImageNode
imports. Resolving this allowed the live code to work within sveltekit.npm svelte-lexical
I am unable to get the npm version of the
svelte-lexical
package working, however. I don't think it's only because of the issue withMarkdownShortcutPlugin.svelte
. The Prism issue seems to resolve with adding the following to thevite
config:But, once this resolves the Prism error, the following error occurs;
Additional note
Another note on sveltekit compatibility:
CodeActionMenuPlugin
andFloatingLinkEditorPlugin
referencedocument
at the top scope, so unable to get either of those plugins working withinsvelte-lexical
local package, or from the npm repository.