@multiplatform.one/rich-text 6.0.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/LICENSE +201 -0
- package/dist/cjs/RichEditor.cjs +132 -0
- package/dist/cjs/RichEditor.native.js +120 -0
- package/dist/cjs/RichEditor.native.js.map +1 -0
- package/dist/cjs/RichEditor.stories.cjs +327 -0
- package/dist/cjs/RichEditor.stories.native.js +342 -0
- package/dist/cjs/RichEditor.stories.native.js.map +1 -0
- package/dist/cjs/RichTextEditor/index.cjs +148 -0
- package/dist/cjs/RichTextEditor/index.native.js +160 -0
- package/dist/cjs/RichTextEditor/index.native.js.map +1 -0
- package/dist/cjs/constants.cjs +135 -0
- package/dist/cjs/constants.native.js +138 -0
- package/dist/cjs/constants.native.js.map +1 -0
- package/dist/cjs/context.cjs +33 -0
- package/dist/cjs/context.native.js +36 -0
- package/dist/cjs/context.native.js.map +1 -0
- package/dist/cjs/editor/BlockDragHandle.cjs +137 -0
- package/dist/cjs/editor/BlockDragHandle.native.js +142 -0
- package/dist/cjs/editor/BlockDragHandle.native.js.map +1 -0
- package/dist/cjs/editor/MarkdownPaste.cjs +65 -0
- package/dist/cjs/editor/MarkdownPaste.native.js +68 -0
- package/dist/cjs/editor/MarkdownPaste.native.js.map +1 -0
- package/dist/cjs/editor/SlashCommands.cjs +369 -0
- package/dist/cjs/editor/SlashCommands.native.js +424 -0
- package/dist/cjs/editor/SlashCommands.native.js.map +1 -0
- package/dist/cjs/editor/TentapEditor.native.js +242 -0
- package/dist/cjs/editor/TentapEditor.native.js.map +1 -0
- package/dist/cjs/editor/TiptapEditor.cjs +578 -0
- package/dist/cjs/editor/TiptapEditor.native.js +661 -0
- package/dist/cjs/editor/TiptapEditor.native.js.map +1 -0
- package/dist/cjs/editor/editorStyles.cjs +272 -0
- package/dist/cjs/editor/editorStyles.native.js +276 -0
- package/dist/cjs/editor/editorStyles.native.js.map +1 -0
- package/dist/cjs/editor/index.cjs +33 -0
- package/dist/cjs/editor/index.native.js +36 -0
- package/dist/cjs/editor/index.native.js.map +1 -0
- package/dist/cjs/editor/types.cjs +54 -0
- package/dist/cjs/editor/types.native.js +57 -0
- package/dist/cjs/editor/types.native.js.map +1 -0
- package/dist/cjs/editor/useEditorState.cjs +129 -0
- package/dist/cjs/editor/useEditorState.native.js +135 -0
- package/dist/cjs/editor/useEditorState.native.js.map +1 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/index.native.js +33 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/styled.cjs +173 -0
- package/dist/cjs/styled.native.js +185 -0
- package/dist/cjs/styled.native.js.map +1 -0
- package/dist/cjs/toolbar/BubbleToolbar.cjs +130 -0
- package/dist/cjs/toolbar/BubbleToolbar.native.js +159 -0
- package/dist/cjs/toolbar/BubbleToolbar.native.js.map +1 -0
- package/dist/cjs/toolbar/CodeBlockBubble.cjs +211 -0
- package/dist/cjs/toolbar/CodeBlockBubble.native.js +228 -0
- package/dist/cjs/toolbar/CodeBlockBubble.native.js.map +1 -0
- package/dist/cjs/toolbar/ColorPicker.cjs +217 -0
- package/dist/cjs/toolbar/ColorPicker.native.js +234 -0
- package/dist/cjs/toolbar/ColorPicker.native.js.map +1 -0
- package/dist/cjs/toolbar/FixedToolbar.cjs +221 -0
- package/dist/cjs/toolbar/FixedToolbar.native.js +322 -0
- package/dist/cjs/toolbar/FixedToolbar.native.js.map +1 -0
- package/dist/cjs/toolbar/HeadingPicker.cjs +158 -0
- package/dist/cjs/toolbar/HeadingPicker.native.js +167 -0
- package/dist/cjs/toolbar/HeadingPicker.native.js.map +1 -0
- package/dist/cjs/toolbar/ImageBubble.cjs +156 -0
- package/dist/cjs/toolbar/ImageBubble.native.js +165 -0
- package/dist/cjs/toolbar/ImageBubble.native.js.map +1 -0
- package/dist/cjs/toolbar/ImageDialog.cjs +115 -0
- package/dist/cjs/toolbar/ImageDialog.native.js +122 -0
- package/dist/cjs/toolbar/ImageDialog.native.js.map +1 -0
- package/dist/cjs/toolbar/LinkBubble.cjs +195 -0
- package/dist/cjs/toolbar/LinkBubble.native.js +204 -0
- package/dist/cjs/toolbar/LinkBubble.native.js.map +1 -0
- package/dist/cjs/toolbar/LinkDialog.cjs +138 -0
- package/dist/cjs/toolbar/LinkDialog.native.js +146 -0
- package/dist/cjs/toolbar/LinkDialog.native.js.map +1 -0
- package/dist/cjs/toolbar/ListPicker.cjs +117 -0
- package/dist/cjs/toolbar/ListPicker.native.js +124 -0
- package/dist/cjs/toolbar/ListPicker.native.js.map +1 -0
- package/dist/cjs/toolbar/MoreDropdown.cjs +201 -0
- package/dist/cjs/toolbar/MoreDropdown.native.js +224 -0
- package/dist/cjs/toolbar/MoreDropdown.native.js.map +1 -0
- package/dist/cjs/toolbar/ResizeHandle.cjs +105 -0
- package/dist/cjs/toolbar/ResizeHandle.native.js +109 -0
- package/dist/cjs/toolbar/ResizeHandle.native.js.map +1 -0
- package/dist/cjs/toolbar/StatusBar.cjs +91 -0
- package/dist/cjs/toolbar/StatusBar.native.js +100 -0
- package/dist/cjs/toolbar/StatusBar.native.js.map +1 -0
- package/dist/cjs/toolbar/TableBubble.cjs +232 -0
- package/dist/cjs/toolbar/TableBubble.native.js +273 -0
- package/dist/cjs/toolbar/TableBubble.native.js.map +1 -0
- package/dist/cjs/toolbar/ToolbarButton.cjs +105 -0
- package/dist/cjs/toolbar/ToolbarButton.native.js +97 -0
- package/dist/cjs/toolbar/ToolbarButton.native.js.map +1 -0
- package/dist/cjs/toolbar/ToolbarGroup.cjs +41 -0
- package/dist/cjs/toolbar/ToolbarGroup.native.js +45 -0
- package/dist/cjs/toolbar/ToolbarGroup.native.js.map +1 -0
- package/dist/cjs/toolbar/icons.cjs +601 -0
- package/dist/cjs/toolbar/icons.native.js +165 -0
- package/dist/cjs/toolbar/icons.native.js.map +1 -0
- package/dist/cjs/toolbar/shortcuts.cjs +62 -0
- package/dist/cjs/toolbar/shortcuts.native.js +66 -0
- package/dist/cjs/toolbar/shortcuts.native.js.map +1 -0
- package/dist/cjs/toolbar/useHorizontalScroll.cjs +250 -0
- package/dist/cjs/toolbar/useHorizontalScroll.native.js +260 -0
- package/dist/cjs/toolbar/useHorizontalScroll.native.js.map +1 -0
- package/dist/cjs/types.cjs +56 -0
- package/dist/cjs/types.native.js +59 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/esm/RichEditor.mjs +107 -0
- package/dist/esm/RichEditor.mjs.map +1 -0
- package/dist/esm/RichEditor.native.js +92 -0
- package/dist/esm/RichEditor.native.js.map +1 -0
- package/dist/esm/RichEditor.stories.mjs +291 -0
- package/dist/esm/RichEditor.stories.mjs.map +1 -0
- package/dist/esm/RichEditor.stories.native.js +303 -0
- package/dist/esm/RichEditor.stories.native.js.map +1 -0
- package/dist/esm/RichTextEditor/index.mjs +123 -0
- package/dist/esm/RichTextEditor/index.mjs.map +1 -0
- package/dist/esm/RichTextEditor/index.native.js +132 -0
- package/dist/esm/RichTextEditor/index.native.js.map +1 -0
- package/dist/esm/constants.mjs +108 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/constants.native.js +108 -0
- package/dist/esm/constants.native.js.map +1 -0
- package/dist/esm/context.mjs +8 -0
- package/dist/esm/context.mjs.map +1 -0
- package/dist/esm/context.native.js +8 -0
- package/dist/esm/context.native.js.map +1 -0
- package/dist/esm/editor/BlockDragHandle.mjs +112 -0
- package/dist/esm/editor/BlockDragHandle.mjs.map +1 -0
- package/dist/esm/editor/BlockDragHandle.native.js +114 -0
- package/dist/esm/editor/BlockDragHandle.native.js.map +1 -0
- package/dist/esm/editor/MarkdownPaste.mjs +40 -0
- package/dist/esm/editor/MarkdownPaste.mjs.map +1 -0
- package/dist/esm/editor/MarkdownPaste.native.js +40 -0
- package/dist/esm/editor/MarkdownPaste.native.js.map +1 -0
- package/dist/esm/editor/SlashCommands.mjs +333 -0
- package/dist/esm/editor/SlashCommands.mjs.map +1 -0
- package/dist/esm/editor/SlashCommands.native.js +385 -0
- package/dist/esm/editor/SlashCommands.native.js.map +1 -0
- package/dist/esm/editor/TentapEditor.native.js +214 -0
- package/dist/esm/editor/TentapEditor.native.js.map +1 -0
- package/dist/esm/editor/TiptapEditor.mjs +542 -0
- package/dist/esm/editor/TiptapEditor.mjs.map +1 -0
- package/dist/esm/editor/TiptapEditor.native.js +622 -0
- package/dist/esm/editor/TiptapEditor.native.js.map +1 -0
- package/dist/esm/editor/editorStyles.mjs +247 -0
- package/dist/esm/editor/editorStyles.mjs.map +1 -0
- package/dist/esm/editor/editorStyles.native.js +248 -0
- package/dist/esm/editor/editorStyles.native.js.map +1 -0
- package/dist/esm/editor/index.mjs +5 -0
- package/dist/esm/editor/index.mjs.map +1 -0
- package/dist/esm/editor/index.native.js +5 -0
- package/dist/esm/editor/index.native.js.map +1 -0
- package/dist/esm/editor/types.mjs +29 -0
- package/dist/esm/editor/types.mjs.map +1 -0
- package/dist/esm/editor/types.native.js +29 -0
- package/dist/esm/editor/types.native.js.map +1 -0
- package/dist/esm/editor/useEditorState.mjs +102 -0
- package/dist/esm/editor/useEditorState.mjs.map +1 -0
- package/dist/esm/editor/useEditorState.native.js +105 -0
- package/dist/esm/editor/useEditorState.native.js.map +1 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +4 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/styled.mjs +144 -0
- package/dist/esm/styled.mjs.map +1 -0
- package/dist/esm/styled.native.js +153 -0
- package/dist/esm/styled.native.js.map +1 -0
- package/dist/esm/toolbar/BubbleToolbar.mjs +105 -0
- package/dist/esm/toolbar/BubbleToolbar.mjs.map +1 -0
- package/dist/esm/toolbar/BubbleToolbar.native.js +131 -0
- package/dist/esm/toolbar/BubbleToolbar.native.js.map +1 -0
- package/dist/esm/toolbar/CodeBlockBubble.mjs +186 -0
- package/dist/esm/toolbar/CodeBlockBubble.mjs.map +1 -0
- package/dist/esm/toolbar/CodeBlockBubble.native.js +200 -0
- package/dist/esm/toolbar/CodeBlockBubble.native.js.map +1 -0
- package/dist/esm/toolbar/ColorPicker.mjs +191 -0
- package/dist/esm/toolbar/ColorPicker.mjs.map +1 -0
- package/dist/esm/toolbar/ColorPicker.native.js +205 -0
- package/dist/esm/toolbar/ColorPicker.native.js.map +1 -0
- package/dist/esm/toolbar/FixedToolbar.mjs +196 -0
- package/dist/esm/toolbar/FixedToolbar.mjs.map +1 -0
- package/dist/esm/toolbar/FixedToolbar.native.js +294 -0
- package/dist/esm/toolbar/FixedToolbar.native.js.map +1 -0
- package/dist/esm/toolbar/HeadingPicker.mjs +133 -0
- package/dist/esm/toolbar/HeadingPicker.mjs.map +1 -0
- package/dist/esm/toolbar/HeadingPicker.native.js +139 -0
- package/dist/esm/toolbar/HeadingPicker.native.js.map +1 -0
- package/dist/esm/toolbar/ImageBubble.mjs +131 -0
- package/dist/esm/toolbar/ImageBubble.mjs.map +1 -0
- package/dist/esm/toolbar/ImageBubble.native.js +137 -0
- package/dist/esm/toolbar/ImageBubble.native.js.map +1 -0
- package/dist/esm/toolbar/ImageDialog.mjs +90 -0
- package/dist/esm/toolbar/ImageDialog.mjs.map +1 -0
- package/dist/esm/toolbar/ImageDialog.native.js +94 -0
- package/dist/esm/toolbar/ImageDialog.native.js.map +1 -0
- package/dist/esm/toolbar/LinkBubble.mjs +170 -0
- package/dist/esm/toolbar/LinkBubble.mjs.map +1 -0
- package/dist/esm/toolbar/LinkBubble.native.js +176 -0
- package/dist/esm/toolbar/LinkBubble.native.js.map +1 -0
- package/dist/esm/toolbar/LinkDialog.mjs +112 -0
- package/dist/esm/toolbar/LinkDialog.mjs.map +1 -0
- package/dist/esm/toolbar/LinkDialog.native.js +117 -0
- package/dist/esm/toolbar/LinkDialog.native.js.map +1 -0
- package/dist/esm/toolbar/ListPicker.mjs +92 -0
- package/dist/esm/toolbar/ListPicker.mjs.map +1 -0
- package/dist/esm/toolbar/ListPicker.native.js +96 -0
- package/dist/esm/toolbar/ListPicker.native.js.map +1 -0
- package/dist/esm/toolbar/MoreDropdown.mjs +176 -0
- package/dist/esm/toolbar/MoreDropdown.mjs.map +1 -0
- package/dist/esm/toolbar/MoreDropdown.native.js +196 -0
- package/dist/esm/toolbar/MoreDropdown.native.js.map +1 -0
- package/dist/esm/toolbar/ResizeHandle.mjs +80 -0
- package/dist/esm/toolbar/ResizeHandle.mjs.map +1 -0
- package/dist/esm/toolbar/ResizeHandle.native.js +81 -0
- package/dist/esm/toolbar/ResizeHandle.native.js.map +1 -0
- package/dist/esm/toolbar/StatusBar.mjs +66 -0
- package/dist/esm/toolbar/StatusBar.mjs.map +1 -0
- package/dist/esm/toolbar/StatusBar.native.js +72 -0
- package/dist/esm/toolbar/StatusBar.native.js.map +1 -0
- package/dist/esm/toolbar/TableBubble.mjs +207 -0
- package/dist/esm/toolbar/TableBubble.mjs.map +1 -0
- package/dist/esm/toolbar/TableBubble.native.js +245 -0
- package/dist/esm/toolbar/TableBubble.native.js.map +1 -0
- package/dist/esm/toolbar/ToolbarButton.mjs +79 -0
- package/dist/esm/toolbar/ToolbarButton.mjs.map +1 -0
- package/dist/esm/toolbar/ToolbarButton.native.js +68 -0
- package/dist/esm/toolbar/ToolbarButton.native.js.map +1 -0
- package/dist/esm/toolbar/ToolbarGroup.mjs +16 -0
- package/dist/esm/toolbar/ToolbarGroup.mjs.map +1 -0
- package/dist/esm/toolbar/ToolbarGroup.native.js +17 -0
- package/dist/esm/toolbar/ToolbarGroup.native.js.map +1 -0
- package/dist/esm/toolbar/icons.mjs +554 -0
- package/dist/esm/toolbar/icons.mjs.map +1 -0
- package/dist/esm/toolbar/icons.native.js +115 -0
- package/dist/esm/toolbar/icons.native.js.map +1 -0
- package/dist/esm/toolbar/shortcuts.mjs +36 -0
- package/dist/esm/toolbar/shortcuts.mjs.map +1 -0
- package/dist/esm/toolbar/shortcuts.native.js +37 -0
- package/dist/esm/toolbar/shortcuts.native.js.map +1 -0
- package/dist/esm/toolbar/useHorizontalScroll.mjs +223 -0
- package/dist/esm/toolbar/useHorizontalScroll.mjs.map +1 -0
- package/dist/esm/toolbar/useHorizontalScroll.native.js +230 -0
- package/dist/esm/toolbar/useHorizontalScroll.native.js.map +1 -0
- package/dist/esm/types.mjs +31 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +31 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/jsx/RichEditor.mjs +107 -0
- package/dist/jsx/RichEditor.mjs.map +1 -0
- package/dist/jsx/RichEditor.native.js +120 -0
- package/dist/jsx/RichEditor.native.js.map +1 -0
- package/dist/jsx/RichEditor.stories.mjs +291 -0
- package/dist/jsx/RichEditor.stories.mjs.map +1 -0
- package/dist/jsx/RichEditor.stories.native.js +342 -0
- package/dist/jsx/RichEditor.stories.native.js.map +1 -0
- package/dist/jsx/RichTextEditor/index.mjs +123 -0
- package/dist/jsx/RichTextEditor/index.mjs.map +1 -0
- package/dist/jsx/RichTextEditor/index.native.js +160 -0
- package/dist/jsx/RichTextEditor/index.native.js.map +1 -0
- package/dist/jsx/constants.mjs +108 -0
- package/dist/jsx/constants.mjs.map +1 -0
- package/dist/jsx/constants.native.js +138 -0
- package/dist/jsx/constants.native.js.map +1 -0
- package/dist/jsx/context.mjs +8 -0
- package/dist/jsx/context.mjs.map +1 -0
- package/dist/jsx/context.native.js +36 -0
- package/dist/jsx/context.native.js.map +1 -0
- package/dist/jsx/editor/BlockDragHandle.mjs +112 -0
- package/dist/jsx/editor/BlockDragHandle.mjs.map +1 -0
- package/dist/jsx/editor/BlockDragHandle.native.js +142 -0
- package/dist/jsx/editor/BlockDragHandle.native.js.map +1 -0
- package/dist/jsx/editor/MarkdownPaste.mjs +40 -0
- package/dist/jsx/editor/MarkdownPaste.mjs.map +1 -0
- package/dist/jsx/editor/MarkdownPaste.native.js +68 -0
- package/dist/jsx/editor/MarkdownPaste.native.js.map +1 -0
- package/dist/jsx/editor/SlashCommands.mjs +333 -0
- package/dist/jsx/editor/SlashCommands.mjs.map +1 -0
- package/dist/jsx/editor/SlashCommands.native.js +424 -0
- package/dist/jsx/editor/SlashCommands.native.js.map +1 -0
- package/dist/jsx/editor/TentapEditor.native.js +242 -0
- package/dist/jsx/editor/TentapEditor.native.js.map +1 -0
- package/dist/jsx/editor/TiptapEditor.mjs +542 -0
- package/dist/jsx/editor/TiptapEditor.mjs.map +1 -0
- package/dist/jsx/editor/TiptapEditor.native.js +661 -0
- package/dist/jsx/editor/TiptapEditor.native.js.map +1 -0
- package/dist/jsx/editor/editorStyles.mjs +247 -0
- package/dist/jsx/editor/editorStyles.mjs.map +1 -0
- package/dist/jsx/editor/editorStyles.native.js +276 -0
- package/dist/jsx/editor/editorStyles.native.js.map +1 -0
- package/dist/jsx/editor/index.mjs +5 -0
- package/dist/jsx/editor/index.mjs.map +1 -0
- package/dist/jsx/editor/index.native.js +36 -0
- package/dist/jsx/editor/index.native.js.map +1 -0
- package/dist/jsx/editor/types.mjs +29 -0
- package/dist/jsx/editor/types.mjs.map +1 -0
- package/dist/jsx/editor/types.native.js +57 -0
- package/dist/jsx/editor/types.native.js.map +1 -0
- package/dist/jsx/editor/useEditorState.mjs +102 -0
- package/dist/jsx/editor/useEditorState.mjs.map +1 -0
- package/dist/jsx/editor/useEditorState.native.js +135 -0
- package/dist/jsx/editor/useEditorState.native.js.map +1 -0
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +4 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +33 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/styled.mjs +144 -0
- package/dist/jsx/styled.mjs.map +1 -0
- package/dist/jsx/styled.native.js +185 -0
- package/dist/jsx/styled.native.js.map +1 -0
- package/dist/jsx/toolbar/BubbleToolbar.mjs +105 -0
- package/dist/jsx/toolbar/BubbleToolbar.mjs.map +1 -0
- package/dist/jsx/toolbar/BubbleToolbar.native.js +159 -0
- package/dist/jsx/toolbar/BubbleToolbar.native.js.map +1 -0
- package/dist/jsx/toolbar/CodeBlockBubble.mjs +186 -0
- package/dist/jsx/toolbar/CodeBlockBubble.mjs.map +1 -0
- package/dist/jsx/toolbar/CodeBlockBubble.native.js +228 -0
- package/dist/jsx/toolbar/CodeBlockBubble.native.js.map +1 -0
- package/dist/jsx/toolbar/ColorPicker.mjs +191 -0
- package/dist/jsx/toolbar/ColorPicker.mjs.map +1 -0
- package/dist/jsx/toolbar/ColorPicker.native.js +234 -0
- package/dist/jsx/toolbar/ColorPicker.native.js.map +1 -0
- package/dist/jsx/toolbar/FixedToolbar.mjs +196 -0
- package/dist/jsx/toolbar/FixedToolbar.mjs.map +1 -0
- package/dist/jsx/toolbar/FixedToolbar.native.js +322 -0
- package/dist/jsx/toolbar/FixedToolbar.native.js.map +1 -0
- package/dist/jsx/toolbar/HeadingPicker.mjs +133 -0
- package/dist/jsx/toolbar/HeadingPicker.mjs.map +1 -0
- package/dist/jsx/toolbar/HeadingPicker.native.js +167 -0
- package/dist/jsx/toolbar/HeadingPicker.native.js.map +1 -0
- package/dist/jsx/toolbar/ImageBubble.mjs +131 -0
- package/dist/jsx/toolbar/ImageBubble.mjs.map +1 -0
- package/dist/jsx/toolbar/ImageBubble.native.js +165 -0
- package/dist/jsx/toolbar/ImageBubble.native.js.map +1 -0
- package/dist/jsx/toolbar/ImageDialog.mjs +90 -0
- package/dist/jsx/toolbar/ImageDialog.mjs.map +1 -0
- package/dist/jsx/toolbar/ImageDialog.native.js +122 -0
- package/dist/jsx/toolbar/ImageDialog.native.js.map +1 -0
- package/dist/jsx/toolbar/LinkBubble.mjs +170 -0
- package/dist/jsx/toolbar/LinkBubble.mjs.map +1 -0
- package/dist/jsx/toolbar/LinkBubble.native.js +204 -0
- package/dist/jsx/toolbar/LinkBubble.native.js.map +1 -0
- package/dist/jsx/toolbar/LinkDialog.mjs +112 -0
- package/dist/jsx/toolbar/LinkDialog.mjs.map +1 -0
- package/dist/jsx/toolbar/LinkDialog.native.js +146 -0
- package/dist/jsx/toolbar/LinkDialog.native.js.map +1 -0
- package/dist/jsx/toolbar/ListPicker.mjs +92 -0
- package/dist/jsx/toolbar/ListPicker.mjs.map +1 -0
- package/dist/jsx/toolbar/ListPicker.native.js +124 -0
- package/dist/jsx/toolbar/ListPicker.native.js.map +1 -0
- package/dist/jsx/toolbar/MoreDropdown.mjs +176 -0
- package/dist/jsx/toolbar/MoreDropdown.mjs.map +1 -0
- package/dist/jsx/toolbar/MoreDropdown.native.js +224 -0
- package/dist/jsx/toolbar/MoreDropdown.native.js.map +1 -0
- package/dist/jsx/toolbar/ResizeHandle.mjs +80 -0
- package/dist/jsx/toolbar/ResizeHandle.mjs.map +1 -0
- package/dist/jsx/toolbar/ResizeHandle.native.js +109 -0
- package/dist/jsx/toolbar/ResizeHandle.native.js.map +1 -0
- package/dist/jsx/toolbar/StatusBar.mjs +66 -0
- package/dist/jsx/toolbar/StatusBar.mjs.map +1 -0
- package/dist/jsx/toolbar/StatusBar.native.js +100 -0
- package/dist/jsx/toolbar/StatusBar.native.js.map +1 -0
- package/dist/jsx/toolbar/TableBubble.mjs +207 -0
- package/dist/jsx/toolbar/TableBubble.mjs.map +1 -0
- package/dist/jsx/toolbar/TableBubble.native.js +273 -0
- package/dist/jsx/toolbar/TableBubble.native.js.map +1 -0
- package/dist/jsx/toolbar/ToolbarButton.mjs +79 -0
- package/dist/jsx/toolbar/ToolbarButton.mjs.map +1 -0
- package/dist/jsx/toolbar/ToolbarButton.native.js +97 -0
- package/dist/jsx/toolbar/ToolbarButton.native.js.map +1 -0
- package/dist/jsx/toolbar/ToolbarGroup.mjs +16 -0
- package/dist/jsx/toolbar/ToolbarGroup.mjs.map +1 -0
- package/dist/jsx/toolbar/ToolbarGroup.native.js +45 -0
- package/dist/jsx/toolbar/ToolbarGroup.native.js.map +1 -0
- package/dist/jsx/toolbar/icons.mjs +554 -0
- package/dist/jsx/toolbar/icons.mjs.map +1 -0
- package/dist/jsx/toolbar/icons.native.js +165 -0
- package/dist/jsx/toolbar/icons.native.js.map +1 -0
- package/dist/jsx/toolbar/shortcuts.mjs +36 -0
- package/dist/jsx/toolbar/shortcuts.mjs.map +1 -0
- package/dist/jsx/toolbar/shortcuts.native.js +66 -0
- package/dist/jsx/toolbar/shortcuts.native.js.map +1 -0
- package/dist/jsx/toolbar/useHorizontalScroll.mjs +223 -0
- package/dist/jsx/toolbar/useHorizontalScroll.mjs.map +1 -0
- package/dist/jsx/toolbar/useHorizontalScroll.native.js +260 -0
- package/dist/jsx/toolbar/useHorizontalScroll.native.js.map +1 -0
- package/dist/jsx/types.mjs +31 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +59 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/package.json +117 -0
- package/src/RichEditor.native.tsx +161 -0
- package/src/RichEditor.stories.tsx +324 -0
- package/src/RichEditor.tsx +185 -0
- package/src/RichTextEditor/index.tsx +245 -0
- package/src/RichTextEditor/richTextEditor.spec.tsx +239 -0
- package/src/constants.ts +100 -0
- package/src/context.spec.ts +9 -0
- package/src/context.ts +16 -0
- package/src/editor/BlockDragHandle.ts +141 -0
- package/src/editor/MarkdownPaste.ts +50 -0
- package/src/editor/SlashCommands.tsx +357 -0
- package/src/editor/TentapEditor.native.tsx +269 -0
- package/src/editor/TiptapEditor.tsx +616 -0
- package/src/editor/editorStyles.spec.ts +24 -0
- package/src/editor/editorStyles.ts +260 -0
- package/src/editor/index.ts +10 -0
- package/src/editor/tentapEditor.spec.ts +125 -0
- package/src/editor/tiptapEditor.spec.tsx +169 -0
- package/src/editor/types.ts +142 -0
- package/src/editor/useEditorState.spec.ts +93 -0
- package/src/editor/useEditorState.ts +125 -0
- package/src/exports.spec.ts +128 -0
- package/src/index.ts +13 -0
- package/src/integration.spec.tsx +430 -0
- package/src/richEditor.spec.tsx +169 -0
- package/src/styled.spec.tsx +42 -0
- package/src/styled.ts +177 -0
- package/src/toolbar/BubbleToolbar.tsx +151 -0
- package/src/toolbar/CodeBlockBubble.tsx +141 -0
- package/src/toolbar/ColorPicker.tsx +211 -0
- package/src/toolbar/FixedToolbar.native.tsx +381 -0
- package/src/toolbar/FixedToolbar.tsx +252 -0
- package/src/toolbar/HeadingPicker.tsx +169 -0
- package/src/toolbar/ImageBubble.tsx +126 -0
- package/src/toolbar/ImageDialog.tsx +93 -0
- package/src/toolbar/LinkBubble.tsx +166 -0
- package/src/toolbar/LinkDialog.tsx +124 -0
- package/src/toolbar/ListPicker.tsx +121 -0
- package/src/toolbar/MoreDropdown.tsx +185 -0
- package/src/toolbar/ResizeHandle.tsx +80 -0
- package/src/toolbar/StatusBar.tsx +76 -0
- package/src/toolbar/TableBubble.tsx +197 -0
- package/src/toolbar/ToolbarButton.native.tsx +105 -0
- package/src/toolbar/ToolbarButton.tsx +114 -0
- package/src/toolbar/ToolbarGroup.tsx +38 -0
- package/src/toolbar/bubbleToolbar.spec.tsx +93 -0
- package/src/toolbar/fixedToolbar.spec.tsx +127 -0
- package/src/toolbar/icons.native.tsx +112 -0
- package/src/toolbar/icons.tsx +417 -0
- package/src/toolbar/shortcuts.ts +42 -0
- package/src/toolbar/toolbarPrimitives.spec.tsx +118 -0
- package/src/toolbar/toolbarSubComponents.spec.tsx +115 -0
- package/src/toolbar/useHorizontalScroll.tsx +270 -0
- package/src/types.spec.ts +102 -0
- package/src/types.ts +217 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS styles for the ProseMirror editor content area.
|
|
3
|
+
*
|
|
4
|
+
* ProseMirror renders its own DOM outside Tamagui, so CSS injection via
|
|
5
|
+
* a <style> tag is necessary. Colors use Tamagui CSS custom properties
|
|
6
|
+
* for theme awareness.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface EditorCSSOptions {
|
|
10
|
+
/** Minimum height of the editor in pixels */
|
|
11
|
+
minHeight?: number;
|
|
12
|
+
/** Maximum height of the editor in pixels (enables scroll) */
|
|
13
|
+
maxHeight?: number;
|
|
14
|
+
/** CSS font-family string for body text */
|
|
15
|
+
bodyFontFamily?: string;
|
|
16
|
+
/** CSS font-family string for headings */
|
|
17
|
+
headingFontFamily?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getEditorCSS(options: EditorCSSOptions = {}): string {
|
|
21
|
+
const { minHeight = 150, maxHeight, bodyFontFamily, headingFontFamily } = options;
|
|
22
|
+
const bodyFont = bodyFontFamily || "inherit";
|
|
23
|
+
const headingFont = headingFontFamily || bodyFont;
|
|
24
|
+
|
|
25
|
+
return `
|
|
26
|
+
.ProseMirror {
|
|
27
|
+
padding: 12px 12px 12px 16px;
|
|
28
|
+
min-height: ${minHeight}px;
|
|
29
|
+
${maxHeight ? `max-height: ${maxHeight}px; overflow-y: auto;` : ""}
|
|
30
|
+
outline: none;
|
|
31
|
+
font-family: ${bodyFont};
|
|
32
|
+
color: var(--color12);
|
|
33
|
+
}
|
|
34
|
+
.ProseMirror:focus {
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
|
+
.ProseMirror p {
|
|
38
|
+
margin: 0 0 0.5em 0;
|
|
39
|
+
}
|
|
40
|
+
.ProseMirror p:last-child {
|
|
41
|
+
margin-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
.ProseMirror h1,
|
|
44
|
+
.ProseMirror h2,
|
|
45
|
+
.ProseMirror h3,
|
|
46
|
+
.ProseMirror h4,
|
|
47
|
+
.ProseMirror h5,
|
|
48
|
+
.ProseMirror h6 {
|
|
49
|
+
font-family: ${headingFont};
|
|
50
|
+
}
|
|
51
|
+
.ProseMirror h1 {
|
|
52
|
+
font-size: 2em;
|
|
53
|
+
font-weight: 700;
|
|
54
|
+
margin: 0.5em 0;
|
|
55
|
+
}
|
|
56
|
+
.ProseMirror h2 {
|
|
57
|
+
font-size: 1.5em;
|
|
58
|
+
font-weight: 600;
|
|
59
|
+
margin: 0.5em 0;
|
|
60
|
+
}
|
|
61
|
+
.ProseMirror h3 {
|
|
62
|
+
font-size: 1.17em;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
margin: 0.5em 0;
|
|
65
|
+
}
|
|
66
|
+
.ProseMirror h4 {
|
|
67
|
+
font-size: 1em;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
margin: 0.5em 0;
|
|
70
|
+
}
|
|
71
|
+
.ProseMirror h5 {
|
|
72
|
+
font-size: 0.875em;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
margin: 0.5em 0;
|
|
75
|
+
}
|
|
76
|
+
.ProseMirror h6 {
|
|
77
|
+
font-size: 0.75em;
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
margin: 0.5em 0;
|
|
80
|
+
}
|
|
81
|
+
.ProseMirror ul,
|
|
82
|
+
.ProseMirror ol {
|
|
83
|
+
padding-left: 1em;
|
|
84
|
+
margin: 0.5em 0;
|
|
85
|
+
}
|
|
86
|
+
.ProseMirror ul {
|
|
87
|
+
list-style-type: disc;
|
|
88
|
+
}
|
|
89
|
+
.ProseMirror ol {
|
|
90
|
+
list-style-type: decimal;
|
|
91
|
+
}
|
|
92
|
+
.ProseMirror li {
|
|
93
|
+
display: list-item;
|
|
94
|
+
line-height: 1.6;
|
|
95
|
+
}
|
|
96
|
+
.ProseMirror li p {
|
|
97
|
+
margin: 0;
|
|
98
|
+
}
|
|
99
|
+
.ProseMirror ul ul {
|
|
100
|
+
list-style-type: circle;
|
|
101
|
+
}
|
|
102
|
+
.ProseMirror ul ul ul {
|
|
103
|
+
list-style-type: square;
|
|
104
|
+
}
|
|
105
|
+
.ProseMirror ul[data-type="taskList"] {
|
|
106
|
+
list-style: none;
|
|
107
|
+
padding-left: 0;
|
|
108
|
+
margin-left: 0;
|
|
109
|
+
}
|
|
110
|
+
.ProseMirror ul[data-type="taskList"] li {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: flex-start;
|
|
113
|
+
gap: 0.5em;
|
|
114
|
+
}
|
|
115
|
+
.ProseMirror ul[data-type="taskList"] li > label {
|
|
116
|
+
flex: 0 0 auto;
|
|
117
|
+
margin-top: 0.2em;
|
|
118
|
+
}
|
|
119
|
+
.ProseMirror ul[data-type="taskList"] li > div {
|
|
120
|
+
flex: 1 1 auto;
|
|
121
|
+
}
|
|
122
|
+
.ProseMirror ul[data-type="taskList"] input[type="checkbox"] {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
width: 1em;
|
|
125
|
+
height: 1em;
|
|
126
|
+
}
|
|
127
|
+
.ProseMirror img {
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
height: auto;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
}
|
|
132
|
+
.ProseMirror img.ProseMirror-selectednode {
|
|
133
|
+
outline: 2px solid var(--blue10, #0066cc);
|
|
134
|
+
}
|
|
135
|
+
.ProseMirror blockquote {
|
|
136
|
+
border-left: 3px solid var(--color6, #ccc);
|
|
137
|
+
padding-left: 1em;
|
|
138
|
+
margin: 0.5em 0;
|
|
139
|
+
color: var(--color10, #666);
|
|
140
|
+
}
|
|
141
|
+
.ProseMirror code {
|
|
142
|
+
background-color: var(--color4, rgba(0,0,0,0.05));
|
|
143
|
+
padding: 0.15em 0.35em;
|
|
144
|
+
border-radius: 4px;
|
|
145
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
146
|
+
font-size: 0.875em;
|
|
147
|
+
word-break: break-word;
|
|
148
|
+
}
|
|
149
|
+
.ProseMirror pre {
|
|
150
|
+
background-color: var(--color3, rgba(0,0,0,0.04));
|
|
151
|
+
border: 1px solid var(--color5, rgba(0,0,0,0.08));
|
|
152
|
+
padding: 0.75em 1em;
|
|
153
|
+
border-radius: 4px;
|
|
154
|
+
overflow-x: auto;
|
|
155
|
+
margin: 0.5em 0;
|
|
156
|
+
display: block;
|
|
157
|
+
width: 100%;
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
}
|
|
160
|
+
.ProseMirror pre code {
|
|
161
|
+
background: none;
|
|
162
|
+
border: none;
|
|
163
|
+
padding: 0;
|
|
164
|
+
border-radius: 0;
|
|
165
|
+
font-size: 0.875em;
|
|
166
|
+
color: inherit;
|
|
167
|
+
word-break: normal;
|
|
168
|
+
white-space: pre;
|
|
169
|
+
}
|
|
170
|
+
.ProseMirror a {
|
|
171
|
+
color: var(--blue10, #0066cc);
|
|
172
|
+
text-decoration: underline;
|
|
173
|
+
}
|
|
174
|
+
.ProseMirror hr {
|
|
175
|
+
border: none;
|
|
176
|
+
border-top: 2px solid var(--color6, #ccc);
|
|
177
|
+
margin: 1em 0;
|
|
178
|
+
}
|
|
179
|
+
.ProseMirror p.is-editor-empty:first-child::before {
|
|
180
|
+
content: attr(data-placeholder);
|
|
181
|
+
color: var(--color8, #aaa);
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
float: left;
|
|
184
|
+
height: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Block drag handle */
|
|
188
|
+
.block-drag-handle:hover {
|
|
189
|
+
background-color: var(--color4, rgba(0,0,0,0.05));
|
|
190
|
+
opacity: 1 !important;
|
|
191
|
+
}
|
|
192
|
+
.block-drag-handle:active {
|
|
193
|
+
cursor: grabbing;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Tables */
|
|
197
|
+
.ProseMirror table {
|
|
198
|
+
border-collapse: collapse;
|
|
199
|
+
width: 100%;
|
|
200
|
+
margin: 0.5em 0;
|
|
201
|
+
overflow: hidden;
|
|
202
|
+
}
|
|
203
|
+
.ProseMirror td,
|
|
204
|
+
.ProseMirror th {
|
|
205
|
+
border: 1px solid var(--color6, #ddd);
|
|
206
|
+
padding: 0.4em 0.6em;
|
|
207
|
+
vertical-align: top;
|
|
208
|
+
position: relative;
|
|
209
|
+
min-width: 80px;
|
|
210
|
+
}
|
|
211
|
+
.ProseMirror th {
|
|
212
|
+
background-color: var(--color3, #f5f5f5);
|
|
213
|
+
font-weight: 600;
|
|
214
|
+
}
|
|
215
|
+
.ProseMirror .selectedCell {
|
|
216
|
+
background-color: var(--blue3, rgba(0, 102, 204, 0.08));
|
|
217
|
+
}
|
|
218
|
+
.ProseMirror .column-resize-handle {
|
|
219
|
+
position: absolute;
|
|
220
|
+
right: -2px;
|
|
221
|
+
top: 0;
|
|
222
|
+
bottom: 0;
|
|
223
|
+
width: 4px;
|
|
224
|
+
background-color: var(--blue10, #0066cc);
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
}
|
|
227
|
+
.ProseMirror.resize-cursor {
|
|
228
|
+
cursor: col-resize;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Syntax highlighting (lowlight / highlight.js compatible) */
|
|
232
|
+
.ProseMirror pre .hljs-comment,
|
|
233
|
+
.ProseMirror pre .hljs-quote { color: var(--color9, #6a737d); font-style: italic; }
|
|
234
|
+
.ProseMirror pre .hljs-keyword,
|
|
235
|
+
.ProseMirror pre .hljs-selector-tag,
|
|
236
|
+
.ProseMirror pre .hljs-meta { color: var(--purple10, #d73a49); }
|
|
237
|
+
.ProseMirror pre .hljs-string,
|
|
238
|
+
.ProseMirror pre .hljs-attr,
|
|
239
|
+
.ProseMirror pre .hljs-template-tag,
|
|
240
|
+
.ProseMirror pre .hljs-template-variable { color: var(--green10, #22863a); }
|
|
241
|
+
.ProseMirror pre .hljs-number,
|
|
242
|
+
.ProseMirror pre .hljs-literal,
|
|
243
|
+
.ProseMirror pre .hljs-type,
|
|
244
|
+
.ProseMirror pre .hljs-params { color: var(--blue10, #005cc5); }
|
|
245
|
+
.ProseMirror pre .hljs-built_in,
|
|
246
|
+
.ProseMirror pre .hljs-builtin-name { color: var(--orange10, #e36209); }
|
|
247
|
+
.ProseMirror pre .hljs-title,
|
|
248
|
+
.ProseMirror pre .hljs-section { color: var(--blue10, #005cc5); font-weight: 600; }
|
|
249
|
+
.ProseMirror pre .hljs-name,
|
|
250
|
+
.ProseMirror pre .hljs-tag { color: var(--green10, #22863a); }
|
|
251
|
+
.ProseMirror pre .hljs-attribute { color: var(--purple10, #6f42c1); }
|
|
252
|
+
.ProseMirror pre .hljs-variable,
|
|
253
|
+
.ProseMirror pre .hljs-symbol,
|
|
254
|
+
.ProseMirror pre .hljs-bullet { color: var(--orange10, #e36209); }
|
|
255
|
+
.ProseMirror pre .hljs-addition { color: var(--green10, #22863a); background-color: rgba(34,134,58,0.1); }
|
|
256
|
+
.ProseMirror pre .hljs-deletion { color: var(--red10, #b31d28); background-color: rgba(179,29,40,0.1); }
|
|
257
|
+
.ProseMirror pre .hljs-emphasis { font-style: italic; }
|
|
258
|
+
.ProseMirror pre .hljs-strong { font-weight: bold; }
|
|
259
|
+
`;
|
|
260
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor internal exports
|
|
3
|
+
*
|
|
4
|
+
* These are implementation details used by the compound component.
|
|
5
|
+
* Public API is exported from src/index.ts.
|
|
6
|
+
*/
|
|
7
|
+
export { TiptapEditor } from "./TiptapEditor";
|
|
8
|
+
export type { TiptapEditorProps } from "./TiptapEditor";
|
|
9
|
+
export { getEditorCSS } from "./editorStyles";
|
|
10
|
+
export { getEditorStateFromTiptap, getEditorStateFromBridge } from "./useEditorState";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { NATIVE_SUPPORTED_COMMANDS } from "../constants";
|
|
3
|
+
import { getEditorStateFromBridge } from "./useEditorState";
|
|
4
|
+
|
|
5
|
+
// ===========================================================================
|
|
6
|
+
// Test bridge extensions configuration
|
|
7
|
+
// ===========================================================================
|
|
8
|
+
|
|
9
|
+
describe("TentapEditor bridge extensions", () => {
|
|
10
|
+
it("includes ColorBridge, HighlightBridge, ImageBridge, and TaskListBridge", () => {
|
|
11
|
+
// We validate the bridge state mapping reads the fields these bridges
|
|
12
|
+
// provide. Since this is a .native.tsx file we cannot directly import
|
|
13
|
+
// in a web test environment, so we verify the state mapping and
|
|
14
|
+
// supported commands map which are the integration points.
|
|
15
|
+
|
|
16
|
+
const bridgeState = {
|
|
17
|
+
isBoldActive: false,
|
|
18
|
+
isItalicActive: false,
|
|
19
|
+
isUnderlineActive: false,
|
|
20
|
+
isStrikeActive: false,
|
|
21
|
+
isCodeActive: false,
|
|
22
|
+
headingLevel: 0,
|
|
23
|
+
isBulletListActive: false,
|
|
24
|
+
isOrderedListActive: false,
|
|
25
|
+
isTaskListActive: true,
|
|
26
|
+
isBlockquoteActive: false,
|
|
27
|
+
isLinkActive: false,
|
|
28
|
+
canUndo: false,
|
|
29
|
+
canRedo: false,
|
|
30
|
+
activeColor: "#e53935",
|
|
31
|
+
activeHighlight: "#fff59d",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const state = getEditorStateFromBridge(bridgeState);
|
|
35
|
+
|
|
36
|
+
// ColorBridge fields
|
|
37
|
+
expect(state.textColor).toBe("#e53935");
|
|
38
|
+
// HighlightBridge fields
|
|
39
|
+
expect(state.highlightColor).toBe("#fff59d");
|
|
40
|
+
// TaskListBridge fields
|
|
41
|
+
expect(state.isTaskList).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// ===========================================================================
|
|
46
|
+
// Test executeCommand bridge method mapping
|
|
47
|
+
// ===========================================================================
|
|
48
|
+
|
|
49
|
+
describe("TentapEditor executeCommand mapping", () => {
|
|
50
|
+
it("textColor, highlight, image, and taskList are not no-ops", () => {
|
|
51
|
+
// Validate through the NATIVE_SUPPORTED_COMMANDS map that these commands
|
|
52
|
+
// are marked as supported (meaning they have real bridge implementations)
|
|
53
|
+
expect(NATIVE_SUPPORTED_COMMANDS.textColor).toBe(true);
|
|
54
|
+
expect(NATIVE_SUPPORTED_COMMANDS.highlight).toBe(true);
|
|
55
|
+
expect(NATIVE_SUPPORTED_COMMANDS.image).toBe(true);
|
|
56
|
+
expect(NATIVE_SUPPORTED_COMMANDS.taskList).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("genuinely unsupported features are marked as unsupported", () => {
|
|
60
|
+
expect(NATIVE_SUPPORTED_COMMANDS.subscript).toBe(false);
|
|
61
|
+
expect(NATIVE_SUPPORTED_COMMANDS.superscript).toBe(false);
|
|
62
|
+
expect(NATIVE_SUPPORTED_COMMANDS.codeBlock).toBe(false);
|
|
63
|
+
expect(NATIVE_SUPPORTED_COMMANDS.horizontalRule).toBe(false);
|
|
64
|
+
expect(NATIVE_SUPPORTED_COMMANDS.clearFormatting).toBe(false);
|
|
65
|
+
expect(NATIVE_SUPPORTED_COMMANDS.alignLeft).toBe(false);
|
|
66
|
+
expect(NATIVE_SUPPORTED_COMMANDS.alignCenter).toBe(false);
|
|
67
|
+
expect(NATIVE_SUPPORTED_COMMANDS.alignRight).toBe(false);
|
|
68
|
+
expect(NATIVE_SUPPORTED_COMMANDS.alignJustify).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// ===========================================================================
|
|
73
|
+
// Test mapBridgeStateToEditorState (getEditorStateFromBridge)
|
|
74
|
+
// ===========================================================================
|
|
75
|
+
|
|
76
|
+
describe("getEditorStateFromBridge for TentapEditor", () => {
|
|
77
|
+
it("reads activeColor, activeHighlight, and isTaskListActive from bridge state", () => {
|
|
78
|
+
const bridgeState = {
|
|
79
|
+
isBoldActive: true,
|
|
80
|
+
isItalicActive: false,
|
|
81
|
+
isUnderlineActive: true,
|
|
82
|
+
isStrikeActive: false,
|
|
83
|
+
isCodeActive: false,
|
|
84
|
+
headingLevel: 2,
|
|
85
|
+
isBulletListActive: false,
|
|
86
|
+
isOrderedListActive: false,
|
|
87
|
+
isTaskListActive: true,
|
|
88
|
+
isBlockquoteActive: false,
|
|
89
|
+
isLinkActive: true,
|
|
90
|
+
canUndo: true,
|
|
91
|
+
canRedo: false,
|
|
92
|
+
activeColor: "#1e88e5",
|
|
93
|
+
activeHighlight: "#c8e6c9",
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const state = getEditorStateFromBridge(bridgeState);
|
|
97
|
+
|
|
98
|
+
// Values should come from the bridge, not hardcoded
|
|
99
|
+
expect(state.textColor).toBe("#1e88e5");
|
|
100
|
+
expect(state.highlightColor).toBe("#c8e6c9");
|
|
101
|
+
expect(state.isTaskList).toBe(true);
|
|
102
|
+
|
|
103
|
+
// Other state should map correctly
|
|
104
|
+
expect(state.isBold).toBe(true);
|
|
105
|
+
expect(state.isUnderline).toBe(true);
|
|
106
|
+
expect(state.isHeading2).toBe(true);
|
|
107
|
+
expect(state.isParagraph).toBe(false);
|
|
108
|
+
expect(state.isLink).toBe(true);
|
|
109
|
+
expect(state.canUndo).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("returns null for color fields when bridge does not provide them", () => {
|
|
113
|
+
const bridgeState = {
|
|
114
|
+
isBoldActive: false,
|
|
115
|
+
headingLevel: 0,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const state = getEditorStateFromBridge(bridgeState);
|
|
119
|
+
|
|
120
|
+
// When bridge doesn't provide color fields, should be null
|
|
121
|
+
expect(state.textColor).toBeNull();
|
|
122
|
+
expect(state.highlightColor).toBeNull();
|
|
123
|
+
expect(state.isTaskList).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
vi.mock("@multiplatform.one/forms", () => ({
|
|
4
|
+
Button: (props: any) => (
|
|
5
|
+
<button
|
|
6
|
+
role="button"
|
|
7
|
+
aria-label={props["aria-label"]}
|
|
8
|
+
disabled={props.disabled}
|
|
9
|
+
onClick={props.onPress}
|
|
10
|
+
>
|
|
11
|
+
{props.children}
|
|
12
|
+
</button>
|
|
13
|
+
),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
vi.mock("@multiplatform.one/components", () => ({
|
|
17
|
+
Tooltip: ({ children }: any) => children,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
vi.mock("@tiptap/react/menus", () => ({
|
|
21
|
+
BubbleMenu: ({ children }: any) => <div data-testid="bubble-menu">{children}</div>,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// Mock useEditor and EditorContent from @tiptap/react
|
|
25
|
+
const mockEditor = {
|
|
26
|
+
isActive: vi.fn().mockReturnValue(false),
|
|
27
|
+
getAttributes: vi.fn().mockReturnValue({}),
|
|
28
|
+
can: vi.fn().mockReturnValue({ undo: () => false, redo: () => false }),
|
|
29
|
+
getHTML: vi.fn().mockReturnValue("<p></p>"),
|
|
30
|
+
getJSON: vi.fn().mockReturnValue({ type: "doc", content: [] }),
|
|
31
|
+
chain: vi.fn().mockReturnValue({
|
|
32
|
+
focus: vi.fn().mockReturnValue({
|
|
33
|
+
toggleBold: vi.fn().mockReturnValue({ run: vi.fn() }),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
commands: {
|
|
37
|
+
setContent: vi.fn(),
|
|
38
|
+
focus: vi.fn(),
|
|
39
|
+
blur: vi.fn(),
|
|
40
|
+
},
|
|
41
|
+
setEditable: vi.fn(),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
vi.mock("@tiptap/react", () => ({
|
|
45
|
+
useEditor: vi.fn().mockReturnValue(mockEditor),
|
|
46
|
+
EditorContent: ({ editor: _editor }: any) => <div data-testid="editor-content">Editor</div>,
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
vi.mock("@tiptap/starter-kit", () => ({
|
|
50
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
51
|
+
}));
|
|
52
|
+
vi.mock("@tiptap/extension-underline", () => ({ default: {} }));
|
|
53
|
+
vi.mock("@tiptap/extension-link", () => ({
|
|
54
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
55
|
+
}));
|
|
56
|
+
vi.mock("@tiptap/extension-placeholder", () => ({
|
|
57
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
58
|
+
}));
|
|
59
|
+
vi.mock("@tiptap/extension-text-align", () => ({
|
|
60
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
61
|
+
}));
|
|
62
|
+
vi.mock("@tiptap/extension-color", () => ({ Color: {} }));
|
|
63
|
+
vi.mock("@tiptap/extension-text-style", () => ({ TextStyle: {} }));
|
|
64
|
+
vi.mock("@tiptap/extension-highlight", () => ({
|
|
65
|
+
Highlight: { configure: vi.fn().mockReturnValue({}) },
|
|
66
|
+
}));
|
|
67
|
+
vi.mock("@tiptap/extension-subscript", () => ({ Subscript: {} }));
|
|
68
|
+
vi.mock("@tiptap/extension-superscript", () => ({ Superscript: {} }));
|
|
69
|
+
vi.mock("@tiptap/extension-task-list", () => ({ default: {} }));
|
|
70
|
+
vi.mock("@tiptap/extension-task-item", () => ({
|
|
71
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
72
|
+
}));
|
|
73
|
+
vi.mock("@tiptap/extension-image", () => ({
|
|
74
|
+
default: { configure: vi.fn().mockReturnValue({}) },
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
import { createRef } from "react";
|
|
78
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
79
|
+
import { RichEditorContext } from "../context";
|
|
80
|
+
import type { RichEditorRef } from "../types";
|
|
81
|
+
import { getEditorCSS } from "./editorStyles";
|
|
82
|
+
|
|
83
|
+
const { TiptapEditor } = await import("./TiptapEditor");
|
|
84
|
+
|
|
85
|
+
function withContext(
|
|
86
|
+
ui: React.ReactElement,
|
|
87
|
+
ctxProps?: { size?: any; compact?: boolean; disabled?: boolean },
|
|
88
|
+
) {
|
|
89
|
+
return (
|
|
90
|
+
<RichEditorContext.Provider
|
|
91
|
+
size={ctxProps?.size ?? "$true"}
|
|
92
|
+
compact={ctxProps?.compact ?? false}
|
|
93
|
+
disabled={ctxProps?.disabled ?? false}
|
|
94
|
+
>
|
|
95
|
+
{ui}
|
|
96
|
+
</RichEditorContext.Provider>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
describe("TiptapEditor", () => {
|
|
101
|
+
it("renders with getEditorCSS() styles applied, not inline hardcoded CSS", () => {
|
|
102
|
+
const { container } = renderWithProviders(withContext(<TiptapEditor />));
|
|
103
|
+
|
|
104
|
+
const styleTag = container.querySelector("style");
|
|
105
|
+
expect(styleTag).toBeTruthy();
|
|
106
|
+
// The CSS should contain Tamagui CSS custom properties
|
|
107
|
+
const cssContent = styleTag?.textContent ?? "";
|
|
108
|
+
expect(cssContent).toContain("var(--color");
|
|
109
|
+
// It should match the output from getEditorCSS
|
|
110
|
+
getEditorCSS();
|
|
111
|
+
expect(cssContent).toContain(".ProseMirror");
|
|
112
|
+
expect(cssContent).toContain("var(--blue10");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("reads styling from RichEditorContext.useStyledContext()", () => {
|
|
116
|
+
// Render with compact and disabled context
|
|
117
|
+
const { container } = renderWithProviders(
|
|
118
|
+
withContext(<TiptapEditor />, {
|
|
119
|
+
size: "$2",
|
|
120
|
+
compact: true,
|
|
121
|
+
disabled: false,
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Should render successfully with context values applied
|
|
126
|
+
expect(container.firstChild).toBeTruthy();
|
|
127
|
+
expect(container.querySelector("[data-testid='editor-content']")).toBeTruthy();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("renders BubbleToolbar when showBubbleToolbar is true and does not when false", () => {
|
|
131
|
+
// With showBubbleToolbar={true}
|
|
132
|
+
const { container: withBubble } = renderWithProviders(
|
|
133
|
+
withContext(<TiptapEditor showBubbleToolbar />),
|
|
134
|
+
);
|
|
135
|
+
expect(withBubble.querySelector("[data-testid='bubble-menu']")).toBeTruthy();
|
|
136
|
+
|
|
137
|
+
// With showBubbleToolbar={false} (default)
|
|
138
|
+
const { container: withoutBubble } = renderWithProviders(
|
|
139
|
+
withContext(<TiptapEditor showBubbleToolbar={false} />),
|
|
140
|
+
);
|
|
141
|
+
expect(withoutBubble.querySelector("[data-testid='bubble-menu']")).toBeNull();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("exposes RichEditorRef methods via forwardRef and useImperativeHandle", () => {
|
|
145
|
+
const ref = createRef<RichEditorRef>();
|
|
146
|
+
|
|
147
|
+
renderWithProviders(withContext(<TiptapEditor ref={ref} />));
|
|
148
|
+
|
|
149
|
+
expect(ref.current).toBeTruthy();
|
|
150
|
+
expect(typeof ref.current?.executeCommand).toBe("function");
|
|
151
|
+
expect(typeof ref.current?.getState).toBe("function");
|
|
152
|
+
expect(typeof ref.current?.getHTML).toBe("function");
|
|
153
|
+
expect(typeof ref.current?.getJSON).toBe("function");
|
|
154
|
+
expect(typeof ref.current?.setHTML).toBe("function");
|
|
155
|
+
expect(typeof ref.current?.setJSON).toBe("function");
|
|
156
|
+
expect(typeof ref.current?.focus).toBe("function");
|
|
157
|
+
expect(typeof ref.current?.blur).toBe("function");
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("does not include inline hardcoded CSS values", () => {
|
|
161
|
+
const { container } = renderWithProviders(withContext(<TiptapEditor />));
|
|
162
|
+
|
|
163
|
+
const styleTag = container.querySelector("style");
|
|
164
|
+
const cssContent = styleTag?.textContent ?? "";
|
|
165
|
+
// Should use CSS custom properties for theme-aware colors
|
|
166
|
+
expect(cssContent).toContain("var(--color12)");
|
|
167
|
+
expect(cssContent).toContain("var(--color8");
|
|
168
|
+
});
|
|
169
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the rich text editor
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type TextAlignment = "left" | "center" | "right" | "justify";
|
|
6
|
+
|
|
7
|
+
export type EditorCommand =
|
|
8
|
+
| "bold"
|
|
9
|
+
| "italic"
|
|
10
|
+
| "underline"
|
|
11
|
+
| "strike"
|
|
12
|
+
| "code"
|
|
13
|
+
| "subscript"
|
|
14
|
+
| "superscript"
|
|
15
|
+
| "heading1"
|
|
16
|
+
| "heading2"
|
|
17
|
+
| "heading3"
|
|
18
|
+
| "heading4"
|
|
19
|
+
| "heading5"
|
|
20
|
+
| "heading6"
|
|
21
|
+
| "paragraph"
|
|
22
|
+
| "bulletList"
|
|
23
|
+
| "orderedList"
|
|
24
|
+
| "taskList"
|
|
25
|
+
| "blockquote"
|
|
26
|
+
| "codeBlock"
|
|
27
|
+
| "link"
|
|
28
|
+
| "image"
|
|
29
|
+
| "undo"
|
|
30
|
+
| "redo"
|
|
31
|
+
| "alignLeft"
|
|
32
|
+
| "alignCenter"
|
|
33
|
+
| "alignRight"
|
|
34
|
+
| "alignJustify"
|
|
35
|
+
| "textColor"
|
|
36
|
+
| "highlight"
|
|
37
|
+
| "horizontalRule"
|
|
38
|
+
| "clearFormatting";
|
|
39
|
+
|
|
40
|
+
export interface EditorState {
|
|
41
|
+
isBold: boolean;
|
|
42
|
+
isItalic: boolean;
|
|
43
|
+
isUnderline: boolean;
|
|
44
|
+
isStrike: boolean;
|
|
45
|
+
isCode: boolean;
|
|
46
|
+
isSubscript: boolean;
|
|
47
|
+
isSuperscript: boolean;
|
|
48
|
+
isHeading1: boolean;
|
|
49
|
+
isHeading2: boolean;
|
|
50
|
+
isHeading3: boolean;
|
|
51
|
+
isHeading4: boolean;
|
|
52
|
+
isHeading5: boolean;
|
|
53
|
+
isHeading6: boolean;
|
|
54
|
+
isParagraph: boolean;
|
|
55
|
+
isBulletList: boolean;
|
|
56
|
+
isOrderedList: boolean;
|
|
57
|
+
isTaskList: boolean;
|
|
58
|
+
isBlockquote: boolean;
|
|
59
|
+
isCodeBlock: boolean;
|
|
60
|
+
isLink: boolean;
|
|
61
|
+
canUndo: boolean;
|
|
62
|
+
canRedo: boolean;
|
|
63
|
+
textAlign: TextAlignment;
|
|
64
|
+
/** Current text color (null means default) */
|
|
65
|
+
textColor: string | null;
|
|
66
|
+
/** Current highlight/background color (null means none) */
|
|
67
|
+
highlightColor: string | null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface RichEditorRef {
|
|
71
|
+
/** Execute an editor command */
|
|
72
|
+
executeCommand: (command: EditorCommand, payload?: any) => void;
|
|
73
|
+
/** Get the current editor state */
|
|
74
|
+
getState: () => EditorState;
|
|
75
|
+
/** Get the content as HTML */
|
|
76
|
+
getHTML: () => string;
|
|
77
|
+
/** Get the content as JSON (ProseMirror format) */
|
|
78
|
+
getJSON: () => any;
|
|
79
|
+
/** Set content from HTML */
|
|
80
|
+
setHTML: (html: string) => void;
|
|
81
|
+
/** Set content from JSON */
|
|
82
|
+
setJSON: (json: any) => void;
|
|
83
|
+
/** Focus the editor */
|
|
84
|
+
focus: () => void;
|
|
85
|
+
/** Blur the editor */
|
|
86
|
+
blur: () => void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface RichEditorProps {
|
|
90
|
+
/** Initial content as HTML */
|
|
91
|
+
initialContent?: string;
|
|
92
|
+
/** Initial content as JSON (takes precedence over initialContent) */
|
|
93
|
+
initialJSON?: any;
|
|
94
|
+
/** Placeholder text when editor is empty */
|
|
95
|
+
placeholder?: string;
|
|
96
|
+
/** Whether the editor is editable */
|
|
97
|
+
editable?: boolean;
|
|
98
|
+
/** Auto focus on mount */
|
|
99
|
+
autoFocus?: boolean;
|
|
100
|
+
/** Called when content changes */
|
|
101
|
+
onChange?: (html: string, json: any) => void;
|
|
102
|
+
/** Called when editor state changes (bold, italic, etc.) */
|
|
103
|
+
onStateChange?: (state: EditorState) => void;
|
|
104
|
+
/** Called when editor is focused */
|
|
105
|
+
onFocus?: () => void;
|
|
106
|
+
/** Called when editor is blurred */
|
|
107
|
+
onBlur?: () => void;
|
|
108
|
+
/** Minimum height of the editor */
|
|
109
|
+
minHeight?: number;
|
|
110
|
+
/** Maximum height of the editor */
|
|
111
|
+
maxHeight?: number;
|
|
112
|
+
/** Show error state */
|
|
113
|
+
hasError?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const defaultEditorState: EditorState = {
|
|
117
|
+
isBold: false,
|
|
118
|
+
isItalic: false,
|
|
119
|
+
isUnderline: false,
|
|
120
|
+
isStrike: false,
|
|
121
|
+
isCode: false,
|
|
122
|
+
isSubscript: false,
|
|
123
|
+
isSuperscript: false,
|
|
124
|
+
isHeading1: false,
|
|
125
|
+
isHeading2: false,
|
|
126
|
+
isHeading3: false,
|
|
127
|
+
isHeading4: false,
|
|
128
|
+
isHeading5: false,
|
|
129
|
+
isHeading6: false,
|
|
130
|
+
isParagraph: true,
|
|
131
|
+
isBulletList: false,
|
|
132
|
+
isOrderedList: false,
|
|
133
|
+
isTaskList: false,
|
|
134
|
+
isBlockquote: false,
|
|
135
|
+
isCodeBlock: false,
|
|
136
|
+
isLink: false,
|
|
137
|
+
canUndo: false,
|
|
138
|
+
canRedo: false,
|
|
139
|
+
textAlign: "left",
|
|
140
|
+
textColor: null,
|
|
141
|
+
highlightColor: null,
|
|
142
|
+
};
|