@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,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List picker dropdown for selecting list types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
7
|
+
import { Popover, Text, YStack } from "tamagui";
|
|
8
|
+
import type { EditorCommand, EditorState, RichEditorRef } from "../types";
|
|
9
|
+
import { DropdownMenuItemFrame } from "../styled";
|
|
10
|
+
import { ToolbarDropdownButton } from "./ToolbarButton";
|
|
11
|
+
import { BulletListIcon, OrderedListIcon, TaskListIcon } from "./icons";
|
|
12
|
+
|
|
13
|
+
// ===========================================================================
|
|
14
|
+
// Types
|
|
15
|
+
// ===========================================================================
|
|
16
|
+
|
|
17
|
+
export interface ListPickerProps {
|
|
18
|
+
/** Reference to the editor */
|
|
19
|
+
editorRef: React.RefObject<RichEditorRef | null>;
|
|
20
|
+
/** Current editor state */
|
|
21
|
+
state: EditorState;
|
|
22
|
+
/** Whether the picker is disabled */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ===========================================================================
|
|
27
|
+
// List Options
|
|
28
|
+
// ===========================================================================
|
|
29
|
+
|
|
30
|
+
interface ListOption {
|
|
31
|
+
label: string;
|
|
32
|
+
command: EditorCommand;
|
|
33
|
+
stateKey: keyof EditorState;
|
|
34
|
+
icon: React.FC;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const LIST_OPTIONS: ListOption[] = [
|
|
38
|
+
{
|
|
39
|
+
label: "Bullet List",
|
|
40
|
+
command: "bulletList",
|
|
41
|
+
stateKey: "isBulletList",
|
|
42
|
+
icon: BulletListIcon,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Ordered List",
|
|
46
|
+
command: "orderedList",
|
|
47
|
+
stateKey: "isOrderedList",
|
|
48
|
+
icon: OrderedListIcon,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Task List",
|
|
52
|
+
command: "taskList",
|
|
53
|
+
stateKey: "isTaskList",
|
|
54
|
+
icon: TaskListIcon,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
// ===========================================================================
|
|
59
|
+
// ListPicker
|
|
60
|
+
// ===========================================================================
|
|
61
|
+
|
|
62
|
+
function getActiveListIcon(state: EditorState) {
|
|
63
|
+
if (state.isOrderedList) return OrderedListIcon;
|
|
64
|
+
if (state.isTaskList) return TaskListIcon;
|
|
65
|
+
return BulletListIcon;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isAnyListActive(state: EditorState): boolean {
|
|
69
|
+
return state.isBulletList || state.isOrderedList || state.isTaskList;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function ListPicker({ editorRef, state, disabled }: ListPickerProps) {
|
|
73
|
+
const { knobProps } = useResolvedKnobs();
|
|
74
|
+
const [open, setOpen] = useState(false);
|
|
75
|
+
const ActiveIcon = getActiveListIcon(state);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Popover open={open} onOpenChange={setOpen} placement="bottom-start">
|
|
79
|
+
<Popover.Trigger asChild>
|
|
80
|
+
<ToolbarDropdownButton
|
|
81
|
+
active={isAnyListActive(state)}
|
|
82
|
+
disabled={disabled}
|
|
83
|
+
onPress={() => setOpen(true)}
|
|
84
|
+
aria-label="Lists"
|
|
85
|
+
>
|
|
86
|
+
<ActiveIcon />
|
|
87
|
+
</ToolbarDropdownButton>
|
|
88
|
+
</Popover.Trigger>
|
|
89
|
+
<Popover.Content
|
|
90
|
+
{...knobProps.panelPadding}
|
|
91
|
+
backgroundColor="$background"
|
|
92
|
+
borderWidth={1}
|
|
93
|
+
borderColor="$borderColor"
|
|
94
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
95
|
+
elevation={knobProps.elevation}
|
|
96
|
+
enterStyle={{ opacity: 0, y: -5 }}
|
|
97
|
+
exitStyle={{ opacity: 0, y: -5 }}
|
|
98
|
+
>
|
|
99
|
+
<YStack gap="$1" minWidth={150}>
|
|
100
|
+
{LIST_OPTIONS.map((option) => {
|
|
101
|
+
const Icon = option.icon;
|
|
102
|
+
return (
|
|
103
|
+
<DropdownMenuItemFrame
|
|
104
|
+
key={option.command}
|
|
105
|
+
active={state[option.stateKey] as boolean}
|
|
106
|
+
onPress={() => {
|
|
107
|
+
editorRef.current?.executeCommand(option.command);
|
|
108
|
+
setOpen(false);
|
|
109
|
+
}}
|
|
110
|
+
aria-label={option.label}
|
|
111
|
+
>
|
|
112
|
+
<Icon />
|
|
113
|
+
<Text>{option.label}</Text>
|
|
114
|
+
</DropdownMenuItemFrame>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
117
|
+
</YStack>
|
|
118
|
+
</Popover.Content>
|
|
119
|
+
</Popover>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "More" overflow dropdown for less-frequently-used toolbar actions.
|
|
3
|
+
* Groups: Subscript, Superscript | Alignment | Horizontal Rule, Clear Formatting
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type React from "react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
9
|
+
import { Popover, Text, XStack, YStack } from "tamagui";
|
|
10
|
+
import type { EditorCommand, EditorState, RichEditorRef } from "../types";
|
|
11
|
+
import { DropdownMenuItemFrame, ToolbarSeparatorFrame } from "../styled";
|
|
12
|
+
import { ToolbarButton } from "./ToolbarButton";
|
|
13
|
+
import {
|
|
14
|
+
SubscriptIcon,
|
|
15
|
+
SuperscriptIcon,
|
|
16
|
+
AlignLeftIcon,
|
|
17
|
+
AlignCenterIcon,
|
|
18
|
+
AlignRightIcon,
|
|
19
|
+
AlignJustifyIcon,
|
|
20
|
+
HorizontalRuleIcon,
|
|
21
|
+
ClearFormattingIcon,
|
|
22
|
+
} from "./icons";
|
|
23
|
+
import { SHORTCUTS } from "./shortcuts";
|
|
24
|
+
|
|
25
|
+
export interface MoreDropdownProps {
|
|
26
|
+
editorRef: React.RefObject<RichEditorRef | null>;
|
|
27
|
+
state: EditorState;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface MoreItem {
|
|
32
|
+
label: string;
|
|
33
|
+
command: EditorCommand;
|
|
34
|
+
payload?: any;
|
|
35
|
+
icon: React.FC;
|
|
36
|
+
isActive?: (state: EditorState) => boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const INLINE_ITEMS: MoreItem[] = [
|
|
40
|
+
{
|
|
41
|
+
label: SHORTCUTS.subscript,
|
|
42
|
+
command: "subscript",
|
|
43
|
+
icon: SubscriptIcon,
|
|
44
|
+
isActive: (s) => s.isSubscript,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: SHORTCUTS.superscript,
|
|
48
|
+
command: "superscript",
|
|
49
|
+
icon: SuperscriptIcon,
|
|
50
|
+
isActive: (s) => s.isSuperscript,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const ALIGN_ITEMS: MoreItem[] = [
|
|
55
|
+
{
|
|
56
|
+
label: SHORTCUTS.alignLeft,
|
|
57
|
+
command: "alignLeft",
|
|
58
|
+
icon: AlignLeftIcon,
|
|
59
|
+
isActive: (s) => s.textAlign === "left",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: SHORTCUTS.alignCenter,
|
|
63
|
+
command: "alignCenter",
|
|
64
|
+
icon: AlignCenterIcon,
|
|
65
|
+
isActive: (s) => s.textAlign === "center",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: SHORTCUTS.alignRight,
|
|
69
|
+
command: "alignRight",
|
|
70
|
+
icon: AlignRightIcon,
|
|
71
|
+
isActive: (s) => s.textAlign === "right",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: SHORTCUTS.alignJustify,
|
|
75
|
+
command: "alignJustify",
|
|
76
|
+
icon: AlignJustifyIcon,
|
|
77
|
+
isActive: (s) => s.textAlign === "justify",
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const BLOCK_ITEMS: MoreItem[] = [
|
|
82
|
+
{
|
|
83
|
+
label: SHORTCUTS.horizontalRule,
|
|
84
|
+
command: "horizontalRule",
|
|
85
|
+
icon: HorizontalRuleIcon,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: SHORTCUTS.clearFormatting,
|
|
89
|
+
command: "clearFormatting",
|
|
90
|
+
icon: ClearFormattingIcon,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
function MoreIcon() {
|
|
95
|
+
return (
|
|
96
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="none">
|
|
97
|
+
<circle cx="5" cy="12" r="2" />
|
|
98
|
+
<circle cx="12" cy="12" r="2" />
|
|
99
|
+
<circle cx="19" cy="12" r="2" />
|
|
100
|
+
</svg>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function preventFocusTheft(e: React.MouseEvent) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function ItemSection({
|
|
109
|
+
items,
|
|
110
|
+
state,
|
|
111
|
+
onSelect,
|
|
112
|
+
}: {
|
|
113
|
+
items: MoreItem[];
|
|
114
|
+
state: EditorState;
|
|
115
|
+
onSelect: (command: EditorCommand, payload?: any) => void;
|
|
116
|
+
}) {
|
|
117
|
+
return (
|
|
118
|
+
<>
|
|
119
|
+
{items.map((item) => {
|
|
120
|
+
const Icon = item.icon;
|
|
121
|
+
return (
|
|
122
|
+
<DropdownMenuItemFrame
|
|
123
|
+
key={item.command}
|
|
124
|
+
active={item.isActive?.(state)}
|
|
125
|
+
onMouseDown={preventFocusTheft}
|
|
126
|
+
onPress={() => onSelect(item.command, item.payload)}
|
|
127
|
+
aria-label={item.label}
|
|
128
|
+
>
|
|
129
|
+
<Icon />
|
|
130
|
+
<Text fontSize={13}>{item.label}</Text>
|
|
131
|
+
</DropdownMenuItemFrame>
|
|
132
|
+
);
|
|
133
|
+
})}
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function MoreDropdown({ editorRef, state, disabled }: MoreDropdownProps) {
|
|
139
|
+
const { knobProps } = useResolvedKnobs();
|
|
140
|
+
const [open, setOpen] = useState(false);
|
|
141
|
+
|
|
142
|
+
const handleSelect = (command: EditorCommand, payload?: any) => {
|
|
143
|
+
editorRef.current?.executeCommand(command, payload);
|
|
144
|
+
if (command === "horizontalRule" || command === "clearFormatting") {
|
|
145
|
+
setOpen(false);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Popover open={open} onOpenChange={setOpen} placement="bottom-end">
|
|
151
|
+
<Popover.Trigger asChild>
|
|
152
|
+
<ToolbarButton
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
onPress={() => setOpen(true)}
|
|
155
|
+
aria-label="More formatting options"
|
|
156
|
+
tooltip="More"
|
|
157
|
+
>
|
|
158
|
+
<MoreIcon />
|
|
159
|
+
</ToolbarButton>
|
|
160
|
+
</Popover.Trigger>
|
|
161
|
+
<Popover.Content
|
|
162
|
+
{...knobProps.panelPadding}
|
|
163
|
+
backgroundColor="$background"
|
|
164
|
+
borderWidth={1}
|
|
165
|
+
borderColor="$borderColor"
|
|
166
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
167
|
+
elevation={knobProps.elevation}
|
|
168
|
+
enterStyle={{ opacity: 0, y: -5 }}
|
|
169
|
+
exitStyle={{ opacity: 0, y: -5 }}
|
|
170
|
+
>
|
|
171
|
+
<YStack gap="$1" minWidth={200}>
|
|
172
|
+
<ItemSection items={INLINE_ITEMS} state={state} onSelect={handleSelect} />
|
|
173
|
+
<XStack paddingVertical="$1">
|
|
174
|
+
<ToolbarSeparatorFrame vertical={false} width="100%" height={1} marginHorizontal={0} />
|
|
175
|
+
</XStack>
|
|
176
|
+
<ItemSection items={ALIGN_ITEMS} state={state} onSelect={handleSelect} />
|
|
177
|
+
<XStack paddingVertical="$1">
|
|
178
|
+
<ToolbarSeparatorFrame vertical={false} width="100%" height={1} marginHorizontal={0} />
|
|
179
|
+
</XStack>
|
|
180
|
+
<ItemSection items={BLOCK_ITEMS} state={state} onSelect={handleSelect} />
|
|
181
|
+
</YStack>
|
|
182
|
+
</Popover.Content>
|
|
183
|
+
</Popover>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag-to-resize handle for the editor container.
|
|
3
|
+
* Positioned at the bottom-right corner; dragging vertically adjusts editor height.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useCallback, useRef } from "react";
|
|
7
|
+
import { View } from "tamagui";
|
|
8
|
+
|
|
9
|
+
export interface ResizeHandleProps {
|
|
10
|
+
containerRef: React.RefObject<HTMLElement | null>;
|
|
11
|
+
minHeight?: number;
|
|
12
|
+
maxHeight?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function GripIcon() {
|
|
16
|
+
return (
|
|
17
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" opacity={0.4}>
|
|
18
|
+
<path d="M10 2L2 10" stroke="currentColor" strokeWidth="1.5" fill="none" />
|
|
19
|
+
<path d="M10 6L6 10" stroke="currentColor" strokeWidth="1.5" fill="none" />
|
|
20
|
+
<path d="M10 10L10 10" stroke="currentColor" strokeWidth="1.5" fill="none" />
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function ResizeHandle({ containerRef, minHeight = 150, maxHeight }: ResizeHandleProps) {
|
|
26
|
+
const startY = useRef(0);
|
|
27
|
+
const startHeight = useRef(0);
|
|
28
|
+
|
|
29
|
+
const onMouseDown = useCallback(
|
|
30
|
+
(e: React.MouseEvent) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
const el = containerRef.current;
|
|
33
|
+
if (!el) return;
|
|
34
|
+
|
|
35
|
+
startY.current = e.clientY;
|
|
36
|
+
startHeight.current = el.getBoundingClientRect().height;
|
|
37
|
+
|
|
38
|
+
const onMouseMove = (ev: MouseEvent) => {
|
|
39
|
+
const delta = ev.clientY - startY.current;
|
|
40
|
+
let newHeight = startHeight.current + delta;
|
|
41
|
+
if (newHeight < minHeight) newHeight = minHeight;
|
|
42
|
+
if (maxHeight && newHeight > maxHeight) newHeight = maxHeight;
|
|
43
|
+
el.style.height = `${newHeight}px`;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const onMouseUp = () => {
|
|
47
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
48
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
49
|
+
document.body.style.cursor = "";
|
|
50
|
+
document.body.style.userSelect = "";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
document.body.style.cursor = "ns-resize";
|
|
54
|
+
document.body.style.userSelect = "none";
|
|
55
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
56
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
57
|
+
},
|
|
58
|
+
[containerRef, minHeight, maxHeight],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View
|
|
63
|
+
position="absolute"
|
|
64
|
+
bottom={0}
|
|
65
|
+
right={0}
|
|
66
|
+
width={16}
|
|
67
|
+
height={16}
|
|
68
|
+
cursor="ns-resize"
|
|
69
|
+
alignItems="center"
|
|
70
|
+
justifyContent="center"
|
|
71
|
+
opacity={0.6}
|
|
72
|
+
hoverStyle={{ opacity: 1 }}
|
|
73
|
+
onMouseDown={onMouseDown as any}
|
|
74
|
+
aria-label="Resize editor"
|
|
75
|
+
role="separator"
|
|
76
|
+
>
|
|
77
|
+
<GripIcon />
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status bar footer showing word/character count and a rich-text / markdown toggle.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { XStack, Text } from "tamagui";
|
|
6
|
+
import { RichEditorContext } from "../context";
|
|
7
|
+
import type { EditorMode, EditorState } from "../types";
|
|
8
|
+
|
|
9
|
+
export interface StatusBarProps {
|
|
10
|
+
state: EditorState;
|
|
11
|
+
mode: EditorMode;
|
|
12
|
+
onModeChange: (mode: EditorMode) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ModeButton({
|
|
16
|
+
label,
|
|
17
|
+
active,
|
|
18
|
+
onPress,
|
|
19
|
+
}: {
|
|
20
|
+
label: string;
|
|
21
|
+
active: boolean;
|
|
22
|
+
onPress: () => void;
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<Text
|
|
26
|
+
fontSize={11}
|
|
27
|
+
color={active ? "$color12" : "$color9"}
|
|
28
|
+
fontWeight={active ? "600" : "400"}
|
|
29
|
+
cursor="pointer"
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
hoverStyle={{ color: "$color11" }}
|
|
32
|
+
userSelect="none"
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</Text>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function StatusBar({ state, mode, onModeChange }: StatusBarProps) {
|
|
40
|
+
const _ctx = RichEditorContext.useStyledContext();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<XStack
|
|
44
|
+
borderTopWidth={1}
|
|
45
|
+
borderTopColor="$color5"
|
|
46
|
+
paddingHorizontal="$3"
|
|
47
|
+
paddingVertical="$1.5"
|
|
48
|
+
justifyContent="space-between"
|
|
49
|
+
alignItems="center"
|
|
50
|
+
>
|
|
51
|
+
<XStack gap="$1.5" alignItems="center">
|
|
52
|
+
<ModeButton
|
|
53
|
+
label="Rich text"
|
|
54
|
+
active={mode === "richtext"}
|
|
55
|
+
onPress={() => onModeChange("richtext")}
|
|
56
|
+
/>
|
|
57
|
+
<Text fontSize={11} color="$color7">
|
|
58
|
+
|
|
|
59
|
+
</Text>
|
|
60
|
+
<ModeButton
|
|
61
|
+
label="Markdown"
|
|
62
|
+
active={mode === "markdown"}
|
|
63
|
+
onPress={() => onModeChange("markdown")}
|
|
64
|
+
/>
|
|
65
|
+
</XStack>
|
|
66
|
+
<XStack gap="$3">
|
|
67
|
+
<Text fontSize={11} color="$color9">
|
|
68
|
+
{state.wordCount} {state.wordCount === 1 ? "word" : "words"}
|
|
69
|
+
</Text>
|
|
70
|
+
<Text fontSize={11} color="$color9">
|
|
71
|
+
{state.characterCount} {state.characterCount === 1 ? "character" : "characters"}
|
|
72
|
+
</Text>
|
|
73
|
+
</XStack>
|
|
74
|
+
</XStack>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bubble menu shown when cursor is inside a table.
|
|
3
|
+
* Provides row/column add/delete and table management actions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import type { Editor } from "@tiptap/react";
|
|
8
|
+
import { BubbleMenu } from "@tiptap/react/menus";
|
|
9
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
10
|
+
import { Popover, Text, XStack, YStack } from "tamagui";
|
|
11
|
+
import { DropdownMenuItemFrame, ToolbarSeparatorFrame } from "../styled";
|
|
12
|
+
import { ToolbarButton, ToolbarDropdownButton } from "./ToolbarButton";
|
|
13
|
+
|
|
14
|
+
function RowPlusIcon() {
|
|
15
|
+
return (
|
|
16
|
+
<svg
|
|
17
|
+
width="14"
|
|
18
|
+
height="14"
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
fill="none"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
strokeWidth="2"
|
|
23
|
+
>
|
|
24
|
+
<line x1="12" y1="5" x2="12" y2="19" />
|
|
25
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TrashIcon() {
|
|
31
|
+
return (
|
|
32
|
+
<svg
|
|
33
|
+
width="14"
|
|
34
|
+
height="14"
|
|
35
|
+
viewBox="0 0 24 24"
|
|
36
|
+
fill="none"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
strokeWidth="2"
|
|
39
|
+
>
|
|
40
|
+
<polyline points="3 6 5 6 21 6" />
|
|
41
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface TableAction {
|
|
47
|
+
label: string;
|
|
48
|
+
action: (editor: Editor) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ROW_ACTIONS: TableAction[] = [
|
|
52
|
+
{ label: "Add row above", action: (e) => e.chain().focus().addRowBefore().run() },
|
|
53
|
+
{ label: "Add row below", action: (e) => e.chain().focus().addRowAfter().run() },
|
|
54
|
+
{ label: "Delete row", action: (e) => e.chain().focus().deleteRow().run() },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const COL_ACTIONS: TableAction[] = [
|
|
58
|
+
{ label: "Add column before", action: (e) => e.chain().focus().addColumnBefore().run() },
|
|
59
|
+
{ label: "Add column after", action: (e) => e.chain().focus().addColumnAfter().run() },
|
|
60
|
+
{ label: "Delete column", action: (e) => e.chain().focus().deleteColumn().run() },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const TABLE_ACTIONS: TableAction[] = [
|
|
64
|
+
{ label: "Toggle header row", action: (e) => e.chain().focus().toggleHeaderRow().run() },
|
|
65
|
+
{ label: "Merge cells", action: (e) => e.chain().focus().mergeCells().run() },
|
|
66
|
+
{ label: "Split cell", action: (e) => e.chain().focus().splitCell().run() },
|
|
67
|
+
{ label: "Delete table", action: (e) => e.chain().focus().deleteTable().run() },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
export interface TableBubbleProps {
|
|
71
|
+
editor: Editor | null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function TableBubble({ editor }: TableBubbleProps) {
|
|
75
|
+
const { knobProps } = useResolvedKnobs();
|
|
76
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
77
|
+
|
|
78
|
+
if (!editor) return null;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<BubbleMenu
|
|
82
|
+
editor={editor}
|
|
83
|
+
shouldShow={({ editor: e }) => e.isActive("table")}
|
|
84
|
+
options={{ placement: "top" }}
|
|
85
|
+
>
|
|
86
|
+
<XStack
|
|
87
|
+
backgroundColor="$background"
|
|
88
|
+
borderWidth={1}
|
|
89
|
+
borderColor="$borderColor"
|
|
90
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
91
|
+
padding="$1"
|
|
92
|
+
gap="$1"
|
|
93
|
+
alignItems="center"
|
|
94
|
+
elevation={knobProps.elevation}
|
|
95
|
+
>
|
|
96
|
+
<ToolbarButton
|
|
97
|
+
onPress={() => editor.chain().focus().addRowAfter().run()}
|
|
98
|
+
aria-label="Add row"
|
|
99
|
+
tooltip="Add row below"
|
|
100
|
+
>
|
|
101
|
+
<RowPlusIcon />
|
|
102
|
+
</ToolbarButton>
|
|
103
|
+
|
|
104
|
+
<ToolbarButton
|
|
105
|
+
onPress={() => editor.chain().focus().addColumnAfter().run()}
|
|
106
|
+
aria-label="Add column"
|
|
107
|
+
tooltip="Add column after"
|
|
108
|
+
>
|
|
109
|
+
<Text fontSize={11} fontWeight="700">
|
|
110
|
+
+Col
|
|
111
|
+
</Text>
|
|
112
|
+
</ToolbarButton>
|
|
113
|
+
|
|
114
|
+
<Popover open={menuOpen} onOpenChange={setMenuOpen} placement="bottom">
|
|
115
|
+
<Popover.Trigger asChild>
|
|
116
|
+
<ToolbarDropdownButton onPress={() => setMenuOpen(true)} aria-label="Table options">
|
|
117
|
+
<Text fontSize={12}>Table</Text>
|
|
118
|
+
</ToolbarDropdownButton>
|
|
119
|
+
</Popover.Trigger>
|
|
120
|
+
<Popover.Content
|
|
121
|
+
{...knobProps.panelPadding}
|
|
122
|
+
backgroundColor="$background"
|
|
123
|
+
borderWidth={1}
|
|
124
|
+
borderColor="$borderColor"
|
|
125
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
126
|
+
elevation={knobProps.elevation}
|
|
127
|
+
enterStyle={{ opacity: 0, y: -5 }}
|
|
128
|
+
exitStyle={{ opacity: 0, y: -5 }}
|
|
129
|
+
>
|
|
130
|
+
<YStack gap="$0.5" minWidth={180}>
|
|
131
|
+
{ROW_ACTIONS.map((a) => (
|
|
132
|
+
<DropdownMenuItemFrame
|
|
133
|
+
key={a.label}
|
|
134
|
+
onPress={() => {
|
|
135
|
+
a.action(editor);
|
|
136
|
+
setMenuOpen(false);
|
|
137
|
+
}}
|
|
138
|
+
aria-label={a.label}
|
|
139
|
+
>
|
|
140
|
+
<Text fontSize={13}>{a.label}</Text>
|
|
141
|
+
</DropdownMenuItemFrame>
|
|
142
|
+
))}
|
|
143
|
+
<XStack paddingVertical="$0.5">
|
|
144
|
+
<ToolbarSeparatorFrame
|
|
145
|
+
vertical={false}
|
|
146
|
+
width="100%"
|
|
147
|
+
height={1}
|
|
148
|
+
marginHorizontal={0}
|
|
149
|
+
/>
|
|
150
|
+
</XStack>
|
|
151
|
+
{COL_ACTIONS.map((a) => (
|
|
152
|
+
<DropdownMenuItemFrame
|
|
153
|
+
key={a.label}
|
|
154
|
+
onPress={() => {
|
|
155
|
+
a.action(editor);
|
|
156
|
+
setMenuOpen(false);
|
|
157
|
+
}}
|
|
158
|
+
aria-label={a.label}
|
|
159
|
+
>
|
|
160
|
+
<Text fontSize={13}>{a.label}</Text>
|
|
161
|
+
</DropdownMenuItemFrame>
|
|
162
|
+
))}
|
|
163
|
+
<XStack paddingVertical="$0.5">
|
|
164
|
+
<ToolbarSeparatorFrame
|
|
165
|
+
vertical={false}
|
|
166
|
+
width="100%"
|
|
167
|
+
height={1}
|
|
168
|
+
marginHorizontal={0}
|
|
169
|
+
/>
|
|
170
|
+
</XStack>
|
|
171
|
+
{TABLE_ACTIONS.map((a) => (
|
|
172
|
+
<DropdownMenuItemFrame
|
|
173
|
+
key={a.label}
|
|
174
|
+
onPress={() => {
|
|
175
|
+
a.action(editor);
|
|
176
|
+
setMenuOpen(false);
|
|
177
|
+
}}
|
|
178
|
+
aria-label={a.label}
|
|
179
|
+
>
|
|
180
|
+
<Text fontSize={13}>{a.label}</Text>
|
|
181
|
+
</DropdownMenuItemFrame>
|
|
182
|
+
))}
|
|
183
|
+
</YStack>
|
|
184
|
+
</Popover.Content>
|
|
185
|
+
</Popover>
|
|
186
|
+
|
|
187
|
+
<ToolbarButton
|
|
188
|
+
onPress={() => editor.chain().focus().deleteTable().run()}
|
|
189
|
+
aria-label="Delete table"
|
|
190
|
+
tooltip="Delete table"
|
|
191
|
+
>
|
|
192
|
+
<TrashIcon />
|
|
193
|
+
</ToolbarButton>
|
|
194
|
+
</XStack>
|
|
195
|
+
</BubbleMenu>
|
|
196
|
+
);
|
|
197
|
+
}
|