Package Exports
- @flowbite-svelte-plugins/texteditor
- @flowbite-svelte-plugins/texteditor/AddColumnAfter.svelte
- @flowbite-svelte-plugins/texteditor/AddColumnBefore.svelte
- @flowbite-svelte-plugins/texteditor/AddRowAfter.svelte
- @flowbite-svelte-plugins/texteditor/AddRowBefore.svelte
- @flowbite-svelte-plugins/texteditor/AlignCenter.svelte
- @flowbite-svelte-plugins/texteditor/AlignJustify.svelte
- @flowbite-svelte-plugins/texteditor/AlignLeft.svelte
- @flowbite-svelte-plugins/texteditor/AlignRight.svelte
- @flowbite-svelte-plugins/texteditor/AlignmentButton.svelte
- @flowbite-svelte-plugins/texteditor/Blockquote.svelte
- @flowbite-svelte-plugins/texteditor/Bold.svelte
- @flowbite-svelte-plugins/texteditor/BulletList.svelte
- @flowbite-svelte-plugins/texteditor/Code.svelte
- @flowbite-svelte-plugins/texteditor/CodeBlock.svelte
- @flowbite-svelte-plugins/texteditor/Color.svelte
- @flowbite-svelte-plugins/texteditor/ContentWrapper.svelte
- @flowbite-svelte-plugins/texteditor/DeleteColumn.svelte
- @flowbite-svelte-plugins/texteditor/DeleteRow.svelte
- @flowbite-svelte-plugins/texteditor/DeleteTable.svelte
- @flowbite-svelte-plugins/texteditor/Divider.svelte
- @flowbite-svelte-plugins/texteditor/EditorWrapper.svelte
- @flowbite-svelte-plugins/texteditor/FixTables.svelte
- @flowbite-svelte-plugins/texteditor/FontFamily.svelte
- @flowbite-svelte-plugins/texteditor/FontSize.svelte
- @flowbite-svelte-plugins/texteditor/FormatButton.svelte
- @flowbite-svelte-plugins/texteditor/GoToNextCell.svelte
- @flowbite-svelte-plugins/texteditor/GoToPreviousCell.svelte
- @flowbite-svelte-plugins/texteditor/GroupAlignment.svelte
- @flowbite-svelte-plugins/texteditor/GroupFormat.svelte
- @flowbite-svelte-plugins/texteditor/GroupLayout.svelte
- @flowbite-svelte-plugins/texteditor/GroupMedia.svelte
- @flowbite-svelte-plugins/texteditor/GroupTable.svelte
- @flowbite-svelte-plugins/texteditor/GroupTable2.svelte
- @flowbite-svelte-plugins/texteditor/GroupUndoRedo.svelte
- @flowbite-svelte-plugins/texteditor/Highlight.svelte
- @flowbite-svelte-plugins/texteditor/HorizontalRule.svelte
- @flowbite-svelte-plugins/texteditor/Image.svelte
- @flowbite-svelte-plugins/texteditor/ImageAdvanced.svelte
- @flowbite-svelte-plugins/texteditor/ImageButton.svelte
- @flowbite-svelte-plugins/texteditor/Italic.svelte
- @flowbite-svelte-plugins/texteditor/LayoutButton.svelte
- @flowbite-svelte-plugins/texteditor/Link.svelte
- @flowbite-svelte-plugins/texteditor/ListItem.svelte
- @flowbite-svelte-plugins/texteditor/MergeCells.svelte
- @flowbite-svelte-plugins/texteditor/MergeOrSplit.svelte
- @flowbite-svelte-plugins/texteditor/OrderedList.svelte
- @flowbite-svelte-plugins/texteditor/RemoveLink.svelte
- @flowbite-svelte-plugins/texteditor/SplitCell.svelte
- @flowbite-svelte-plugins/texteditor/Strike.svelte
- @flowbite-svelte-plugins/texteditor/Subscript.svelte
- @flowbite-svelte-plugins/texteditor/Superscript.svelte
- @flowbite-svelte-plugins/texteditor/Table.svelte
- @flowbite-svelte-plugins/texteditor/TableButton.svelte
- @flowbite-svelte-plugins/texteditor/TableCell.svelte
- @flowbite-svelte-plugins/texteditor/TaskItem.svelte
- @flowbite-svelte-plugins/texteditor/TaskList.svelte
- @flowbite-svelte-plugins/texteditor/TextEditor.svelte
- @flowbite-svelte-plugins/texteditor/ToggleHeaderCell.svelte
- @flowbite-svelte-plugins/texteditor/ToggleHeaderColumn.svelte
- @flowbite-svelte-plugins/texteditor/ToggleHeaderRow.svelte
- @flowbite-svelte-plugins/texteditor/ToolbarRowWrapper.svelte
- @flowbite-svelte-plugins/texteditor/ToolbarWrapper.svelte
- @flowbite-svelte-plugins/texteditor/Underline.svelte
- @flowbite-svelte-plugins/texteditor/UndoRedo.svelte
- @flowbite-svelte-plugins/texteditor/Youtube.svelte
- @flowbite-svelte-plugins/texteditor/package.json
Readme
@flowbite-svelte-plugins/texteditor
Use the wysiwyg text editor component to create and modify content by manipulating paragraphs, headings, images and styling them using all available options.
Installation
pnpm i -D @flowbite-svelte-plugins/texteditor
Text editor example
<script lang="ts">
import { GroupAlignment, GroupUndoRedo, GroupFormat, GroupLayout, GroupMedia, TextEditor, ToolbarRowWrapper, Divider } from '@flowbite-svelte-plugins/texteditor';
import type { Editor } from '@tiptap/core';
import { Button } from 'flowbite-svelte';
let editorElement = $state<HTMLDivElement | null>(null);
let editorInstance = $state<Editor | null>(null);
function getEditorContent() {
return editorInstance?.getHTML() ?? '';
}
function setEditorContent(content: string) {
editorInstance?.commands.setContent(content);
}
const content =
'<p>Flowbite is an <strong>open-source library of UI components</strong> based on the utility-first Tailwind CSS framework featuring dark mode support, a Figma design system, and more.</p><p>It includes all of the commonly used components that a website requires, such as buttons, dropdowns, navigation bars, modals, datepickers, advanced charts and the list goes on.</p><p>Here is an example of a button component:</p><code><button type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Default</button></code><p>Learn more about all components from the <a href="https://flowbite.com/docs/getting-started/introduction/">Flowbite Docs</a>.</p>';
</script>
<TextEditor bind:element={editorElement} bind:editor={editorInstance} {content}>
<ToolbarRowWrapper>
<GroupFormat editor={editorInstance} />
<Divider />
<GroupAlignment editor={editorInstance} />
</ToolbarRowWrapper>
<ToolbarRowWrapper top={false}>
<GroupUndoRedo editor={editorInstance} />
<GroupLayout editor={editorInstance} />
<Divider />
<GroupMedia editor={editorInstance} />
</ToolbarRowWrapper>
</TextEditor>
<div class="mt-4">
<Button onclick={() => console.log(getEditorContent())}>Get Content</Button>
<Button onclick={() => setEditorContent('<p>New content!</p>')}>Set Content</Button>
</div>