@multiplatform.one/rich-text 6.1.0 → 6.3.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/README.md +60 -0
- package/dist/cjs/RichEditor.cjs +84 -9
- package/dist/cjs/RichEditor.native.js +422 -35
- package/dist/cjs/RichEditor.native.js.map +1 -1
- package/dist/cjs/RichTextEditor/index.cjs +18 -2
- package/dist/cjs/RichTextEditor/index.native.js +18 -2
- package/dist/cjs/RichTextEditor/index.native.js.map +1 -1
- package/dist/cjs/constants.cjs +52 -29
- package/dist/cjs/constants.native.js +59 -29
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/editor/BlockDragHandle.cjs +22 -7
- package/dist/cjs/editor/BlockDragHandle.native.js +41 -7
- package/dist/cjs/editor/BlockDragHandle.native.js.map +1 -1
- package/dist/cjs/editor/SlashCommands.cjs +249 -293
- package/dist/cjs/editor/SlashCommands.native.js +306 -340
- package/dist/cjs/editor/SlashCommands.native.js.map +1 -1
- package/dist/cjs/editor/TentapEditor.native.js +44 -12
- package/dist/cjs/editor/TentapEditor.native.js.map +1 -1
- package/dist/cjs/editor/TiptapEditor.cjs +140 -33
- package/dist/cjs/editor/TiptapEditor.native.js +153 -33
- package/dist/cjs/editor/TiptapEditor.native.js.map +1 -1
- package/dist/cjs/editor/blockAnchor.cjs +43 -0
- package/dist/cjs/editor/blockAnchor.native.js +68 -0
- package/dist/cjs/editor/blockAnchor.native.js.map +1 -0
- package/dist/cjs/editor/codeBlockPreview.cjs +230 -0
- package/dist/cjs/editor/codeBlockPreview.native.js +265 -0
- package/dist/cjs/editor/codeBlockPreview.native.js.map +1 -0
- package/dist/cjs/editor/editorStyles.cjs +203 -34
- package/dist/cjs/editor/editorStyles.native.js +203 -34
- package/dist/cjs/editor/editorStyles.native.js.map +1 -1
- package/dist/cjs/editor/emoji.cjs +128 -0
- package/dist/cjs/editor/emoji.native.js +184 -0
- package/dist/cjs/editor/emoji.native.js.map +1 -0
- package/dist/cjs/editor/lazyKatex.cjs +78 -0
- package/dist/cjs/editor/lazyKatex.native.js +117 -0
- package/dist/cjs/editor/lazyKatex.native.js.map +1 -0
- package/dist/cjs/editor/markdown.cjs +216 -0
- package/dist/cjs/editor/markdown.native.js +278 -0
- package/dist/cjs/editor/markdown.native.js.map +1 -0
- package/dist/cjs/editor/mathematics.cjs +168 -0
- package/dist/cjs/editor/mathematics.native.js +202 -0
- package/dist/cjs/editor/mathematics.native.js.map +1 -0
- package/dist/cjs/editor/media.cjs +138 -0
- package/dist/cjs/editor/media.native.js +172 -0
- package/dist/cjs/editor/media.native.js.map +1 -0
- package/dist/cjs/editor/mentions.cjs +73 -0
- package/dist/cjs/editor/mentions.native.js +84 -0
- package/dist/cjs/editor/mentions.native.js.map +1 -0
- package/dist/cjs/editor/pasteCleanup.cjs +83 -0
- package/dist/cjs/editor/pasteCleanup.native.js +175 -0
- package/dist/cjs/editor/pasteCleanup.native.js.map +1 -0
- package/dist/cjs/editor/suggestionPopup.cjs +297 -0
- package/dist/cjs/editor/suggestionPopup.native.js +327 -0
- package/dist/cjs/editor/suggestionPopup.native.js.map +1 -0
- package/dist/cjs/preview.cjs +263 -0
- package/dist/cjs/preview.native.js +294 -0
- package/dist/cjs/preview.native.js.map +1 -0
- package/dist/cjs/shared/t.cjs +53 -0
- package/dist/cjs/shared/t.native.js +56 -0
- package/dist/cjs/shared/t.native.js.map +1 -0
- package/dist/cjs/shared/url.cjs +35 -0
- package/dist/cjs/shared/url.native.js +38 -0
- package/dist/cjs/shared/url.native.js.map +1 -0
- package/dist/cjs/styled.cjs +13 -6
- package/dist/cjs/styled.native.js +13 -6
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/toolbar/BubbleToolbar.cjs +10 -8
- package/dist/cjs/toolbar/BubbleToolbar.native.js +10 -8
- package/dist/cjs/toolbar/BubbleToolbar.native.js.map +1 -1
- package/dist/cjs/toolbar/CodeBlockBubble.cjs +59 -23
- package/dist/cjs/toolbar/CodeBlockBubble.native.js +71 -25
- package/dist/cjs/toolbar/CodeBlockBubble.native.js.map +1 -1
- package/dist/cjs/toolbar/ColorPicker.cjs +19 -54
- package/dist/cjs/toolbar/ColorPicker.native.js +81 -179
- package/dist/cjs/toolbar/ColorPicker.native.js.map +1 -1
- package/dist/cjs/toolbar/FixedToolbar.cjs +33 -10
- package/dist/cjs/toolbar/FixedToolbar.native.js +46 -54
- package/dist/cjs/toolbar/FixedToolbar.native.js.map +1 -1
- package/dist/cjs/toolbar/HeadingPicker.cjs +32 -39
- package/dist/cjs/toolbar/HeadingPicker.native.js +61 -51
- package/dist/cjs/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/cjs/toolbar/ImageBubble.cjs +20 -43
- package/dist/cjs/toolbar/ImageBubble.native.js +20 -43
- package/dist/cjs/toolbar/ImageBubble.native.js.map +1 -1
- package/dist/cjs/toolbar/ImageDialog.cjs +5 -4
- package/dist/cjs/toolbar/ImageDialog.native.js +76 -65
- package/dist/cjs/toolbar/ImageDialog.native.js.map +1 -1
- package/dist/cjs/toolbar/LinkBubble.cjs +23 -70
- package/dist/cjs/toolbar/LinkBubble.native.js +23 -70
- package/dist/cjs/toolbar/LinkBubble.native.js.map +1 -1
- package/dist/cjs/toolbar/LinkDialog.cjs +19 -18
- package/dist/cjs/toolbar/LinkDialog.native.js +86 -83
- package/dist/cjs/toolbar/LinkDialog.native.js.map +1 -1
- package/dist/cjs/toolbar/ListPicker.cjs +32 -43
- package/dist/cjs/toolbar/ListPicker.native.js +43 -44
- package/dist/cjs/toolbar/ListPicker.native.js.map +1 -1
- package/dist/cjs/toolbar/MathBubble.cjs +159 -0
- package/dist/cjs/toolbar/MathBubble.native.js +169 -0
- package/dist/cjs/toolbar/MathBubble.native.js.map +1 -0
- package/dist/cjs/toolbar/MoreDropdown.cjs +51 -98
- package/dist/cjs/toolbar/MoreDropdown.native.js +73 -98
- package/dist/cjs/toolbar/MoreDropdown.native.js.map +1 -1
- package/dist/cjs/toolbar/StatusBar.cjs +19 -10
- package/dist/cjs/toolbar/StatusBar.native.js +19 -10
- package/dist/cjs/toolbar/StatusBar.native.js.map +1 -1
- package/dist/cjs/toolbar/TableBubble.cjs +77 -95
- package/dist/cjs/toolbar/TableBubble.native.js +73 -71
- package/dist/cjs/toolbar/TableBubble.native.js.map +1 -1
- package/dist/cjs/toolbar/ToolbarButton.cjs +86 -21
- package/dist/cjs/toolbar/ToolbarButton.native.js +14 -4
- package/dist/cjs/toolbar/ToolbarButton.native.js.map +1 -1
- package/dist/cjs/toolbar/icons.cjs +111 -468
- package/dist/cjs/toolbar/shortcuts.cjs +73 -24
- package/dist/cjs/toolbar/shortcuts.native.js +73 -24
- package/dist/cjs/toolbar/shortcuts.native.js.map +1 -1
- package/dist/cjs/toolbar/useHorizontalScroll.cjs +25 -5
- package/dist/cjs/toolbar/useHorizontalScroll.native.js +25 -5
- package/dist/cjs/toolbar/useHorizontalScroll.native.js.map +1 -1
- package/dist/cjs/toolbar/useRovingFocus.cjs +80 -0
- package/dist/cjs/toolbar/useRovingFocus.native.js +113 -0
- package/dist/cjs/toolbar/useRovingFocus.native.js.map +1 -0
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/RichEditor.mjs +85 -10
- package/dist/esm/RichEditor.mjs.map +1 -1
- package/dist/esm/RichEditor.native.js +425 -38
- package/dist/esm/RichEditor.native.js.map +1 -1
- package/dist/esm/RichTextEditor/index.mjs +18 -2
- package/dist/esm/RichTextEditor/index.mjs.map +1 -1
- package/dist/esm/RichTextEditor/index.native.js +18 -2
- package/dist/esm/RichTextEditor/index.native.js.map +1 -1
- package/dist/esm/constants.mjs +47 -29
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +54 -29
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/editor/BlockDragHandle.mjs +22 -7
- package/dist/esm/editor/BlockDragHandle.mjs.map +1 -1
- package/dist/esm/editor/BlockDragHandle.native.js +41 -7
- package/dist/esm/editor/BlockDragHandle.native.js.map +1 -1
- package/dist/esm/editor/SlashCommands.mjs +250 -294
- package/dist/esm/editor/SlashCommands.mjs.map +1 -1
- package/dist/esm/editor/SlashCommands.native.js +307 -341
- package/dist/esm/editor/SlashCommands.native.js.map +1 -1
- package/dist/esm/editor/TentapEditor.native.js +45 -13
- package/dist/esm/editor/TentapEditor.native.js.map +1 -1
- package/dist/esm/editor/TiptapEditor.mjs +142 -35
- package/dist/esm/editor/TiptapEditor.mjs.map +1 -1
- package/dist/esm/editor/TiptapEditor.native.js +155 -35
- package/dist/esm/editor/TiptapEditor.native.js.map +1 -1
- package/dist/esm/editor/blockAnchor.mjs +18 -0
- package/dist/esm/editor/blockAnchor.mjs.map +1 -0
- package/dist/esm/editor/blockAnchor.native.js +40 -0
- package/dist/esm/editor/blockAnchor.native.js.map +1 -0
- package/dist/esm/editor/codeBlockPreview.mjs +190 -0
- package/dist/esm/editor/codeBlockPreview.mjs.map +1 -0
- package/dist/esm/editor/codeBlockPreview.native.js +222 -0
- package/dist/esm/editor/codeBlockPreview.native.js.map +1 -0
- package/dist/esm/editor/editorStyles.mjs +203 -34
- package/dist/esm/editor/editorStyles.mjs.map +1 -1
- package/dist/esm/editor/editorStyles.native.js +203 -34
- package/dist/esm/editor/editorStyles.native.js.map +1 -1
- package/dist/esm/editor/emoji.mjs +88 -0
- package/dist/esm/editor/emoji.mjs.map +1 -0
- package/dist/esm/editor/emoji.native.js +141 -0
- package/dist/esm/editor/emoji.native.js.map +1 -0
- package/dist/esm/editor/lazyKatex.mjs +40 -0
- package/dist/esm/editor/lazyKatex.mjs.map +1 -0
- package/dist/esm/editor/lazyKatex.native.js +76 -0
- package/dist/esm/editor/lazyKatex.native.js.map +1 -0
- package/dist/esm/editor/markdown.mjs +179 -0
- package/dist/esm/editor/markdown.mjs.map +1 -0
- package/dist/esm/editor/markdown.native.js +238 -0
- package/dist/esm/editor/markdown.native.js.map +1 -0
- package/dist/esm/editor/mathematics.mjs +142 -0
- package/dist/esm/editor/mathematics.mjs.map +1 -0
- package/dist/esm/editor/mathematics.native.js +173 -0
- package/dist/esm/editor/mathematics.native.js.map +1 -0
- package/dist/esm/editor/media.mjs +113 -0
- package/dist/esm/editor/media.mjs.map +1 -0
- package/dist/esm/editor/media.native.js +144 -0
- package/dist/esm/editor/media.native.js.map +1 -0
- package/dist/esm/editor/mentions.mjs +37 -0
- package/dist/esm/editor/mentions.mjs.map +1 -0
- package/dist/esm/editor/mentions.native.js +45 -0
- package/dist/esm/editor/mentions.native.js.map +1 -0
- package/dist/esm/editor/pasteCleanup.mjs +57 -0
- package/dist/esm/editor/pasteCleanup.mjs.map +1 -0
- package/dist/esm/editor/pasteCleanup.native.js +146 -0
- package/dist/esm/editor/pasteCleanup.native.js.map +1 -0
- package/dist/esm/editor/suggestionPopup.mjs +268 -0
- package/dist/esm/editor/suggestionPopup.mjs.map +1 -0
- package/dist/esm/editor/suggestionPopup.native.js +295 -0
- package/dist/esm/editor/suggestionPopup.native.js.map +1 -0
- package/dist/esm/preview.mjs +236 -0
- package/dist/esm/preview.mjs.map +1 -0
- package/dist/esm/preview.native.js +264 -0
- package/dist/esm/preview.native.js.map +1 -0
- package/dist/esm/shared/t.mjs +17 -0
- package/dist/esm/shared/t.mjs.map +1 -0
- package/dist/esm/shared/t.native.js +17 -0
- package/dist/esm/shared/t.native.js.map +1 -0
- package/dist/esm/shared/url.mjs +10 -0
- package/dist/esm/shared/url.mjs.map +1 -0
- package/dist/esm/shared/url.native.js +10 -0
- package/dist/esm/shared/url.native.js.map +1 -0
- package/dist/esm/styled.mjs +13 -6
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +13 -6
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/toolbar/BubbleToolbar.mjs +11 -9
- package/dist/esm/toolbar/BubbleToolbar.mjs.map +1 -1
- package/dist/esm/toolbar/BubbleToolbar.native.js +11 -9
- package/dist/esm/toolbar/BubbleToolbar.native.js.map +1 -1
- package/dist/esm/toolbar/CodeBlockBubble.mjs +60 -24
- package/dist/esm/toolbar/CodeBlockBubble.mjs.map +1 -1
- package/dist/esm/toolbar/CodeBlockBubble.native.js +72 -26
- package/dist/esm/toolbar/CodeBlockBubble.native.js.map +1 -1
- package/dist/esm/toolbar/ColorPicker.mjs +21 -56
- package/dist/esm/toolbar/ColorPicker.mjs.map +1 -1
- package/dist/esm/toolbar/ColorPicker.native.js +82 -180
- package/dist/esm/toolbar/ColorPicker.native.js.map +1 -1
- package/dist/esm/toolbar/FixedToolbar.mjs +34 -11
- package/dist/esm/toolbar/FixedToolbar.mjs.map +1 -1
- package/dist/esm/toolbar/FixedToolbar.native.js +47 -55
- package/dist/esm/toolbar/FixedToolbar.native.js.map +1 -1
- package/dist/esm/toolbar/HeadingPicker.mjs +34 -41
- package/dist/esm/toolbar/HeadingPicker.mjs.map +1 -1
- package/dist/esm/toolbar/HeadingPicker.native.js +63 -53
- package/dist/esm/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/esm/toolbar/ImageBubble.mjs +20 -43
- package/dist/esm/toolbar/ImageBubble.mjs.map +1 -1
- package/dist/esm/toolbar/ImageBubble.native.js +20 -43
- package/dist/esm/toolbar/ImageBubble.native.js.map +1 -1
- package/dist/esm/toolbar/ImageDialog.mjs +5 -4
- package/dist/esm/toolbar/ImageDialog.mjs.map +1 -1
- package/dist/esm/toolbar/ImageDialog.native.js +75 -64
- package/dist/esm/toolbar/ImageDialog.native.js.map +1 -1
- package/dist/esm/toolbar/LinkBubble.mjs +23 -70
- package/dist/esm/toolbar/LinkBubble.mjs.map +1 -1
- package/dist/esm/toolbar/LinkBubble.native.js +23 -70
- package/dist/esm/toolbar/LinkBubble.native.js.map +1 -1
- package/dist/esm/toolbar/LinkDialog.mjs +17 -16
- package/dist/esm/toolbar/LinkDialog.mjs.map +1 -1
- package/dist/esm/toolbar/LinkDialog.native.js +84 -80
- package/dist/esm/toolbar/LinkDialog.native.js.map +1 -1
- package/dist/esm/toolbar/ListPicker.mjs +33 -44
- package/dist/esm/toolbar/ListPicker.mjs.map +1 -1
- package/dist/esm/toolbar/ListPicker.native.js +44 -45
- package/dist/esm/toolbar/ListPicker.native.js.map +1 -1
- package/dist/esm/toolbar/MathBubble.mjs +134 -0
- package/dist/esm/toolbar/MathBubble.mjs.map +1 -0
- package/dist/esm/toolbar/MathBubble.native.js +141 -0
- package/dist/esm/toolbar/MathBubble.native.js.map +1 -0
- package/dist/esm/toolbar/MoreDropdown.mjs +50 -97
- package/dist/esm/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/esm/toolbar/MoreDropdown.native.js +72 -97
- package/dist/esm/toolbar/MoreDropdown.native.js.map +1 -1
- package/dist/esm/toolbar/StatusBar.mjs +19 -10
- package/dist/esm/toolbar/StatusBar.mjs.map +1 -1
- package/dist/esm/toolbar/StatusBar.native.js +19 -10
- package/dist/esm/toolbar/StatusBar.native.js.map +1 -1
- package/dist/esm/toolbar/TableBubble.mjs +77 -95
- package/dist/esm/toolbar/TableBubble.mjs.map +1 -1
- package/dist/esm/toolbar/TableBubble.native.js +73 -71
- package/dist/esm/toolbar/TableBubble.native.js.map +1 -1
- package/dist/esm/toolbar/ToolbarButton.mjs +87 -22
- package/dist/esm/toolbar/ToolbarButton.mjs.map +1 -1
- package/dist/esm/toolbar/ToolbarButton.native.js +14 -4
- package/dist/esm/toolbar/ToolbarButton.native.js.map +1 -1
- package/dist/esm/toolbar/icons.mjs +109 -469
- package/dist/esm/toolbar/icons.mjs.map +1 -1
- package/dist/esm/toolbar/shortcuts.mjs +73 -24
- package/dist/esm/toolbar/shortcuts.mjs.map +1 -1
- package/dist/esm/toolbar/shortcuts.native.js +73 -24
- package/dist/esm/toolbar/shortcuts.native.js.map +1 -1
- package/dist/esm/toolbar/useHorizontalScroll.mjs +25 -6
- package/dist/esm/toolbar/useHorizontalScroll.mjs.map +1 -1
- package/dist/esm/toolbar/useHorizontalScroll.native.js +25 -6
- package/dist/esm/toolbar/useHorizontalScroll.native.js.map +1 -1
- package/dist/esm/toolbar/useRovingFocus.mjs +55 -0
- package/dist/esm/toolbar/useRovingFocus.mjs.map +1 -0
- package/dist/esm/toolbar/useRovingFocus.native.js +85 -0
- package/dist/esm/toolbar/useRovingFocus.native.js.map +1 -0
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js.map +1 -1
- package/dist/jsx/RichEditor.mjs +85 -10
- package/dist/jsx/RichEditor.mjs.map +1 -1
- package/dist/jsx/RichEditor.native.js +422 -35
- package/dist/jsx/RichEditor.native.js.map +1 -1
- package/dist/jsx/RichTextEditor/index.mjs +18 -2
- package/dist/jsx/RichTextEditor/index.mjs.map +1 -1
- package/dist/jsx/RichTextEditor/index.native.js +18 -2
- package/dist/jsx/RichTextEditor/index.native.js.map +1 -1
- package/dist/jsx/constants.mjs +47 -29
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.js +59 -29
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/editor/BlockDragHandle.mjs +22 -7
- package/dist/jsx/editor/BlockDragHandle.mjs.map +1 -1
- package/dist/jsx/editor/BlockDragHandle.native.js +41 -7
- package/dist/jsx/editor/BlockDragHandle.native.js.map +1 -1
- package/dist/jsx/editor/SlashCommands.mjs +250 -294
- package/dist/jsx/editor/SlashCommands.mjs.map +1 -1
- package/dist/jsx/editor/SlashCommands.native.js +306 -340
- package/dist/jsx/editor/SlashCommands.native.js.map +1 -1
- package/dist/jsx/editor/TentapEditor.native.js +44 -12
- package/dist/jsx/editor/TentapEditor.native.js.map +1 -1
- package/dist/jsx/editor/TiptapEditor.mjs +142 -35
- package/dist/jsx/editor/TiptapEditor.mjs.map +1 -1
- package/dist/jsx/editor/TiptapEditor.native.js +153 -33
- package/dist/jsx/editor/TiptapEditor.native.js.map +1 -1
- package/dist/jsx/editor/blockAnchor.mjs +18 -0
- package/dist/jsx/editor/blockAnchor.mjs.map +1 -0
- package/dist/jsx/editor/blockAnchor.native.js +68 -0
- package/dist/jsx/editor/blockAnchor.native.js.map +1 -0
- package/dist/jsx/editor/codeBlockPreview.mjs +190 -0
- package/dist/jsx/editor/codeBlockPreview.mjs.map +1 -0
- package/dist/jsx/editor/codeBlockPreview.native.js +265 -0
- package/dist/jsx/editor/codeBlockPreview.native.js.map +1 -0
- package/dist/jsx/editor/editorStyles.mjs +203 -34
- package/dist/jsx/editor/editorStyles.mjs.map +1 -1
- package/dist/jsx/editor/editorStyles.native.js +203 -34
- package/dist/jsx/editor/editorStyles.native.js.map +1 -1
- package/dist/jsx/editor/emoji.mjs +88 -0
- package/dist/jsx/editor/emoji.mjs.map +1 -0
- package/dist/jsx/editor/emoji.native.js +184 -0
- package/dist/jsx/editor/emoji.native.js.map +1 -0
- package/dist/jsx/editor/lazyKatex.mjs +40 -0
- package/dist/jsx/editor/lazyKatex.mjs.map +1 -0
- package/dist/jsx/editor/lazyKatex.native.js +117 -0
- package/dist/jsx/editor/lazyKatex.native.js.map +1 -0
- package/dist/jsx/editor/markdown.mjs +179 -0
- package/dist/jsx/editor/markdown.mjs.map +1 -0
- package/dist/jsx/editor/markdown.native.js +278 -0
- package/dist/jsx/editor/markdown.native.js.map +1 -0
- package/dist/jsx/editor/mathematics.mjs +142 -0
- package/dist/jsx/editor/mathematics.mjs.map +1 -0
- package/dist/jsx/editor/mathematics.native.js +202 -0
- package/dist/jsx/editor/mathematics.native.js.map +1 -0
- package/dist/jsx/editor/media.mjs +113 -0
- package/dist/jsx/editor/media.mjs.map +1 -0
- package/dist/jsx/editor/media.native.js +172 -0
- package/dist/jsx/editor/media.native.js.map +1 -0
- package/dist/jsx/editor/mentions.mjs +37 -0
- package/dist/jsx/editor/mentions.mjs.map +1 -0
- package/dist/jsx/editor/mentions.native.js +84 -0
- package/dist/jsx/editor/mentions.native.js.map +1 -0
- package/dist/jsx/editor/pasteCleanup.mjs +57 -0
- package/dist/jsx/editor/pasteCleanup.mjs.map +1 -0
- package/dist/jsx/editor/pasteCleanup.native.js +175 -0
- package/dist/jsx/editor/pasteCleanup.native.js.map +1 -0
- package/dist/jsx/editor/suggestionPopup.mjs +268 -0
- package/dist/jsx/editor/suggestionPopup.mjs.map +1 -0
- package/dist/jsx/editor/suggestionPopup.native.js +327 -0
- package/dist/jsx/editor/suggestionPopup.native.js.map +1 -0
- package/dist/jsx/preview.mjs +236 -0
- package/dist/jsx/preview.mjs.map +1 -0
- package/dist/jsx/preview.native.js +294 -0
- package/dist/jsx/preview.native.js.map +1 -0
- package/dist/jsx/shared/t.mjs +17 -0
- package/dist/jsx/shared/t.mjs.map +1 -0
- package/dist/jsx/shared/t.native.js +56 -0
- package/dist/jsx/shared/t.native.js.map +1 -0
- package/dist/jsx/shared/url.mjs +10 -0
- package/dist/jsx/shared/url.mjs.map +1 -0
- package/dist/jsx/shared/url.native.js +38 -0
- package/dist/jsx/shared/url.native.js.map +1 -0
- package/dist/jsx/styled.mjs +13 -6
- package/dist/jsx/styled.mjs.map +1 -1
- package/dist/jsx/styled.native.js +13 -6
- package/dist/jsx/styled.native.js.map +1 -1
- package/dist/jsx/toolbar/BubbleToolbar.mjs +11 -9
- package/dist/jsx/toolbar/BubbleToolbar.mjs.map +1 -1
- package/dist/jsx/toolbar/BubbleToolbar.native.js +10 -8
- package/dist/jsx/toolbar/BubbleToolbar.native.js.map +1 -1
- package/dist/jsx/toolbar/CodeBlockBubble.mjs +60 -24
- package/dist/jsx/toolbar/CodeBlockBubble.mjs.map +1 -1
- package/dist/jsx/toolbar/CodeBlockBubble.native.js +71 -25
- package/dist/jsx/toolbar/CodeBlockBubble.native.js.map +1 -1
- package/dist/jsx/toolbar/ColorPicker.mjs +21 -56
- package/dist/jsx/toolbar/ColorPicker.mjs.map +1 -1
- package/dist/jsx/toolbar/ColorPicker.native.js +81 -179
- package/dist/jsx/toolbar/ColorPicker.native.js.map +1 -1
- package/dist/jsx/toolbar/FixedToolbar.mjs +34 -11
- package/dist/jsx/toolbar/FixedToolbar.mjs.map +1 -1
- package/dist/jsx/toolbar/FixedToolbar.native.js +46 -54
- package/dist/jsx/toolbar/FixedToolbar.native.js.map +1 -1
- package/dist/jsx/toolbar/HeadingPicker.mjs +34 -41
- package/dist/jsx/toolbar/HeadingPicker.mjs.map +1 -1
- package/dist/jsx/toolbar/HeadingPicker.native.js +61 -51
- package/dist/jsx/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/jsx/toolbar/ImageBubble.mjs +20 -43
- package/dist/jsx/toolbar/ImageBubble.mjs.map +1 -1
- package/dist/jsx/toolbar/ImageBubble.native.js +20 -43
- package/dist/jsx/toolbar/ImageBubble.native.js.map +1 -1
- package/dist/jsx/toolbar/ImageDialog.mjs +5 -4
- package/dist/jsx/toolbar/ImageDialog.mjs.map +1 -1
- package/dist/jsx/toolbar/ImageDialog.native.js +76 -65
- package/dist/jsx/toolbar/ImageDialog.native.js.map +1 -1
- package/dist/jsx/toolbar/LinkBubble.mjs +23 -70
- package/dist/jsx/toolbar/LinkBubble.mjs.map +1 -1
- package/dist/jsx/toolbar/LinkBubble.native.js +23 -70
- package/dist/jsx/toolbar/LinkBubble.native.js.map +1 -1
- package/dist/jsx/toolbar/LinkDialog.mjs +17 -16
- package/dist/jsx/toolbar/LinkDialog.mjs.map +1 -1
- package/dist/jsx/toolbar/LinkDialog.native.js +86 -83
- package/dist/jsx/toolbar/LinkDialog.native.js.map +1 -1
- package/dist/jsx/toolbar/ListPicker.mjs +33 -44
- package/dist/jsx/toolbar/ListPicker.mjs.map +1 -1
- package/dist/jsx/toolbar/ListPicker.native.js +43 -44
- package/dist/jsx/toolbar/ListPicker.native.js.map +1 -1
- package/dist/jsx/toolbar/MathBubble.mjs +134 -0
- package/dist/jsx/toolbar/MathBubble.mjs.map +1 -0
- package/dist/jsx/toolbar/MathBubble.native.js +169 -0
- package/dist/jsx/toolbar/MathBubble.native.js.map +1 -0
- package/dist/jsx/toolbar/MoreDropdown.mjs +50 -97
- package/dist/jsx/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/jsx/toolbar/MoreDropdown.native.js +73 -98
- package/dist/jsx/toolbar/MoreDropdown.native.js.map +1 -1
- package/dist/jsx/toolbar/StatusBar.mjs +19 -10
- package/dist/jsx/toolbar/StatusBar.mjs.map +1 -1
- package/dist/jsx/toolbar/StatusBar.native.js +19 -10
- package/dist/jsx/toolbar/StatusBar.native.js.map +1 -1
- package/dist/jsx/toolbar/TableBubble.mjs +77 -95
- package/dist/jsx/toolbar/TableBubble.mjs.map +1 -1
- package/dist/jsx/toolbar/TableBubble.native.js +73 -71
- package/dist/jsx/toolbar/TableBubble.native.js.map +1 -1
- package/dist/jsx/toolbar/ToolbarButton.mjs +87 -22
- package/dist/jsx/toolbar/ToolbarButton.mjs.map +1 -1
- package/dist/jsx/toolbar/ToolbarButton.native.js +14 -4
- package/dist/jsx/toolbar/ToolbarButton.native.js.map +1 -1
- package/dist/jsx/toolbar/icons.mjs +109 -469
- package/dist/jsx/toolbar/icons.mjs.map +1 -1
- package/dist/jsx/toolbar/shortcuts.mjs +73 -24
- package/dist/jsx/toolbar/shortcuts.mjs.map +1 -1
- package/dist/jsx/toolbar/shortcuts.native.js +73 -24
- package/dist/jsx/toolbar/shortcuts.native.js.map +1 -1
- package/dist/jsx/toolbar/useHorizontalScroll.mjs +25 -6
- package/dist/jsx/toolbar/useHorizontalScroll.mjs.map +1 -1
- package/dist/jsx/toolbar/useHorizontalScroll.native.js +25 -5
- package/dist/jsx/toolbar/useHorizontalScroll.native.js.map +1 -1
- package/dist/jsx/toolbar/useRovingFocus.mjs +55 -0
- package/dist/jsx/toolbar/useRovingFocus.mjs.map +1 -0
- package/dist/jsx/toolbar/useRovingFocus.native.js +113 -0
- package/dist/jsx/toolbar/useRovingFocus.native.js.map +1 -0
- package/dist/jsx/types.mjs.map +1 -1
- package/dist/jsx/types.native.js.map +1 -1
- package/package.json +28 -13
- package/src/RichEditor.native.tsx +451 -49
- package/src/RichEditor.stories.tsx +158 -0
- package/src/RichEditor.tsx +121 -7
- package/src/RichTextEditor/index.tsx +41 -3
- package/src/RichTextEditor/richTextEditor.spec.tsx +11 -4
- package/src/constants.ts +86 -24
- package/src/editor/BlockDragHandle.ts +30 -5
- package/src/editor/SlashCommands.tsx +228 -293
- package/src/editor/TentapEditor.native.tsx +68 -17
- package/src/editor/TiptapEditor.tsx +187 -22
- package/src/editor/blockAnchor.spec.ts +70 -0
- package/src/editor/blockAnchor.ts +42 -0
- package/src/editor/codeBlockPreview.spec.ts +144 -0
- package/src/editor/codeBlockPreview.ts +266 -0
- package/src/editor/css.d.ts +2 -0
- package/src/editor/details.spec.ts +48 -0
- package/src/editor/editorStyles.spec.ts +25 -0
- package/src/editor/editorStyles.ts +218 -34
- package/src/editor/emoji.spec.ts +88 -0
- package/src/editor/emoji.ts +147 -0
- package/src/editor/emojilib.d.ts +16 -0
- package/src/editor/lazyKatex.spec.ts +38 -0
- package/src/editor/lazyKatex.ts +68 -0
- package/src/editor/markdown.spec.ts +196 -0
- package/src/editor/markdown.ts +249 -0
- package/src/editor/mathematics.spec.ts +97 -0
- package/src/editor/mathematics.ts +179 -0
- package/src/editor/media.spec.ts +121 -0
- package/src/editor/media.ts +133 -0
- package/src/editor/mentions.spec.ts +41 -0
- package/src/editor/mentions.ts +55 -0
- package/src/editor/pasteCleanup.spec.ts +84 -0
- package/src/editor/pasteCleanup.ts +124 -0
- package/src/editor/suggestionPopup.spec.tsx +105 -0
- package/src/editor/suggestionPopup.tsx +414 -0
- package/src/editor/tiptapEditor.spec.tsx +15 -8
- package/src/exports.spec.ts +4 -2
- package/src/index.ts +7 -1
- package/src/integration.spec.tsx +38 -9
- package/src/preview.spec.ts +130 -0
- package/src/preview.ts +287 -0
- package/src/richEditor.spec.tsx +10 -3
- package/src/shared/t.ts +25 -0
- package/src/shared/url.ts +16 -0
- package/src/styled.ts +13 -6
- package/src/toolbar/BubbleToolbar.tsx +11 -8
- package/src/toolbar/CodeBlockBubble.tsx +66 -28
- package/src/toolbar/ColorPicker.native.tsx +126 -0
- package/src/toolbar/ColorPicker.tsx +23 -67
- package/src/toolbar/FixedToolbar.native.tsx +51 -51
- package/src/toolbar/FixedToolbar.tsx +54 -10
- package/src/toolbar/HeadingPicker.tsx +46 -38
- package/src/toolbar/ImageBubble.tsx +26 -44
- package/src/toolbar/ImageDialog.native.tsx +97 -0
- package/src/toolbar/ImageDialog.tsx +5 -4
- package/src/toolbar/LinkBubble.tsx +27 -64
- package/src/toolbar/LinkDialog.native.tsx +117 -0
- package/src/toolbar/LinkDialog.tsx +28 -24
- package/src/toolbar/ListPicker.tsx +47 -43
- package/src/toolbar/MathBubble.tsx +140 -0
- package/src/toolbar/MoreDropdown.tsx +53 -60
- package/src/toolbar/StatusBar.tsx +13 -8
- package/src/toolbar/TableBubble.tsx +82 -94
- package/src/toolbar/ToolbarButton.native.tsx +14 -4
- package/src/toolbar/ToolbarButton.tsx +98 -19
- package/src/toolbar/bubbleToolbar.spec.tsx +2 -1
- package/src/toolbar/fixedToolbar.spec.tsx +4 -2
- package/src/toolbar/icons.tsx +113 -323
- package/src/toolbar/shortcuts.ts +77 -24
- package/src/toolbar/toolbarPrimitives.spec.tsx +29 -1
- package/src/toolbar/toolbarSubComponents.spec.tsx +4 -2
- package/src/toolbar/useHorizontalScroll.spec.ts +67 -0
- package/src/toolbar/useHorizontalScroll.tsx +39 -12
- package/src/toolbar/useRovingFocus.spec.tsx +100 -0
- package/src/toolbar/useRovingFocus.ts +82 -0
- package/src/types.spec.ts +40 -1
- package/src/types.ts +28 -0
- package/types/RichEditor.d.ts +51 -0
- package/types/RichEditor.d.ts.map +1 -0
- package/types/RichEditor.native.d.ts +59 -0
- package/types/RichEditor.native.d.ts.map +1 -0
- package/types/RichTextEditor/index.d.ts +71 -0
- package/types/RichTextEditor/index.d.ts.map +1 -0
- package/types/constants.d.ts +49 -0
- package/types/constants.d.ts.map +1 -0
- package/types/context.d.ts +10 -0
- package/types/context.d.ts.map +1 -0
- package/types/editor/BlockDragHandle.d.ts +8 -0
- package/types/editor/BlockDragHandle.d.ts.map +1 -0
- package/types/editor/MarkdownPaste.d.ts +8 -0
- package/types/editor/MarkdownPaste.d.ts.map +1 -0
- package/types/editor/SlashCommands.d.ts +24 -0
- package/types/editor/SlashCommands.d.ts.map +1 -0
- package/types/editor/TentapEditor.native.d.ts +21 -0
- package/types/editor/TentapEditor.native.d.ts.map +1 -0
- package/types/editor/TiptapEditor.d.ts +24 -0
- package/types/editor/TiptapEditor.d.ts.map +1 -0
- package/types/editor/blockAnchor.d.ts +25 -0
- package/types/editor/blockAnchor.d.ts.map +1 -0
- package/types/editor/codeBlockPreview.d.ts +51 -0
- package/types/editor/codeBlockPreview.d.ts.map +1 -0
- package/types/editor/editorStyles.d.ts +25 -0
- package/types/editor/editorStyles.d.ts.map +1 -0
- package/types/editor/emoji.d.ts +45 -0
- package/types/editor/emoji.d.ts.map +1 -0
- package/types/editor/index.d.ts +11 -0
- package/types/editor/index.d.ts.map +1 -0
- package/types/editor/lazyKatex.d.ts +33 -0
- package/types/editor/lazyKatex.d.ts.map +1 -0
- package/types/editor/markdown.d.ts +24 -0
- package/types/editor/markdown.d.ts.map +1 -0
- package/types/editor/mathematics.d.ts +44 -0
- package/types/editor/mathematics.d.ts.map +1 -0
- package/types/editor/media.d.ts +32 -0
- package/types/editor/media.d.ts.map +1 -0
- package/types/editor/mentions.d.ts +15 -0
- package/types/editor/mentions.d.ts.map +1 -0
- package/types/editor/pasteCleanup.d.ts +24 -0
- package/types/editor/pasteCleanup.d.ts.map +1 -0
- package/types/editor/suggestionPopup.d.ts +113 -0
- package/types/editor/suggestionPopup.d.ts.map +1 -0
- package/types/editor/types.d.ts +80 -0
- package/types/editor/types.d.ts.map +1 -0
- package/types/editor/useEditorState.d.ts +19 -0
- package/types/editor/useEditorState.d.ts.map +1 -0
- package/types/index.d.ts +11 -0
- package/types/index.d.ts.map +1 -0
- package/types/preview.d.ts +44 -0
- package/types/preview.d.ts.map +1 -0
- package/types/shared/t.d.ts +10 -0
- package/types/shared/t.d.ts.map +1 -0
- package/types/shared/url.d.ts +9 -0
- package/types/shared/url.d.ts.map +1 -0
- package/types/styled.d.ts +40 -0
- package/types/styled.d.ts.map +1 -0
- package/types/toolbar/BubbleToolbar.d.ts +23 -0
- package/types/toolbar/BubbleToolbar.d.ts.map +1 -0
- package/types/toolbar/CodeBlockBubble.d.ts +10 -0
- package/types/toolbar/CodeBlockBubble.d.ts.map +1 -0
- package/types/toolbar/ColorPicker.d.ts +15 -0
- package/types/toolbar/ColorPicker.d.ts.map +1 -0
- package/types/toolbar/ColorPicker.native.d.ts +20 -0
- package/types/toolbar/ColorPicker.native.d.ts.map +1 -0
- package/types/toolbar/FixedToolbar.d.ts +32 -0
- package/types/toolbar/FixedToolbar.d.ts.map +1 -0
- package/types/toolbar/FixedToolbar.native.d.ts +30 -0
- package/types/toolbar/FixedToolbar.native.d.ts.map +1 -0
- package/types/toolbar/HeadingPicker.d.ts +14 -0
- package/types/toolbar/HeadingPicker.d.ts.map +1 -0
- package/types/toolbar/ImageBubble.d.ts +10 -0
- package/types/toolbar/ImageBubble.d.ts.map +1 -0
- package/types/toolbar/ImageDialog.d.ts +12 -0
- package/types/toolbar/ImageDialog.d.ts.map +1 -0
- package/types/toolbar/ImageDialog.native.d.ts +15 -0
- package/types/toolbar/ImageDialog.native.d.ts.map +1 -0
- package/types/toolbar/LinkBubble.d.ts +10 -0
- package/types/toolbar/LinkBubble.d.ts.map +1 -0
- package/types/toolbar/LinkDialog.d.ts +20 -0
- package/types/toolbar/LinkDialog.d.ts.map +1 -0
- package/types/toolbar/LinkDialog.native.d.ts +18 -0
- package/types/toolbar/LinkDialog.native.d.ts.map +1 -0
- package/types/toolbar/ListPicker.d.ts +14 -0
- package/types/toolbar/ListPicker.d.ts.map +1 -0
- package/types/toolbar/MathBubble.d.ts +11 -0
- package/types/toolbar/MathBubble.d.ts.map +1 -0
- package/types/toolbar/MoreDropdown.d.ts +13 -0
- package/types/toolbar/MoreDropdown.d.ts.map +1 -0
- package/types/toolbar/ResizeHandle.d.ts +11 -0
- package/types/toolbar/ResizeHandle.d.ts.map +1 -0
- package/types/toolbar/StatusBar.d.ts +11 -0
- package/types/toolbar/StatusBar.d.ts.map +1 -0
- package/types/toolbar/TableBubble.d.ts +10 -0
- package/types/toolbar/TableBubble.d.ts.map +1 -0
- package/types/toolbar/ToolbarButton.d.ts +35 -0
- package/types/toolbar/ToolbarButton.d.ts.map +1 -0
- package/types/toolbar/ToolbarButton.native.d.ts +30 -0
- package/types/toolbar/ToolbarButton.native.d.ts.map +1 -0
- package/types/toolbar/ToolbarGroup.d.ts +14 -0
- package/types/toolbar/ToolbarGroup.d.ts.map +1 -0
- package/types/toolbar/icons.d.ts +52 -0
- package/types/toolbar/icons.d.ts.map +1 -0
- package/types/toolbar/icons.native.d.ts +41 -0
- package/types/toolbar/icons.native.d.ts.map +1 -0
- package/types/toolbar/shortcuts.d.ts +34 -0
- package/types/toolbar/shortcuts.d.ts.map +1 -0
- package/types/toolbar/useHorizontalScroll.d.ts +43 -0
- package/types/toolbar/useHorizontalScroll.d.ts.map +1 -0
- package/types/toolbar/useRovingFocus.d.ts +10 -0
- package/types/toolbar/useRovingFocus.d.ts.map +1 -0
- package/types/types.d.ts +125 -0
- package/types/types.d.ts.map +1 -0
- package/dist/cjs/RichEditor.stories.cjs +0 -327
- package/dist/cjs/RichEditor.stories.native.js +0 -342
- package/dist/cjs/RichEditor.stories.native.js.map +0 -1
- package/dist/esm/RichEditor.stories.mjs +0 -291
- package/dist/esm/RichEditor.stories.mjs.map +0 -1
- package/dist/esm/RichEditor.stories.native.js +0 -303
- package/dist/esm/RichEditor.stories.native.js.map +0 -1
- package/dist/jsx/RichEditor.stories.mjs +0 -291
- package/dist/jsx/RichEditor.stories.mjs.map +0 -1
- package/dist/jsx/RichEditor.stories.native.js +0 -342
- package/dist/jsx/RichEditor.stories.native.js.map +0 -1
|
@@ -31,6 +31,10 @@ const meta: Meta<typeof RichTextEditor> = {
|
|
|
31
31
|
showBubbleToolbar: { control: "boolean" },
|
|
32
32
|
compact: { control: "boolean" },
|
|
33
33
|
skeleton: { control: "boolean" },
|
|
34
|
+
defaultFullscreen: { control: "boolean" },
|
|
35
|
+
fullscreen: { control: false },
|
|
36
|
+
onFullscreenChange: { control: false },
|
|
37
|
+
inlineEditing: { control: "boolean" },
|
|
34
38
|
size: { control: "select", options: ["$2", "$3", "$4"] },
|
|
35
39
|
minHeight: { control: "number" },
|
|
36
40
|
maxHeight: { control: "number" },
|
|
@@ -322,3 +326,157 @@ export const Skeleton: Story = {
|
|
|
322
326
|
minHeight: 200,
|
|
323
327
|
},
|
|
324
328
|
};
|
|
329
|
+
|
|
330
|
+
// ---------------------------------------------------------------------------
|
|
331
|
+
// Fullscreen
|
|
332
|
+
// ---------------------------------------------------------------------------
|
|
333
|
+
|
|
334
|
+
export const Fullscreen: Story = {
|
|
335
|
+
args: {
|
|
336
|
+
label: "Fullscreen",
|
|
337
|
+
defaultFullscreen: false,
|
|
338
|
+
defaultValue:
|
|
339
|
+
"<p>Use the expand button at the toolbar's right end to fill the viewport. Press Escape (or the button again) to exit.</p>",
|
|
340
|
+
minHeight: 200,
|
|
341
|
+
helperText: "Toggle fullscreen from the toolbar; Escape exits",
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ---------------------------------------------------------------------------
|
|
346
|
+
// InlineEmbedded (native escape hatch; web renders the normal inline editor)
|
|
347
|
+
// ---------------------------------------------------------------------------
|
|
348
|
+
|
|
349
|
+
export const InlineEmbedded: Story = {
|
|
350
|
+
args: {
|
|
351
|
+
label: "Inline (embedded)",
|
|
352
|
+
inlineEditing: true,
|
|
353
|
+
defaultValue: "<p>Native: edits inline without the fullscreen modal (escape hatch).</p>",
|
|
354
|
+
minHeight: 160,
|
|
355
|
+
helperText: "inlineEditing keeps the old embedded editor on native",
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
// WithMentions (@ suggestion popup wired to a demo directory)
|
|
361
|
+
// ---------------------------------------------------------------------------
|
|
362
|
+
|
|
363
|
+
const MENTION_DIRECTORY = [
|
|
364
|
+
{ id: "ada", display: "Ada Lovelace", description: "Analyst" },
|
|
365
|
+
{ id: "alan", display: "Alan Turing", description: "Computer science" },
|
|
366
|
+
{ id: "grace", display: "Grace Hopper", description: "Compilers" },
|
|
367
|
+
{ id: "linus", display: "Linus Torvalds", description: "Kernels" },
|
|
368
|
+
{ id: "margaret", display: "Margaret Hamilton", description: "Flight software" },
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
export const WithMentions: Story = {
|
|
372
|
+
args: {
|
|
373
|
+
label: "With Mentions",
|
|
374
|
+
placeholder: "Type @ to mention someone...",
|
|
375
|
+
minHeight: 200,
|
|
376
|
+
helperText: "The @ popup shares the slash-menu chrome (LC-16)",
|
|
377
|
+
mentions: {
|
|
378
|
+
items: (query: string) =>
|
|
379
|
+
MENTION_DIRECTORY.filter((item) =>
|
|
380
|
+
item.display.toLowerCase().includes(query.toLowerCase()),
|
|
381
|
+
),
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
// WithEmoji (`:` shortname autocomplete — lazy dataset)
|
|
388
|
+
// ---------------------------------------------------------------------------
|
|
389
|
+
|
|
390
|
+
export const WithEmoji: Story = {
|
|
391
|
+
args: {
|
|
392
|
+
label: "Emoji Autocomplete",
|
|
393
|
+
placeholder: "Type : followed by a name, e.g. :tada",
|
|
394
|
+
minHeight: 160,
|
|
395
|
+
helperText:
|
|
396
|
+
"The : popup shares the slash/mention chrome (LC-16); the dataset lazy-loads on first trigger and inserts plain unicode",
|
|
397
|
+
},
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// WithMermaid (fenced diagram code with live preview)
|
|
402
|
+
// ---------------------------------------------------------------------------
|
|
403
|
+
|
|
404
|
+
export const WithMermaid: Story = {
|
|
405
|
+
args: {
|
|
406
|
+
label: "Mermaid Diagram",
|
|
407
|
+
showBubbleToolbar: true,
|
|
408
|
+
minHeight: 320,
|
|
409
|
+
helperText:
|
|
410
|
+
"The diagram engine lazy-loads on the first mermaid block; edits re-render debounced; invalid syntax shows the parse error",
|
|
411
|
+
defaultValue:
|
|
412
|
+
"<p>Flow below — edit the code to see the live preview update.</p>" +
|
|
413
|
+
'<pre><code class="language-mermaid">graph TD\n A[Draft] --> B{Review}\n B -->|approve| C[Merge]\n B -->|reject| A</code></pre>',
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// ---------------------------------------------------------------------------
|
|
418
|
+
// WithMath (inline $...$ + $$ block via lazy KaTeX, incl. error state)
|
|
419
|
+
// ---------------------------------------------------------------------------
|
|
420
|
+
|
|
421
|
+
export const WithMath: Story = {
|
|
422
|
+
args: {
|
|
423
|
+
label: "Math (KaTeX)",
|
|
424
|
+
showBubbleToolbar: true,
|
|
425
|
+
minHeight: 320,
|
|
426
|
+
helperText:
|
|
427
|
+
"KaTeX lazy-loads on the first math node; select an inline formula to edit it; bad TeX shows the parse error",
|
|
428
|
+
defaultValue:
|
|
429
|
+
'<p>Inline: <span data-type="inline-math" data-latex="E=mc^2">E=mc^2</span> flows with text.</p>' +
|
|
430
|
+
'<pre><code class="language-math">\\sum_{i=0}^{n} i = \\frac{n(n+1)}{2}</code></pre>' +
|
|
431
|
+
'<p>Error state: <span data-type="inline-math" data-latex="\\nope{">\\nope{</span> keeps the source visible.</p>',
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// ---------------------------------------------------------------------------
|
|
436
|
+
// WithDetails (collapsible <details> sections)
|
|
437
|
+
// ---------------------------------------------------------------------------
|
|
438
|
+
|
|
439
|
+
export const WithDetails: Story = {
|
|
440
|
+
args: {
|
|
441
|
+
label: "Collapsible Section",
|
|
442
|
+
minHeight: 240,
|
|
443
|
+
helperText:
|
|
444
|
+
"GitLab-style <details>: toggle collapses content; markdown keeps it as raw HTML (lossless)",
|
|
445
|
+
defaultValue:
|
|
446
|
+
"<details open><summary>Deployment checklist</summary>" +
|
|
447
|
+
'<div data-type="detailsContent"><ul><li><p>Run the migration</p></li>' +
|
|
448
|
+
"<li><p>Flip the feature flag</p></li></ul></div></details>" +
|
|
449
|
+
"<p>Content after the section.</p>",
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// ---------------------------------------------------------------------------
|
|
454
|
+
// WithUploadHooks (prop-driven image/file upload)
|
|
455
|
+
// ---------------------------------------------------------------------------
|
|
456
|
+
|
|
457
|
+
export const WithUploadHooks: Story = {
|
|
458
|
+
args: {
|
|
459
|
+
label: "With Upload Hooks",
|
|
460
|
+
placeholder: "Paste or drop an image or file...",
|
|
461
|
+
minHeight: 200,
|
|
462
|
+
helperText: "onImageUpload / onFileUpload resolve fake URLs after a short delay",
|
|
463
|
+
onImageUpload: async (file: File) =>
|
|
464
|
+
new Promise<string>((resolve) =>
|
|
465
|
+
setTimeout(
|
|
466
|
+
() => resolve(`https://example.com/uploads/${encodeURIComponent(file.name)}`),
|
|
467
|
+
150,
|
|
468
|
+
),
|
|
469
|
+
),
|
|
470
|
+
onFileUpload: async (file: File) =>
|
|
471
|
+
new Promise<{ url: string; name?: string }>((resolve) =>
|
|
472
|
+
setTimeout(
|
|
473
|
+
() =>
|
|
474
|
+
resolve({
|
|
475
|
+
url: `https://example.com/files/${encodeURIComponent(file.name)}`,
|
|
476
|
+
name: file.name,
|
|
477
|
+
}),
|
|
478
|
+
150,
|
|
479
|
+
),
|
|
480
|
+
),
|
|
481
|
+
},
|
|
482
|
+
};
|
package/src/RichEditor.tsx
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import {
|
|
16
16
|
forwardRef,
|
|
17
17
|
useCallback,
|
|
18
|
+
useEffect,
|
|
18
19
|
useImperativeHandle,
|
|
19
20
|
useMemo,
|
|
20
21
|
useRef,
|
|
@@ -60,6 +61,18 @@ export interface RichEditorCombinedProps extends RichEditorProps {
|
|
|
60
61
|
resizable?: boolean;
|
|
61
62
|
/** Show word/character count status bar (default: true) */
|
|
62
63
|
showStatusBar?: boolean;
|
|
64
|
+
/** Controlled fullscreen state (uncontrolled when omitted) */
|
|
65
|
+
fullscreen?: boolean;
|
|
66
|
+
/** Initial fullscreen state when uncontrolled (default: false) */
|
|
67
|
+
defaultFullscreen?: boolean;
|
|
68
|
+
/** Called when the fullscreen state changes */
|
|
69
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Native only: render the embedded inline editor instead of the
|
|
72
|
+
* preview + fullscreen edit modal. Ignored on web (the web editor is
|
|
73
|
+
* always inline; fullscreen is the toolbar toggle).
|
|
74
|
+
*/
|
|
75
|
+
inlineEditing?: boolean;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
// ===========================================================================
|
|
@@ -79,6 +92,10 @@ const RichEditorImpl = forwardRef<RichEditorRef, RichEditorCombinedProps>(
|
|
|
79
92
|
hasError,
|
|
80
93
|
editable = true,
|
|
81
94
|
onStateChange,
|
|
95
|
+
fullscreen: fullscreenProp,
|
|
96
|
+
defaultFullscreen = false,
|
|
97
|
+
onFullscreenChange,
|
|
98
|
+
inlineEditing: _inlineEditing,
|
|
82
99
|
...editorProps
|
|
83
100
|
},
|
|
84
101
|
ref,
|
|
@@ -87,6 +104,10 @@ const RichEditorImpl = forwardRef<RichEditorRef, RichEditorCombinedProps>(
|
|
|
87
104
|
const frameRef = useRef<HTMLElement>(null);
|
|
88
105
|
const [editorState, setEditorState] = useState<EditorState>(defaultEditorState);
|
|
89
106
|
const [editorMode, setEditorMode] = useState<EditorMode>("richtext");
|
|
107
|
+
const [internalFullscreen, setInternalFullscreen] = useState(defaultFullscreen);
|
|
108
|
+
const [linkDialogOpen, setLinkDialogOpen] = useState(false);
|
|
109
|
+
|
|
110
|
+
const fullscreen = fullscreenProp ?? internalFullscreen;
|
|
90
111
|
|
|
91
112
|
const { knobProps } = useResolvedKnobs({
|
|
92
113
|
component: "RichEditor",
|
|
@@ -102,7 +123,94 @@ const RichEditorImpl = forwardRef<RichEditorRef, RichEditorCombinedProps>(
|
|
|
102
123
|
[onStateChange],
|
|
103
124
|
);
|
|
104
125
|
|
|
105
|
-
|
|
126
|
+
const handleFullscreenChange = useCallback(
|
|
127
|
+
(next: boolean) => {
|
|
128
|
+
setInternalFullscreen(next);
|
|
129
|
+
onFullscreenChange?.(next);
|
|
130
|
+
},
|
|
131
|
+
[onFullscreenChange],
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// Escape exits fullscreen -- but open menus/dialogs get Escape first:
|
|
135
|
+
// popover content is still mounted while it dismisses on the same
|
|
136
|
+
// keydown (React unmounts async), so the presence check skips this
|
|
137
|
+
// handler until the next Escape. The slash menu stops propagation when
|
|
138
|
+
// it consumes Escape, so it never reaches here. defaultPrevented is NOT
|
|
139
|
+
// a usable signal -- ProseMirror preventDefaults Escape unconditionally
|
|
140
|
+
// whenever focus is inside the editor.
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!fullscreen || typeof document === "undefined") return undefined;
|
|
143
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
144
|
+
if (event.key !== "Escape") return;
|
|
145
|
+
const openOverlay = Array.from(
|
|
146
|
+
document.querySelectorAll<HTMLElement>(
|
|
147
|
+
'[role="dialog"], [role="menu"], [role="listbox"]',
|
|
148
|
+
),
|
|
149
|
+
).some((el) => el.getClientRects().length > 0);
|
|
150
|
+
if (openOverlay) return;
|
|
151
|
+
handleFullscreenChange(false);
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
154
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
155
|
+
}, [fullscreen, handleFullscreenChange]);
|
|
156
|
+
|
|
157
|
+
// Lock page scroll while fullscreen and clear any drag-resize inline
|
|
158
|
+
// height (ResizeHandle writes style.height, which would beat inset 0)
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (!fullscreen || typeof document === "undefined") return undefined;
|
|
161
|
+
const frame = frameRef.current;
|
|
162
|
+
const prevHeight = frame?.style.height ?? "";
|
|
163
|
+
if (frame) frame.style.height = "";
|
|
164
|
+
const prevBodyOverflow = document.body.style.overflow;
|
|
165
|
+
const prevHtmlOverflow = document.documentElement.style.overflow;
|
|
166
|
+
// scrollbar-gutter: stable shrinks the initial containing block, which
|
|
167
|
+
// would leave a gutter-wide strip beside the fixed inset-0 frame
|
|
168
|
+
const prevGutter = document.documentElement.style.scrollbarGutter;
|
|
169
|
+
document.body.style.overflow = "hidden";
|
|
170
|
+
document.documentElement.style.overflow = "hidden";
|
|
171
|
+
document.documentElement.style.scrollbarGutter = "auto";
|
|
172
|
+
return () => {
|
|
173
|
+
document.body.style.overflow = prevBodyOverflow;
|
|
174
|
+
document.documentElement.style.overflow = prevHtmlOverflow;
|
|
175
|
+
document.documentElement.style.scrollbarGutter = prevGutter;
|
|
176
|
+
if (frame) frame.style.height = prevHeight;
|
|
177
|
+
};
|
|
178
|
+
}, [fullscreen]);
|
|
179
|
+
|
|
180
|
+
// Mod+K opens the link dialog (GitLab parity). Scoped to the editor
|
|
181
|
+
// frame so multiple editors on a page do not fight over the shortcut.
|
|
182
|
+
const showToolbarNow = showToolbar && editable && editorMode === "richtext";
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
const frame = frameRef.current;
|
|
185
|
+
if (!frame || !showToolbarNow || typeof document === "undefined") return undefined;
|
|
186
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
187
|
+
if (!(event.metaKey || event.ctrlKey)) return;
|
|
188
|
+
if (event.altKey || event.shiftKey) return;
|
|
189
|
+
if (event.key.toLowerCase() !== "k") return;
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
setLinkDialogOpen(true);
|
|
192
|
+
};
|
|
193
|
+
frame.addEventListener("keydown", handleKeyDown);
|
|
194
|
+
return () => frame.removeEventListener("keydown", handleKeyDown);
|
|
195
|
+
}, [showToolbarNow]);
|
|
196
|
+
|
|
197
|
+
// Delegate per call — a frozen `internalRef.current` snapshot would bind
|
|
198
|
+
// the first render's methods, where the Tiptap editor is still null
|
|
199
|
+
// (immediatelyRender: false), leaving every host-facing method a no-op.
|
|
200
|
+
useImperativeHandle(
|
|
201
|
+
ref,
|
|
202
|
+
() => ({
|
|
203
|
+
executeCommand: (command, payload) => internalRef.current?.executeCommand(command, payload),
|
|
204
|
+
getState: () => internalRef.current?.getState() ?? defaultEditorState,
|
|
205
|
+
getHTML: () => internalRef.current?.getHTML() ?? "",
|
|
206
|
+
getJSON: () => internalRef.current?.getJSON() ?? null,
|
|
207
|
+
setHTML: (html) => internalRef.current?.setHTML(html),
|
|
208
|
+
setJSON: (json) => internalRef.current?.setJSON(json),
|
|
209
|
+
focus: () => internalRef.current?.focus(),
|
|
210
|
+
blur: () => internalRef.current?.blur(),
|
|
211
|
+
}),
|
|
212
|
+
[],
|
|
213
|
+
);
|
|
106
214
|
|
|
107
215
|
const cappedRadius = clampRadiusForLargeComponent(knobProps.borderRadius.borderRadius, 4);
|
|
108
216
|
|
|
@@ -130,19 +238,24 @@ const RichEditorImpl = forwardRef<RichEditorRef, RichEditorCombinedProps>(
|
|
|
130
238
|
<EditorFrame
|
|
131
239
|
ref={frameRef as any}
|
|
132
240
|
hasError={hasError}
|
|
133
|
-
borderRadius={cappedRadius}
|
|
134
|
-
borderWidth={knobProps.borderRadius.borderWidth}
|
|
241
|
+
borderRadius={fullscreen ? 0 : cappedRadius}
|
|
242
|
+
borderWidth={fullscreen ? 0 : knobProps.borderRadius.borderWidth}
|
|
135
243
|
borderColor={hasError ? "$red10" : "$color6"}
|
|
136
|
-
backgroundColor={knobProps.inputBackground ?? "$color2"}
|
|
244
|
+
backgroundColor={fullscreen ? "$background" : (knobProps.inputBackground ?? "$color2")}
|
|
137
245
|
disabled={disabled}
|
|
138
|
-
position="relative"
|
|
246
|
+
position={fullscreen ? ("fixed" as any) : "relative"}
|
|
247
|
+
{...(fullscreen && { top: 0, left: 0, right: 0, bottom: 0, zIndex: 100000 })}
|
|
139
248
|
>
|
|
140
|
-
{
|
|
249
|
+
{showToolbarNow && (
|
|
141
250
|
<FixedToolbar
|
|
142
251
|
editorRef={internalRef}
|
|
143
252
|
state={editorState}
|
|
144
253
|
sections={sections}
|
|
145
254
|
hasError={hasError}
|
|
255
|
+
fullscreen={fullscreen}
|
|
256
|
+
onFullscreenToggle={() => handleFullscreenChange(!fullscreen)}
|
|
257
|
+
linkDialogOpen={linkDialogOpen}
|
|
258
|
+
onLinkDialogOpenChange={setLinkDialogOpen}
|
|
146
259
|
/>
|
|
147
260
|
)}
|
|
148
261
|
<TiptapEditor
|
|
@@ -155,11 +268,12 @@ const RichEditorImpl = forwardRef<RichEditorRef, RichEditorCombinedProps>(
|
|
|
155
268
|
bodyFontFamily={bodyFontFamily}
|
|
156
269
|
headingFontFamily={headingFontFamily}
|
|
157
270
|
editorMode={editorMode}
|
|
271
|
+
fullscreen={fullscreen}
|
|
158
272
|
/>
|
|
159
273
|
{showStatusBar && (
|
|
160
274
|
<StatusBar state={editorState} mode={editorMode} onModeChange={setEditorMode} />
|
|
161
275
|
)}
|
|
162
|
-
{resizable && !disabled && (
|
|
276
|
+
{resizable && !disabled && !fullscreen && (
|
|
163
277
|
<ResizeHandle
|
|
164
278
|
containerRef={frameRef as RefObject<HTMLElement>}
|
|
165
279
|
minHeight={editorProps.minHeight ?? 150}
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
type FieldComponentProps,
|
|
28
28
|
type Validator,
|
|
29
29
|
} from "@multiplatform.one/forms";
|
|
30
|
-
import type { ToolbarSection } from "../types";
|
|
31
|
-
import type { RichEditorRef } from "../types";
|
|
30
|
+
import type { RichEditorRef, RichTextMentionOptions, ToolbarSection } from "../types";
|
|
32
31
|
import { RichEditor } from "../RichEditor";
|
|
32
|
+
import { t } from "../shared/t";
|
|
33
33
|
|
|
34
34
|
// ---------------------------------------------------------------------------
|
|
35
35
|
// Custom empty check for rich text
|
|
@@ -86,6 +86,29 @@ export type RichTextEditorProps<
|
|
|
86
86
|
sections?: ToolbarSection[];
|
|
87
87
|
/** When true, renders a skeleton placeholder instead of the editor */
|
|
88
88
|
skeleton?: boolean;
|
|
89
|
+
/** Controlled fullscreen state (web; uncontrolled when omitted) */
|
|
90
|
+
fullscreen?: boolean;
|
|
91
|
+
/** Initial fullscreen state when uncontrolled (default: false) */
|
|
92
|
+
defaultFullscreen?: boolean;
|
|
93
|
+
/** Called when the fullscreen state changes */
|
|
94
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Native only: render the embedded inline editor instead of the
|
|
97
|
+
* preview + fullscreen edit modal (ignored on web)
|
|
98
|
+
*/
|
|
99
|
+
inlineEditing?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Uploads a pasted/dropped image and resolves its URL (web). Without it,
|
|
102
|
+
* images are inlined as base64 data URIs.
|
|
103
|
+
*/
|
|
104
|
+
onImageUpload?: (file: File) => Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Uploads a pasted/dropped non-image file and resolves its URL (web).
|
|
107
|
+
* Inserts an attachment chip link; without it, non-image files are ignored.
|
|
108
|
+
*/
|
|
109
|
+
onFileUpload?: (file: File) => Promise<{ url: string; name?: string }>;
|
|
110
|
+
/** Enables the @ mention suggestion popup (web) */
|
|
111
|
+
mentions?: RichTextMentionOptions;
|
|
89
112
|
};
|
|
90
113
|
|
|
91
114
|
// ---------------------------------------------------------------------------
|
|
@@ -102,7 +125,7 @@ export function RichTextEditor<
|
|
|
102
125
|
const {
|
|
103
126
|
defaultValue = "",
|
|
104
127
|
form,
|
|
105
|
-
placeholder
|
|
128
|
+
placeholder: placeholderProp,
|
|
106
129
|
disabled,
|
|
107
130
|
readOnly,
|
|
108
131
|
minHeight = 150,
|
|
@@ -125,9 +148,17 @@ export function RichTextEditor<
|
|
|
125
148
|
showBubbleToolbar = false,
|
|
126
149
|
sections,
|
|
127
150
|
skeleton,
|
|
151
|
+
fullscreen,
|
|
152
|
+
defaultFullscreen,
|
|
153
|
+
onFullscreenChange,
|
|
154
|
+
inlineEditing,
|
|
155
|
+
onImageUpload,
|
|
156
|
+
onFileUpload,
|
|
157
|
+
mentions,
|
|
128
158
|
..._restProps
|
|
129
159
|
} = props;
|
|
130
160
|
|
|
161
|
+
const placeholder = placeholderProp ?? t("Write something...");
|
|
131
162
|
const { resolvedForm, knobProps, id } = useFormField({ form });
|
|
132
163
|
const resolvedValidators = useResolvedValidators(
|
|
133
164
|
required,
|
|
@@ -182,6 +213,13 @@ export function RichTextEditor<
|
|
|
182
213
|
hasError={hasError}
|
|
183
214
|
size={size}
|
|
184
215
|
compact={compact}
|
|
216
|
+
fullscreen={fullscreen}
|
|
217
|
+
defaultFullscreen={defaultFullscreen}
|
|
218
|
+
onFullscreenChange={onFullscreenChange}
|
|
219
|
+
inlineEditing={inlineEditing}
|
|
220
|
+
onImageUpload={onImageUpload}
|
|
221
|
+
onFileUpload={onFileUpload}
|
|
222
|
+
mentions={mentions}
|
|
185
223
|
/>
|
|
186
224
|
);
|
|
187
225
|
};
|
|
@@ -4,8 +4,9 @@ import { describe, it, expect, vi } from "vitest";
|
|
|
4
4
|
// Mocks -- must come before imports
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
|
|
7
|
-
vi.mock("@multiplatform.one/forms", () => {
|
|
7
|
+
vi.mock("@multiplatform.one/forms", async (importOriginal) => {
|
|
8
8
|
return {
|
|
9
|
+
...(await importOriginal<Record<string, unknown>>()),
|
|
9
10
|
Field: ({ children, ...props }: any) => {
|
|
10
11
|
const field = {
|
|
11
12
|
state: { value: props.defaultValue ?? "", meta: { errors: [] } },
|
|
@@ -57,7 +58,7 @@ vi.mock("@multiplatform.one/forms", () => {
|
|
|
57
58
|
isEmpty?: (v: unknown) => boolean,
|
|
58
59
|
) => {
|
|
59
60
|
if (!required) return validators;
|
|
60
|
-
const check = isEmpty || ((v: unknown) => v
|
|
61
|
+
const check = isEmpty || ((v: unknown) => v === null || v === undefined || v === "");
|
|
61
62
|
const requiredValidator = ({ value }: { value: unknown }) =>
|
|
62
63
|
check(value)
|
|
63
64
|
? `${typeof label === "string" ? label : name || "Field"} is required`
|
|
@@ -84,11 +85,13 @@ vi.mock("@multiplatform.one/forms", () => {
|
|
|
84
85
|
};
|
|
85
86
|
});
|
|
86
87
|
|
|
87
|
-
vi.mock("@multiplatform.one/components", () => ({
|
|
88
|
+
vi.mock("@multiplatform.one/components", async (importOriginal) => ({
|
|
89
|
+
...(await importOriginal<Record<string, unknown>>()),
|
|
88
90
|
Tooltip: ({ children }: any) => children,
|
|
89
91
|
}));
|
|
90
92
|
|
|
91
|
-
vi.mock("@multiplatform.one/theme", () => ({
|
|
93
|
+
vi.mock("@multiplatform.one/theme", async (importOriginal) => ({
|
|
94
|
+
...(await importOriginal<Record<string, unknown>>()),
|
|
92
95
|
useResolvedKnobs: () => ({
|
|
93
96
|
knobProps: {
|
|
94
97
|
body: {},
|
|
@@ -132,6 +135,10 @@ const mockEditor = {
|
|
|
132
135
|
blur: vi.fn(),
|
|
133
136
|
},
|
|
134
137
|
setEditable: vi.fn(),
|
|
138
|
+
storage: {
|
|
139
|
+
mediaUpload: { handlers: {} },
|
|
140
|
+
suggestionChrome: { value: null },
|
|
141
|
+
},
|
|
135
142
|
};
|
|
136
143
|
|
|
137
144
|
vi.mock("@tiptap/react", () => ({
|
package/src/constants.ts
CHANGED
|
@@ -5,40 +5,102 @@
|
|
|
5
5
|
import type { NativeCapability } from "./types";
|
|
6
6
|
|
|
7
7
|
// ===========================================================================
|
|
8
|
-
// Color Palettes
|
|
8
|
+
// Color Palettes (Axiom 5 ONE SOURCE: theme ramp tokens, never fixed hexes)
|
|
9
9
|
// ===========================================================================
|
|
10
10
|
|
|
11
11
|
export interface ColorEntry {
|
|
12
12
|
/** Display name for the color */
|
|
13
13
|
name: string;
|
|
14
|
-
/**
|
|
14
|
+
/** CSS color value (theme custom property on web), or null for default/none */
|
|
15
15
|
value: string | null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
/** A palette entry backed by a theme token instead of a literal color */
|
|
19
|
+
export interface ColorTokenEntry {
|
|
20
|
+
/** Display name for the color */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Theme token key (e.g. "red11"), or null for default/none */
|
|
23
|
+
token: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Hue swatches ride the radix step-11 text ramps: legible (>=4.5:1) on the
|
|
28
|
+
* step-1/2 editor surface in BOTH schemes, so the same token list serves
|
|
29
|
+
* light and dark. `color12` is the house strong ink (near-black in light,
|
|
30
|
+
* near-white in dark).
|
|
31
|
+
*/
|
|
32
|
+
const TEXT_COLOR_HUES: ColorTokenEntry[] = [
|
|
33
|
+
{ name: "Gray", token: "gray11" },
|
|
34
|
+
{ name: "Red", token: "red11" },
|
|
35
|
+
{ name: "Orange", token: "orange11" },
|
|
36
|
+
{ name: "Yellow", token: "yellow11" },
|
|
37
|
+
{ name: "Green", token: "green11" },
|
|
38
|
+
{ name: "Blue", token: "blue11" },
|
|
39
|
+
{ name: "Purple", token: "purple11" },
|
|
40
|
+
{ name: "Pink", token: "pink11" },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export const TEXT_COLOR_TOKENS: ColorTokenEntry[] = [
|
|
44
|
+
{ name: "Default", token: null },
|
|
45
|
+
// color12 resolves near-black in light schemes; the label states what renders
|
|
46
|
+
{ name: "Black", token: "color12" },
|
|
47
|
+
...TEXT_COLOR_HUES,
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Dark-scheme display names for the same tokens: the values are identical
|
|
52
|
+
* (theme vars re-resolve per scheme) — only the neutral ink's honest label
|
|
53
|
+
* flips (color12 renders near-white in dark).
|
|
54
|
+
*/
|
|
55
|
+
export const TEXT_COLOR_TOKENS_DARK: ColorTokenEntry[] = [
|
|
56
|
+
{ name: "Default", token: null },
|
|
57
|
+
{ name: "White", token: "color12" },
|
|
58
|
+
...TEXT_COLOR_HUES,
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Highlight washes ride the radix step-5 component backgrounds: pastel in
|
|
63
|
+
* light, deep-dim in dark — the scheme's own ink (color12, inherited by the
|
|
64
|
+
* mark) stays legible on them in both schemes.
|
|
65
|
+
*/
|
|
66
|
+
export const HIGHLIGHT_COLOR_TOKENS: ColorTokenEntry[] = [
|
|
67
|
+
{ name: "None", token: null },
|
|
68
|
+
{ name: "Yellow", token: "yellow5" },
|
|
69
|
+
{ name: "Green", token: "green5" },
|
|
70
|
+
{ name: "Blue", token: "blue5" },
|
|
71
|
+
{ name: "Pink", token: "pink5" },
|
|
72
|
+
{ name: "Purple", token: "purple5" },
|
|
73
|
+
{ name: "Orange", token: "orange5" },
|
|
74
|
+
{ name: "Red", token: "red5" },
|
|
75
|
+
{ name: "Cyan", token: "cyan5" },
|
|
30
76
|
];
|
|
31
77
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Web palette values are CSS custom properties: applied color marks re-resolve
|
|
80
|
+
* live from the ambient theme, so content authored in one scheme stays legible
|
|
81
|
+
* when the scheme flips. Native pickers resolve the same tokens via useTheme()
|
|
82
|
+
* (see ColorPicker.native), and TentapEditor injects the resolved vars into
|
|
83
|
+
* the 10Tap webview so cross-authored content renders there too.
|
|
84
|
+
*/
|
|
85
|
+
const toCssVarEntry = ({ name, token }: ColorTokenEntry): ColorEntry => ({
|
|
86
|
+
name,
|
|
87
|
+
value: token ? `var(--${token})` : null,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const TEXT_COLORS: ColorEntry[] = TEXT_COLOR_TOKENS.map(toCssVarEntry);
|
|
91
|
+
export const TEXT_COLORS_DARK: ColorEntry[] = TEXT_COLOR_TOKENS_DARK.map(toCssVarEntry);
|
|
92
|
+
export const HIGHLIGHT_COLORS: ColorEntry[] = HIGHLIGHT_COLOR_TOKENS.map(toCssVarEntry);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Every theme token the palettes reference — the single list used to inject
|
|
96
|
+
* resolved CSS custom properties into the native 10Tap webview.
|
|
97
|
+
*/
|
|
98
|
+
export const PALETTE_THEME_TOKENS: string[] = [
|
|
99
|
+
...new Set(
|
|
100
|
+
[...TEXT_COLOR_TOKENS, ...HIGHLIGHT_COLOR_TOKENS]
|
|
101
|
+
.map((entry) => entry.token)
|
|
102
|
+
.filter((token): token is string => token !== null),
|
|
103
|
+
),
|
|
42
104
|
];
|
|
43
105
|
|
|
44
106
|
// ===========================================================================
|
|
@@ -8,13 +8,38 @@ import { Extension } from "@tiptap/core";
|
|
|
8
8
|
import { Plugin, PluginKey, NodeSelection } from "@tiptap/pm/state";
|
|
9
9
|
|
|
10
10
|
const HANDLE_WIDTH = 20;
|
|
11
|
-
const
|
|
11
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
12
|
+
const GRIP_DOTS: Array<[number, number]> = [
|
|
13
|
+
[4, 3],
|
|
14
|
+
[10, 3],
|
|
15
|
+
[4, 7],
|
|
16
|
+
[10, 7],
|
|
17
|
+
[4, 11],
|
|
18
|
+
[10, 11],
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function createGripIcon(): SVGSVGElement {
|
|
22
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
23
|
+
svg.setAttribute("width", "14");
|
|
24
|
+
svg.setAttribute("height", "14");
|
|
25
|
+
svg.setAttribute("viewBox", "0 0 14 14");
|
|
26
|
+
svg.setAttribute("fill", "currentColor");
|
|
27
|
+
svg.setAttribute("opacity", "0.35");
|
|
28
|
+
for (const [cx, cy] of GRIP_DOTS) {
|
|
29
|
+
const circle = document.createElementNS(SVG_NS, "circle");
|
|
30
|
+
circle.setAttribute("cx", String(cx));
|
|
31
|
+
circle.setAttribute("cy", String(cy));
|
|
32
|
+
circle.setAttribute("r", "1.2");
|
|
33
|
+
svg.appendChild(circle);
|
|
34
|
+
}
|
|
35
|
+
return svg;
|
|
36
|
+
}
|
|
12
37
|
|
|
13
38
|
function createHandleElement(): HTMLDivElement {
|
|
14
39
|
const el = document.createElement("div");
|
|
15
40
|
el.className = "block-drag-handle";
|
|
16
41
|
el.draggable = true;
|
|
17
|
-
el.
|
|
42
|
+
el.appendChild(createGripIcon());
|
|
18
43
|
Object.assign(el.style, {
|
|
19
44
|
position: "absolute",
|
|
20
45
|
width: `${HANDLE_WIDTH}px`,
|
|
@@ -25,7 +50,8 @@ function createHandleElement(): HTMLDivElement {
|
|
|
25
50
|
cursor: "grab",
|
|
26
51
|
borderRadius: "4px",
|
|
27
52
|
opacity: "0",
|
|
28
|
-
|
|
53
|
+
// decorative fade lives in editorStyles CSS, driven by the motion knob
|
|
54
|
+
// (animation none silences it); direct drag stays instant either way
|
|
29
55
|
zIndex: "10",
|
|
30
56
|
userSelect: "none",
|
|
31
57
|
});
|
|
@@ -36,7 +62,6 @@ export const BlockDragHandle = Extension.create({
|
|
|
36
62
|
name: "blockDragHandle",
|
|
37
63
|
|
|
38
64
|
addProseMirrorPlugins() {
|
|
39
|
-
const { editor } = this;
|
|
40
65
|
let handle: HTMLDivElement | null = null;
|
|
41
66
|
let currentBlockPos: number | null = null;
|
|
42
67
|
|
|
@@ -104,7 +129,7 @@ export const BlockDragHandle = Extension.create({
|
|
|
104
129
|
};
|
|
105
130
|
|
|
106
131
|
const onDragStart = (event: DragEvent) => {
|
|
107
|
-
if (currentBlockPos
|
|
132
|
+
if (currentBlockPos === null) return;
|
|
108
133
|
const node = editorView.state.doc.nodeAt(currentBlockPos);
|
|
109
134
|
if (!node) return;
|
|
110
135
|
|