@sveltia/ui 0.90.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/bottom-navigation/bottom-navigation.svelte +3 -9
- package/dist/components/bottom-navigation/bottom-navigation.svelte.d.ts +4 -39
- package/dist/components/button/button-group.svelte +2 -4
- package/dist/components/button/button-group.svelte.d.ts +3 -19
- package/dist/components/button/select-button-group.svelte +2 -13
- package/dist/components/button/select-button-group.svelte.d.ts +5 -67
- package/dist/components/calendar/calendar.d.ts +9 -0
- package/dist/components/calendar/calendar.js +43 -0
- package/dist/components/calendar/calendar.svelte +26 -27
- package/dist/components/checkbox/checkbox-group.svelte +2 -8
- package/dist/components/checkbox/checkbox-group.svelte.d.ts +4 -39
- package/dist/components/dialog/alert-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/confirmation-dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/dialog.svelte +6 -7
- package/dist/components/dialog/dialog.svelte.d.ts +2 -3
- package/dist/components/dialog/prompt-dialog.svelte +2 -2
- package/dist/components/dialog/prompt-dialog.svelte.d.ts +2 -3
- package/dist/components/disclosure/disclosure.svelte +14 -16
- package/dist/components/disclosure/disclosure.svelte.d.ts +4 -38
- package/dist/components/drawer/drawer.svelte +22 -39
- package/dist/components/drawer/drawer.svelte.d.ts +3 -24
- package/dist/components/grid/grid-body.svelte +2 -3
- package/dist/components/grid/grid-body.svelte.d.ts +3 -18
- package/dist/components/grid/grid-cell.svelte +2 -8
- package/dist/components/grid/grid-cell.svelte.d.ts +3 -22
- package/dist/components/grid/grid-col-header.svelte +2 -4
- package/dist/components/grid/grid-col-header.svelte.d.ts +3 -19
- package/dist/components/grid/grid-foot.svelte +4 -9
- package/dist/components/grid/grid-foot.svelte.d.ts +3 -22
- package/dist/components/grid/grid-head.svelte +4 -9
- package/dist/components/grid/grid-head.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row-header.svelte +2 -8
- package/dist/components/grid/grid-row-header.svelte.d.ts +3 -22
- package/dist/components/grid/grid-row.svelte +4 -5
- package/dist/components/grid/grid-row.svelte.d.ts +3 -19
- package/dist/components/grid/grid.d.ts +10 -0
- package/dist/components/grid/grid.js +11 -0
- package/dist/components/grid/grid.svelte +6 -7
- package/dist/components/grid/grid.svelte.d.ts +5 -21
- package/dist/components/listbox/listbox.svelte +34 -15
- package/dist/components/listbox/listbox.svelte.d.ts +5 -69
- package/dist/components/listbox/option-group.svelte +2 -8
- package/dist/components/listbox/option-group.svelte.d.ts +4 -39
- package/dist/components/listbox/option.svelte +2 -1
- package/dist/components/menu/menu-item-group.svelte +2 -6
- package/dist/components/menu/menu-item-group.svelte.d.ts +3 -22
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu.svelte +2 -8
- package/dist/components/menu/menu.svelte.d.ts +4 -39
- package/dist/components/radio/radio-group.svelte +2 -17
- package/dist/components/radio/radio-group.svelte.d.ts +5 -67
- package/dist/components/radio/radio.svelte +19 -22
- package/dist/components/radio/radio.svelte.d.ts +10 -40
- package/dist/components/resizable-pane/resizable-handle.svelte +42 -49
- package/dist/components/resizable-pane/resizable-pane-group.svelte +44 -58
- package/dist/components/resizable-pane/resizable-pane-group.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/resizable-pane.svelte +2 -5
- package/dist/components/resizable-pane/resizable-pane.svelte.d.ts +3 -19
- package/dist/components/resizable-pane/sizing.d.ts +24 -0
- package/dist/components/resizable-pane/sizing.js +83 -0
- package/dist/components/select/combobox.svelte +35 -39
- package/dist/components/select/select-tags.svelte +3 -13
- package/dist/components/select/select-tags.svelte.d.ts +5 -67
- package/dist/components/slider/slider.d.ts +5 -4
- package/dist/components/slider/slider.js +28 -23
- package/dist/components/slider/slider.svelte +64 -62
- package/dist/components/slider/slider.svelte.d.ts +4 -37
- package/dist/components/switch/switch.svelte +2 -13
- package/dist/components/switch/switch.svelte.d.ts +5 -67
- package/dist/components/table/table-body.svelte +2 -4
- package/dist/components/table/table-body.svelte.d.ts +3 -19
- package/dist/components/table/table-cell.svelte +2 -8
- package/dist/components/table/table-cell.svelte.d.ts +3 -22
- package/dist/components/table/table-col-header.svelte +2 -8
- package/dist/components/table/table-col-header.svelte.d.ts +3 -22
- package/dist/components/table/table-foot.svelte +2 -8
- package/dist/components/table/table-foot.svelte.d.ts +3 -22
- package/dist/components/table/table-head.svelte +2 -8
- package/dist/components/table/table-head.svelte.d.ts +3 -22
- package/dist/components/table/table-part.svelte +2 -4
- package/dist/components/table/table-part.svelte.d.ts +3 -19
- package/dist/components/table/table-row-header.svelte +2 -8
- package/dist/components/table/table-row-header.svelte.d.ts +3 -22
- package/dist/components/table/table-row.svelte +2 -8
- package/dist/components/table/table-row.svelte.d.ts +3 -22
- package/dist/components/table/table.svelte +2 -4
- package/dist/components/table/table.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-box.svelte +2 -4
- package/dist/components/tabs/tab-box.svelte.d.ts +3 -19
- package/dist/components/tabs/tab-list.svelte +2 -7
- package/dist/components/tabs/tab-list.svelte.d.ts +4 -37
- package/dist/components/tabs/tab-panel.svelte +2 -8
- package/dist/components/tabs/tab-panel.svelte.d.ts +3 -22
- package/dist/components/tabs/tab-panels.svelte +2 -8
- package/dist/components/tabs/tab-panels.svelte.d.ts +3 -22
- package/dist/components/text-editor/code-editor.js +14 -7
- package/dist/components/text-editor/code-editor.svelte +14 -22
- package/dist/components/text-editor/code-editor.svelte.d.ts +5 -103
- package/dist/components/text-editor/config.d.ts +73 -0
- package/dist/components/text-editor/config.js +110 -0
- package/dist/components/text-editor/constants.d.ts +40 -6
- package/dist/components/text-editor/constants.js +81 -7
- package/dist/components/text-editor/conversion/editor-components.js +4 -4
- package/dist/components/text-editor/conversion/html/components.d.ts +16 -0
- package/dist/components/text-editor/conversion/html/components.js +87 -0
- package/dist/components/text-editor/conversion/html/export.d.ts +10 -0
- package/dist/components/text-editor/conversion/html/export.js +360 -0
- package/dist/components/text-editor/conversion/html/import-rules.d.ts +12 -0
- package/dist/components/text-editor/conversion/html/import-rules.js +234 -0
- package/dist/components/text-editor/conversion/html/index.d.ts +10 -0
- package/dist/components/text-editor/conversion/html/index.js +33 -0
- package/dist/components/text-editor/conversion/html/paragraph.d.ts +1 -0
- package/dist/components/text-editor/conversion/html/paragraph.js +123 -0
- package/dist/components/text-editor/conversion/html/task-list.d.ts +13 -0
- package/dist/components/text-editor/conversion/html/task-list.js +82 -0
- package/dist/components/text-editor/conversion/html/unsupported.d.ts +2 -0
- package/dist/components/text-editor/conversion/html/unsupported.js +122 -0
- package/dist/components/text-editor/conversion/html/utils.d.ts +6 -0
- package/dist/components/text-editor/conversion/html/utils.js +34 -0
- package/dist/components/text-editor/conversion/import.js +33 -27
- package/dist/components/text-editor/conversion/markdown/block-conversion.d.ts +4 -0
- package/dist/components/text-editor/conversion/markdown/block-conversion.js +154 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.d.ts +16 -0
- package/dist/components/text-editor/conversion/markdown/block-structure.js +254 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.d.ts +57 -0
- package/dist/components/text-editor/conversion/markdown/code-blocks.js +279 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.d.ts +19 -0
- package/dist/components/text-editor/conversion/markdown/code-spans.js +71 -0
- package/dist/components/text-editor/conversion/markdown/formatting.d.ts +22 -0
- package/dist/components/text-editor/conversion/markdown/formatting.js +451 -0
- package/dist/components/text-editor/conversion/markdown/index.d.ts +10 -0
- package/dist/components/text-editor/conversion/markdown/index.js +55 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.d.ts +2 -0
- package/dist/components/text-editor/conversion/markdown/placeholders.js +229 -0
- package/dist/components/text-editor/conversion/markdown/syntax.d.ts +99 -0
- package/dist/components/text-editor/conversion/markdown/syntax.js +206 -0
- package/dist/components/text-editor/conversion/placeholder-chars.d.ts +43 -0
- package/dist/components/text-editor/conversion/placeholder-chars.js +51 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.d.ts +1 -0
- package/dist/components/text-editor/conversion/transformers/block-escape.js +53 -26
- package/dist/components/text-editor/conversion/transformers/code.d.ts +3 -14
- package/dist/components/text-editor/conversion/transformers/code.js +78 -16
- package/dist/components/text-editor/conversion/transformers/formatted-code.js +3 -18
- package/dist/components/text-editor/conversion/transformers/inline-code.js +3 -1
- package/dist/components/text-editor/conversion/transformers/link.js +3 -1
- package/dist/components/text-editor/conversion/transformers/raw-syntax.d.ts +0 -19
- package/dist/components/text-editor/conversion/transformers/raw-syntax.js +22 -93
- package/dist/components/text-editor/conversion/transformers/table.js +57 -16
- package/dist/components/text-editor/conversion/transformers/task-list.d.ts +24 -0
- package/dist/components/text-editor/conversion/transformers/task-list.js +53 -0
- package/dist/components/text-editor/conversion/update.d.ts +19 -2
- package/dist/components/text-editor/conversion/update.js +64 -40
- package/dist/components/text-editor/core.d.ts +12 -51
- package/dist/components/text-editor/core.js +47 -77
- package/dist/components/text-editor/editing/commands.js +9 -18
- package/dist/components/text-editor/editing/guards.d.ts +7 -0
- package/dist/components/text-editor/editing/guards.js +123 -0
- package/dist/components/text-editor/editing/raw-markdown.d.ts +7 -2
- package/dist/components/text-editor/editing/raw-markdown.js +68 -8
- package/dist/components/text-editor/editing/selection.js +6 -2
- package/dist/components/text-editor/lexical-root.svelte +89 -47
- package/dist/components/text-editor/lexical-root.svelte.d.ts +4 -67
- package/dist/components/text-editor/shiki/{facade.d.ts → engine.d.ts} +8 -8
- package/dist/components/text-editor/shiki/{facade.js → engine.js} +53 -156
- package/dist/components/text-editor/shiki/highlighter.js +5 -5
- package/dist/components/text-editor/shiki/lexical.d.ts +6 -0
- package/dist/components/text-editor/shiki/lexical.js +165 -0
- package/dist/components/text-editor/shiki/preload.js +1 -1
- package/dist/components/text-editor/shiki/source-highlight.svelte.d.ts +15 -0
- package/dist/components/text-editor/shiki/source-highlight.svelte.js +120 -0
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/store.svelte.js +65 -16
- package/dist/components/text-editor/text-editor.svelte +57 -146
- package/dist/components/text-editor/text-editor.svelte.d.ts +9 -105
- package/dist/components/text-editor/toolbar/actions.d.ts +25 -0
- package/dist/components/text-editor/toolbar/actions.js +107 -0
- package/dist/components/text-editor/toolbar/align-menu-button.svelte +16 -14
- package/dist/components/text-editor/toolbar/format-text-button.svelte +27 -19
- package/dist/components/text-editor/toolbar/insert-horizontal-rule-button.svelte +23 -23
- package/dist/components/text-editor/toolbar/insert-item-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +47 -51
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/insert-table-button.svelte +35 -52
- package/dist/components/text-editor/toolbar/table-action-menu.svelte +19 -17
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +34 -11
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte.d.ts +0 -8
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +35 -41
- package/dist/components/text-editor/widgets/emoji-autocomplete.svelte +7 -6
- package/dist/components/text-editor/widgets/floating-link-editor.svelte +19 -32
- package/dist/components/text-editor/widgets/table-cell-menu-button.svelte +28 -32
- package/dist/components/text-field/date-time-input.svelte +7 -8
- package/dist/components/text-field/date-time-input.svelte.d.ts +3 -32
- package/dist/components/text-field/number-input.d.ts +0 -2
- package/dist/components/text-field/number-input.js +25 -25
- package/dist/components/text-field/number-input.svelte +18 -9
- package/dist/components/text-field/number-input.svelte.d.ts +1 -1
- package/dist/components/text-field/text-area.d.ts +2 -0
- package/dist/components/text-field/text-area.js +31 -0
- package/dist/components/text-field/text-area.svelte +12 -25
- package/dist/components/text-field/text-area.svelte.d.ts +5 -67
- package/dist/components/toast/toast.svelte +31 -8
- package/dist/components/toast/toast.svelte.d.ts +6 -6
- package/dist/components/toolbar/toolbar.svelte +2 -7
- package/dist/components/toolbar/toolbar.svelte.d.ts +4 -37
- package/dist/components/tree/tree-item.svelte +2 -6
- package/dist/components/tree/tree-item.svelte.d.ts +3 -22
- package/dist/components/tree/tree.svelte +3 -10
- package/dist/components/tree/tree.svelte.d.ts +4 -39
- package/dist/components/util/group.svelte +2 -7
- package/dist/components/util/group.svelte.d.ts +4 -37
- package/dist/components/util/modal.d.ts +9 -0
- package/dist/components/util/modal.js +30 -0
- package/dist/components/util/modal.svelte +16 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/ar.yaml +2 -0
- package/dist/locales/bg.yaml +2 -0
- package/dist/locales/ca.yaml +2 -0
- package/dist/locales/cs.yaml +2 -0
- package/dist/locales/da.yaml +2 -0
- package/dist/locales/de.yaml +2 -0
- package/dist/locales/el.yaml +2 -0
- package/dist/locales/en-CA.yaml +2 -0
- package/dist/locales/en-GB.yaml +2 -0
- package/dist/locales/en-US.yaml +2 -0
- package/dist/locales/en-ZA.yaml +2 -0
- package/dist/locales/es-CO.yaml +2 -0
- package/dist/locales/es-ES.yaml +2 -0
- package/dist/locales/fa.yaml +2 -0
- package/dist/locales/fi.yaml +2 -0
- package/dist/locales/fr.yaml +2 -0
- package/dist/locales/he.yaml +2 -0
- package/dist/locales/hr.yaml +2 -0
- package/dist/locales/hu.yaml +176 -0
- package/dist/locales/it.yaml +2 -0
- package/dist/locales/ja.yaml +2 -0
- package/dist/locales/ko.yaml +2 -0
- package/dist/locales/nl.yaml +2 -0
- package/dist/locales/pl.yaml +2 -0
- package/dist/locales/pt-BR.yaml +2 -0
- package/dist/locales/pt-PT.yaml +2 -0
- package/dist/locales/ru.yaml +2 -0
- package/dist/locales/sk.yaml +2 -0
- package/dist/locales/sv.yaml +2 -0
- package/dist/locales/tr.yaml +2 -0
- package/dist/locales/uk.yaml +2 -0
- package/dist/locales/vi.yaml +2 -0
- package/dist/locales/zh-CN.yaml +2 -0
- package/dist/locales/zh-TW.yaml +2 -0
- package/dist/services/composite-widget.svelte.d.ts +76 -0
- package/dist/services/composite-widget.svelte.js +157 -0
- package/dist/services/focus.d.ts +2 -0
- package/dist/services/focus.js +68 -0
- package/dist/services/group.svelte.d.ts +17 -69
- package/dist/services/group.svelte.js +128 -391
- package/dist/services/label.d.ts +9 -0
- package/dist/services/label.js +22 -0
- package/dist/services/menu.d.ts +8 -0
- package/dist/services/menu.js +237 -0
- package/dist/services/navigation.d.ts +9 -0
- package/dist/services/navigation.js +13 -0
- package/dist/services/number.d.ts +2 -0
- package/dist/services/number.js +27 -0
- package/dist/services/pointer-drag.d.ts +14 -0
- package/dist/services/pointer-drag.js +89 -0
- package/dist/services/popup.svelte.js +123 -103
- package/dist/services/text.d.ts +3 -0
- package/dist/services/text.js +17 -0
- package/dist/services/tree.svelte.d.ts +29 -43
- package/dist/services/tree.svelte.js +58 -105
- package/dist/services/type-ahead.d.ts +10 -1
- package/dist/services/type-ahead.js +56 -34
- package/dist/typedefs.d.ts +108 -6
- package/dist/typedefs.js +63 -6
- package/package.json +5 -5
- package/dist/components/text-editor/conversion/html.d.ts +0 -30
- package/dist/components/text-editor/conversion/html.js +0 -857
- package/dist/components/text-editor/conversion/markdown.d.ts +0 -56
- package/dist/components/text-editor/conversion/markdown.js +0 -949
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +0 -28
- package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte.d.ts +0 -37
- package/dist/components/text-editor/toolbar/insert-component.d.ts +0 -3
- package/dist/components/text-editor/toolbar/insert-component.js +0 -37
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax highlighting of the Markdown or HTML source shown in the plain text mode of the text
|
|
3
|
+
* editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { unique } from '@sveltia/utils/array';
|
|
7
|
+
import { untrack } from 'svelte';
|
|
8
|
+
import { parseOpeningFence } from '../conversion/markdown/code-blocks.js';
|
|
9
|
+
import { highlightCodeToTokens } from './engine.js';
|
|
10
|
+
import { loadCodeHighlighter } from './preload.js';
|
|
11
|
+
import { getCodeTheme, onCodeThemeChange } from './theme.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @import { HighlightedToken } from '../../../typedefs.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Maximum length of the Markdown or HTML source to highlight in the plain text mode. The whole
|
|
19
|
+
* source is tokenized on every keystroke, so highlighting a longer one would make typing sluggish.
|
|
20
|
+
*/
|
|
21
|
+
export const MAX_HIGHLIGHT_LENGTH = 20_000;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get the languages used in the fenced code blocks of the given Markdown source, read from the
|
|
25
|
+
* opening fences the same way the rich text mode reads them; see `parseOpeningFence()`. Fences
|
|
26
|
+
* within a code block are taken in as well, which only means loading a grammar that isn’t needed.
|
|
27
|
+
* @param {string} source Markdown source.
|
|
28
|
+
* @returns {string[]} Unique languages, in the order they first appear.
|
|
29
|
+
*/
|
|
30
|
+
export const getCodeFenceLanguages = (source) =>
|
|
31
|
+
unique(
|
|
32
|
+
source
|
|
33
|
+
.split('\n')
|
|
34
|
+
.map((line) => parseOpeningFence(line)?.language)
|
|
35
|
+
.filter((language) => language !== undefined),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a function that highlights the Markdown or HTML source in the plain text mode, loading the
|
|
40
|
+
* highlighter, as well as the languages of the fenced code blocks in Markdown, while the mode is
|
|
41
|
+
* shown, and following the app’s appearance. This must be called during the component
|
|
42
|
+
* initialization, as it sets up effects.
|
|
43
|
+
* @param {object} args Arguments.
|
|
44
|
+
* @param {'markdown' | 'html'} args.language Language of the source.
|
|
45
|
+
* @param {() => boolean} args.isActive Whether the plain text mode is shown. Nothing is loaded or
|
|
46
|
+
* highlighted otherwise.
|
|
47
|
+
* @param {() => string} args.getSource Get the current source, to find the languages of its fenced
|
|
48
|
+
* code blocks.
|
|
49
|
+
* @returns {(source: string) => HighlightedToken[][] | undefined} Function to highlight the given
|
|
50
|
+
* source, which returns `undefined` while the highlighter is still loading, the plain text mode
|
|
51
|
+
* isn’t shown, or the source is too long. It’s reactive: it gives new tokens once something has
|
|
52
|
+
* been loaded, or the theme has changed.
|
|
53
|
+
*/
|
|
54
|
+
export const createSourceHighlighter = ({ language, isActive, getSource }) => {
|
|
55
|
+
/** Syntax highlighting theme matching the app’s appearance. */
|
|
56
|
+
let codeTheme = $state(getCodeTheme());
|
|
57
|
+
/** Incremented whenever the highlighter has loaded something, to highlight the text again. */
|
|
58
|
+
let loadCount = $state(0);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Comma-separated languages used in the fenced code blocks of the Markdown source, which are
|
|
62
|
+
* highlighted as well. It’s a string rather than an array, so the highlighter isn’t reloaded on
|
|
63
|
+
* every keystroke.
|
|
64
|
+
*/
|
|
65
|
+
const codeLanguages = $derived.by(() => {
|
|
66
|
+
if (!isActive() || language !== 'markdown' || getSource().length > MAX_HIGHLIGHT_LENGTH) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return getCodeFenceLanguages(getSource()).join(',');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
$effect(() =>
|
|
74
|
+
onCodeThemeChange(async () => {
|
|
75
|
+
const theme = getCodeTheme();
|
|
76
|
+
|
|
77
|
+
// Keep the current highlighting until the new theme is ready, so the text doesn’t flash
|
|
78
|
+
if (isActive()) {
|
|
79
|
+
await loadCodeHighlighter(language);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Ignore an outdated change, in case the appearance has changed again while loading
|
|
83
|
+
if (theme === getCodeTheme()) {
|
|
84
|
+
codeTheme = theme;
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
$effect(() => {
|
|
90
|
+
// Load the highlighter only when the plain text mode is actually shown
|
|
91
|
+
if (!isActive()) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const languages = codeLanguages ? codeLanguages.split(',') : [];
|
|
96
|
+
|
|
97
|
+
void codeTheme;
|
|
98
|
+
|
|
99
|
+
untrack(() => {
|
|
100
|
+
// The Markdown or HTML grammar is loaded first, because the engine has to be in place before
|
|
101
|
+
// anything else can be loaded
|
|
102
|
+
loadCodeHighlighter(language).then(async () => {
|
|
103
|
+
loadCount += 1;
|
|
104
|
+
await Promise.all(languages.map((lang) => loadCodeHighlighter(lang)));
|
|
105
|
+
loadCount += 1;
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return (source) => {
|
|
111
|
+
void loadCount;
|
|
112
|
+
|
|
113
|
+
// Don’t waste time on tokenizing the source while the rich text mode is shown
|
|
114
|
+
if (!isActive() || source.length > MAX_HIGHLIGHT_LENGTH) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return highlightCodeToTokens(source, language, { theme: codeTheme });
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateElementId } from '@sveltia/utils/element';
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { convertHtmlToLexical, convertMarkdownToLexical } from './conversion/import.js';
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeConfig } from './config.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @import { LexicalEditor } from 'lexical';
|
|
@@ -9,6 +9,13 @@ import { limitToSingleLine } from './editing/single-line.js';
|
|
|
9
9
|
* @import { TextEditorConfig, TextEditorSelectionState, TextEditorStore } from '../../typedefs.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Function to call with the new input value whenever it changes, for each editor store; see
|
|
14
|
+
* {@link syncEditorProps}.
|
|
15
|
+
* @type {WeakMap<TextEditorStore, (inputValue: string) => void>}
|
|
16
|
+
*/
|
|
17
|
+
const inputValueListeners = new WeakMap();
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Create an editor editor store that contains all the states and configuration.
|
|
14
21
|
* @returns {TextEditorStore} Store.
|
|
@@ -22,17 +29,8 @@ export const createEditorStore = () => {
|
|
|
22
29
|
let editor = $state();
|
|
23
30
|
/** @type {Transformer[]} */
|
|
24
31
|
let enabledTransformers = $state([]);
|
|
25
|
-
|
|
26
32
|
/** @type {TextEditorConfig} */
|
|
27
|
-
let config = $state({
|
|
28
|
-
modes: [],
|
|
29
|
-
enabledButtons: [],
|
|
30
|
-
components: [],
|
|
31
|
-
useMarkdownShortcuts: true,
|
|
32
|
-
isCodeEditor: false,
|
|
33
|
-
useEmojiAutocomplete: false,
|
|
34
|
-
});
|
|
35
|
-
|
|
33
|
+
let config = $state(normalizeConfig({ useMarkdownShortcuts: true }));
|
|
36
34
|
/** @type {string} */
|
|
37
35
|
let inputValue = $state('');
|
|
38
36
|
/** @type {TextEditorSelectionState} */
|
|
@@ -130,7 +128,8 @@ export const createEditorStore = () => {
|
|
|
130
128
|
}
|
|
131
129
|
};
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
/** @type {TextEditorStore} */
|
|
132
|
+
const store = {
|
|
134
133
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
135
134
|
get editor() {
|
|
136
135
|
return editor;
|
|
@@ -154,7 +153,7 @@ export const createEditorStore = () => {
|
|
|
154
153
|
return config;
|
|
155
154
|
},
|
|
156
155
|
set config(newValue) {
|
|
157
|
-
config =
|
|
156
|
+
config = normalizeConfig(newValue);
|
|
158
157
|
useRichText = config.modes[0] === 'rich-text' || config.isCodeEditor;
|
|
159
158
|
},
|
|
160
159
|
get inputValue() {
|
|
@@ -163,9 +162,7 @@ export const createEditorStore = () => {
|
|
|
163
162
|
set inputValue(newValue) {
|
|
164
163
|
const hasChange = inputValue !== newValue;
|
|
165
164
|
|
|
166
|
-
|
|
167
|
-
inputValue = newValue;
|
|
168
|
-
}
|
|
165
|
+
store.setExportedValue(newValue);
|
|
169
166
|
|
|
170
167
|
if (useRichText && (hasChange || editor?.getEditorState().isEmpty())) {
|
|
171
168
|
convertToLexical();
|
|
@@ -255,8 +252,26 @@ export const createEditorStore = () => {
|
|
|
255
252
|
* @returns {string | undefined} Imported value, or `undefined` if the content has changed.
|
|
256
253
|
*/
|
|
257
254
|
getImportedValue: (value) => (lastImport?.exported === value ? lastImport.source : undefined),
|
|
255
|
+
/**
|
|
256
|
+
* Set the input value to the one exported from the Lexical editor, without importing it back
|
|
257
|
+
* into the editor, which would reset its nodes and selection.
|
|
258
|
+
* @param {string} value Exported value.
|
|
259
|
+
*/
|
|
260
|
+
setExportedValue: (value) => {
|
|
261
|
+
if (inputValue !== value) {
|
|
262
|
+
inputValue = value;
|
|
263
|
+
inputValueListeners.get(store)?.(value);
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* Export the content of the Lexical editor right away, if it’s scheduled to be exported. The
|
|
268
|
+
* editor root sets this while the editor is there.
|
|
269
|
+
*/
|
|
270
|
+
flushExport: () => {},
|
|
258
271
|
/* eslint-enable jsdoc/require-jsdoc */
|
|
259
272
|
};
|
|
273
|
+
|
|
274
|
+
return store;
|
|
260
275
|
};
|
|
261
276
|
|
|
262
277
|
/**
|
|
@@ -272,6 +287,17 @@ export const createEditorStore = () => {
|
|
|
272
287
|
* @param {(pending: boolean) => void} args.setPending Update the `pending` prop.
|
|
273
288
|
*/
|
|
274
289
|
export const syncEditorProps = (editorStore, { getInputValue, setValue, setPending }) => {
|
|
290
|
+
/**
|
|
291
|
+
* Input value last passed on to the props.
|
|
292
|
+
* @type {string | undefined}
|
|
293
|
+
*/
|
|
294
|
+
let appliedValue = undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Latest input value, which may not have been passed on to the props yet.
|
|
297
|
+
* @type {string | undefined}
|
|
298
|
+
*/
|
|
299
|
+
let latestValue = undefined;
|
|
300
|
+
|
|
275
301
|
$effect(() => {
|
|
276
302
|
setPending(editorStore.pending);
|
|
277
303
|
});
|
|
@@ -305,8 +331,31 @@ export const syncEditorProps = (editorStore, { getInputValue, setValue, setPendi
|
|
|
305
331
|
|
|
306
332
|
const newValue = editorStore.inputValue;
|
|
307
333
|
|
|
334
|
+
appliedValue = newValue;
|
|
335
|
+
|
|
308
336
|
untrack(() => {
|
|
309
337
|
setValue(newValue);
|
|
310
338
|
});
|
|
311
339
|
});
|
|
340
|
+
|
|
341
|
+
// An editor being removed passes on what was just typed as it goes, either as the focus leaves it
|
|
342
|
+
// or as `<LexicalRoot>` is destroyed, but the effect above is gone by then. Remember the change,
|
|
343
|
+
// and pass it on once the removal is done: a teardown function only sees the state as it was
|
|
344
|
+
// before, so it can’t tell whether the props have been changed from outside in the meantime,
|
|
345
|
+
// e.g. in the same tick as the removal, in which case they win
|
|
346
|
+
inputValueListeners.set(editorStore, (newValue) => {
|
|
347
|
+
latestValue = newValue;
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
$effect(() => () => {
|
|
351
|
+
queueMicrotask(() => {
|
|
352
|
+
if (
|
|
353
|
+
latestValue !== undefined &&
|
|
354
|
+
latestValue !== appliedValue &&
|
|
355
|
+
untrack(getInputValue) === appliedValue
|
|
356
|
+
) {
|
|
357
|
+
setValue(latestValue);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
312
361
|
};
|
|
@@ -8,31 +8,28 @@
|
|
|
8
8
|
import Alert from '../alert/alert.svelte';
|
|
9
9
|
import TextArea from '../text-field/text-area.svelte';
|
|
10
10
|
import Toast from '../toast/toast.svelte';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getEditorSetup } from './config.js';
|
|
12
|
+
import { DEFAULT_BUTTON_TYPES } from './constants.js';
|
|
13
13
|
import EmojiAutocomplete from './widgets/emoji-autocomplete.svelte';
|
|
14
14
|
import FloatingLinkEditor from './widgets/floating-link-editor.svelte';
|
|
15
15
|
import LexicalRoot from './lexical-root.svelte';
|
|
16
16
|
import TableCellMenuButton from './widgets/table-cell-menu-button.svelte';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
getRawTextState,
|
|
20
|
-
registerRawTextSingleLine,
|
|
21
|
-
} from './editing/raw-markdown.js';
|
|
22
|
-
import { highlightCodeToTokens } from './shiki/facade.js';
|
|
23
|
-
import { getCodeTheme, onCodeThemeChange } from './shiki/theme.js';
|
|
17
|
+
import { registerRawTextSelection, registerRawTextSingleLine } from './editing/raw-markdown.js';
|
|
18
|
+
import { createSourceHighlighter } from './shiki/source-highlight.svelte.js';
|
|
24
19
|
import { createEditorStore, syncEditorProps } from './store.svelte.js';
|
|
25
20
|
import TextEditorToolbar from './toolbar/text-editor-toolbar.svelte';
|
|
26
21
|
|
|
27
22
|
/**
|
|
28
|
-
* @import { Snippet } from 'svelte';
|
|
29
23
|
* @import {
|
|
24
|
+
* EditorCommonProps,
|
|
25
|
+
* FormFieldStateProps,
|
|
30
26
|
* TextEditorComponent,
|
|
31
27
|
* TextEditorMode,
|
|
32
28
|
* TextEditorNodeType,
|
|
33
29
|
* TextEditorValueFormat,
|
|
30
|
+
* WidgetStateProps,
|
|
34
31
|
* } from '../../typedefs.js';
|
|
35
|
-
* @import {
|
|
32
|
+
* @import { NormalizedEditorConfig } from './config.js';
|
|
36
33
|
*/
|
|
37
34
|
|
|
38
35
|
/**
|
|
@@ -48,11 +45,11 @@
|
|
|
48
45
|
* @property {boolean} [pending] Whether the user has changed the rich text content, and the
|
|
49
46
|
* editor has yet to update {@link value}, which it does a moment later. Bind it to wait for the
|
|
50
47
|
* change before reading the value, for example to save it. Read-only.
|
|
51
|
-
* @property {boolean} [flex] Make the text input container flexible.
|
|
52
48
|
* @property {'ltr' | 'rtl' | 'auto'} [dir] The `dir` attribute on the editable text box, both
|
|
53
49
|
* the rich text editor and the `<textarea>` element of the plain text mode.
|
|
54
50
|
* @property {TextEditorMode[]} [modes] Enabled modes.
|
|
55
|
-
* @property {TextEditorNodeType[]} [buttons] Enabled buttons.
|
|
51
|
+
* @property {TextEditorNodeType[]} [buttons] Enabled buttons. All the inline and block level
|
|
52
|
+
* buttons by default, except the HTML-only `underline`.
|
|
56
53
|
* @property {TextEditorComponent[]} [components] Editor components.
|
|
57
54
|
* @property {boolean} [multiline] Whether the content can span multiple paragraphs and lines.
|
|
58
55
|
* With `false`, the content is kept in a single paragraph: the Enter key does nothing, and the
|
|
@@ -66,26 +63,11 @@
|
|
|
66
63
|
* rich text editor.
|
|
67
64
|
* @property {boolean} [useEmojiAutocomplete] Whether to autocomplete emojis when the user
|
|
68
65
|
* types a shortcode, like `:smi`.
|
|
69
|
-
* @property {string} [class] The `class` attribute on the wrapper element.
|
|
70
|
-
* @property {boolean} [hidden] Whether to hide the widget.
|
|
71
|
-
* @property {boolean} [disabled] Whether to disable the widget. An alias of the `aria-disabled`
|
|
72
|
-
* attribute.
|
|
73
|
-
* @property {boolean} [readonly] Whether to make the widget read-only. An alias of the
|
|
74
|
-
* `aria-readonly` attribute.
|
|
75
|
-
* @property {boolean} [required] Whether to mark the widget required. An alias of the
|
|
76
|
-
* `aria-required` attribute.
|
|
77
|
-
* @property {boolean} [invalid] Whether to mark the widget invalid. An alias of the
|
|
78
|
-
* `aria-invalid` attribute.
|
|
79
|
-
* @property {string} [ariaLabel] The `aria-label` attribute on the editable text box. Either
|
|
80
|
-
* this or `ariaLabelledby` is required for the editor to have an accessible name.
|
|
81
|
-
* @property {string} [ariaLabelledby] The `aria-labelledby` attribute on the editable text box.
|
|
82
|
-
* @property {string} [ariaDescribedby] The `aria-describedby` attribute on the editable text
|
|
83
|
-
* box.
|
|
84
|
-
* @property {Snippet} [children] Primary slot content.
|
|
85
66
|
*/
|
|
86
67
|
|
|
87
68
|
/**
|
|
88
|
-
* @type {
|
|
69
|
+
* @type {EditorCommonProps & WidgetStateProps & FormFieldStateProps & Props &
|
|
70
|
+
* Record<string, any>}
|
|
89
71
|
*/
|
|
90
72
|
let {
|
|
91
73
|
/* eslint-disable prefer-const */
|
|
@@ -95,7 +77,7 @@
|
|
|
95
77
|
flex = false,
|
|
96
78
|
dir = undefined,
|
|
97
79
|
modes = ['rich-text', 'plain-text'],
|
|
98
|
-
buttons = [...
|
|
80
|
+
buttons = [...DEFAULT_BUTTON_TYPES],
|
|
99
81
|
components = [],
|
|
100
82
|
multiline = true,
|
|
101
83
|
minimal = false,
|
|
@@ -112,7 +94,8 @@
|
|
|
112
94
|
'aria-label': ariaLabelAttr = undefined,
|
|
113
95
|
'aria-labelledby': ariaLabelledbyAttr = undefined,
|
|
114
96
|
'aria-describedby': ariaDescribedbyAttr = undefined,
|
|
115
|
-
|
|
97
|
+
// Not rendered, but kept out of `restProps`, which go on the wrapper element
|
|
98
|
+
children: _children,
|
|
116
99
|
...restProps
|
|
117
100
|
/* eslint-enable prefer-const */
|
|
118
101
|
} = $props();
|
|
@@ -127,6 +110,9 @@
|
|
|
127
110
|
'aria-describedby': ariaDescribedby ?? ariaDescribedbyAttr,
|
|
128
111
|
});
|
|
129
112
|
|
|
113
|
+
/** Whether the user can change the content, which the widgets below are only shown for. */
|
|
114
|
+
const editable = $derived(!disabled && !readonly);
|
|
115
|
+
|
|
130
116
|
const editorStore = createEditorStore();
|
|
131
117
|
|
|
132
118
|
// svelte-ignore state_referenced_locally
|
|
@@ -143,21 +129,10 @@
|
|
|
143
129
|
|
|
144
130
|
setContext('editorStore', editorStore);
|
|
145
131
|
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Maximum length of the Markdown or HTML source to highlight in the plain text mode. The whole
|
|
152
|
-
* source is tokenized on every keystroke, so highlighting a longer one would make typing
|
|
153
|
-
* sluggish.
|
|
154
|
-
*/
|
|
155
|
-
const MAX_HIGHLIGHT_LENGTH = 20_000;
|
|
156
|
-
|
|
157
|
-
/** Syntax highlighting theme matching the app’s appearance. */
|
|
158
|
-
let codeTheme = $state(getCodeTheme());
|
|
159
|
-
/** Incremented whenever the highlighter has loaded something, to highlight the text again. */
|
|
160
|
-
let highlighterLoadCount = $state(0);
|
|
132
|
+
/** Features derived from the editor configuration, which the store holds normalized. */
|
|
133
|
+
const setup = $derived(
|
|
134
|
+
getEditorSetup(/** @type {NormalizedEditorConfig} */ (editorStore.config)),
|
|
135
|
+
);
|
|
161
136
|
|
|
162
137
|
const usePlainText = $derived(!editorStore.useRichText && !hidden);
|
|
163
138
|
/**
|
|
@@ -167,81 +142,24 @@
|
|
|
167
142
|
* document slow. As nobody sees the `<textarea>` meanwhile, it only gets `auto` once it’s shown.
|
|
168
143
|
*/
|
|
169
144
|
const textAreaDir = $derived(dir === 'auto' && editorStore.useRichText ? undefined : dir);
|
|
170
|
-
/**
|
|
171
|
-
* Comma-separated languages used in the fenced code blocks of the Markdown source, which are
|
|
172
|
-
* highlighted as well. It’s a string rather than an array, so the highlighter isn’t reloaded on
|
|
173
|
-
* every keystroke.
|
|
174
|
-
*/
|
|
175
|
-
const codeLanguages = $derived.by(() => {
|
|
176
|
-
if (
|
|
177
|
-
!usePlainText ||
|
|
178
|
-
sourceLanguage !== 'markdown' ||
|
|
179
|
-
editorStore.inputValue.length > MAX_HIGHLIGHT_LENGTH
|
|
180
|
-
) {
|
|
181
|
-
return '';
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return [
|
|
185
|
-
...new Set(
|
|
186
|
-
[...editorStore.inputValue.matchAll(/^[ \t]*(?:```|~~~)[ \t]*(?<lang>[\w+#-]+)/gm)].map(
|
|
187
|
-
({ groups }) => groups?.lang,
|
|
188
|
-
),
|
|
189
|
-
),
|
|
190
|
-
].join(',');
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Highlight the Markdown or HTML source in the plain text mode.
|
|
195
|
-
* @param {string} source Markdown or HTML source.
|
|
196
|
-
* @returns {HighlightedToken[][] | undefined} Tokens, or `undefined` while the highlighter is
|
|
197
|
-
* still loading.
|
|
198
|
-
*/
|
|
199
|
-
const highlightSource = (source) => {
|
|
200
|
-
void highlighterLoadCount;
|
|
201
|
-
|
|
202
|
-
// Don’t waste time on tokenizing the source while the rich text mode is shown
|
|
203
|
-
if (!usePlainText || source.length > MAX_HIGHLIGHT_LENGTH) {
|
|
204
|
-
return undefined;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return highlightCodeToTokens(source, sourceLanguage, { theme: codeTheme });
|
|
208
|
-
};
|
|
209
145
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// Keep the current highlighting until the new theme is ready, so the text doesn’t flash
|
|
215
|
-
if (usePlainText) {
|
|
216
|
-
await loadCodeHighlighter(sourceLanguage);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Ignore an outdated change, in case the appearance has changed again while loading
|
|
220
|
-
if (theme === getCodeTheme()) {
|
|
221
|
-
codeTheme = theme;
|
|
222
|
-
}
|
|
223
|
-
}),
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
$effect(() => {
|
|
227
|
-
// Load the highlighter only when the plain text mode is actually shown
|
|
228
|
-
if (!usePlainText) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const languages = codeLanguages ? codeLanguages.split(',') : [];
|
|
233
|
-
|
|
234
|
-
void codeTheme;
|
|
146
|
+
/** Language of the source shown in the plain text mode. */
|
|
147
|
+
// svelte-ignore state_referenced_locally
|
|
148
|
+
const sourceLanguage = format === 'html' ? 'html' : 'markdown';
|
|
235
149
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
150
|
+
/** Highlighter of the Markdown or HTML source shown in the plain text mode. */
|
|
151
|
+
const highlightSource = createSourceHighlighter({
|
|
152
|
+
language: sourceLanguage,
|
|
153
|
+
/**
|
|
154
|
+
* Check if the plain text mode is shown.
|
|
155
|
+
* @returns {boolean} Result.
|
|
156
|
+
*/
|
|
157
|
+
isActive: () => usePlainText,
|
|
158
|
+
/**
|
|
159
|
+
* Get the Markdown or HTML source.
|
|
160
|
+
* @returns {string} Source.
|
|
161
|
+
*/
|
|
162
|
+
getSource: () => editorStore.inputValue,
|
|
245
163
|
});
|
|
246
164
|
|
|
247
165
|
$effect(() => {
|
|
@@ -253,29 +171,22 @@
|
|
|
253
171
|
return undefined;
|
|
254
172
|
}
|
|
255
173
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
untrack(update);
|
|
274
|
-
events.forEach((type) => textArea.addEventListener(type, update));
|
|
275
|
-
|
|
276
|
-
return () => {
|
|
277
|
-
events.forEach((type) => textArea.removeEventListener(type, update));
|
|
278
|
-
};
|
|
174
|
+
return untrack(() =>
|
|
175
|
+
registerRawTextSelection(
|
|
176
|
+
textArea,
|
|
177
|
+
(blockType) => {
|
|
178
|
+
editorStore.selection = { blockNodeKey: null, blockType, inlineTypes: [] };
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
/**
|
|
182
|
+
* Tell whether the task list button is enabled. It’s read on every change rather than
|
|
183
|
+
* once, so a change to the buttons is followed.
|
|
184
|
+
* @returns {boolean} Result.
|
|
185
|
+
*/
|
|
186
|
+
hasTaskList: () => setup.hasTaskList,
|
|
187
|
+
},
|
|
188
|
+
),
|
|
189
|
+
);
|
|
279
190
|
});
|
|
280
191
|
|
|
281
192
|
$effect(() => {
|
|
@@ -351,13 +262,13 @@
|
|
|
351
262
|
{required}
|
|
352
263
|
{invalid}
|
|
353
264
|
/>
|
|
354
|
-
{#if editorStore.config.useEmojiAutocomplete &&
|
|
265
|
+
{#if editorStore.config.useEmojiAutocomplete && editable}
|
|
355
266
|
<EmojiAutocomplete />
|
|
356
267
|
{/if}
|
|
357
|
-
{#if
|
|
268
|
+
{#if setup.hasLink && editable}
|
|
358
269
|
<FloatingLinkEditor />
|
|
359
270
|
{/if}
|
|
360
|
-
{#if
|
|
271
|
+
{#if setup.hasTable && editable}
|
|
361
272
|
<TableCellMenuButton />
|
|
362
273
|
{/if}
|
|
363
274
|
</div>
|