@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,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG icon components for the rich text editor toolbar
|
|
3
|
+
*
|
|
4
|
+
* All icons use currentColor for fill/stroke to inherit text color.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Text, styled } from "tamagui";
|
|
8
|
+
|
|
9
|
+
// ===========================================================================
|
|
10
|
+
// SVG Wrapper
|
|
11
|
+
// ===========================================================================
|
|
12
|
+
|
|
13
|
+
const SvgWrapper = styled(Text, {
|
|
14
|
+
name: "SvgWrapper",
|
|
15
|
+
display: "flex",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// ===========================================================================
|
|
21
|
+
// Text Style Icons
|
|
22
|
+
// ===========================================================================
|
|
23
|
+
|
|
24
|
+
export const BoldIcon = styled(Text, {
|
|
25
|
+
fontWeight: "bold",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const ItalicIcon = styled(Text, {
|
|
29
|
+
fontStyle: "italic",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const UnderlineIcon = styled(Text, {
|
|
33
|
+
textDecorationLine: "underline",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const StrikeIcon = styled(Text, {
|
|
37
|
+
textDecorationLine: "line-through",
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ===========================================================================
|
|
41
|
+
// SVG Icons
|
|
42
|
+
// ===========================================================================
|
|
43
|
+
|
|
44
|
+
export function UndoIcon() {
|
|
45
|
+
return (
|
|
46
|
+
<SvgWrapper>
|
|
47
|
+
<svg
|
|
48
|
+
width="16"
|
|
49
|
+
height="16"
|
|
50
|
+
viewBox="0 0 24 24"
|
|
51
|
+
fill="none"
|
|
52
|
+
stroke="currentColor"
|
|
53
|
+
strokeWidth="2"
|
|
54
|
+
strokeLinecap="round"
|
|
55
|
+
strokeLinejoin="round"
|
|
56
|
+
>
|
|
57
|
+
<polyline points="1 4 1 10 7 10" />
|
|
58
|
+
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
|
|
59
|
+
</svg>
|
|
60
|
+
</SvgWrapper>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function RedoIcon() {
|
|
65
|
+
return (
|
|
66
|
+
<SvgWrapper>
|
|
67
|
+
<svg
|
|
68
|
+
width="16"
|
|
69
|
+
height="16"
|
|
70
|
+
viewBox="0 0 24 24"
|
|
71
|
+
fill="none"
|
|
72
|
+
stroke="currentColor"
|
|
73
|
+
strokeWidth="2"
|
|
74
|
+
strokeLinecap="round"
|
|
75
|
+
strokeLinejoin="round"
|
|
76
|
+
>
|
|
77
|
+
<polyline points="23 4 23 10 17 10" />
|
|
78
|
+
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10" />
|
|
79
|
+
</svg>
|
|
80
|
+
</SvgWrapper>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function AlignLeftIcon() {
|
|
85
|
+
return (
|
|
86
|
+
<SvgWrapper>
|
|
87
|
+
<svg
|
|
88
|
+
width="16"
|
|
89
|
+
height="16"
|
|
90
|
+
viewBox="0 0 24 24"
|
|
91
|
+
fill="none"
|
|
92
|
+
stroke="currentColor"
|
|
93
|
+
strokeWidth="2"
|
|
94
|
+
>
|
|
95
|
+
<line x1="3" y1="6" x2="21" y2="6" />
|
|
96
|
+
<line x1="3" y1="12" x2="15" y2="12" />
|
|
97
|
+
<line x1="3" y1="18" x2="21" y2="18" />
|
|
98
|
+
</svg>
|
|
99
|
+
</SvgWrapper>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function AlignCenterIcon() {
|
|
104
|
+
return (
|
|
105
|
+
<SvgWrapper>
|
|
106
|
+
<svg
|
|
107
|
+
width="16"
|
|
108
|
+
height="16"
|
|
109
|
+
viewBox="0 0 24 24"
|
|
110
|
+
fill="none"
|
|
111
|
+
stroke="currentColor"
|
|
112
|
+
strokeWidth="2"
|
|
113
|
+
>
|
|
114
|
+
<line x1="3" y1="6" x2="21" y2="6" />
|
|
115
|
+
<line x1="6" y1="12" x2="18" y2="12" />
|
|
116
|
+
<line x1="3" y1="18" x2="21" y2="18" />
|
|
117
|
+
</svg>
|
|
118
|
+
</SvgWrapper>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function AlignRightIcon() {
|
|
123
|
+
return (
|
|
124
|
+
<SvgWrapper>
|
|
125
|
+
<svg
|
|
126
|
+
width="16"
|
|
127
|
+
height="16"
|
|
128
|
+
viewBox="0 0 24 24"
|
|
129
|
+
fill="none"
|
|
130
|
+
stroke="currentColor"
|
|
131
|
+
strokeWidth="2"
|
|
132
|
+
>
|
|
133
|
+
<line x1="3" y1="6" x2="21" y2="6" />
|
|
134
|
+
<line x1="9" y1="12" x2="21" y2="12" />
|
|
135
|
+
<line x1="3" y1="18" x2="21" y2="18" />
|
|
136
|
+
</svg>
|
|
137
|
+
</SvgWrapper>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function AlignJustifyIcon() {
|
|
142
|
+
return (
|
|
143
|
+
<SvgWrapper>
|
|
144
|
+
<svg
|
|
145
|
+
width="16"
|
|
146
|
+
height="16"
|
|
147
|
+
viewBox="0 0 24 24"
|
|
148
|
+
fill="none"
|
|
149
|
+
stroke="currentColor"
|
|
150
|
+
strokeWidth="2"
|
|
151
|
+
>
|
|
152
|
+
<line x1="3" y1="6" x2="21" y2="6" />
|
|
153
|
+
<line x1="3" y1="12" x2="21" y2="12" />
|
|
154
|
+
<line x1="3" y1="18" x2="21" y2="18" />
|
|
155
|
+
</svg>
|
|
156
|
+
</SvgWrapper>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function LinkIcon() {
|
|
161
|
+
return (
|
|
162
|
+
<SvgWrapper>
|
|
163
|
+
<svg
|
|
164
|
+
width="16"
|
|
165
|
+
height="16"
|
|
166
|
+
viewBox="0 0 24 24"
|
|
167
|
+
fill="none"
|
|
168
|
+
stroke="currentColor"
|
|
169
|
+
strokeWidth="2"
|
|
170
|
+
>
|
|
171
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
172
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
173
|
+
</svg>
|
|
174
|
+
</SvgWrapper>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function TextColorIcon({ color }: { color?: string | null }) {
|
|
179
|
+
return (
|
|
180
|
+
<SvgWrapper>
|
|
181
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
|
182
|
+
<text x="12" y="14" textAnchor="middle" fontSize="14" fontWeight="bold" fill="currentColor">
|
|
183
|
+
A
|
|
184
|
+
</text>
|
|
185
|
+
<rect x="4" y="18" width="16" height="3" rx="1" fill={color || "currentColor"} />
|
|
186
|
+
</svg>
|
|
187
|
+
</SvgWrapper>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function HighlightIcon({ color }: { color?: string | null }) {
|
|
192
|
+
return (
|
|
193
|
+
<SvgWrapper>
|
|
194
|
+
<svg
|
|
195
|
+
width="16"
|
|
196
|
+
height="16"
|
|
197
|
+
viewBox="0 0 24 24"
|
|
198
|
+
fill="none"
|
|
199
|
+
stroke="currentColor"
|
|
200
|
+
strokeWidth="2"
|
|
201
|
+
>
|
|
202
|
+
<path d="M12 20h9" />
|
|
203
|
+
<path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" />
|
|
204
|
+
{color && <rect x="2" y="18" width="8" height="4" rx="1" fill={color} stroke="none" />}
|
|
205
|
+
</svg>
|
|
206
|
+
</SvgWrapper>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function HorizontalRuleIcon() {
|
|
211
|
+
return (
|
|
212
|
+
<SvgWrapper>
|
|
213
|
+
<svg
|
|
214
|
+
width="16"
|
|
215
|
+
height="16"
|
|
216
|
+
viewBox="0 0 24 24"
|
|
217
|
+
fill="none"
|
|
218
|
+
stroke="currentColor"
|
|
219
|
+
strokeWidth="2"
|
|
220
|
+
>
|
|
221
|
+
<line x1="3" y1="12" x2="21" y2="12" />
|
|
222
|
+
</svg>
|
|
223
|
+
</SvgWrapper>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function ClearFormattingIcon() {
|
|
228
|
+
return (
|
|
229
|
+
<SvgWrapper>
|
|
230
|
+
<svg
|
|
231
|
+
width="16"
|
|
232
|
+
height="16"
|
|
233
|
+
viewBox="0 0 24 24"
|
|
234
|
+
fill="none"
|
|
235
|
+
stroke="currentColor"
|
|
236
|
+
strokeWidth="2"
|
|
237
|
+
>
|
|
238
|
+
<path d="M4 7h6.5l-2.5 9h-4" />
|
|
239
|
+
<path d="M13.5 7l-2.5 9" />
|
|
240
|
+
<path d="M17 7h3" />
|
|
241
|
+
<line x1="4" y1="20" x2="20" y2="4" strokeWidth="2.5" />
|
|
242
|
+
</svg>
|
|
243
|
+
</SvgWrapper>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function SubscriptIcon() {
|
|
248
|
+
return (
|
|
249
|
+
<SvgWrapper>
|
|
250
|
+
<svg
|
|
251
|
+
width="16"
|
|
252
|
+
height="16"
|
|
253
|
+
viewBox="0 0 24 24"
|
|
254
|
+
fill="none"
|
|
255
|
+
stroke="currentColor"
|
|
256
|
+
strokeWidth="2"
|
|
257
|
+
>
|
|
258
|
+
<path d="M4 5l8 8" />
|
|
259
|
+
<path d="M12 5l-8 8" />
|
|
260
|
+
<text x="18" y="20" fontSize="10" fontWeight="bold" fill="currentColor" stroke="none">
|
|
261
|
+
2
|
|
262
|
+
</text>
|
|
263
|
+
</svg>
|
|
264
|
+
</SvgWrapper>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export function SuperscriptIcon() {
|
|
269
|
+
return (
|
|
270
|
+
<SvgWrapper>
|
|
271
|
+
<svg
|
|
272
|
+
width="16"
|
|
273
|
+
height="16"
|
|
274
|
+
viewBox="0 0 24 24"
|
|
275
|
+
fill="none"
|
|
276
|
+
stroke="currentColor"
|
|
277
|
+
strokeWidth="2"
|
|
278
|
+
>
|
|
279
|
+
<path d="M4 11l8 8" />
|
|
280
|
+
<path d="M12 11l-8 8" />
|
|
281
|
+
<text x="18" y="10" fontSize="10" fontWeight="bold" fill="currentColor" stroke="none">
|
|
282
|
+
2
|
|
283
|
+
</text>
|
|
284
|
+
</svg>
|
|
285
|
+
</SvgWrapper>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export function BulletListIcon() {
|
|
290
|
+
return (
|
|
291
|
+
<SvgWrapper>
|
|
292
|
+
<svg
|
|
293
|
+
width="16"
|
|
294
|
+
height="16"
|
|
295
|
+
viewBox="0 0 24 24"
|
|
296
|
+
fill="none"
|
|
297
|
+
stroke="currentColor"
|
|
298
|
+
strokeWidth="2"
|
|
299
|
+
>
|
|
300
|
+
<line x1="9" y1="6" x2="20" y2="6" />
|
|
301
|
+
<line x1="9" y1="12" x2="20" y2="12" />
|
|
302
|
+
<line x1="9" y1="18" x2="20" y2="18" />
|
|
303
|
+
<circle cx="4" cy="6" r="1.5" fill="currentColor" stroke="none" />
|
|
304
|
+
<circle cx="4" cy="12" r="1.5" fill="currentColor" stroke="none" />
|
|
305
|
+
<circle cx="4" cy="18" r="1.5" fill="currentColor" stroke="none" />
|
|
306
|
+
</svg>
|
|
307
|
+
</SvgWrapper>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export function OrderedListIcon() {
|
|
312
|
+
return (
|
|
313
|
+
<SvgWrapper>
|
|
314
|
+
<svg
|
|
315
|
+
width="16"
|
|
316
|
+
height="16"
|
|
317
|
+
viewBox="0 0 24 24"
|
|
318
|
+
fill="none"
|
|
319
|
+
stroke="currentColor"
|
|
320
|
+
strokeWidth="2"
|
|
321
|
+
>
|
|
322
|
+
<line x1="10" y1="6" x2="20" y2="6" />
|
|
323
|
+
<line x1="10" y1="12" x2="20" y2="12" />
|
|
324
|
+
<line x1="10" y1="18" x2="20" y2="18" />
|
|
325
|
+
<text x="4" y="8" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
|
|
326
|
+
1
|
|
327
|
+
</text>
|
|
328
|
+
<text x="4" y="14" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
|
|
329
|
+
2
|
|
330
|
+
</text>
|
|
331
|
+
<text x="4" y="20" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
|
|
332
|
+
3
|
|
333
|
+
</text>
|
|
334
|
+
</svg>
|
|
335
|
+
</SvgWrapper>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function TaskListIcon() {
|
|
340
|
+
return (
|
|
341
|
+
<SvgWrapper>
|
|
342
|
+
<svg
|
|
343
|
+
width="16"
|
|
344
|
+
height="16"
|
|
345
|
+
viewBox="0 0 24 24"
|
|
346
|
+
fill="none"
|
|
347
|
+
stroke="currentColor"
|
|
348
|
+
strokeWidth="2"
|
|
349
|
+
>
|
|
350
|
+
<line x1="10" y1="6" x2="20" y2="6" />
|
|
351
|
+
<line x1="10" y1="12" x2="20" y2="12" />
|
|
352
|
+
<line x1="10" y1="18" x2="20" y2="18" />
|
|
353
|
+
<rect x="3" y="4" width="4" height="4" rx="0.5" />
|
|
354
|
+
<rect x="3" y="10" width="4" height="4" rx="0.5" />
|
|
355
|
+
<rect x="3" y="16" width="4" height="4" rx="0.5" />
|
|
356
|
+
<path d="M4 12l1 1 2-2" strokeWidth="1.5" />
|
|
357
|
+
</svg>
|
|
358
|
+
</SvgWrapper>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function ImageIcon() {
|
|
363
|
+
return (
|
|
364
|
+
<SvgWrapper>
|
|
365
|
+
<svg
|
|
366
|
+
width="16"
|
|
367
|
+
height="16"
|
|
368
|
+
viewBox="0 0 24 24"
|
|
369
|
+
fill="none"
|
|
370
|
+
stroke="currentColor"
|
|
371
|
+
strokeWidth="2"
|
|
372
|
+
>
|
|
373
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
|
374
|
+
<circle cx="8.5" cy="8.5" r="1.5" />
|
|
375
|
+
<polyline points="21 15 16 10 5 21" />
|
|
376
|
+
</svg>
|
|
377
|
+
</SvgWrapper>
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function BlockquoteIcon() {
|
|
382
|
+
return (
|
|
383
|
+
<SvgWrapper>
|
|
384
|
+
<svg
|
|
385
|
+
width="16"
|
|
386
|
+
height="16"
|
|
387
|
+
viewBox="0 0 24 24"
|
|
388
|
+
fill="none"
|
|
389
|
+
stroke="currentColor"
|
|
390
|
+
strokeWidth="2"
|
|
391
|
+
>
|
|
392
|
+
<path d="M3 6h18" />
|
|
393
|
+
<path d="M3 12h18" />
|
|
394
|
+
<path d="M3 18h18" />
|
|
395
|
+
<rect x="2" y="4" width="2" height="16" rx="1" fill="currentColor" stroke="none" />
|
|
396
|
+
</svg>
|
|
397
|
+
</SvgWrapper>
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export function CodeBlockIcon() {
|
|
402
|
+
return (
|
|
403
|
+
<SvgWrapper>
|
|
404
|
+
<svg
|
|
405
|
+
width="16"
|
|
406
|
+
height="16"
|
|
407
|
+
viewBox="0 0 24 24"
|
|
408
|
+
fill="none"
|
|
409
|
+
stroke="currentColor"
|
|
410
|
+
strokeWidth="2"
|
|
411
|
+
>
|
|
412
|
+
<polyline points="16 18 22 12 16 6" />
|
|
413
|
+
<polyline points="8 6 2 12 8 18" />
|
|
414
|
+
</svg>
|
|
415
|
+
</SvgWrapper>
|
|
416
|
+
);
|
|
417
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-aware keyboard shortcut labels for toolbar tooltips.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const isMac =
|
|
6
|
+
typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? "");
|
|
7
|
+
|
|
8
|
+
const MOD = isMac ? "⌘" : "Ctrl+";
|
|
9
|
+
const SHIFT = isMac ? "⇧" : "Shift+";
|
|
10
|
+
const ALT = isMac ? "⌥" : "Alt+";
|
|
11
|
+
|
|
12
|
+
export function shortcut(label: string, keys?: string): string {
|
|
13
|
+
if (!keys) return label;
|
|
14
|
+
return `${label} (${keys})`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SHORTCUTS = {
|
|
18
|
+
bold: shortcut("Bold", `${MOD}B`),
|
|
19
|
+
italic: shortcut("Italic", `${MOD}I`),
|
|
20
|
+
underline: shortcut("Underline", `${MOD}U`),
|
|
21
|
+
strike: shortcut("Strikethrough", `${MOD}${SHIFT}X`),
|
|
22
|
+
code: shortcut("Code", `${MOD}E`),
|
|
23
|
+
subscript: "Subscript",
|
|
24
|
+
superscript: "Superscript",
|
|
25
|
+
undo: shortcut("Undo", `${MOD}Z`),
|
|
26
|
+
redo: shortcut("Redo", `${MOD}${SHIFT}Z`),
|
|
27
|
+
alignLeft: shortcut("Align Left", `${MOD}${SHIFT}L`),
|
|
28
|
+
alignCenter: shortcut("Align Center", `${MOD}${SHIFT}E`),
|
|
29
|
+
alignRight: shortcut("Align Right", `${MOD}${SHIFT}R`),
|
|
30
|
+
alignJustify: shortcut("Justify", `${MOD}${SHIFT}J`),
|
|
31
|
+
blockquote: shortcut("Blockquote", `${MOD}${SHIFT}B`),
|
|
32
|
+
codeBlock: shortcut("Code Block", `${MOD}${ALT}C`),
|
|
33
|
+
bulletList: shortcut("Bullet List", `${MOD}${SHIFT}8`),
|
|
34
|
+
orderedList: shortcut("Ordered List", `${MOD}${SHIFT}7`),
|
|
35
|
+
taskList: shortcut("Task List", `${MOD}${SHIFT}9`),
|
|
36
|
+
link: shortcut("Link", `${MOD}K`),
|
|
37
|
+
horizontalRule: "Horizontal Rule",
|
|
38
|
+
image: "Image",
|
|
39
|
+
textColor: "Text Color",
|
|
40
|
+
highlight: "Highlight",
|
|
41
|
+
clearFormatting: "Clear Formatting",
|
|
42
|
+
} as const;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
|
+
import { RichEditorContext } from "../context";
|
|
4
|
+
import { ToolbarGroup } from "./ToolbarGroup";
|
|
5
|
+
import {
|
|
6
|
+
UndoIcon,
|
|
7
|
+
RedoIcon,
|
|
8
|
+
BoldIcon,
|
|
9
|
+
AlignLeftIcon,
|
|
10
|
+
LinkIcon,
|
|
11
|
+
TextColorIcon,
|
|
12
|
+
HighlightIcon,
|
|
13
|
+
BulletListIcon,
|
|
14
|
+
ImageIcon,
|
|
15
|
+
} from "./icons";
|
|
16
|
+
|
|
17
|
+
vi.mock("@multiplatform.one/forms", () => ({
|
|
18
|
+
Button: (props: any) => (
|
|
19
|
+
<button
|
|
20
|
+
role="button"
|
|
21
|
+
aria-label={props["aria-label"]}
|
|
22
|
+
disabled={props.disabled}
|
|
23
|
+
onClick={props.onPress}
|
|
24
|
+
data-active={props.theme === "active" ? "true" : undefined}
|
|
25
|
+
>
|
|
26
|
+
{props.children}
|
|
27
|
+
</button>
|
|
28
|
+
),
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
vi.mock("@multiplatform.one/components", () => ({
|
|
32
|
+
Tooltip: ({ children }: any) => children,
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
// Import after mocks
|
|
36
|
+
const { ToolbarButton, ToolbarDropdownButton } = await import("./ToolbarButton");
|
|
37
|
+
|
|
38
|
+
describe("ToolbarButton", () => {
|
|
39
|
+
it("renders with required aria-label and applies active state", () => {
|
|
40
|
+
const onPress = vi.fn();
|
|
41
|
+
const { getByRole } = renderWithProviders(
|
|
42
|
+
<RichEditorContext.Provider size="$true" compact={false} disabled={false}>
|
|
43
|
+
<ToolbarButton active onPress={onPress} aria-label="Bold" tooltip="Bold">
|
|
44
|
+
<BoldIcon>B</BoldIcon>
|
|
45
|
+
</ToolbarButton>
|
|
46
|
+
</RichEditorContext.Provider>,
|
|
47
|
+
);
|
|
48
|
+
const button = getByRole("button");
|
|
49
|
+
expect(button).toBeTruthy();
|
|
50
|
+
expect(button.getAttribute("aria-label")).toBe("Bold");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("reads size/compact from RichEditorContext", () => {
|
|
54
|
+
const { container } = renderWithProviders(
|
|
55
|
+
<RichEditorContext.Provider size="$2" compact disabled={false}>
|
|
56
|
+
<ToolbarButton onPress={() => {}} aria-label="Test Button">
|
|
57
|
+
Test
|
|
58
|
+
</ToolbarButton>
|
|
59
|
+
</RichEditorContext.Provider>,
|
|
60
|
+
);
|
|
61
|
+
expect(container.firstChild).toBeTruthy();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("ToolbarDropdownButton", () => {
|
|
66
|
+
it("renders with caret icon", () => {
|
|
67
|
+
const { container } = renderWithProviders(
|
|
68
|
+
<RichEditorContext.Provider size="$true" compact={false} disabled={false}>
|
|
69
|
+
<ToolbarDropdownButton onPress={() => {}} aria-label="Heading">
|
|
70
|
+
H1
|
|
71
|
+
</ToolbarDropdownButton>
|
|
72
|
+
</RichEditorContext.Provider>,
|
|
73
|
+
);
|
|
74
|
+
// ToolbarDropdownButton renders a caret (CaretDownIcon from phosphor)
|
|
75
|
+
const svgs = container.querySelectorAll("svg");
|
|
76
|
+
expect(svgs.length).toBeGreaterThan(0);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("ToolbarGroup", () => {
|
|
81
|
+
it("hides children when visible is false", () => {
|
|
82
|
+
const { container } = renderWithProviders(
|
|
83
|
+
<ToolbarGroup visible={false}>
|
|
84
|
+
<span data-testid="child">Should not render</span>
|
|
85
|
+
</ToolbarGroup>,
|
|
86
|
+
);
|
|
87
|
+
expect(container.querySelector("[data-testid='child']")).toBeNull();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("renders children when visible is true", () => {
|
|
91
|
+
const { container } = renderWithProviders(
|
|
92
|
+
<ToolbarGroup visible>
|
|
93
|
+
<span data-testid="child">Should render</span>
|
|
94
|
+
</ToolbarGroup>,
|
|
95
|
+
);
|
|
96
|
+
expect(container.querySelector("[data-testid='child']")).toBeTruthy();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("icons", () => {
|
|
101
|
+
it("all icon components render without error", () => {
|
|
102
|
+
const { container } = renderWithProviders(
|
|
103
|
+
<>
|
|
104
|
+
<UndoIcon />
|
|
105
|
+
<RedoIcon />
|
|
106
|
+
<AlignLeftIcon />
|
|
107
|
+
<LinkIcon />
|
|
108
|
+
<TextColorIcon />
|
|
109
|
+
<HighlightIcon />
|
|
110
|
+
<BulletListIcon />
|
|
111
|
+
<ImageIcon />
|
|
112
|
+
</>,
|
|
113
|
+
);
|
|
114
|
+
// Each SVG icon should produce an svg element
|
|
115
|
+
const svgs = container.querySelectorAll("svg");
|
|
116
|
+
expect(svgs.length).toBeGreaterThanOrEqual(8);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
|
+
import { RichEditorContext } from "../context";
|
|
4
|
+
import { defaultEditorState } from "../types";
|
|
5
|
+
import { TEXT_COLORS, HIGHLIGHT_COLORS } from "../constants";
|
|
6
|
+
import { normalizeUrl } from "./LinkDialog";
|
|
7
|
+
|
|
8
|
+
vi.mock("@multiplatform.one/forms", () => ({
|
|
9
|
+
Button: (props: any) => (
|
|
10
|
+
<button
|
|
11
|
+
role="button"
|
|
12
|
+
aria-label={props["aria-label"]}
|
|
13
|
+
disabled={props.disabled}
|
|
14
|
+
onClick={props.onPress}
|
|
15
|
+
>
|
|
16
|
+
{props.children}
|
|
17
|
+
</button>
|
|
18
|
+
),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
vi.mock("@multiplatform.one/components", () => ({
|
|
22
|
+
Tooltip: ({ children }: any) => children,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const { TextColorPicker, HighlightColorPicker } = await import("./ColorPicker");
|
|
26
|
+
const { HeadingPicker } = await import("./HeadingPicker");
|
|
27
|
+
const { ListPicker } = await import("./ListPicker");
|
|
28
|
+
const { ImageDialog } = await import("./ImageDialog");
|
|
29
|
+
|
|
30
|
+
function withContext(ui: React.ReactElement) {
|
|
31
|
+
return (
|
|
32
|
+
<RichEditorContext.Provider size="$true" compact={false} disabled={false}>
|
|
33
|
+
{ui}
|
|
34
|
+
</RichEditorContext.Provider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe("ColorPicker", () => {
|
|
39
|
+
it("renders text color picker trigger button", () => {
|
|
40
|
+
const editorRef = { current: null };
|
|
41
|
+
const { getByRole } = renderWithProviders(
|
|
42
|
+
withContext(<TextColorPicker editorRef={editorRef} state={defaultEditorState} />),
|
|
43
|
+
);
|
|
44
|
+
const button = getByRole("button");
|
|
45
|
+
expect(button).toBeTruthy();
|
|
46
|
+
expect(button.getAttribute("aria-label")).toBe("Text Color");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("renders highlight color picker trigger button", () => {
|
|
50
|
+
const editorRef = { current: null };
|
|
51
|
+
const { getByRole } = renderWithProviders(
|
|
52
|
+
withContext(<HighlightColorPicker editorRef={editorRef} state={defaultEditorState} />),
|
|
53
|
+
);
|
|
54
|
+
const button = getByRole("button");
|
|
55
|
+
expect(button).toBeTruthy();
|
|
56
|
+
expect(button.getAttribute("aria-label")).toBe("Highlight Color");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("uses TEXT_COLORS and HIGHLIGHT_COLORS from constants", () => {
|
|
60
|
+
expect(TEXT_COLORS.length).toBeGreaterThan(5);
|
|
61
|
+
expect(HIGHLIGHT_COLORS.length).toBeGreaterThan(3);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("LinkDialog normalizeUrl", () => {
|
|
66
|
+
it("auto-prepends https:// to URLs without protocol", () => {
|
|
67
|
+
expect(normalizeUrl("example.com")).toBe("https://example.com");
|
|
68
|
+
expect(normalizeUrl("www.test.org/path")).toBe("https://www.test.org/path");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("preserves URLs that already have a protocol", () => {
|
|
72
|
+
expect(normalizeUrl("https://example.com")).toBe("https://example.com");
|
|
73
|
+
expect(normalizeUrl("http://example.com")).toBe("http://example.com");
|
|
74
|
+
expect(normalizeUrl("mailto:user@example.com")).toBe("mailto:user@example.com");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("returns empty string for empty input", () => {
|
|
78
|
+
expect(normalizeUrl("")).toBe("");
|
|
79
|
+
expect(normalizeUrl(" ")).toBe("");
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("HeadingPicker", () => {
|
|
84
|
+
it("renders H1-H6 plus Paragraph options (7 total) in trigger", () => {
|
|
85
|
+
const editorRef = { current: null };
|
|
86
|
+
const { getByRole } = renderWithProviders(
|
|
87
|
+
withContext(<HeadingPicker editorRef={editorRef} state={defaultEditorState} />),
|
|
88
|
+
);
|
|
89
|
+
const button = getByRole("button");
|
|
90
|
+
expect(button).toBeTruthy();
|
|
91
|
+
expect(button.getAttribute("aria-label")).toBe("Heading");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("ListPicker", () => {
|
|
96
|
+
it("renders list picker trigger button", () => {
|
|
97
|
+
const editorRef = { current: null };
|
|
98
|
+
const { getByRole } = renderWithProviders(
|
|
99
|
+
withContext(<ListPicker editorRef={editorRef} state={defaultEditorState} />),
|
|
100
|
+
);
|
|
101
|
+
const button = getByRole("button");
|
|
102
|
+
expect(button).toBeTruthy();
|
|
103
|
+
expect(button.getAttribute("aria-label")).toBe("Lists");
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("ImageDialog", () => {
|
|
108
|
+
it("renders image dialog trigger button with URL input", () => {
|
|
109
|
+
const editorRef = { current: null };
|
|
110
|
+
const { getByRole } = renderWithProviders(withContext(<ImageDialog editorRef={editorRef} />));
|
|
111
|
+
const button = getByRole("button");
|
|
112
|
+
expect(button).toBeTruthy();
|
|
113
|
+
expect(button.getAttribute("aria-label")).toBe("Insert Image");
|
|
114
|
+
});
|
|
115
|
+
});
|