@multiplatform.one/rich-text 6.1.0 → 6.4.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 +89 -9
- package/dist/cjs/RichEditor.native.js +444 -35
- package/dist/cjs/RichEditor.native.js.map +1 -1
- package/dist/cjs/RichTextEditor/index.cjs +20 -2
- package/dist/cjs/RichTextEditor/index.native.js +20 -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 +257 -294
- package/dist/cjs/editor/SlashCommands.native.js +320 -341
- package/dist/cjs/editor/SlashCommands.native.js.map +1 -1
- package/dist/cjs/editor/TentapEditor.native.js +59 -12
- package/dist/cjs/editor/TentapEditor.native.js.map +1 -1
- package/dist/cjs/editor/TiptapEditor.cjs +143 -240
- package/dist/cjs/editor/TiptapEditor.native.js +163 -289
- 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/capabilities.cjs +37 -0
- package/dist/cjs/editor/capabilities.native.js +41 -0
- package/dist/cjs/editor/capabilities.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/extensions.cjs +275 -0
- package/dist/cjs/editor/extensions.native.js +328 -0
- package/dist/cjs/editor/extensions.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/index.cjs +5 -2
- package/dist/cjs/index.native.js +4 -1
- package/dist/cjs/index.native.js.map +1 -1
- 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 +19 -14
- package/dist/cjs/toolbar/BubbleToolbar.native.js +22 -15
- 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 +39 -13
- 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 +54 -93
- package/dist/cjs/toolbar/MoreDropdown.native.js +80 -93
- 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 +91 -96
- package/dist/cjs/toolbar/TableBubble.native.js +90 -73
- 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 +90 -10
- package/dist/esm/RichEditor.mjs.map +1 -1
- package/dist/esm/RichEditor.native.js +447 -38
- package/dist/esm/RichEditor.native.js.map +1 -1
- package/dist/esm/RichTextEditor/index.mjs +20 -2
- package/dist/esm/RichTextEditor/index.mjs.map +1 -1
- package/dist/esm/RichTextEditor/index.native.js +20 -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 +258 -295
- package/dist/esm/editor/SlashCommands.mjs.map +1 -1
- package/dist/esm/editor/SlashCommands.native.js +321 -342
- package/dist/esm/editor/SlashCommands.native.js.map +1 -1
- package/dist/esm/editor/TentapEditor.native.js +60 -13
- package/dist/esm/editor/TentapEditor.native.js.map +1 -1
- package/dist/esm/editor/TiptapEditor.mjs +145 -231
- package/dist/esm/editor/TiptapEditor.mjs.map +1 -1
- package/dist/esm/editor/TiptapEditor.native.js +165 -280
- 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/capabilities.mjs +10 -0
- package/dist/esm/editor/capabilities.mjs.map +1 -0
- package/dist/esm/editor/capabilities.native.js +11 -0
- package/dist/esm/editor/capabilities.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/extensions.mjs +236 -0
- package/dist/esm/editor/extensions.mjs.map +1 -0
- package/dist/esm/editor/extensions.native.js +286 -0
- package/dist/esm/editor/extensions.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/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -1
- package/dist/esm/index.native.js.map +1 -1
- 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 +20 -15
- package/dist/esm/toolbar/BubbleToolbar.mjs.map +1 -1
- package/dist/esm/toolbar/BubbleToolbar.native.js +23 -16
- 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 +40 -14
- 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 +53 -92
- package/dist/esm/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/esm/toolbar/MoreDropdown.native.js +79 -92
- 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 +91 -96
- package/dist/esm/toolbar/TableBubble.mjs.map +1 -1
- package/dist/esm/toolbar/TableBubble.native.js +90 -73
- 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 +90 -10
- package/dist/jsx/RichEditor.mjs.map +1 -1
- package/dist/jsx/RichEditor.native.js +444 -35
- package/dist/jsx/RichEditor.native.js.map +1 -1
- package/dist/jsx/RichTextEditor/index.mjs +20 -2
- package/dist/jsx/RichTextEditor/index.mjs.map +1 -1
- package/dist/jsx/RichTextEditor/index.native.js +20 -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 +258 -295
- package/dist/jsx/editor/SlashCommands.mjs.map +1 -1
- package/dist/jsx/editor/SlashCommands.native.js +320 -341
- package/dist/jsx/editor/SlashCommands.native.js.map +1 -1
- package/dist/jsx/editor/TentapEditor.native.js +59 -12
- package/dist/jsx/editor/TentapEditor.native.js.map +1 -1
- package/dist/jsx/editor/TiptapEditor.mjs +145 -231
- package/dist/jsx/editor/TiptapEditor.mjs.map +1 -1
- package/dist/jsx/editor/TiptapEditor.native.js +163 -289
- 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/capabilities.mjs +10 -0
- package/dist/jsx/editor/capabilities.mjs.map +1 -0
- package/dist/jsx/editor/capabilities.native.js +41 -0
- package/dist/jsx/editor/capabilities.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/extensions.mjs +236 -0
- package/dist/jsx/editor/extensions.mjs.map +1 -0
- package/dist/jsx/editor/extensions.native.js +328 -0
- package/dist/jsx/editor/extensions.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/index.js +2 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +4 -1
- package/dist/jsx/index.native.js.map +1 -1
- 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 +20 -15
- package/dist/jsx/toolbar/BubbleToolbar.mjs.map +1 -1
- package/dist/jsx/toolbar/BubbleToolbar.native.js +22 -15
- 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 +40 -14
- 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 +53 -92
- package/dist/jsx/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/jsx/toolbar/MoreDropdown.native.js +80 -93
- 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 +91 -96
- package/dist/jsx/toolbar/TableBubble.mjs.map +1 -1
- package/dist/jsx/toolbar/TableBubble.native.js +90 -73
- 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 +471 -49
- package/src/RichEditor.stories.tsx +190 -0
- package/src/RichEditor.tsx +126 -7
- package/src/RichTextEditor/index.tsx +54 -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 +238 -293
- package/src/editor/TentapEditor.native.tsx +81 -17
- package/src/editor/TiptapEditor.tsx +202 -265
- package/src/editor/blockAnchor.spec.ts +70 -0
- package/src/editor/blockAnchor.ts +42 -0
- package/src/editor/capabilities.spec.ts +190 -0
- package/src/editor/capabilities.ts +76 -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/extensions.ts +315 -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 +10 -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 +48 -33
- 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 +73 -21
- 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 +79 -62
- package/src/toolbar/StatusBar.tsx +13 -8
- package/src/toolbar/TableBubble.tsx +136 -95
- 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 +56 -1
- 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 +77 -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/capabilities.d.ts +29 -0
- package/types/editor/capabilities.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/extensions.d.ts +41 -0
- package/types/editor/extensions.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 +12 -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 +25 -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 +34 -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 +15 -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 +13 -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 +147 -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
|
@@ -5,7 +5,8 @@ import { defaultEditorState } from "../types";
|
|
|
5
5
|
import { TEXT_COLORS, HIGHLIGHT_COLORS } from "../constants";
|
|
6
6
|
import { normalizeUrl } from "./LinkDialog";
|
|
7
7
|
|
|
8
|
-
vi.mock("@multiplatform.one/forms", () => ({
|
|
8
|
+
vi.mock("@multiplatform.one/forms", async (importOriginal) => ({
|
|
9
|
+
...(await importOriginal<Record<string, unknown>>()),
|
|
9
10
|
Button: (props: any) => (
|
|
10
11
|
<button
|
|
11
12
|
role="button"
|
|
@@ -18,7 +19,8 @@ vi.mock("@multiplatform.one/forms", () => ({
|
|
|
18
19
|
),
|
|
19
20
|
}));
|
|
20
21
|
|
|
21
|
-
vi.mock("@multiplatform.one/components", () => ({
|
|
22
|
+
vi.mock("@multiplatform.one/components", async (importOriginal) => ({
|
|
23
|
+
...(await importOriginal<Record<string, unknown>>()),
|
|
22
24
|
Tooltip: ({ children }: any) => children,
|
|
23
25
|
}));
|
|
24
26
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollArrow direction math (rtl-audit U1-class residual): CSSOM flips the
|
|
3
|
+
* scrollLeft range under RTL (0 → −(scrollWidth − clientWidth)), so the raw
|
|
4
|
+
* LTR reading inverted both arrow visibility and the remaining-distance
|
|
5
|
+
* clamp. `horizontalScrollEdges` is the direction-normalized primitive both
|
|
6
|
+
* the visibility hook and the hover-scroll loop consume.
|
|
7
|
+
*/
|
|
8
|
+
import { describe, expect, it, vi } from "vitest";
|
|
9
|
+
|
|
10
|
+
// The module under test imports useDirection (house RTL pattern); the pure
|
|
11
|
+
// edge math is exercised with explicit directions (same wholesale-mock
|
|
12
|
+
// precedent as toolbarPrimitives.spec).
|
|
13
|
+
vi.mock("@multiplatform.one/components", () => ({
|
|
14
|
+
useDirection: () => "ltr",
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const { horizontalScrollEdges } = await import("./useHorizontalScroll");
|
|
18
|
+
|
|
19
|
+
const scroller = (scrollLeft: number) => ({ scrollLeft, scrollWidth: 500, clientWidth: 300 });
|
|
20
|
+
|
|
21
|
+
describe("horizontalScrollEdges", () => {
|
|
22
|
+
it("LTR: scrollLeft is the distance from the left edge", () => {
|
|
23
|
+
expect(horizontalScrollEdges(scroller(0), "ltr")).toEqual({
|
|
24
|
+
fromLeftEdge: 0,
|
|
25
|
+
fromRightEdge: 200,
|
|
26
|
+
});
|
|
27
|
+
expect(horizontalScrollEdges(scroller(120), "ltr")).toEqual({
|
|
28
|
+
fromLeftEdge: 120,
|
|
29
|
+
fromRightEdge: 80,
|
|
30
|
+
});
|
|
31
|
+
expect(horizontalScrollEdges(scroller(200), "ltr")).toEqual({
|
|
32
|
+
fromLeftEdge: 200,
|
|
33
|
+
fromRightEdge: 0,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("RTL: scrollLeft runs 0 → −range, distances normalize per edge", () => {
|
|
38
|
+
// Start position (flush right): everything overflows to the LEFT.
|
|
39
|
+
expect(horizontalScrollEdges(scroller(0), "rtl")).toEqual({
|
|
40
|
+
fromLeftEdge: 200,
|
|
41
|
+
fromRightEdge: 0,
|
|
42
|
+
});
|
|
43
|
+
expect(horizontalScrollEdges(scroller(-120), "rtl")).toEqual({
|
|
44
|
+
fromLeftEdge: 80,
|
|
45
|
+
fromRightEdge: 120,
|
|
46
|
+
});
|
|
47
|
+
// Fully scrolled (flush left): nothing further left, all content right.
|
|
48
|
+
expect(horizontalScrollEdges(scroller(-200), "rtl")).toEqual({
|
|
49
|
+
fromLeftEdge: 0,
|
|
50
|
+
fromRightEdge: 200,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("no overflow: both distances collapse to zero in both directions", () => {
|
|
55
|
+
const flat = { scrollLeft: 0, scrollWidth: 300, clientWidth: 300 };
|
|
56
|
+
expect(horizontalScrollEdges(flat, "ltr")).toEqual({ fromLeftEdge: 0, fromRightEdge: 0 });
|
|
57
|
+
expect(horizontalScrollEdges(flat, "rtl")).toEqual({ fromLeftEdge: 0, fromRightEdge: 0 });
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("pre-fix regression: raw scrollLeft sign misreads RTL edges", () => {
|
|
61
|
+
// The old visibility math (scrollLeft > threshold) at the RTL start
|
|
62
|
+
// position read 0 → no left arrow, while 200px actually overflowed left.
|
|
63
|
+
const atRtlStart = horizontalScrollEdges(scroller(0), "rtl");
|
|
64
|
+
expect(atRtlStart.fromLeftEdge).toBeGreaterThan(8);
|
|
65
|
+
expect(atRtlStart.fromRightEdge).toBeLessThanOrEqual(8);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -8,9 +8,31 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
8
8
|
import { View } from "tamagui";
|
|
9
9
|
import { LinearGradient } from "@tamagui/linear-gradient";
|
|
10
10
|
import { CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";
|
|
11
|
+
import { useDirection } from "@multiplatform.one/components";
|
|
11
12
|
|
|
12
13
|
const scrollArrowThreshold = 8;
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Physical px distances from each horizontal scroll edge. The arrows are
|
|
17
|
+
* physically-anchored edge overlays (left:0 / right:0), but CSSOM flips the
|
|
18
|
+
* `scrollLeft` range under RTL: an RTL scroller runs 0 → −(scrollWidth −
|
|
19
|
+
* clientWidth), so the LTR reading (`scrollLeft` = distance from the left
|
|
20
|
+
* edge) inverts and both arrow visibility and the remaining-distance clamp
|
|
21
|
+
* break. Normalize per `useDirection()` (house RTL pattern) instead of
|
|
22
|
+
* reading the raw sign.
|
|
23
|
+
*/
|
|
24
|
+
export function horizontalScrollEdges(
|
|
25
|
+
element: Pick<HTMLElement, "scrollLeft" | "scrollWidth" | "clientWidth">,
|
|
26
|
+
direction: "ltr" | "rtl",
|
|
27
|
+
): { fromLeftEdge: number; fromRightEdge: number } {
|
|
28
|
+
const range = Math.max(element.scrollWidth - element.clientWidth, 0);
|
|
29
|
+
const minScrollLeft = direction === "rtl" ? -range : 0;
|
|
30
|
+
return {
|
|
31
|
+
fromLeftEdge: element.scrollLeft - minScrollLeft,
|
|
32
|
+
fromRightEdge: minScrollLeft + range - element.scrollLeft,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
14
36
|
// ===========================================================================
|
|
15
37
|
// useHorizontalScroll
|
|
16
38
|
// ===========================================================================
|
|
@@ -98,17 +120,21 @@ export function useHorizontalScroll(ref: React.RefObject<HTMLDivElement | null>)
|
|
|
98
120
|
* Hook to track horizontal scroll arrows visibility
|
|
99
121
|
*/
|
|
100
122
|
export function useHorizontalScrollArrows() {
|
|
123
|
+
const direction = useDirection();
|
|
101
124
|
const [arrowLeft, setArrowLeft] = useState(false);
|
|
102
125
|
const [arrowRight, setArrowRight] = useState(false);
|
|
103
126
|
const arrowScrollDirRef = useRef<"left" | "right" | null>(null);
|
|
104
127
|
|
|
105
|
-
const updateArrows = useCallback(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
const updateArrows = useCallback(
|
|
129
|
+
(element: HTMLElement) => {
|
|
130
|
+
const { fromLeftEdge, fromRightEdge } = horizontalScrollEdges(element, direction);
|
|
131
|
+
const left = fromLeftEdge > scrollArrowThreshold;
|
|
132
|
+
const right = fromRightEdge > scrollArrowThreshold;
|
|
133
|
+
setArrowLeft((prev) => (prev !== left ? left : prev));
|
|
134
|
+
setArrowRight((prev) => (prev !== right ? right : prev));
|
|
135
|
+
},
|
|
136
|
+
[direction],
|
|
137
|
+
);
|
|
112
138
|
|
|
113
139
|
return { arrowLeft, arrowRight, arrowScrollDirRef, updateArrows };
|
|
114
140
|
}
|
|
@@ -136,6 +162,7 @@ export function HorizontalScrollArrow({
|
|
|
136
162
|
transition,
|
|
137
163
|
}: HorizontalScrollArrowProps) {
|
|
138
164
|
const isLeft = direction === "left";
|
|
165
|
+
const textDirection = useDirection();
|
|
139
166
|
const animationFrameRef = useRef(0);
|
|
140
167
|
const lastTimeRef = useRef(0);
|
|
141
168
|
const resumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
@@ -163,10 +190,10 @@ export function HorizontalScrollArrow({
|
|
|
163
190
|
const now = performance.now();
|
|
164
191
|
const elapsed = now - lastTimeRef.current;
|
|
165
192
|
lastTimeRef.current = now;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
193
|
+
// Remaining distance to this arrow's physical edge (RTL-normalized);
|
|
194
|
+
// the step itself stays physical: scrollLeft always decreases leftward.
|
|
195
|
+
const { fromLeftEdge, fromRightEdge } = horizontalScrollEdges(el, textDirection);
|
|
196
|
+
const px = Math.min(elapsed / 2, Math.max(isLeft ? fromLeftEdge : fromRightEdge, 0));
|
|
170
197
|
if (px > 0) {
|
|
171
198
|
selfScrollingRef.current = true;
|
|
172
199
|
arrowScrollDirRef.current = isLeft ? "left" : "right";
|
|
@@ -175,7 +202,7 @@ export function HorizontalScrollArrow({
|
|
|
175
202
|
animationFrameRef.current = requestAnimationFrame(tick);
|
|
176
203
|
};
|
|
177
204
|
animationFrameRef.current = requestAnimationFrame(tick);
|
|
178
|
-
}, [isLeft, scrollRef, arrowScrollDirRef]);
|
|
205
|
+
}, [isLeft, scrollRef, arrowScrollDirRef, textDirection]);
|
|
179
206
|
|
|
180
207
|
const openTimestampRef = useRef(0);
|
|
181
208
|
useEffect(() => {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { fireEvent, render } from "@testing-library/react";
|
|
4
|
+
import { useRovingFocus } from "./useRovingFocus";
|
|
5
|
+
|
|
6
|
+
function Toolbar({ disabledSecond = false }: { disabledSecond?: boolean }) {
|
|
7
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
8
|
+
useRovingFocus(ref);
|
|
9
|
+
return (
|
|
10
|
+
<div ref={ref} role="toolbar" aria-label="Test toolbar">
|
|
11
|
+
<button type="button">one</button>
|
|
12
|
+
<button type="button" disabled={disabledSecond}>
|
|
13
|
+
two
|
|
14
|
+
</button>
|
|
15
|
+
<button type="button">three</button>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Tamagui Buttons render as <div role="button">, not <button> */
|
|
21
|
+
function DivToolbar() {
|
|
22
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
23
|
+
useRovingFocus(ref);
|
|
24
|
+
return (
|
|
25
|
+
<div ref={ref} role="toolbar" aria-label="Div toolbar">
|
|
26
|
+
<div role="button" tabIndex={0}>
|
|
27
|
+
bold
|
|
28
|
+
</div>
|
|
29
|
+
<div role="button" tabIndex={0}>
|
|
30
|
+
italic
|
|
31
|
+
</div>
|
|
32
|
+
<div role="button" tabIndex={0} aria-disabled="true">
|
|
33
|
+
redo
|
|
34
|
+
</div>
|
|
35
|
+
<div role="button" tabIndex={0}>
|
|
36
|
+
undo
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
describe("useRovingFocus", () => {
|
|
43
|
+
it("handles div[role=button] controls (Tamagui Button shape)", () => {
|
|
44
|
+
const { getAllByRole, getByRole } = render(<DivToolbar />);
|
|
45
|
+
const buttons = getAllByRole("button");
|
|
46
|
+
// aria-disabled control is excluded from the roving order entirely
|
|
47
|
+
expect(buttons.map((b) => b.tabIndex)).toEqual([0, -1, 0, -1]);
|
|
48
|
+
buttons[0]!.focus();
|
|
49
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
50
|
+
expect(document.activeElement).toBe(buttons[1]);
|
|
51
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
52
|
+
// skips the aria-disabled control
|
|
53
|
+
expect(document.activeElement).toBe(buttons[3]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("makes the toolbar a single tab stop (first button 0, rest -1)", () => {
|
|
57
|
+
const { getAllByRole } = render(<Toolbar />);
|
|
58
|
+
const buttons = getAllByRole("button");
|
|
59
|
+
expect(buttons.map((b) => b.tabIndex)).toEqual([0, -1, -1]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("moves focus with ArrowRight and wraps", () => {
|
|
63
|
+
const { getAllByRole, getByRole } = render(<Toolbar />);
|
|
64
|
+
const [first, second, third] = getAllByRole("button");
|
|
65
|
+
first!.focus();
|
|
66
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
67
|
+
expect(document.activeElement).toBe(second);
|
|
68
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
69
|
+
expect(document.activeElement).toBe(third);
|
|
70
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
71
|
+
expect(document.activeElement).toBe(first);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("moves focus with ArrowLeft (reverse) and Home/End", () => {
|
|
75
|
+
const { getAllByRole, getByRole } = render(<Toolbar />);
|
|
76
|
+
const [first, _second, third] = getAllByRole("button");
|
|
77
|
+
first!.focus();
|
|
78
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowLeft" });
|
|
79
|
+
expect(document.activeElement).toBe(third);
|
|
80
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "Home" });
|
|
81
|
+
expect(document.activeElement).toBe(first);
|
|
82
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "End" });
|
|
83
|
+
expect(document.activeElement).toBe(third);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("skips disabled controls", () => {
|
|
87
|
+
const { getAllByRole, getByRole } = render(<Toolbar disabledSecond />);
|
|
88
|
+
const [first, _second, third] = getAllByRole("button");
|
|
89
|
+
first!.focus();
|
|
90
|
+
fireEvent.keyDown(getByRole("toolbar"), { key: "ArrowRight" });
|
|
91
|
+
expect(document.activeElement).toBe(third);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("updates the tab stop when focus lands on a control", () => {
|
|
95
|
+
const { getAllByRole } = render(<Toolbar />);
|
|
96
|
+
const buttons = getAllByRole("button");
|
|
97
|
+
fireEvent.focusIn(buttons[2]!);
|
|
98
|
+
expect(buttons.map((b) => b.tabIndex)).toEqual([-1, -1, 0]);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roving tabindex for the toolbar (WAI-ARIA toolbar pattern).
|
|
3
|
+
*
|
|
4
|
+
* The toolbar is ONE tab stop: Tab enters at the last-active control and
|
|
5
|
+
* leaves on the next Tab; ArrowLeft/ArrowRight (direction-aware for RTL),
|
|
6
|
+
* Home, and End move between enabled controls.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useEffect } from "react";
|
|
10
|
+
import type { RefObject } from "react";
|
|
11
|
+
|
|
12
|
+
// Tamagui Buttons render as <div role="button">, so match by role as well
|
|
13
|
+
// as by tag; disabled controls drop out of the roving order either way.
|
|
14
|
+
const FOCUSABLE = [
|
|
15
|
+
'button:not([disabled]):not([aria-disabled="true"])',
|
|
16
|
+
'[role="button"]:not([disabled]):not([aria-disabled="true"])',
|
|
17
|
+
].join(", ");
|
|
18
|
+
|
|
19
|
+
export function useRovingFocus(containerRef: RefObject<HTMLElement | null>) {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const container = containerRef.current;
|
|
22
|
+
if (!container) return undefined;
|
|
23
|
+
|
|
24
|
+
const controls = () => Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE));
|
|
25
|
+
|
|
26
|
+
const setTabStops = (active?: HTMLElement) => {
|
|
27
|
+
const list = controls();
|
|
28
|
+
if (list.length === 0) return;
|
|
29
|
+
const current =
|
|
30
|
+
active && list.includes(active) ? active : (list.find((b) => b.tabIndex === 0) ?? list[0]!);
|
|
31
|
+
for (const control of list) control.tabIndex = control === current ? 0 : -1;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
setTabStops();
|
|
35
|
+
|
|
36
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
37
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
38
|
+
const list = controls();
|
|
39
|
+
if (list.length === 0) return;
|
|
40
|
+
const current = document.activeElement as HTMLElement | null;
|
|
41
|
+
let index = current ? list.indexOf(current) : -1;
|
|
42
|
+
if (index === -1) return;
|
|
43
|
+
|
|
44
|
+
const isRtl =
|
|
45
|
+
(container.closest("[dir]") as HTMLElement | null)?.dir === "rtl" || document.dir === "rtl";
|
|
46
|
+
const forward = isRtl ? -1 : 1;
|
|
47
|
+
|
|
48
|
+
if (event.key === "ArrowRight") index = (index + forward + list.length) % list.length;
|
|
49
|
+
else if (event.key === "ArrowLeft") index = (index - forward + list.length) % list.length;
|
|
50
|
+
else if (event.key === "Home") index = 0;
|
|
51
|
+
else index = list.length - 1;
|
|
52
|
+
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
const next = list[index]!;
|
|
55
|
+
setTabStops(next);
|
|
56
|
+
next.focus();
|
|
57
|
+
next.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleFocusIn = (event: FocusEvent) => {
|
|
61
|
+
const target = event.target as HTMLElement;
|
|
62
|
+
if (target.matches?.(FOCUSABLE)) setTabStops(target);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Buttons mount/unmount (sections, disabled flips) -- keep stops valid
|
|
66
|
+
const observer = new MutationObserver(() => setTabStops());
|
|
67
|
+
observer.observe(container, {
|
|
68
|
+
childList: true,
|
|
69
|
+
subtree: true,
|
|
70
|
+
attributes: true,
|
|
71
|
+
attributeFilter: ["disabled", "aria-disabled"],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
container.addEventListener("keydown", handleKeyDown);
|
|
75
|
+
container.addEventListener("focusin", handleFocusIn);
|
|
76
|
+
return () => {
|
|
77
|
+
observer.disconnect();
|
|
78
|
+
container.removeEventListener("keydown", handleKeyDown);
|
|
79
|
+
container.removeEventListener("focusin", handleFocusIn);
|
|
80
|
+
};
|
|
81
|
+
}, [containerRef]);
|
|
82
|
+
}
|
package/src/types.spec.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
2
|
import { defaultEditorState } from "./types";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
NATIVE_SUPPORTED_COMMANDS,
|
|
5
|
+
TEXT_COLORS,
|
|
6
|
+
TEXT_COLORS_DARK,
|
|
7
|
+
HIGHLIGHT_COLORS,
|
|
8
|
+
PALETTE_THEME_TOKENS,
|
|
9
|
+
} from "./constants";
|
|
4
10
|
|
|
5
11
|
describe("types and constants", () => {
|
|
6
12
|
it("defaultEditorState has expected shape and default values", () => {
|
|
@@ -56,6 +62,28 @@ describe("types and constants", () => {
|
|
|
56
62
|
expect(noneEntry?.name).toBe("None");
|
|
57
63
|
});
|
|
58
64
|
|
|
65
|
+
it("palette values are theme custom properties, never raw hex (Axiom 5 / DG-COL-01)", () => {
|
|
66
|
+
for (const entry of [...TEXT_COLORS, ...TEXT_COLORS_DARK, ...HIGHLIGHT_COLORS]) {
|
|
67
|
+
if (entry.value === null) continue;
|
|
68
|
+
expect(entry.value).toMatch(/^var\(--[a-zA-Z0-9]+\)$/);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("light and dark text palettes share tokens; only the neutral ink label flips", () => {
|
|
73
|
+
expect(TEXT_COLORS_DARK.map((c) => c.value)).toEqual(TEXT_COLORS.map((c) => c.value));
|
|
74
|
+
expect(TEXT_COLORS.find((c) => c.value === "var(--color12)")?.name).toBe("Black");
|
|
75
|
+
expect(TEXT_COLORS_DARK.find((c) => c.value === "var(--color12)")?.name).toBe("White");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("PALETTE_THEME_TOKENS covers every token referenced by the palettes", () => {
|
|
79
|
+
expect(PALETTE_THEME_TOKENS.length).toBeGreaterThan(0);
|
|
80
|
+
for (const entry of [...TEXT_COLORS, ...HIGHLIGHT_COLORS]) {
|
|
81
|
+
if (entry.value === null) continue;
|
|
82
|
+
const token = entry.value.replace(/^var\(--/, "").replace(/\)$/, "");
|
|
83
|
+
expect(PALETTE_THEME_TOKENS).toContain(token);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
59
87
|
it("NativeCapability covers all EditorCommand values", () => {
|
|
60
88
|
const commands: string[] = [
|
|
61
89
|
"bold",
|
|
@@ -89,6 +117,17 @@ describe("types and constants", () => {
|
|
|
89
117
|
"highlight",
|
|
90
118
|
"horizontalRule",
|
|
91
119
|
"clearFormatting",
|
|
120
|
+
"insertTable",
|
|
121
|
+
"addColumnBefore",
|
|
122
|
+
"addColumnAfter",
|
|
123
|
+
"deleteColumn",
|
|
124
|
+
"addRowBefore",
|
|
125
|
+
"addRowAfter",
|
|
126
|
+
"deleteRow",
|
|
127
|
+
"deleteTable",
|
|
128
|
+
"mergeCells",
|
|
129
|
+
"splitCell",
|
|
130
|
+
"toggleHeaderRow",
|
|
92
131
|
];
|
|
93
132
|
|
|
94
133
|
for (const cmd of commands) {
|
package/src/types.ts
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { FontSizeTokens } from "tamagui";
|
|
6
|
+
import type { MentionItem } from "@multiplatform.one/forms";
|
|
7
|
+
|
|
8
|
+
// ===========================================================================
|
|
9
|
+
// Mentions
|
|
10
|
+
// ===========================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Mention wiring for the @ suggestion popup (web). Uses the forms
|
|
14
|
+
* `MentionItem` contract (LC-16: same data shape as MentionInput).
|
|
15
|
+
*/
|
|
16
|
+
export interface RichTextMentionOptions {
|
|
17
|
+
/** Trigger character (default "@") */
|
|
18
|
+
trigger?: string;
|
|
19
|
+
/** Returns suggestion items for a query (sync or async) */
|
|
20
|
+
items: (query: string) => MentionItem[] | Promise<MentionItem[]>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ===========================================================================
|
|
24
|
+
// Editor Capabilities
|
|
25
|
+
// ===========================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Capability surface of the editor:
|
|
29
|
+
* - "full": every extension and toolbar control (default).
|
|
30
|
+
* - "markdown": WYSIWYG constrained to what GFM markdown can express —
|
|
31
|
+
* non-markdown extensions (underline, highlight, text color, alignment,
|
|
32
|
+
* sub/superscript, details, inline math, mentions) are NOT registered
|
|
33
|
+
* (commands absent, not just hidden), the toolbar shows only the
|
|
34
|
+
* markdown-expressible controls, `initialContent` is parsed as markdown,
|
|
35
|
+
* and `onChange` emits a markdown string.
|
|
36
|
+
*/
|
|
37
|
+
export type EditorCapabilities = "full" | "markdown";
|
|
6
38
|
|
|
7
39
|
// ===========================================================================
|
|
8
40
|
// Editor Command
|
|
@@ -135,10 +167,14 @@ export interface RichEditorRef {
|
|
|
135
167
|
getHTML: () => string;
|
|
136
168
|
/** Get the content as JSON (ProseMirror format) */
|
|
137
169
|
getJSON: () => any;
|
|
170
|
+
/** Get the content serialized to GFM markdown (web) */
|
|
171
|
+
getMarkdown: () => string;
|
|
138
172
|
/** Set content from HTML */
|
|
139
173
|
setHTML: (html: string) => void;
|
|
140
174
|
/** Set content from JSON */
|
|
141
175
|
setJSON: (json: any) => void;
|
|
176
|
+
/** Set content from a markdown string without emitting onChange (web) */
|
|
177
|
+
setMarkdown: (markdown: string) => void;
|
|
142
178
|
/** Focus the editor */
|
|
143
179
|
focus: () => void;
|
|
144
180
|
/** Blur the editor */
|
|
@@ -146,7 +182,14 @@ export interface RichEditorRef {
|
|
|
146
182
|
}
|
|
147
183
|
|
|
148
184
|
export interface RichEditorProps {
|
|
149
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Capability preset (default "full"). With "markdown", only the
|
|
187
|
+
* markdown-expressible extensions register, the toolbar shows only the
|
|
188
|
+
* corresponding controls, `initialContent` is parsed as markdown, and
|
|
189
|
+
* `onChange` receives a markdown string. Fixed at mount.
|
|
190
|
+
*/
|
|
191
|
+
capabilities?: EditorCapabilities;
|
|
192
|
+
/** Initial content as HTML ("full") or markdown ("markdown" capabilities) */
|
|
150
193
|
initialContent?: string;
|
|
151
194
|
/** Initial content as JSON (takes precedence over initialContent) */
|
|
152
195
|
initialJSON?: any;
|
|
@@ -170,6 +213,18 @@ export interface RichEditorProps {
|
|
|
170
213
|
maxHeight?: number;
|
|
171
214
|
/** Show error state */
|
|
172
215
|
hasError?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Uploads a pasted/dropped image and resolves its URL (web). Without it,
|
|
218
|
+
* images are inlined as base64 data URIs.
|
|
219
|
+
*/
|
|
220
|
+
onImageUpload?: (file: File) => Promise<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Uploads a pasted/dropped non-image file and resolves its URL (web).
|
|
223
|
+
* Inserts an attachment chip link; without it, non-image files are ignored.
|
|
224
|
+
*/
|
|
225
|
+
onFileUpload?: (file: File) => Promise<{ url: string; name?: string }>;
|
|
226
|
+
/** Enables the @ mention suggestion popup (web) */
|
|
227
|
+
mentions?: RichTextMentionOptions;
|
|
173
228
|
}
|
|
174
229
|
|
|
175
230
|
// ===========================================================================
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RichEditor compound component (web)
|
|
3
|
+
*
|
|
4
|
+
* Combines the TiptapEditor, FixedToolbar, and BubbleToolbar into a compound
|
|
5
|
+
* component with static properties:
|
|
6
|
+
* - RichEditor.FixedToolbar
|
|
7
|
+
* - RichEditor.BubbleToolbar
|
|
8
|
+
* - RichEditor.Editor
|
|
9
|
+
*
|
|
10
|
+
* Root provides RichEditorContext with resolved size, compact, and disabled.
|
|
11
|
+
* Uses useResolvedKnobs for knobs integration and clampRadiusForLargeComponent
|
|
12
|
+
* for radius clamping (max $4).
|
|
13
|
+
*/
|
|
14
|
+
import type { SizeTokens } from "tamagui";
|
|
15
|
+
import type { RichEditorProps, RichEditorRef, ToolbarSection } from "./types";
|
|
16
|
+
import { FixedToolbar } from "./toolbar/FixedToolbar";
|
|
17
|
+
import { BubbleToolbar } from "./toolbar/BubbleToolbar";
|
|
18
|
+
export interface RichEditorCombinedProps extends RichEditorProps {
|
|
19
|
+
/** Size token for the editor */
|
|
20
|
+
size?: SizeTokens;
|
|
21
|
+
/** Use compact sizing for tighter controls */
|
|
22
|
+
compact?: boolean;
|
|
23
|
+
/** Show the fixed toolbar (default: true) */
|
|
24
|
+
showToolbar?: boolean;
|
|
25
|
+
/** Show the bubble toolbar on text selection (default: false, web only) */
|
|
26
|
+
showBubbleToolbar?: boolean;
|
|
27
|
+
/** Toolbar sections to display (shows all when omitted) */
|
|
28
|
+
sections?: ToolbarSection[];
|
|
29
|
+
/** Show a drag handle to resize the editor vertically (default: true) */
|
|
30
|
+
resizable?: boolean;
|
|
31
|
+
/** Show word/character count status bar (default: true) */
|
|
32
|
+
showStatusBar?: boolean;
|
|
33
|
+
/** Controlled fullscreen state (uncontrolled when omitted) */
|
|
34
|
+
fullscreen?: boolean;
|
|
35
|
+
/** Initial fullscreen state when uncontrolled (default: false) */
|
|
36
|
+
defaultFullscreen?: boolean;
|
|
37
|
+
/** Called when the fullscreen state changes */
|
|
38
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Native only: render the embedded inline editor instead of the
|
|
41
|
+
* preview + fullscreen edit modal. Ignored on web (the web editor is
|
|
42
|
+
* always inline; fullscreen is the toolbar toggle).
|
|
43
|
+
*/
|
|
44
|
+
inlineEditing?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const RichEditor: import("react").ForwardRefExoticComponent<RichEditorCombinedProps & import("react").RefAttributes<RichEditorRef>> & {
|
|
47
|
+
FixedToolbar: typeof FixedToolbar;
|
|
48
|
+
BubbleToolbar: typeof BubbleToolbar;
|
|
49
|
+
Editor: import("react").NamedExoticComponent<import("./editor").TiptapEditorProps & import("react").RefAttributes<RichEditorRef>>;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=RichEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../src/RichEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,OAAO,KAAK,EAGV,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,gCAAgC;IAChC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAgOD,eAAO,MAAM,UAAU;;;;CAIrB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RichEditor compound component (native)
|
|
3
|
+
*
|
|
4
|
+
* Mobile editing model (Notion / Gmail convention):
|
|
5
|
+
*
|
|
6
|
+
* - INLINE (default): a compact PREVIEW surface themed like an input --
|
|
7
|
+
* the committed content rendered as styled text (or the placeholder),
|
|
8
|
+
* with a subtle edit affordance. Tapping it does not type inline; it
|
|
9
|
+
* opens the fullscreen editor.
|
|
10
|
+
* - FULLSCREEN EDIT: a safe-area-aware RN Modal. Header bar with Cancel
|
|
11
|
+
* (left, discards the draft back to the pre-open value) and Done (right,
|
|
12
|
+
* commits via onChange) -- draft-until-commit. The Tentap editor fills
|
|
13
|
+
* the screen and the FixedToolbar docks ABOVE the keyboard via
|
|
14
|
+
* KeyboardAvoidingView.
|
|
15
|
+
* - `inlineEditing` opts back into the embedded inline editor for hosts
|
|
16
|
+
* that truly want the old behavior.
|
|
17
|
+
*
|
|
18
|
+
* The web `fullscreen` / `defaultFullscreen` / `onFullscreenChange` props
|
|
19
|
+
* map to the modal here, so the public API is one surface.
|
|
20
|
+
*
|
|
21
|
+
* No BubbleToolbar sub-component (10Tap does not support floating menus).
|
|
22
|
+
* The BubbleToolbar property is still present on the compound component
|
|
23
|
+
* to maintain the same public interface, but renders nothing on native.
|
|
24
|
+
*/
|
|
25
|
+
import type { SizeTokens } from "tamagui";
|
|
26
|
+
import type { RichEditorProps, RichEditorRef, ToolbarSection } from "./types";
|
|
27
|
+
import { FixedToolbar } from "./toolbar/FixedToolbar";
|
|
28
|
+
export interface RichEditorCombinedProps extends RichEditorProps {
|
|
29
|
+
/** Size token for the editor */
|
|
30
|
+
size?: SizeTokens;
|
|
31
|
+
/** Use compact sizing for tighter controls */
|
|
32
|
+
compact?: boolean;
|
|
33
|
+
/** Show the fixed toolbar (default: true) */
|
|
34
|
+
showToolbar?: boolean;
|
|
35
|
+
/** Show the bubble toolbar on text selection (not supported on native, ignored) */
|
|
36
|
+
showBubbleToolbar?: boolean;
|
|
37
|
+
/** Toolbar sections to display (shows all when omitted) */
|
|
38
|
+
sections?: ToolbarSection[];
|
|
39
|
+
/** Controlled fullscreen state (opens the fullscreen edit modal) */
|
|
40
|
+
fullscreen?: boolean;
|
|
41
|
+
/** Initial fullscreen state when uncontrolled (default: false) */
|
|
42
|
+
defaultFullscreen?: boolean;
|
|
43
|
+
/** Called when the fullscreen state changes */
|
|
44
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Escape hatch: render the old embedded inline editor instead of the
|
|
47
|
+
* preview + fullscreen modal (default: false)
|
|
48
|
+
*/
|
|
49
|
+
inlineEditing?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** No-op BubbleToolbar for native -- 10Tap does not support floating menus */
|
|
52
|
+
declare function NativeBubbleToolbar(): null;
|
|
53
|
+
export declare const RichEditor: import("react").ForwardRefExoticComponent<RichEditorCombinedProps & import("react").RefAttributes<RichEditorRef>> & {
|
|
54
|
+
FixedToolbar: typeof FixedToolbar;
|
|
55
|
+
BubbleToolbar: typeof NativeBubbleToolbar;
|
|
56
|
+
Editor: any;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=RichEditor.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichEditor.native.d.ts","sourceRoot":"","sources":["../src/RichEditor.native.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,OAAO,KAAK,EAAe,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI3F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAUtD,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,gCAAgC;IAChC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAMD,8EAA8E;AAC9E,iBAAS,mBAAmB,SAE3B;AA+eD,eAAO,MAAM,UAAU;;;;CAIrB,CAAC"}
|