lexical-svelte-runes v0.1.4-beta.88.9795
the main check test branch
i forked lexical repo for tracking purpose fork, ideally we need to catch up commit by commit by i guess it is fine that we just add whatever is needed.
QuickStart
pnpm install lexical-svelte-runes@latest @unocss/reset
<script lang="ts">
import '@unocss/reset/tailwind-compat.css'; //using unocss reset
//import 'uno.css';
import 'lexical-svelte-runes/uno.css'; // import all the generated classname, if you have uno or tailwind, you can ignore this
import 'lexical-svelte-runes/index.css'; // react playground css
import * as Editor from 'lexical-svelte-runes/editor';
import { createHistoryContext } from 'lexical-svelte-runes/playground/context/SharedHistoryContext.js';
import type { Settings } from 'lexical-svelte-runes/playground/appSettings.js';
let { ...props }: Settings = $props(); // check Settings type for all the settings!
createHistoryContext();
</script>
<Editor.SettingsContext settings={props}>
<Editor.SharedAutocompleteContext>
<Editor.LexicalComposer>
<div class="editor-shell w-full">
<Editor.Editor />
</div>
</Editor.LexicalComposer>
</Editor.SharedAutocompleteContext>
</Editor.SettingsContext>
Goal
when importing a new plugin to lexical-svelte-runes, we can use external library instead of copy all the logic from react playground to keep code clean but at the same time we want to 'make sure the structure of our code is similar to react's so that it is easy to debug/maintain, a lot of times we can simply check the commits in rect to copy the changes over.
- migrate to melt-ui/shadcn for components
- use external library instead creating our own
- image resize library
- colorPicker components
- ...
- use feature based folder architecture instead of plugin folder and nodes folder
/dialog node.svelte plugin.svelte.ts
TODO
- codebase needs cleanup remove unused files,dependencies
- imports more components from lexical playground
- setup git actions & releases...
Contribute How-to
- since we use runes to polyfill react hook & svelte runes, it is super easy to port an component, simply copy the tsx into the right folder, then run autoFix.js to clean the import (removing $ by renaming imports) then fix the code to make it svelte-ish ! remember the output of useState
const [fn,setFn]=useState()
are both function just like solidjs
steps (wip)
(we also need to refractor the current repo, i.e move all plugins in to the same folder currently there are some naughty plugins outside )
- clone the lexical-svelte(the repo you are on now) repo - we will refer to the cloned repo 'svelte repo'
- clone official lexical repo - we will refer to the cloned repo 'react repo'
- go to https://playground.lexical.dev/ and pick something we dont have i.e font dropdown
- go to react repo, navigate to react playground package,
- go to toolbar and recursively copy the necessary code for font dropdown to svelte repo's toolbar
- go to editor.tsx , find the plugin for font dropdown (if there is one), recursively copy it over to svelte repo (you might also need to check https://github.com/facebook/lexical/tree/main/packages/lexical-react, we put put leixcal-playground and lexical-react in one package) , put it under
src/playground/plugins/_
, unlike react repo, we want to group by features, so all required files for a feature should be under src/plugins/_, dont need to create a separate nodes folder for nodes - now you have a bunch of
.tsx
and.ts
files under plugins/* , slowly convert each one to svelte files , for.ts
you probably just need to fix the errors due to our svelte hooks ! - you can use autoFix to rename imports since svelte does not support
$
in svelte files - remember when you convert code to svelte , you can use external libs but please keep code structure as similar to the react repo as much as possible for easier debug later on!
- remember to add node to playgroundNodes after your ported from react's repo https://github.com/facebook/lexical/tree/main/packages/lexical-playground/src/nodes
- add converted plugins to the editor.tsx in svelte repo
- remove unused files
- i.e .tsx that you used autoFix.js on or some utilities that svelte don't need
todos...
- fully migration image inserts, captions (try use a image resize lib instead of writing custom resize logic...)
- excalidraw
- finish up autocomplete(current version is customized, i couldnt get lexical-playground's version to work)
- table
- sticky note
- tweet
- youtube videos
- figma
- charts, diagrams...
- columns layout
- lexical-devtool-core
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
8 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago