svelte-slate
TypeScript icon, indicating that this package has built-in type declarations

0.1.83 • Public • Published

svelte slate

examples license npm (scoped) build

Tools

tries to mimic the react api from slate-react as much as possible

<script lang="ts">
	import { Slate, Editable, withSvelte } from 'svelte-slate';
	import { createEditor } from 'slate';

	const editor = withSvelte(createEditor());
	let value = [
		{
			type: 'paragraph',
			children: [{ text: 'This is editable ' }]
		}
	];
</script>

<Slate {editor} bind:value>
	<Editable placeholder="Enter some plain text..." />
</Slate>

Vite Problems

using the plugin imports can result in mutiple instances of svelte witch can cause context errors, exclude svelte-slate from deps here

export default defineConfig({
	optimizeDeps: {
		exclude: ['svelte-slate']
	}
});

Custom Rendering

Default components for elements, leafs, and placeholders are provider but can easily be overridden see Element.svelte and Leaf.svelte and then can be used in the editable component like <Editable {Element} {Leaf} />

/svelte-slate/

    Package Sidebar

    Install

    npm i svelte-slate

    Weekly Downloads

    8

    Version

    0.1.83

    License

    (MIT OR Apache-2.0)

    Unpacked Size

    280 kB

    Total Files

    117

    Last publish

    Collaborators

    • nathanfaucett