@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
package/src/shared/t.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import i18n from "i18next";
|
|
2
|
+
|
|
3
|
+
type TOptions = Record<string, unknown>;
|
|
4
|
+
|
|
5
|
+
function interpolate(template: string, options?: TOptions): string {
|
|
6
|
+
if (!options) return template;
|
|
7
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key: string) => {
|
|
8
|
+
const value = options[key];
|
|
9
|
+
return value === undefined || value === null ? `{{${key}}}` : String(value);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Safe catalog lookup for labels, tooltips, and chrome copy. When i18n is
|
|
15
|
+
* not initialized (unit tests / headless DS), returns the English key with
|
|
16
|
+
* light `{{var}}` interpolation so callers never get `undefined`. Same
|
|
17
|
+
* contract as `forms/src/shared/t.ts` and `table/src/shared/t.ts`.
|
|
18
|
+
*/
|
|
19
|
+
export function t(key: string, options?: TOptions): string {
|
|
20
|
+
if (i18n?.isInitialized) {
|
|
21
|
+
const translated: unknown = i18n.t(key, options as never);
|
|
22
|
+
if (typeof translated === "string" && translated.length > 0) return translated;
|
|
23
|
+
}
|
|
24
|
+
return interpolate(key, options);
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL normalization shared by the web LinkDialog and the native
|
|
3
|
+
* link/image dialogs (LC-16: one implementation).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Ensures URL has a protocol prefix, auto-prepending https:// if missing.
|
|
8
|
+
*/
|
|
9
|
+
export function normalizeUrl(url: string): string {
|
|
10
|
+
const trimmed = url.trim();
|
|
11
|
+
if (!trimmed) return trimmed;
|
|
12
|
+
if (/^https?:\/\//i.test(trimmed)) return trimmed;
|
|
13
|
+
if (/^mailto:/i.test(trimmed)) return trimmed;
|
|
14
|
+
if (/^tel:/i.test(trimmed)) return trimmed;
|
|
15
|
+
return `https://${trimmed}`;
|
|
16
|
+
}
|
package/src/styled.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Separator, View, XStack, styled } from "tamagui";
|
|
6
|
+
import { menuRowFrame } from "@multiplatform.one/theme";
|
|
6
7
|
import { RichEditorContext } from "./context";
|
|
7
8
|
|
|
8
9
|
// ===========================================================================
|
|
@@ -134,12 +135,18 @@ export const ToolbarSeparatorFrame = styled(Separator, {
|
|
|
134
135
|
export const DropdownMenuItemFrame = styled(XStack, {
|
|
135
136
|
name: "DropdownMenuItemFrame",
|
|
136
137
|
context: RichEditorContext,
|
|
137
|
-
|
|
138
|
+
// SP-EDGE geometry comes from the shared LC-16 `menuRowFrame` recipe
|
|
139
|
+
// (theme): full-width row, own horizontal padding, flat corners, no focus
|
|
140
|
+
// outline — the same frame DropdownMenu items, Select options, and
|
|
141
|
+
// MentionInput suggestions use. Menu-only concerns stay local: cursor,
|
|
142
|
+
// gap, vertical padding, and the color ramp.
|
|
143
|
+
...menuRowFrame,
|
|
144
|
+
// Pressable rows must expose a real control role — without it screen
|
|
145
|
+
// readers (and role-based queries) see an unnamed generic div.
|
|
146
|
+
role: "button",
|
|
138
147
|
paddingVertical: "$2",
|
|
139
148
|
gap: "$2",
|
|
140
|
-
alignItems: "center",
|
|
141
149
|
cursor: "pointer",
|
|
142
|
-
borderRadius: "$2",
|
|
143
150
|
|
|
144
151
|
hoverStyle: {
|
|
145
152
|
backgroundColor: "$color4",
|
|
@@ -149,11 +156,11 @@ export const DropdownMenuItemFrame = styled(XStack, {
|
|
|
149
156
|
backgroundColor: "$color5",
|
|
150
157
|
},
|
|
151
158
|
|
|
159
|
+
// Focus highlight doubles as the focus indicator (full-width row);
|
|
160
|
+
// menuRowFrame suppresses the outline by design.
|
|
152
161
|
focusVisibleStyle: {
|
|
153
162
|
backgroundColor: "$color4",
|
|
154
|
-
|
|
155
|
-
outlineStyle: "solid",
|
|
156
|
-
outlineWidth: 2,
|
|
163
|
+
outlineStyle: "none" as any,
|
|
157
164
|
},
|
|
158
165
|
|
|
159
166
|
variants: {
|
|
@@ -19,6 +19,7 @@ import { defaultEditorState } from "../types";
|
|
|
19
19
|
import { ToolbarButton } from "./ToolbarButton";
|
|
20
20
|
import {
|
|
21
21
|
BoldIcon,
|
|
22
|
+
InlineCodeIcon,
|
|
22
23
|
ItalicIcon,
|
|
23
24
|
UnderlineIcon,
|
|
24
25
|
StrikeIcon,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
import { TextColorPicker, HighlightColorPicker } from "./ColorPicker";
|
|
29
30
|
import { LinkDialog } from "./LinkDialog";
|
|
30
31
|
import { SHORTCUTS } from "./shortcuts";
|
|
32
|
+
import { t } from "../shared/t";
|
|
31
33
|
|
|
32
34
|
// ===========================================================================
|
|
33
35
|
// Types
|
|
@@ -58,6 +60,7 @@ export function BubbleToolbar({
|
|
|
58
60
|
return (
|
|
59
61
|
<BubbleMenu
|
|
60
62
|
editor={editor}
|
|
63
|
+
className="rt-bubble-menu"
|
|
61
64
|
shouldShow={({ editor: e, from, to }) => {
|
|
62
65
|
if (from === to) return false;
|
|
63
66
|
if (e.isActive("codeBlock")) return false;
|
|
@@ -79,7 +82,7 @@ export function BubbleToolbar({
|
|
|
79
82
|
<ToolbarButton
|
|
80
83
|
active={state.isBold}
|
|
81
84
|
onPress={() => editorRef.current?.executeCommand("bold")}
|
|
82
|
-
aria-label="Bold"
|
|
85
|
+
aria-label={t("Bold")}
|
|
83
86
|
tooltip={SHORTCUTS.bold}
|
|
84
87
|
>
|
|
85
88
|
<BoldIcon>B</BoldIcon>
|
|
@@ -88,7 +91,7 @@ export function BubbleToolbar({
|
|
|
88
91
|
<ToolbarButton
|
|
89
92
|
active={state.isItalic}
|
|
90
93
|
onPress={() => editorRef.current?.executeCommand("italic")}
|
|
91
|
-
aria-label="Italic"
|
|
94
|
+
aria-label={t("Italic")}
|
|
92
95
|
tooltip={SHORTCUTS.italic}
|
|
93
96
|
>
|
|
94
97
|
<ItalicIcon>I</ItalicIcon>
|
|
@@ -97,7 +100,7 @@ export function BubbleToolbar({
|
|
|
97
100
|
<ToolbarButton
|
|
98
101
|
active={state.isUnderline}
|
|
99
102
|
onPress={() => editorRef.current?.executeCommand("underline")}
|
|
100
|
-
aria-label="Underline"
|
|
103
|
+
aria-label={t("Underline")}
|
|
101
104
|
tooltip={SHORTCUTS.underline}
|
|
102
105
|
>
|
|
103
106
|
<UnderlineIcon>U</UnderlineIcon>
|
|
@@ -106,7 +109,7 @@ export function BubbleToolbar({
|
|
|
106
109
|
<ToolbarButton
|
|
107
110
|
active={state.isStrike}
|
|
108
111
|
onPress={() => editorRef.current?.executeCommand("strike")}
|
|
109
|
-
aria-label="Strikethrough"
|
|
112
|
+
aria-label={t("Strikethrough")}
|
|
110
113
|
tooltip={SHORTCUTS.strike}
|
|
111
114
|
>
|
|
112
115
|
<StrikeIcon>S</StrikeIcon>
|
|
@@ -115,16 +118,16 @@ export function BubbleToolbar({
|
|
|
115
118
|
<ToolbarButton
|
|
116
119
|
active={state.isCode}
|
|
117
120
|
onPress={() => editorRef.current?.executeCommand("code")}
|
|
118
|
-
aria-label="Code"
|
|
121
|
+
aria-label={t("Code")}
|
|
119
122
|
tooltip={SHORTCUTS.code}
|
|
120
123
|
>
|
|
121
|
-
|
|
124
|
+
<InlineCodeIcon />
|
|
122
125
|
</ToolbarButton>
|
|
123
126
|
|
|
124
127
|
<ToolbarButton
|
|
125
128
|
active={state.isSubscript}
|
|
126
129
|
onPress={() => editorRef.current?.executeCommand("subscript")}
|
|
127
|
-
aria-label="Subscript"
|
|
130
|
+
aria-label={t("Subscript")}
|
|
128
131
|
tooltip={SHORTCUTS.subscript}
|
|
129
132
|
>
|
|
130
133
|
<SubscriptIcon />
|
|
@@ -133,7 +136,7 @@ export function BubbleToolbar({
|
|
|
133
136
|
<ToolbarButton
|
|
134
137
|
active={state.isSuperscript}
|
|
135
138
|
onPress={() => editorRef.current?.executeCommand("superscript")}
|
|
136
|
-
aria-label="Superscript"
|
|
139
|
+
aria-label={t("Superscript")}
|
|
137
140
|
tooltip={SHORTCUTS.superscript}
|
|
138
141
|
>
|
|
139
142
|
<SuperscriptIcon />
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bubble menu shown when cursor is inside a code block.
|
|
3
|
-
* Provides language selection and remove
|
|
3
|
+
* Provides language selection, copy-to-clipboard, and remove actions.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useCallback, useState } from "react";
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import type { Editor } from "@tiptap/react";
|
|
8
8
|
import { BubbleMenu } from "@tiptap/react/menus";
|
|
9
9
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
10
|
+
import { CheckIcon, CopyIcon, TrashIcon } from "@phosphor-icons/react";
|
|
10
11
|
import { Popover, Text, XStack, YStack } from "tamagui";
|
|
11
12
|
import { DropdownMenuItemFrame } from "../styled";
|
|
13
|
+
import { getBlockVirtualElement } from "../editor/blockAnchor";
|
|
12
14
|
import { ToolbarButton, ToolbarDropdownButton } from "./ToolbarButton";
|
|
15
|
+
import { t } from "../shared/t";
|
|
13
16
|
|
|
14
17
|
const LANGUAGES = [
|
|
15
18
|
{ value: null, label: "Plain text" },
|
|
@@ -25,6 +28,8 @@ const LANGUAGES = [
|
|
|
25
28
|
{ value: "json", label: "JSON" },
|
|
26
29
|
{ value: "kotlin", label: "Kotlin" },
|
|
27
30
|
{ value: "markdown", label: "Markdown" },
|
|
31
|
+
{ value: "math", label: "Math (TeX)" },
|
|
32
|
+
{ value: "mermaid", label: "Mermaid" },
|
|
28
33
|
{ value: "php", label: "PHP" },
|
|
29
34
|
{ value: "python", label: "Python" },
|
|
30
35
|
{ value: "ruby", label: "Ruby" },
|
|
@@ -37,33 +42,36 @@ const LANGUAGES = [
|
|
|
37
42
|
{ value: "yaml", label: "YAML" },
|
|
38
43
|
] as const;
|
|
39
44
|
|
|
40
|
-
function TrashIcon() {
|
|
41
|
-
return (
|
|
42
|
-
<svg
|
|
43
|
-
width="14"
|
|
44
|
-
height="14"
|
|
45
|
-
viewBox="0 0 24 24"
|
|
46
|
-
fill="none"
|
|
47
|
-
stroke="currentColor"
|
|
48
|
-
strokeWidth="2"
|
|
49
|
-
>
|
|
50
|
-
<polyline points="3 6 5 6 21 6" />
|
|
51
|
-
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
52
|
-
</svg>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
45
|
export interface CodeBlockBubbleProps {
|
|
57
46
|
editor: Editor | null;
|
|
58
47
|
}
|
|
59
48
|
|
|
49
|
+
/** Reads the text of the code block the selection sits in */
|
|
50
|
+
function getActiveCodeBlockText(editor: Editor): string {
|
|
51
|
+
const { $from } = editor.state.selection;
|
|
52
|
+
for (let depth = $from.depth; depth >= 0; depth--) {
|
|
53
|
+
const node = $from.node(depth);
|
|
54
|
+
if (node.type.name === "codeBlock") return node.textContent;
|
|
55
|
+
}
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
|
|
60
59
|
export function CodeBlockBubble({ editor }: CodeBlockBubbleProps) {
|
|
61
60
|
const { knobProps } = useResolvedKnobs();
|
|
62
61
|
const [langOpen, setLangOpen] = useState(false);
|
|
62
|
+
const [copied, setCopied] = useState(false);
|
|
63
|
+
const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
64
|
+
|
|
65
|
+
useEffect(
|
|
66
|
+
() => () => {
|
|
67
|
+
if (copiedTimer.current) clearTimeout(copiedTimer.current);
|
|
68
|
+
},
|
|
69
|
+
[],
|
|
70
|
+
);
|
|
63
71
|
|
|
64
72
|
const currentLang = editor?.getAttributes("codeBlock")?.language ?? null;
|
|
65
|
-
const
|
|
66
|
-
|
|
73
|
+
const rawLabel = LANGUAGES.find((l) => l.value === currentLang)?.label ?? currentLang;
|
|
74
|
+
const currentLabel = currentLang === null ? t("Plain text") : (rawLabel ?? t("Plain text"));
|
|
67
75
|
|
|
68
76
|
const setLanguage = useCallback(
|
|
69
77
|
(lang: string | null) => {
|
|
@@ -74,6 +82,18 @@ export function CodeBlockBubble({ editor }: CodeBlockBubbleProps) {
|
|
|
74
82
|
[editor],
|
|
75
83
|
);
|
|
76
84
|
|
|
85
|
+
const copyCode = useCallback(async () => {
|
|
86
|
+
if (!editor) return;
|
|
87
|
+
try {
|
|
88
|
+
await navigator.clipboard.writeText(getActiveCodeBlockText(editor));
|
|
89
|
+
setCopied(true);
|
|
90
|
+
if (copiedTimer.current) clearTimeout(copiedTimer.current);
|
|
91
|
+
copiedTimer.current = setTimeout(() => setCopied(false), 1500);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
console.warn("[rich-text] copy failed:", err);
|
|
94
|
+
}
|
|
95
|
+
}, [editor]);
|
|
96
|
+
|
|
77
97
|
const removeCodeBlock = useCallback(() => {
|
|
78
98
|
if (!editor) return;
|
|
79
99
|
editor.chain().focus().toggleCodeBlock().run();
|
|
@@ -84,8 +104,13 @@ export function CodeBlockBubble({ editor }: CodeBlockBubbleProps) {
|
|
|
84
104
|
return (
|
|
85
105
|
<BubbleMenu
|
|
86
106
|
editor={editor}
|
|
107
|
+
className="rt-bubble-menu"
|
|
87
108
|
shouldShow={({ editor: e }) => e.isActive("codeBlock")}
|
|
88
|
-
|
|
109
|
+
// Anchor to the <pre> rect (not the caret) so the bubble sits above
|
|
110
|
+
// the block instead of covering its first line, and does not chase
|
|
111
|
+
// the caret while typing.
|
|
112
|
+
getReferencedVirtualElement={() => getBlockVirtualElement(editor, "codeBlock")}
|
|
113
|
+
options={{ placement: "top-start", offset: 6 }}
|
|
89
114
|
>
|
|
90
115
|
<XStack
|
|
91
116
|
backgroundColor="$background"
|
|
@@ -99,12 +124,17 @@ export function CodeBlockBubble({ editor }: CodeBlockBubbleProps) {
|
|
|
99
124
|
>
|
|
100
125
|
<Popover open={langOpen} onOpenChange={setLangOpen} placement="bottom-start">
|
|
101
126
|
<Popover.Trigger asChild>
|
|
102
|
-
<ToolbarDropdownButton
|
|
127
|
+
<ToolbarDropdownButton
|
|
128
|
+
onPress={() => setLangOpen(true)}
|
|
129
|
+
aria-label={t("Select language")}
|
|
130
|
+
>
|
|
103
131
|
<Text fontSize={12}>{currentLabel}</Text>
|
|
104
132
|
</ToolbarDropdownButton>
|
|
105
133
|
</Popover.Trigger>
|
|
106
134
|
<Popover.Content
|
|
107
|
-
|
|
135
|
+
// SP-EDGE: container owns only its border — items own all padding.
|
|
136
|
+
padding={0}
|
|
137
|
+
overflow="hidden"
|
|
108
138
|
backgroundColor="$background"
|
|
109
139
|
borderWidth={1}
|
|
110
140
|
borderColor="$borderColor"
|
|
@@ -119,21 +149,29 @@ export function CodeBlockBubble({ editor }: CodeBlockBubbleProps) {
|
|
|
119
149
|
key={lang.label}
|
|
120
150
|
active={currentLang === lang.value}
|
|
121
151
|
onPress={() => setLanguage(lang.value)}
|
|
122
|
-
aria-label={lang.label}
|
|
152
|
+
aria-label={lang.value === null ? t("Plain text") : lang.label}
|
|
123
153
|
>
|
|
124
|
-
<Text fontSize={13}>{lang.label}</Text>
|
|
154
|
+
<Text fontSize={13}>{lang.value === null ? t("Plain text") : lang.label}</Text>
|
|
125
155
|
</DropdownMenuItemFrame>
|
|
126
156
|
))}
|
|
127
157
|
</YStack>
|
|
128
158
|
</Popover.Content>
|
|
129
159
|
</Popover>
|
|
130
160
|
|
|
161
|
+
<ToolbarButton
|
|
162
|
+
onPress={copyCode}
|
|
163
|
+
aria-label={copied ? t("Copied") : t("Copy code")}
|
|
164
|
+
tooltip={copied ? t("Copied") : t("Copy code")}
|
|
165
|
+
>
|
|
166
|
+
{copied ? <CheckIcon size={14} /> : <CopyIcon size={14} />}
|
|
167
|
+
</ToolbarButton>
|
|
168
|
+
|
|
131
169
|
<ToolbarButton
|
|
132
170
|
onPress={removeCodeBlock}
|
|
133
|
-
aria-label="Remove code block"
|
|
134
|
-
tooltip="Remove code block"
|
|
171
|
+
aria-label={t("Remove code block")}
|
|
172
|
+
tooltip={t("Remove code block")}
|
|
135
173
|
>
|
|
136
|
-
<TrashIcon />
|
|
174
|
+
<TrashIcon size={14} />
|
|
137
175
|
</ToolbarButton>
|
|
138
176
|
</XStack>
|
|
139
177
|
</BubbleMenu>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color picker for text color and highlight (native)
|
|
3
|
+
*
|
|
4
|
+
* Must NOT use a second RN Modal / FloatingPanel here: the fullscreen editor
|
|
5
|
+
* is already a Modal, and nesting another Modal on iOS dismisses the parent
|
|
6
|
+
* (SB-N-ios-25 wipe looked like "Text Color cleared the doc" because Cancel
|
|
7
|
+
* via onRequestClose ran). ActionSheetIOS / Android Alert stay in-process.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useCallback, useMemo } from "react";
|
|
11
|
+
import { ActionSheetIOS, Alert, Platform } from "react-native";
|
|
12
|
+
import { useTheme, useThemeName } from "tamagui";
|
|
13
|
+
import type { EditorState, RichEditorRef } from "../types";
|
|
14
|
+
import { TEXT_COLOR_TOKENS, TEXT_COLOR_TOKENS_DARK, HIGHLIGHT_COLOR_TOKENS } from "../constants";
|
|
15
|
+
import type { ColorEntry, ColorTokenEntry } from "../constants";
|
|
16
|
+
import { ToolbarButton } from "./ToolbarButton";
|
|
17
|
+
import { TextColorIcon, HighlightIcon } from "./icons";
|
|
18
|
+
import { t } from "../shared/t";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolves palette theme tokens to concrete color values via the active
|
|
22
|
+
* theme (Axiom 5 ONE SOURCE): RN and the 10Tap webview cannot resolve CSS
|
|
23
|
+
* custom properties, so the native picker applies resolved values.
|
|
24
|
+
*/
|
|
25
|
+
function useResolvedPalette(entries: ColorTokenEntry[]): ColorEntry[] {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
return useMemo(
|
|
28
|
+
() =>
|
|
29
|
+
entries.map(({ name, token }) => ({
|
|
30
|
+
name,
|
|
31
|
+
value: token ? ((theme as any)[token]?.val ?? null) : null,
|
|
32
|
+
})),
|
|
33
|
+
[entries, theme],
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ===========================================================================
|
|
38
|
+
// Types
|
|
39
|
+
// ===========================================================================
|
|
40
|
+
|
|
41
|
+
export interface ColorPickerProps {
|
|
42
|
+
/** Reference to the editor */
|
|
43
|
+
editorRef: React.RefObject<RichEditorRef | null>;
|
|
44
|
+
/** Current editor state */
|
|
45
|
+
state: EditorState;
|
|
46
|
+
/** Whether the picker is disabled */
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function pickColor(title: string, colors: ColorEntry[], onSelect: (color: string | null) => void) {
|
|
51
|
+
const labels = colors.map((c) => t(c.name));
|
|
52
|
+
if (Platform.OS === "ios") {
|
|
53
|
+
ActionSheetIOS.showActionSheetWithOptions(
|
|
54
|
+
{
|
|
55
|
+
title,
|
|
56
|
+
options: [...labels, t("Cancel")],
|
|
57
|
+
cancelButtonIndex: labels.length,
|
|
58
|
+
},
|
|
59
|
+
(index) => {
|
|
60
|
+
if (typeof index !== "number" || index >= labels.length) return;
|
|
61
|
+
onSelect(colors[index]?.value ?? null);
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
Alert.alert(title, undefined, [
|
|
67
|
+
...colors.map((c) => ({
|
|
68
|
+
text: t(c.name),
|
|
69
|
+
onPress: () => onSelect(c.value),
|
|
70
|
+
})),
|
|
71
|
+
{ text: t("Cancel"), style: "cancel" as const },
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ===========================================================================
|
|
76
|
+
// TextColorPicker
|
|
77
|
+
// ===========================================================================
|
|
78
|
+
|
|
79
|
+
export function TextColorPicker({ editorRef, state, disabled }: ColorPickerProps) {
|
|
80
|
+
const themeName = useThemeName();
|
|
81
|
+
// Same tokens both schemes; only the neutral ink's honest label flips
|
|
82
|
+
const textColors = useResolvedPalette(
|
|
83
|
+
String(themeName).startsWith("dark") ? TEXT_COLOR_TOKENS_DARK : TEXT_COLOR_TOKENS,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const handlePress = useCallback(() => {
|
|
87
|
+
pickColor(t("Text Color"), textColors, (color) => {
|
|
88
|
+
editorRef.current?.executeCommand("textColor", { color });
|
|
89
|
+
});
|
|
90
|
+
}, [editorRef, textColors]);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<ToolbarButton
|
|
94
|
+
active={!!state.textColor}
|
|
95
|
+
disabled={disabled}
|
|
96
|
+
onPress={handlePress}
|
|
97
|
+
aria-label={t("Text Color")}
|
|
98
|
+
>
|
|
99
|
+
<TextColorIcon color={state.textColor} />
|
|
100
|
+
</ToolbarButton>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ===========================================================================
|
|
105
|
+
// HighlightColorPicker
|
|
106
|
+
// ===========================================================================
|
|
107
|
+
|
|
108
|
+
export function HighlightColorPicker({ editorRef, state, disabled }: ColorPickerProps) {
|
|
109
|
+
const highlightColors = useResolvedPalette(HIGHLIGHT_COLOR_TOKENS);
|
|
110
|
+
const handlePress = useCallback(() => {
|
|
111
|
+
pickColor(t("Highlight"), highlightColors, (color) => {
|
|
112
|
+
editorRef.current?.executeCommand("highlight", { color });
|
|
113
|
+
});
|
|
114
|
+
}, [editorRef, highlightColors]);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<ToolbarButton
|
|
118
|
+
active={!!state.highlightColor}
|
|
119
|
+
disabled={disabled}
|
|
120
|
+
onPress={handlePress}
|
|
121
|
+
aria-label={t("Highlight Color")}
|
|
122
|
+
>
|
|
123
|
+
<HighlightIcon color={state.highlightColor} />
|
|
124
|
+
</ToolbarButton>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { useCallback, useState } from "react";
|
|
6
|
+
import { PresetSwatches } from "@multiplatform.one/forms";
|
|
6
7
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
7
|
-
import { Popover, Text,
|
|
8
|
+
import { Popover, Text, YStack, useThemeName } from "tamagui";
|
|
8
9
|
import type { EditorState, RichEditorRef } from "../types";
|
|
9
|
-
import { TEXT_COLORS, HIGHLIGHT_COLORS } from "../constants";
|
|
10
|
+
import { TEXT_COLORS, TEXT_COLORS_DARK, HIGHLIGHT_COLORS } from "../constants";
|
|
10
11
|
import type { ColorEntry } from "../constants";
|
|
11
12
|
import { ToolbarButton } from "./ToolbarButton";
|
|
12
13
|
import { TextColorIcon, HighlightIcon } from "./icons";
|
|
14
|
+
import { t } from "../shared/t";
|
|
13
15
|
|
|
14
16
|
// ===========================================================================
|
|
15
17
|
// Types
|
|
@@ -25,51 +27,7 @@ export interface ColorPickerProps {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// ===========================================================================
|
|
28
|
-
//
|
|
29
|
-
// ===========================================================================
|
|
30
|
-
|
|
31
|
-
function ColorSwatch({
|
|
32
|
-
color,
|
|
33
|
-
isSelected,
|
|
34
|
-
onPress,
|
|
35
|
-
isNone,
|
|
36
|
-
}: {
|
|
37
|
-
color: string | null;
|
|
38
|
-
isSelected: boolean;
|
|
39
|
-
onPress: () => void;
|
|
40
|
-
isNone?: boolean;
|
|
41
|
-
}) {
|
|
42
|
-
return (
|
|
43
|
-
<View
|
|
44
|
-
width={24}
|
|
45
|
-
height={24}
|
|
46
|
-
borderRadius={4}
|
|
47
|
-
backgroundColor={color || "$background"}
|
|
48
|
-
borderWidth={isSelected ? 2 : 1}
|
|
49
|
-
borderColor={isSelected ? "$blue10" : "$color6"}
|
|
50
|
-
cursor="pointer"
|
|
51
|
-
hoverStyle={{ opacity: 0.8 }}
|
|
52
|
-
pressStyle={{ scale: 0.95 }}
|
|
53
|
-
onPress={onPress}
|
|
54
|
-
alignItems="center"
|
|
55
|
-
justifyContent="center"
|
|
56
|
-
aria-label={isNone ? "Remove color" : `Color ${color}`}
|
|
57
|
-
>
|
|
58
|
-
{isNone && (
|
|
59
|
-
<View
|
|
60
|
-
position="absolute"
|
|
61
|
-
width={20}
|
|
62
|
-
height={2}
|
|
63
|
-
backgroundColor="$red10"
|
|
64
|
-
transform={[{ rotate: "45deg" }]}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
</View>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ===========================================================================
|
|
72
|
-
// ColorGrid
|
|
30
|
+
// ColorGrid — titled wrapper around the forms PresetSwatches grid
|
|
73
31
|
// ===========================================================================
|
|
74
32
|
|
|
75
33
|
function ColorGrid({
|
|
@@ -91,17 +49,12 @@ function ColorGrid({
|
|
|
91
49
|
<Text fontSize={knobProps.sizeToken} fontWeight="600">
|
|
92
50
|
{title}
|
|
93
51
|
</Text>
|
|
94
|
-
<
|
|
95
|
-
{colors.map((c) => (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
isNone={c.value === null}
|
|
101
|
-
onPress={() => onSelect(c.value)}
|
|
102
|
-
/>
|
|
103
|
-
))}
|
|
104
|
-
</XStack>
|
|
52
|
+
<PresetSwatches
|
|
53
|
+
presetColors={colors.map((c) => ({ ...c, name: t(c.name) }))}
|
|
54
|
+
selectedColor={selectedColor}
|
|
55
|
+
onSelect={onSelect}
|
|
56
|
+
width={maxWidth}
|
|
57
|
+
/>
|
|
105
58
|
</YStack>
|
|
106
59
|
);
|
|
107
60
|
}
|
|
@@ -112,12 +65,15 @@ function ColorGrid({
|
|
|
112
65
|
|
|
113
66
|
export function TextColorPicker({ editorRef, state, disabled }: ColorPickerProps) {
|
|
114
67
|
const { knobProps } = useResolvedKnobs();
|
|
68
|
+
const themeName = useThemeName();
|
|
69
|
+
const textColors = String(themeName).startsWith("dark") ? TEXT_COLORS_DARK : TEXT_COLORS;
|
|
115
70
|
const [open, setOpen] = useState(false);
|
|
116
71
|
|
|
72
|
+
// DISMISS-BY-INTENT (LC-19): swatch click applies the color live; the popup
|
|
73
|
+
// stays open so the user can try several. Outside click / Escape dismisses.
|
|
117
74
|
const handleSelect = useCallback(
|
|
118
75
|
(color: string | null) => {
|
|
119
76
|
editorRef.current?.executeCommand("textColor", { color });
|
|
120
|
-
setOpen(false);
|
|
121
77
|
},
|
|
122
78
|
[editorRef],
|
|
123
79
|
);
|
|
@@ -129,8 +85,8 @@ export function TextColorPicker({ editorRef, state, disabled }: ColorPickerProps
|
|
|
129
85
|
active={!!state.textColor}
|
|
130
86
|
disabled={disabled}
|
|
131
87
|
onPress={() => setOpen(true)}
|
|
132
|
-
aria-label="Text Color"
|
|
133
|
-
tooltip="Text Color"
|
|
88
|
+
aria-label={t("Text Color")}
|
|
89
|
+
tooltip={t("Text Color")}
|
|
134
90
|
>
|
|
135
91
|
<TextColorIcon color={state.textColor} />
|
|
136
92
|
</ToolbarButton>
|
|
@@ -147,8 +103,8 @@ export function TextColorPicker({ editorRef, state, disabled }: ColorPickerProps
|
|
|
147
103
|
>
|
|
148
104
|
<Popover.Arrow borderColor="$borderColor" backgroundColor="$background" />
|
|
149
105
|
<ColorGrid
|
|
150
|
-
title="Text Color"
|
|
151
|
-
colors={
|
|
106
|
+
title={t("Text Color")}
|
|
107
|
+
colors={textColors}
|
|
152
108
|
selectedColor={state.textColor}
|
|
153
109
|
onSelect={handleSelect}
|
|
154
110
|
maxWidth={160}
|
|
@@ -166,10 +122,10 @@ export function HighlightColorPicker({ editorRef, state, disabled }: ColorPicker
|
|
|
166
122
|
const { knobProps } = useResolvedKnobs();
|
|
167
123
|
const [open, setOpen] = useState(false);
|
|
168
124
|
|
|
125
|
+
// DISMISS-BY-INTENT (LC-19): keep the popup open across swatch selections.
|
|
169
126
|
const handleSelect = useCallback(
|
|
170
127
|
(color: string | null) => {
|
|
171
128
|
editorRef.current?.executeCommand("highlight", { color });
|
|
172
|
-
setOpen(false);
|
|
173
129
|
},
|
|
174
130
|
[editorRef],
|
|
175
131
|
);
|
|
@@ -181,8 +137,8 @@ export function HighlightColorPicker({ editorRef, state, disabled }: ColorPicker
|
|
|
181
137
|
active={!!state.highlightColor}
|
|
182
138
|
disabled={disabled}
|
|
183
139
|
onPress={() => setOpen(true)}
|
|
184
|
-
aria-label="Highlight Color"
|
|
185
|
-
tooltip="Highlight"
|
|
140
|
+
aria-label={t("Highlight Color")}
|
|
141
|
+
tooltip={t("Highlight")}
|
|
186
142
|
>
|
|
187
143
|
<HighlightIcon color={state.highlightColor} />
|
|
188
144
|
</ToolbarButton>
|
|
@@ -199,7 +155,7 @@ export function HighlightColorPicker({ editorRef, state, disabled }: ColorPicker
|
|
|
199
155
|
>
|
|
200
156
|
<Popover.Arrow borderColor="$borderColor" backgroundColor="$background" />
|
|
201
157
|
<ColorGrid
|
|
202
|
-
title="Highlight"
|
|
158
|
+
title={t("Highlight")}
|
|
203
159
|
colors={HIGHLIGHT_COLORS}
|
|
204
160
|
selectedColor={state.highlightColor}
|
|
205
161
|
onSelect={handleSelect}
|