@forgedevstack/ink 1.1.2 → 1.1.4
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/CHANGELOG.md +56 -1
- package/README.md +1 -1
- package/dist/common-components/Box/Box.cjs +1 -0
- package/dist/common-components/Box/Box.const.cjs +1 -0
- package/dist/common-components/Box/Box.const.d.ts +3 -0
- package/dist/common-components/Box/Box.const.d.ts.map +1 -0
- package/dist/common-components/Box/Box.const.js +5 -0
- package/dist/common-components/Box/Box.d.ts +4 -0
- package/dist/common-components/Box/Box.d.ts.map +1 -0
- package/dist/common-components/Box/Box.js +14 -0
- package/dist/common-components/Box/Box.types.d.ts +6 -0
- package/dist/common-components/Box/Box.types.d.ts.map +1 -0
- package/dist/common-components/Box/index.d.ts +3 -0
- package/dist/common-components/Box/index.d.ts.map +1 -0
- package/dist/common-components/Button/Button.cjs +1 -0
- package/dist/common-components/Button/Button.const.cjs +1 -0
- package/dist/common-components/Button/Button.const.d.ts +5 -0
- package/dist/common-components/Button/Button.const.d.ts.map +1 -0
- package/dist/common-components/Button/Button.const.js +7 -0
- package/dist/common-components/Button/Button.d.ts +4 -0
- package/dist/common-components/Button/Button.d.ts.map +1 -0
- package/dist/common-components/Button/Button.js +28 -0
- package/dist/common-components/Button/Button.types.d.ts +6 -0
- package/dist/common-components/Button/Button.types.d.ts.map +1 -0
- package/dist/common-components/Button/index.d.ts +3 -0
- package/dist/common-components/Button/index.d.ts.map +1 -0
- package/dist/common-components/Canvas/Canvas.cjs +1 -0
- package/dist/common-components/Canvas/Canvas.const.cjs +1 -0
- package/dist/common-components/Canvas/Canvas.const.d.ts +2 -0
- package/dist/common-components/Canvas/Canvas.const.d.ts.map +1 -0
- package/dist/common-components/Canvas/Canvas.const.js +4 -0
- package/dist/common-components/Canvas/Canvas.d.ts +4 -0
- package/dist/common-components/Canvas/Canvas.d.ts.map +1 -0
- package/dist/common-components/Canvas/Canvas.js +14 -0
- package/dist/common-components/Canvas/Canvas.types.d.ts +5 -0
- package/dist/common-components/Canvas/Canvas.types.d.ts.map +1 -0
- package/dist/common-components/Canvas/index.d.ts +3 -0
- package/dist/common-components/Canvas/index.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.cjs +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.const.cjs +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.const.d.ts +11 -0
- package/dist/common-components/ContextMenu/ContextMenu.const.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.const.js +14 -0
- package/dist/common-components/ContextMenu/ContextMenu.d.ts +4 -0
- package/dist/common-components/ContextMenu/ContextMenu.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.js +69 -0
- package/dist/common-components/ContextMenu/ContextMenu.types.d.ts +33 -0
- package/dist/common-components/ContextMenu/ContextMenu.types.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.d.ts +3 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.js +11 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.test.d.ts +2 -0
- package/dist/common-components/ContextMenu/ContextMenu.utils.test.d.ts.map +1 -0
- package/dist/common-components/ContextMenu/index.d.ts +5 -0
- package/dist/common-components/ContextMenu/index.d.ts.map +1 -0
- package/dist/common-components/Field/Field.cjs +1 -0
- package/dist/common-components/Field/Field.const.cjs +1 -0
- package/dist/common-components/Field/Field.const.d.ts +3 -0
- package/dist/common-components/Field/Field.const.d.ts.map +1 -0
- package/dist/common-components/Field/Field.const.js +5 -0
- package/dist/common-components/Field/Field.d.ts +4 -0
- package/dist/common-components/Field/Field.d.ts.map +1 -0
- package/dist/common-components/Field/Field.js +26 -0
- package/dist/common-components/Field/Field.types.d.ts +10 -0
- package/dist/common-components/Field/Field.types.d.ts.map +1 -0
- package/dist/common-components/Field/index.d.ts +3 -0
- package/dist/common-components/Field/index.d.ts.map +1 -0
- package/dist/common-components/icons/GripIcon.cjs +1 -0
- package/dist/common-components/icons/GripIcon.d.ts +3 -0
- package/dist/common-components/icons/GripIcon.d.ts.map +1 -0
- package/dist/common-components/icons/GripIcon.js +13 -0
- package/dist/common-components/icons/Icon.const.cjs +1 -0
- package/dist/common-components/icons/Icon.const.d.ts +7 -0
- package/dist/common-components/icons/Icon.const.d.ts.map +1 -0
- package/dist/common-components/icons/Icon.const.js +10 -0
- package/dist/common-components/icons/RedoIcon.cjs +1 -0
- package/dist/common-components/icons/RedoIcon.d.ts +3 -0
- package/dist/common-components/icons/RedoIcon.d.ts.map +1 -0
- package/dist/common-components/icons/RedoIcon.js +9 -0
- package/dist/common-components/icons/UndoIcon.cjs +1 -0
- package/dist/common-components/icons/UndoIcon.d.ts +3 -0
- package/dist/common-components/icons/UndoIcon.d.ts.map +1 -0
- package/dist/common-components/icons/UndoIcon.js +9 -0
- package/dist/common-components/icons/index.d.ts +4 -0
- package/dist/common-components/icons/index.d.ts.map +1 -0
- package/dist/common-components/index.d.ts +12 -0
- package/dist/common-components/index.d.ts.map +1 -0
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +923 -435
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.cjs +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.const.cjs +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.const.d.ts +7 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.const.js +10 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.d.ts +4 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.js +17 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.types.d.ts +12 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.utils.cjs +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.utils.d.ts +4 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiAutocomplete/AiAutocomplete.utils.js +25 -0
- package/dist/components/InkEditor/components/AiAutocomplete/index.d.ts +5 -0
- package/dist/components/InkEditor/components/AiAutocomplete/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts +1 -0
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +53 -49
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -1
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.const.cjs +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.const.d.ts +15 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.const.js +18 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.d.ts +1 -6
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.d.ts.map +1 -1
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +53 -8
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.types.d.ts +9 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/index.d.ts +2 -1
- package/dist/components/InkEditor/components/BlockHandles/index.d.ts.map +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.d.ts.map +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +63 -44
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts +2 -0
- package/dist/components/InkEditor/components/FindReplace/FindReplace.types.d.ts.map +1 -1
- package/dist/components/InkEditor/components/FindReplace/index.d.ts +1 -1
- package/dist/components/InkEditor/components/FindReplace/index.d.ts.map +1 -1
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.cjs +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.const.cjs +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.const.d.ts +25 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.const.js +28 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.d.ts +4 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.js +140 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.types.d.ts +32 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.cjs +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.d.ts +4 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.js +16 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/index.d.ts +5 -0
- package/dist/components/InkEditor/components/InlineToolbar/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts +7 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.const.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.const.js +15 -17
- package/dist/components/InkEditor/components/SignPad/SignPad.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.js +57 -58
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.utils.js +5 -14
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +20 -16
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +16 -12
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.cjs +1 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.cjs +1 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.d.ts +10 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.js +18 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.d.ts +4 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.js +43 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.types.d.ts +12 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/index.d.ts +4 -0
- package/dist/components/InkEditor/components/ToolbarCustomize/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +7 -1
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +2 -1
- package/dist/components/InkEditor/helpers/format.utils.d.ts +9 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +113 -20
- package/dist/components/InkEditor/helpers/index.d.ts +1 -1
- package/dist/components/InkEditor/helpers/index.d.ts.map +1 -1
- package/dist/constants/blocks.const.cjs +1 -0
- package/dist/constants/blocks.const.d.ts +11 -0
- package/dist/constants/blocks.const.d.ts.map +1 -0
- package/dist/constants/blocks.const.js +14 -0
- package/dist/constants/colorMode.const.cjs +1 -0
- package/dist/constants/colorMode.const.d.ts +6 -0
- package/dist/constants/colorMode.const.d.ts.map +1 -0
- package/dist/constants/colorMode.const.js +7 -0
- package/dist/constants/contextMenu.const.cjs +1 -0
- package/dist/constants/contextMenu.const.d.ts +37 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -0
- package/dist/constants/contextMenu.const.js +39 -0
- package/dist/constants/defaultIcons.cjs +1 -0
- package/dist/constants/defaultIcons.d.ts +4 -0
- package/dist/constants/defaultIcons.d.ts.map +1 -0
- package/dist/constants/defaultIcons.js +42 -0
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts +4 -0
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +56 -48
- package/dist/constants/findReplaceMenu.const.cjs +1 -0
- package/dist/constants/findReplaceMenu.const.d.ts +10 -0
- package/dist/constants/findReplaceMenu.const.d.ts.map +1 -0
- package/dist/constants/findReplaceMenu.const.js +14 -0
- package/dist/constants/fonts.const.cjs +1 -0
- package/dist/constants/fonts.const.d.ts +25 -0
- package/dist/constants/fonts.const.d.ts.map +1 -0
- package/dist/constants/fonts.const.js +40 -0
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +1 -0
- package/dist/constants/generals.const.d.ts.map +1 -1
- package/dist/constants/generals.const.js +4 -3
- package/dist/constants/index.d.ts +11 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/keyboard.const.cjs +1 -0
- package/dist/constants/keyboard.const.d.ts +5 -0
- package/dist/constants/keyboard.const.d.ts.map +1 -0
- package/dist/constants/keyboard.const.js +7 -0
- package/dist/constants/lists.const.cjs +1 -0
- package/dist/constants/lists.const.d.ts +24 -0
- package/dist/constants/lists.const.d.ts.map +1 -0
- package/dist/constants/lists.const.js +28 -0
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.d.ts +2 -0
- package/dist/constants/numbers.d.ts.map +1 -1
- package/dist/constants/numbers.js +30 -17
- package/dist/constants/openai.const.cjs +1 -0
- package/dist/constants/openai.const.d.ts +42 -0
- package/dist/constants/openai.const.d.ts.map +1 -0
- package/dist/constants/openai.const.js +58 -0
- package/dist/constants/premium.const.cjs +1 -1
- package/dist/constants/premium.const.d.ts +1 -2
- package/dist/constants/premium.const.d.ts.map +1 -1
- package/dist/constants/premium.const.js +6 -34
- package/dist/constants/table.const.cjs +1 -0
- package/dist/constants/table.const.d.ts +8 -0
- package/dist/constants/table.const.d.ts.map +1 -0
- package/dist/constants/table.const.js +10 -0
- package/dist/constants/toolbar.const.cjs +1 -1
- package/dist/constants/toolbar.const.d.ts +7 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -1
- package/dist/constants/toolbar.const.js +11 -4
- package/dist/constants/toolbarMenu.const.cjs +1 -0
- package/dist/constants/toolbarMenu.const.d.ts +19 -0
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -0
- package/dist/constants/toolbarMenu.const.js +65 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -47
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.d.ts.map +1 -1
- package/dist/plugins/ai/demoProvider.js +47 -37
- package/dist/plugins/ai/index.cjs +1 -1
- package/dist/plugins/ai/index.d.ts +3 -1
- package/dist/plugins/ai/index.d.ts.map +1 -1
- package/dist/plugins/ai/index.js +28 -14
- package/dist/plugins/ai/inkServerProvider.cjs +1 -0
- package/dist/plugins/ai/inkServerProvider.d.ts +4 -0
- package/dist/plugins/ai/inkServerProvider.d.ts.map +1 -0
- package/dist/plugins/ai/inkServerProvider.js +52 -0
- package/dist/plugins/ai/inkServerProvider.types.d.ts +15 -0
- package/dist/plugins/ai/inkServerProvider.types.d.ts.map +1 -0
- package/dist/plugins/ai/openaiProvider.cjs +1 -0
- package/dist/plugins/ai/openaiProvider.d.ts +4 -0
- package/dist/plugins/ai/openaiProvider.d.ts.map +1 -0
- package/dist/plugins/ai/openaiProvider.js +128 -0
- package/dist/plugins/ai/openaiProvider.types.d.ts +32 -0
- package/dist/plugins/ai/openaiProvider.types.d.ts.map +1 -0
- package/dist/plugins/ai/openaiProvider.utils.cjs +5 -0
- package/dist/plugins/ai/openaiProvider.utils.d.ts +14 -0
- package/dist/plugins/ai/openaiProvider.utils.d.ts.map +1 -0
- package/dist/plugins/ai/openaiProvider.utils.js +57 -0
- package/dist/styles.css +1 -721
- package/dist/types/ai.types.d.ts +2 -1
- package/dist/types/ai.types.d.ts.map +1 -1
- package/dist/types/features.types.d.ts +2 -0
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +7 -2
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/premium.types.d.ts +1 -1
- package/dist/types/premium.types.d.ts.map +1 -1
- package/dist/utils/blocks.utils.cjs +1 -1
- package/dist/utils/blocks.utils.d.ts +8 -0
- package/dist/utils/blocks.utils.d.ts.map +1 -1
- package/dist/utils/blocks.utils.js +61 -19
- package/dist/utils/blocks.utils.test.d.ts +2 -0
- package/dist/utils/blocks.utils.test.d.ts.map +1 -0
- package/dist/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.js +23 -18
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +7 -2
- package/dist/utils/index.d.ts +6 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/license.utils.cjs +1 -1
- package/dist/utils/license.utils.js +15 -10
- package/dist/utils/memory.utils.cjs +1 -1
- package/dist/utils/memory.utils.d.ts.map +1 -1
- package/dist/utils/memory.utils.js +17 -5
- package/dist/utils/paste.utils.cjs +1 -1
- package/dist/utils/paste.utils.js +27 -23
- package/dist/utils/premium.utils.cjs +1 -1
- package/dist/utils/premium.utils.js +23 -18
- package/dist/utils/selection.utils.cjs +1 -0
- package/dist/utils/selection.utils.d.ts +10 -0
- package/dist/utils/selection.utils.d.ts.map +1 -0
- package/dist/utils/selection.utils.js +58 -0
- package/dist/utils/selection.utils.test.d.ts +2 -0
- package/dist/utils/selection.utils.test.d.ts.map +1 -0
- package/dist/utils/slash.utils.cjs +1 -1
- package/dist/utils/slash.utils.js +13 -8
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +5 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +69 -10
- package/dist/utils/table.utils.test.d.ts +2 -0
- package/dist/utils/table.utils.test.d.ts.map +1 -0
- package/dist/utils/toolbarStorage.utils.cjs +1 -0
- package/dist/utils/toolbarStorage.utils.d.ts +12 -0
- package/dist/utils/toolbarStorage.utils.d.ts.map +1 -0
- package/dist/utils/toolbarStorage.utils.js +92 -0
- package/dist/utils/toolbarStorage.utils.test.d.ts +2 -0
- package/dist/utils/toolbarStorage.utils.test.d.ts.map +1 -0
- package/dist/utils/trackChanges.utils.cjs +1 -1
- package/dist/utils/trackChanges.utils.js +14 -9
- package/dist/utils/typo.utils.cjs +1 -1
- package/dist/utils/typo.utils.js +15 -10
- package/package.json +2 -1
|
@@ -1,647 +1,1135 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { INK_MIN_HEIGHT as
|
|
4
|
-
import { TOOLBAR_OPTION_SIGNATURE as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { jsxs as ce, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S, useState as a, useEffect as I } from "react";
|
|
3
|
+
import { INK_MIN_HEIGHT as bo, INK_DEFAULT_TEXT_COLOR as Ro, INK_DEFAULT_HIGHLIGHT_COLOR as Do, NUMBER_ZERO as _ } from "../../constants/numbers.js";
|
|
4
|
+
import { TOOLBAR_OPTION_FONT_DROPDOWN as St, TOOLBAR_OPTION_LIST_DROPDOWN as Mt, TOOLBAR_OPTION_SIGNATURE as kt, TOOLBAR_OPTION_FIND_REPLACE as Ut, TOOLBAR_OPTION_FIND_REPLACE_DROPDOWN as wt, TOOLBAR_OPTION_HORIZONTAL_RULE as Ht } from "../../constants/toolbar.const.js";
|
|
5
|
+
import { TOOLBAR_SHOW_CONTROL_LABEL as Bo, TOOLBAR_SHOW_CONTROL_ARIA_LABEL as So, CONTEXT_MENU_LABEL_SHOW_TOOLBAR as Mo, CONTEXT_MENU_ID_SHOW_TOOLBAR as ko, TOOLBAR_CONTEXT_MENU_LABEL_CUSTOMIZE as Uo, TOOLBAR_CONTEXT_MENU_ID_CUSTOMIZE as wo, TOOLBAR_CONTEXT_MENU_LABEL_HIDE as Ho, TOOLBAR_CONTEXT_MENU_ID_HIDE as Po, TOOLBAR_OPTION_DIVIDER as Pt } from "../../constants/toolbarMenu.const.js";
|
|
6
|
+
import { INK_DEFAULT_COLOR_MODE as yo, COLOR_MODE_SYSTEM as Fo } from "../../constants/colorMode.const.js";
|
|
7
|
+
import { KEY_TAB as vo, KEY_ENTER as xo, KEY_ESCAPE as Xo, KEY_Z as Ko } from "../../constants/keyboard.const.js";
|
|
8
|
+
import { FONT_VALUE_SYSTEM as Wo, INK_FONT_OPTIONS as Vo, FONT_DROPDOWN_TITLE as Go } from "../../constants/fonts.const.js";
|
|
9
|
+
import { LIST_VALUE_BULLET as Yo, INK_LIST_OPTIONS as zo, LIST_DROPDOWN_TITLE as jo } from "../../constants/lists.const.js";
|
|
10
|
+
import { FIND_REPLACE_FOCUS_FIND as se, INK_FIND_REPLACE_OPTIONS as $o, FIND_REPLACE_DROPDOWN_TITLE as qo, FIND_REPLACE_FOCUS_REPLACE as Zo, FIND_REPLACE_VALUE_REPLACE as Qo } from "../../constants/findReplaceMenu.const.js";
|
|
11
|
+
import { BLOCK_DROP_POSITION_BEFORE as Jo, DIR_LTR as er, DIR_RTL as tr } from "../../constants/blocks.const.js";
|
|
12
|
+
import { INK_PLACEHOLDER_DEFAULT as nr, INK_DEFAULT_TOOLBAR as or, INK_DEFAULT_VARIANT as rr, INK_DEFAULT_CHROME as lr, INK_DEFAULT_AUTHOR as ir, INK_TABLE_DEFAULT_ROWS as cr, INK_TABLE_DEFAULT_COLS as sr, INK_DEFAULT_FEATURES as ar, INK_CLASS_TOOLBAR_SHOW as ur, INK_CLASS_TOOLBAR as dr, INK_CLASS_SHELL as fr, INK_CLASS_BODY as mr, INK_CLASS_CONTENT as _r, INK_CLASS_FOOTER as Tr, INK_CLASS_DIVIDER as Er, INK_HEADING_OPTIONS as pr, INK_BUTTON_CONFIG as yt, INK_CLASS_BLOCK_ACTIVE as Cr, INK_CLASS_ROOT as Lr } from "../../constants/defaults.const.js";
|
|
13
|
+
import { INK_AI_DEMO_PROVIDER_ID as Or } from "../../constants/aiModels.const.js";
|
|
14
|
+
import "../../constants/openai.const.js";
|
|
15
|
+
import { INK_DEFAULT_ICONS as Ft } from "../../constants/defaultIcons.js";
|
|
16
|
+
import { CONTEXT_MENU_LABEL_TABLE_ROW_ABOVE as Nr, CONTEXT_MENU_ID_TABLE_ROW_ABOVE as Ir, CONTEXT_MENU_LABEL_TABLE_ROW_BELOW as gr, CONTEXT_MENU_ID_TABLE_ROW_BELOW as hr, CONTEXT_MENU_LABEL_TABLE_COL_LEFT as Ar, CONTEXT_MENU_ID_TABLE_COL_LEFT as br, CONTEXT_MENU_LABEL_TABLE_COL_RIGHT as Rr, CONTEXT_MENU_ID_TABLE_COL_RIGHT as Dr, CONTEXT_MENU_LABEL_TABLE_DELETE_ROW as Br, CONTEXT_MENU_ID_TABLE_DELETE_ROW as Sr, CONTEXT_MENU_LABEL_TABLE_DELETE_COL as Mr, CONTEXT_MENU_ID_TABLE_DELETE_COL as kr, CONTEXT_MENU_LABEL_BOLD as Ur, CONTEXT_MENU_ID_BOLD as wr, CONTEXT_MENU_LABEL_ITALIC as Hr, CONTEXT_MENU_ID_ITALIC as Pr, CONTEXT_MENU_LABEL_UNDERLINE as yr, CONTEXT_MENU_ID_UNDERLINE as Fr, CONTEXT_MENU_LABEL_STRIKE as vr, CONTEXT_MENU_ID_STRIKE as xr, CONTEXT_MENU_LABEL_HEADING as Xr, CONTEXT_MENU_ID_HEADING as Kr, CONTEXT_MENU_LABEL_BULLET as Wr, CONTEXT_MENU_ID_BULLET as Vr, CONTEXT_MENU_LABEL_ORDERED as Gr, CONTEXT_MENU_ID_ORDERED as Yr, CONTEXT_MENU_LABEL_LINK as zr, CONTEXT_MENU_ID_LINK as jr, CONTEXT_MENU_LABEL_CLEAR as $r, CONTEXT_MENU_ID_CLEAR as qr, CONTEXT_MENU_LABEL_FIND as Zr, CONTEXT_MENU_ID_FIND as Qr, CONTEXT_MENU_LABEL_SIGNATURE as Jr, CONTEXT_MENU_ID_SIGNATURE as el, CONTEXT_MENU_LABEL_COMMENT as tl, CONTEXT_MENU_ID_COMMENT as nl } from "../../constants/contextMenu.const.js";
|
|
17
|
+
import { cn as ol } from "../../utils/cn.utils.js";
|
|
18
|
+
import { applyTypoAutoFix as rl } from "../../utils/typo.utils.js";
|
|
19
|
+
import { createInkId as vt } from "../../utils/id.utils.js";
|
|
20
|
+
import { getTableCellFromSelection as xt, buildTableHtml as ll, insertTableRow as Xt, insertTableColumn as Kt, deleteTableRow as il, deleteTableColumn as cl } from "../../utils/table.utils.js";
|
|
21
|
+
import { getBlockElement as ee, clearBlockDragClasses as Pe, markActiveBlock as Wt, markDraggingBlock as sl, moveBlock as al, resolveDropPosition as Vt, reorderBlockBefore as ul, reorderBlockAfter as dl, markDropTarget as Gt } from "../../utils/blocks.utils.js";
|
|
22
|
+
import { createTrackChange as ye, rejectTrackChangeInHtml as fl, acceptTrackChangeInHtml as ml, wrapInsertHtml as Yt, wrapDeleteHtml as _l } from "../../utils/trackChanges.utils.js";
|
|
23
|
+
import { removeCommentMark as Tl, wrapSelectionAsComment as El, createCommentThread as pl } from "../../utils/comments.utils.js";
|
|
24
|
+
import { InkHistoryStack as Fe } from "../../utils/history.utils.js";
|
|
25
|
+
import { extractSlashQuery as Cl, filterSlashCommands as Ll } from "../../utils/slash.utils.js";
|
|
26
|
+
import { resolveInkPremium as Ol, hasInkPremiumFeature as te, themeTokensToStyle as Nl } from "../../utils/premium.utils.js";
|
|
27
|
+
import { extractClipboardHtml as Il, sanitizePastedHtml as gl, extractClipboardText as hl } from "../../utils/paste.utils.js";
|
|
28
|
+
import { readInkMemory as Al, writeInkMemory as bl } from "../../utils/memory.utils.js";
|
|
29
|
+
import { replaceInHtml as Rl } from "../../utils/findReplace.utils.js";
|
|
30
|
+
import { withPreservedSelection as ve } from "../../utils/selection.utils.js";
|
|
31
|
+
import { readToolbarItems as Dl, readToolbarHidden as Bl, listCustomizableToolbarOptions as Sl, writeToolbarHidden as Ml, buildVisibleToolbarItems as kl, writeToolbarItems as Ul } from "../../utils/toolbarStorage.utils.js";
|
|
32
|
+
import { Button as wl } from "../../common-components/Button/Button.js";
|
|
33
|
+
import { ContextMenu as zt } from "../../common-components/ContextMenu/ContextMenu.js";
|
|
34
|
+
import { insertImage as xe, insertHTML as M, setTextColor as Hl, setHighlightColor as Pl, getActiveFormats as yl, queryCommandValue as Fl, detectListType as vl, tryConvertMarkdownListPrefix as xl, execCommand as L, insertLink as Xl, applyFontFamily as Kl, applyListType as Wl, clearFormatDeep as Vl, setBlockDirection as jt, fileToDataUrl as Gl } from "./helpers/format.utils.js";
|
|
35
|
+
import { inkAi as Yl } from "../../plugins/ai/aiPlugin.js";
|
|
36
|
+
import { ToolbarButton as C } from "./components/ToolbarButton/ToolbarButton.js";
|
|
37
|
+
import { ToolbarDropdown as ae } from "./components/ToolbarDropdown/ToolbarDropdown.js";
|
|
38
|
+
import { ToolbarColorPicker as $t } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
|
|
39
|
+
import { CommentsPanel as zl } from "./components/CommentsPanel/CommentsPanel.js";
|
|
40
|
+
import { AiPanel as jl } from "./components/AiPanel/AiPanel.js";
|
|
41
|
+
import { AiAutocomplete as $l } from "./components/AiAutocomplete/AiAutocomplete.js";
|
|
42
|
+
import { AI_AUTOCOMPLETE_DEBOUNCE_MS as ql, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT as Zl } from "./components/AiAutocomplete/AiAutocomplete.const.js";
|
|
43
|
+
import { getTextBeforeCaret as Ql, getCaretPositionInRoot as qt } from "./components/AiAutocomplete/AiAutocomplete.utils.js";
|
|
44
|
+
import { BlockHandles as Jl } from "./components/BlockHandles/BlockHandles.js";
|
|
45
|
+
import { BLOCK_HANDLES_DRAG_MIME as ei, BLOCK_HANDLES_DRAG_PAYLOAD as ti, BLOCK_HANDLES_DRAG_EFFECT_MOVE as Zt } from "./components/BlockHandles/BlockHandles.const.js";
|
|
46
|
+
import { InlineToolbar as ni } from "./components/InlineToolbar/InlineToolbar.js";
|
|
47
|
+
import { INLINE_TOOLBAR_EDGE_PADDING_PX as oi, INLINE_TOOLBAR_ESTIMATED_WIDTH_PX as ri, INLINE_TOOLBAR_ESTIMATED_HEIGHT_PX as li, INLINE_TOOLBAR_GAP_PX as ii } from "./components/InlineToolbar/InlineToolbar.const.js";
|
|
48
|
+
import { selectionIsInsideElement as ci, clampInlineToolbarPosition as si } from "./components/InlineToolbar/InlineToolbar.utils.js";
|
|
49
|
+
import { SlashMenu as ai } from "./components/SlashMenu/SlashMenu.js";
|
|
50
|
+
import { TrackChangesBar as ui } from "./components/TrackChangesBar/TrackChangesBar.js";
|
|
51
|
+
import { SignPad as di } from "./components/SignPad/SignPad.js";
|
|
52
|
+
import { FindReplace as fi } from "./components/FindReplace/FindReplace.js";
|
|
53
|
+
import { ToolbarCustomize as mi } from "./components/ToolbarCustomize/ToolbarCustomize.js";
|
|
54
|
+
const Xe = () => {
|
|
55
|
+
const g = window.getSelection();
|
|
56
|
+
if (!g || g.rangeCount === _) return "";
|
|
57
|
+
const p = g.getRangeAt(_), h = document.createElement("div");
|
|
58
|
+
return h.appendChild(p.cloneContents()), h.innerHTML;
|
|
59
|
+
}, T = (g) => {
|
|
60
|
+
g == null || g.focus({ preventScroll: !0 });
|
|
61
|
+
}, _c = (g) => {
|
|
62
|
+
var Rt;
|
|
38
63
|
const {
|
|
39
|
-
value:
|
|
40
|
-
defaultValue:
|
|
64
|
+
value: p,
|
|
65
|
+
defaultValue: h = "",
|
|
41
66
|
onChange: A,
|
|
42
|
-
placeholder:
|
|
43
|
-
disabled:
|
|
67
|
+
placeholder: Ke = nr,
|
|
68
|
+
disabled: l = !1,
|
|
44
69
|
readOnly: i = !1,
|
|
45
|
-
minHeight:
|
|
46
|
-
maxHeight:
|
|
47
|
-
toolbar:
|
|
48
|
-
className:
|
|
49
|
-
testId:
|
|
50
|
-
allowImagePaste:
|
|
51
|
-
showCharCount:
|
|
52
|
-
charCountMax:
|
|
53
|
-
typoAutoFix:
|
|
54
|
-
variant:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
70
|
+
minHeight: ue = bo,
|
|
71
|
+
maxHeight: de,
|
|
72
|
+
toolbar: ne = or,
|
|
73
|
+
className: Qt = "",
|
|
74
|
+
testId: Jt,
|
|
75
|
+
allowImagePaste: We = !0,
|
|
76
|
+
showCharCount: Ve = !1,
|
|
77
|
+
charCountMax: Ge,
|
|
78
|
+
typoAutoFix: en = !0,
|
|
79
|
+
variant: tn = rr,
|
|
80
|
+
chrome: nn = lr,
|
|
81
|
+
colorMode: Ye = yo,
|
|
82
|
+
features: on,
|
|
83
|
+
author: H = ir,
|
|
84
|
+
trackChanges: G,
|
|
85
|
+
onTrackChangesChange: fe,
|
|
86
|
+
trackChangesEnabled: oe,
|
|
87
|
+
onTrackChangesEnabledChange: me,
|
|
88
|
+
comments: Y,
|
|
89
|
+
onCommentsChange: _e,
|
|
90
|
+
showCommentsPanel: z,
|
|
91
|
+
onShowCommentsPanelChange: Te,
|
|
92
|
+
ai: f,
|
|
93
|
+
slashCommands: rn,
|
|
94
|
+
tableRows: ln = cr,
|
|
95
|
+
tableCols: cn = sr,
|
|
96
|
+
premium: sn,
|
|
97
|
+
theme: an,
|
|
98
|
+
icons: ze,
|
|
99
|
+
pasteMode: un = "plain",
|
|
100
|
+
onImageUpload: je,
|
|
101
|
+
wysiwyg: dn = !1,
|
|
102
|
+
keepInMemory: P = !1,
|
|
103
|
+
memoryKey: y,
|
|
104
|
+
onToolbarChange: Ee,
|
|
105
|
+
toolbarHidden: F,
|
|
106
|
+
onToolbarHiddenChange: pe,
|
|
107
|
+
style: fn,
|
|
108
|
+
...mn
|
|
109
|
+
} = g, d = { ...ar, ...on }, v = Ol(sn), _n = te(v, "icons"), Tn = te(v, "theme"), En = te(v, "richPaste"), pn = te(v, "imageUpload"), Cn = te(v, "wysiwyg") && dn, m = _n && ze ? { ...Ft, ...ze } : Ft, Ln = Tn ? Nl(an) : {}, On = En && un === "rich", n = S(null), j = S(new Fe(p ?? h)), x = S(null), k = S(null), [$e, Nn] = a(/* @__PURE__ */ new Set()), [In, qe] = a("p"), [gn, hn] = a(0), [An, bn] = a(Ro), [Rn, Dn] = a(Do), [X, Ze] = a(oe ?? !1), [Bn, Qe] = a(G ?? []), [Sn, Je] = a(Y ?? []), [Mn, et] = a(z ?? !1), [tt, Ce] = a(!!(f != null && f.enabled && f.openOnInit)), [re, kn] = a(!1), nt = S(!1), [R, $] = a({
|
|
110
|
+
visible: !1,
|
|
111
|
+
suggestion: "",
|
|
112
|
+
top: _,
|
|
113
|
+
left: _
|
|
114
|
+
}), q = S(null), K = S(_), [ot, Un] = a(""), [wn, Hn] = a(0), [Pn, rt] = a(!1), [yn, le] = a([]), [lt, Fn] = a({ top: 0, left: 0 }), [it, Le] = a(!1), [Oe, ie] = a(!1), [vn, xn] = a(se), [Xn, Kn] = a(Wo), [Wn, ct] = a(Yo), [Vn, Gn] = a(se), [Ne, Ie] = a({ open: !1, x: _, y: _ }), [Yn, st] = a(!1), [ge, he] = a({
|
|
115
|
+
open: !1,
|
|
116
|
+
x: _,
|
|
117
|
+
y: _
|
|
118
|
+
}), [Ae, W] = a({
|
|
119
|
+
open: !1,
|
|
120
|
+
top: _,
|
|
121
|
+
left: _
|
|
122
|
+
}), [be, at] = a(
|
|
123
|
+
() => Dl(P, y) ?? ne
|
|
124
|
+
), [zn, ut] = a(() => F !== void 0 ? F : Bl(P, y) ?? !1), [jn, dt] = a(!1), ft = S(!0), $n = ne.join(","), D = G ?? Bn, Z = Y ?? Sn, Re = z ?? Mn, mt = rn ?? d.slash, _t = F ?? zn, Tt = ne, qn = Sl(Tt), De = Ye === Fo ? void 0 : Ye, Be = !!(d.ai && (f != null && f.enabled) && f.autocomplete !== !1 && !l && !i), Se = () => {
|
|
125
|
+
q.current !== null && (window.clearTimeout(q.current), q.current = null);
|
|
126
|
+
}, b = () => {
|
|
127
|
+
Se(), K.current += 1, $(
|
|
128
|
+
(e) => e.visible || e.suggestion ? { visible: !1, suggestion: "", top: _, left: _ } : e
|
|
129
|
+
);
|
|
130
|
+
}, Zn = () => {
|
|
131
|
+
if (!Be || re || !n.current) {
|
|
132
|
+
b();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const e = window.getSelection();
|
|
136
|
+
if (!e || !e.isCollapsed) {
|
|
137
|
+
b();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
Se(), $(
|
|
141
|
+
(o) => o.visible || o.suggestion ? { ...o, visible: !1, suggestion: "" } : o
|
|
142
|
+
);
|
|
143
|
+
const t = (f == null ? void 0 : f.providerId) || Or;
|
|
144
|
+
q.current = window.setTimeout(() => {
|
|
145
|
+
if (q.current = null, !n.current || nt.current) return;
|
|
146
|
+
const o = window.getSelection();
|
|
147
|
+
if (!o || !o.isCollapsed) return;
|
|
148
|
+
const r = Ql(n.current), c = qt(n.current);
|
|
149
|
+
if (!r.trim() || !c) return;
|
|
150
|
+
const E = K.current + 1;
|
|
151
|
+
K.current = E;
|
|
152
|
+
const N = n.current.innerHTML;
|
|
153
|
+
Yl.runProvider(t, {
|
|
154
|
+
capability: "autocomplete",
|
|
155
|
+
html: N,
|
|
156
|
+
prompt: r,
|
|
157
|
+
modelId: f == null ? void 0 : f.modelId
|
|
158
|
+
}).then((w) => {
|
|
159
|
+
var Bt;
|
|
160
|
+
if (E !== K.current) return;
|
|
161
|
+
const B = ((Bt = w.text) == null ? void 0 : Bt.trim()) || "";
|
|
162
|
+
if (!B) {
|
|
163
|
+
$({
|
|
164
|
+
visible: !1,
|
|
165
|
+
suggestion: "",
|
|
166
|
+
top: _,
|
|
167
|
+
left: _
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const Dt = n.current && qt(n.current) || c;
|
|
172
|
+
$({
|
|
173
|
+
visible: !0,
|
|
174
|
+
suggestion: B,
|
|
175
|
+
top: Dt.top,
|
|
176
|
+
left: Dt.left
|
|
177
|
+
});
|
|
178
|
+
}).catch(() => {
|
|
179
|
+
E === K.current && $({
|
|
180
|
+
visible: !1,
|
|
181
|
+
suggestion: "",
|
|
182
|
+
top: _,
|
|
183
|
+
left: _
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}, ql);
|
|
187
|
+
};
|
|
188
|
+
I(() => () => {
|
|
189
|
+
Se(), K.current += 1;
|
|
190
|
+
}, []), I(() => {
|
|
191
|
+
nt.current = re, re && b();
|
|
192
|
+
}, [re]), I(() => {
|
|
193
|
+
oe !== void 0 && Ze(oe);
|
|
194
|
+
}, [oe]), I(() => {
|
|
195
|
+
G && Qe(G);
|
|
196
|
+
}, [G]), I(() => {
|
|
197
|
+
Y && Je(Y);
|
|
198
|
+
}, [Y]), I(() => {
|
|
199
|
+
z !== void 0 && et(z);
|
|
200
|
+
}, [z]), I(() => {
|
|
201
|
+
F !== void 0 && ut(F);
|
|
202
|
+
}, [F]), I(() => {
|
|
203
|
+
if (ft.current) {
|
|
204
|
+
ft.current = !1;
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
at(ne);
|
|
208
|
+
}, [$n]), I(() => {
|
|
209
|
+
if (!n.current || p === void 0 || p === x.current) return;
|
|
210
|
+
if (n.current.innerHTML === p) {
|
|
211
|
+
x.current = p;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const e = document.activeElement === n.current;
|
|
215
|
+
ve(e ? n.current : null, () => {
|
|
216
|
+
n.current && (n.current.innerHTML = p);
|
|
217
|
+
}), x.current = p;
|
|
218
|
+
}, [p]), I(() => {
|
|
219
|
+
if (!n.current) return;
|
|
220
|
+
const e = P ? Al(y) : "";
|
|
221
|
+
if (e) {
|
|
222
|
+
n.current.innerHTML = e, x.current = e, j.current = new Fe(e), A == null || A(e);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
p === void 0 && h && (n.current.innerHTML = h, x.current = h, j.current = new Fe(h), A == null || A(h));
|
|
94
226
|
}, []);
|
|
95
|
-
const
|
|
227
|
+
const Me = (e) => {
|
|
96
228
|
var t;
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
229
|
+
j.current.push(e), x.current = e, A == null || A(e), P && bl(e, y), Ve && n.current && hn(((t = n.current.textContent) == null ? void 0 : t.length) ?? 0);
|
|
230
|
+
}, U = (e) => {
|
|
231
|
+
n.current && (ve(n.current, () => {
|
|
232
|
+
n.current && (n.current.innerHTML = e);
|
|
233
|
+
}), Me(e));
|
|
234
|
+
}, ke = (e) => {
|
|
235
|
+
ut(e), pe == null || pe(e), Ml(e, P, y);
|
|
236
|
+
}, Qn = (e) => {
|
|
237
|
+
at(e), Ee == null || Ee(e), Ul(e, P, y);
|
|
238
|
+
}, Jn = (e, t) => {
|
|
239
|
+
if (e === Pt) return;
|
|
240
|
+
const o = new Set(
|
|
241
|
+
be.filter((r) => r !== Pt)
|
|
242
|
+
);
|
|
243
|
+
t ? o.add(e) : o.delete(e), Qn(kl(Tt, o));
|
|
244
|
+
}, Q = (e) => {
|
|
245
|
+
Qe(e), fe == null || fe(e);
|
|
246
|
+
}, Ue = (e) => {
|
|
247
|
+
Je(e), _e == null || _e(e);
|
|
248
|
+
}, we = (e) => {
|
|
249
|
+
et(e), Te == null || Te(e);
|
|
250
|
+
}, eo = (e) => {
|
|
251
|
+
Ze(e), me == null || me(e);
|
|
252
|
+
}, to = () => {
|
|
253
|
+
if (l || i) {
|
|
254
|
+
W((c) => c.open ? { ...c, open: !1 } : c);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const e = window.getSelection();
|
|
258
|
+
if (!e || e.isCollapsed || e.rangeCount === 0 || !ci(e, n.current)) {
|
|
259
|
+
W((c) => c.open ? { ...c, open: !1 } : c);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const o = e.getRangeAt(0).getBoundingClientRect();
|
|
263
|
+
if (o.width === 0 && o.height === 0) {
|
|
264
|
+
W((c) => c.open ? { ...c, open: !1 } : c);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const r = si({
|
|
268
|
+
selectionRect: o,
|
|
269
|
+
toolbarWidth: ri,
|
|
270
|
+
toolbarHeight: li,
|
|
271
|
+
viewport: { width: window.innerWidth, height: window.innerHeight },
|
|
272
|
+
gap: ii,
|
|
273
|
+
edgePadding: oi
|
|
274
|
+
});
|
|
275
|
+
W({ open: !0, top: r.top, left: r.left });
|
|
276
|
+
}, J = () => {
|
|
277
|
+
Nn(yl());
|
|
278
|
+
const e = Fl("formatBlock");
|
|
279
|
+
if (e && qe(e.toLowerCase().replace(/[<>]/g, "")), ct(vl()), Un(Xe()), to(), !n.current || !d.blocks) return;
|
|
280
|
+
const t = window.getSelection(), o = (t == null ? void 0 : t.anchorNode) ?? null, r = ee(o, n.current);
|
|
281
|
+
if (Wt(n.current, r), r) {
|
|
282
|
+
const c = n.current.getBoundingClientRect(), E = r.getBoundingClientRect();
|
|
283
|
+
Hn(E.top - c.top + n.current.scrollTop), rt(!0);
|
|
116
284
|
} else
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
var t,
|
|
120
|
-
if (!
|
|
121
|
-
let e =
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
285
|
+
rt(!1);
|
|
286
|
+
}, u = () => {
|
|
287
|
+
var t, o, r;
|
|
288
|
+
if (!n.current) return;
|
|
289
|
+
let e = n.current.innerHTML;
|
|
290
|
+
if (X && d.trackChanges) {
|
|
291
|
+
const c = window.getSelection();
|
|
292
|
+
if (c && !c.isCollapsed) {
|
|
293
|
+
const E = Xe();
|
|
294
|
+
if (E) {
|
|
295
|
+
const N = ye("delete", E, H);
|
|
296
|
+
Q([...D, N]), no(N.id), e = n.current.innerHTML;
|
|
129
297
|
}
|
|
130
298
|
}
|
|
131
299
|
}
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
top:
|
|
141
|
-
left:
|
|
300
|
+
if (Me(e), J(), mt && n.current) {
|
|
301
|
+
const c = ((o = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : o.textContent) ?? "", E = Cl(c);
|
|
302
|
+
if (E !== null) {
|
|
303
|
+
le(Ll(E));
|
|
304
|
+
const N = (r = window.getSelection()) == null ? void 0 : r.getRangeAt(0);
|
|
305
|
+
if (N && n.current) {
|
|
306
|
+
const w = N.getBoundingClientRect(), B = n.current.getBoundingClientRect();
|
|
307
|
+
Fn({
|
|
308
|
+
top: w.bottom - B.top + 8,
|
|
309
|
+
left: w.left - B.left
|
|
142
310
|
});
|
|
143
311
|
}
|
|
144
312
|
} else
|
|
145
|
-
|
|
313
|
+
le([]);
|
|
314
|
+
}
|
|
315
|
+
Be ? Zn() : b();
|
|
316
|
+
}, Et = () => {
|
|
317
|
+
const e = R.suggestion;
|
|
318
|
+
if (!e) {
|
|
319
|
+
b();
|
|
320
|
+
return;
|
|
146
321
|
}
|
|
147
|
-
|
|
322
|
+
T(n.current), L(Zl, e), b(), u();
|
|
323
|
+
}, no = (e) => {
|
|
148
324
|
const t = window.getSelection();
|
|
149
325
|
if (!t || t.rangeCount === 0) return;
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
if (!
|
|
154
|
-
const e =
|
|
155
|
-
t.html !== e && (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
326
|
+
const o = Xe();
|
|
327
|
+
o && M(_l(o, e));
|
|
328
|
+
}, oo = () => {
|
|
329
|
+
if (!n.current || !en || !d.typoAutoFix || l || i) return;
|
|
330
|
+
const e = n.current.innerHTML, t = rl(e);
|
|
331
|
+
t.html !== e && (ve(n.current, () => {
|
|
332
|
+
n.current && (n.current.innerHTML = t.html);
|
|
333
|
+
}), Me(t.html));
|
|
334
|
+
}, O = (e) => {
|
|
335
|
+
if (l || i) return;
|
|
336
|
+
if (T(n.current), e === "clearFormat") {
|
|
337
|
+
Vl(), u();
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (e === "directionLtr" && n.current) {
|
|
341
|
+
jt(n.current, er), u();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (e === "directionRtl" && n.current) {
|
|
345
|
+
jt(n.current, tr), u();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (e === "superscript" || e === "subscript") {
|
|
349
|
+
L(e), u();
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const t = yt[e];
|
|
353
|
+
t && (t.value ? L(t.command, t.value) : L(t.command), u());
|
|
354
|
+
}, ro = (e) => {
|
|
355
|
+
l || i || (T(n.current), L("formatBlock", e), qe(e), u());
|
|
356
|
+
}, lo = (e) => {
|
|
357
|
+
l || i || (T(n.current), Kl(e), Kn(e), u());
|
|
358
|
+
}, io = (e) => {
|
|
359
|
+
l || i || (T(n.current), Wl(e), ct(e), u());
|
|
360
|
+
}, pt = (e) => {
|
|
361
|
+
xn(e), Gn(e), ie(!0);
|
|
362
|
+
}, co = (e) => {
|
|
363
|
+
if (l || i) return;
|
|
364
|
+
pt(e === Qo ? Zo : se);
|
|
365
|
+
}, He = () => {
|
|
366
|
+
if (l || i) return;
|
|
168
367
|
const e = window.prompt("Enter URL:", "https://");
|
|
169
|
-
e && ((
|
|
170
|
-
},
|
|
171
|
-
if (
|
|
368
|
+
e && (T(n.current), Xl(e), u());
|
|
369
|
+
}, Ct = async (e) => pn && je ? je(e) : Gl(e), so = async () => {
|
|
370
|
+
if (l || i) return;
|
|
172
371
|
const e = document.createElement("input");
|
|
173
372
|
e.type = "file", e.accept = "image/*", e.onchange = async () => {
|
|
174
|
-
var
|
|
175
|
-
const t = (
|
|
373
|
+
var r;
|
|
374
|
+
const t = (r = e.files) == null ? void 0 : r[0];
|
|
176
375
|
if (!t) return;
|
|
177
|
-
const
|
|
178
|
-
(
|
|
376
|
+
const o = await Ct(t);
|
|
377
|
+
T(n.current), xe(o, t.name), u();
|
|
179
378
|
}, e.click();
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
E([...k, n]), I(Me(e, n.id));
|
|
379
|
+
}, Lt = () => {
|
|
380
|
+
if (l || i || !d.table) return;
|
|
381
|
+
T(n.current);
|
|
382
|
+
const e = ll(ln, cn);
|
|
383
|
+
if (X && d.trackChanges) {
|
|
384
|
+
const t = ye("insert", e, H);
|
|
385
|
+
Q([...D, t]), M(Yt(e, t.id));
|
|
188
386
|
} else
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
const e =
|
|
193
|
-
if (e === null || !
|
|
194
|
-
|
|
387
|
+
M(e);
|
|
388
|
+
u();
|
|
389
|
+
}, Ot = () => {
|
|
390
|
+
const e = j.current.undo();
|
|
391
|
+
if (e === null || !n.current) {
|
|
392
|
+
L("undo"), u();
|
|
195
393
|
return;
|
|
196
394
|
}
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
const e =
|
|
200
|
-
if (e === null || !
|
|
201
|
-
|
|
395
|
+
U(e);
|
|
396
|
+
}, Nt = () => {
|
|
397
|
+
const e = j.current.redo();
|
|
398
|
+
if (e === null || !n.current) {
|
|
399
|
+
L("redo"), u();
|
|
202
400
|
return;
|
|
203
401
|
}
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
|
|
402
|
+
U(e);
|
|
403
|
+
}, ao = (e) => {
|
|
404
|
+
l || i || (e.preventDefault(), he((t) => t.open ? { ...t, open: !1 } : t), st(!!(d.table && xt())), Ie({ open: !0, x: e.clientX, y: e.clientY }));
|
|
405
|
+
}, uo = (e) => {
|
|
406
|
+
l || i || (e.preventDefault(), Ie((t) => t.open ? { ...t, open: !1 } : t), he({ open: !0, x: e.clientX, y: e.clientY }));
|
|
407
|
+
}, It = () => {
|
|
408
|
+
if (l || i || !d.comments) return;
|
|
208
409
|
const e = window.prompt("Comment:");
|
|
209
410
|
if (!(e != null && e.trim())) return;
|
|
210
|
-
const t =
|
|
211
|
-
if ((
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
411
|
+
const t = vt("hl");
|
|
412
|
+
if (T(n.current), !El(t)) return;
|
|
413
|
+
const r = pl(H, e.trim(), t);
|
|
414
|
+
Ue([r, ...Z]), we(!0), u();
|
|
415
|
+
}, fo = [
|
|
416
|
+
{
|
|
417
|
+
id: wo,
|
|
418
|
+
label: Uo,
|
|
419
|
+
onSelect: () => dt(!0)
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
id: Po,
|
|
423
|
+
label: Ho,
|
|
424
|
+
onSelect: () => ke(!0)
|
|
425
|
+
}
|
|
426
|
+
], V = (e) => {
|
|
427
|
+
const t = xt();
|
|
428
|
+
!t || !d.table || e(t) && u();
|
|
429
|
+
}, mo = [
|
|
430
|
+
...d.table && Yn ? [
|
|
431
|
+
{
|
|
432
|
+
id: Ir,
|
|
433
|
+
label: Nr,
|
|
434
|
+
onSelect: () => V((e) => Xt(e, "before"))
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
id: hr,
|
|
438
|
+
label: gr,
|
|
439
|
+
onSelect: () => V((e) => Xt(e, "after"))
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
id: br,
|
|
443
|
+
label: Ar,
|
|
444
|
+
onSelect: () => V((e) => Kt(e, "before"))
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
id: Dr,
|
|
448
|
+
label: Rr,
|
|
449
|
+
onSelect: () => V((e) => Kt(e, "after"))
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
id: Sr,
|
|
453
|
+
label: Br,
|
|
454
|
+
onSelect: () => V((e) => il(e))
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
id: kr,
|
|
458
|
+
label: Mr,
|
|
459
|
+
onSelect: () => V((e) => cl(e))
|
|
460
|
+
}
|
|
461
|
+
] : [],
|
|
462
|
+
{
|
|
463
|
+
id: wr,
|
|
464
|
+
label: Ur,
|
|
465
|
+
onSelect: () => O("bold")
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
id: Pr,
|
|
469
|
+
label: Hr,
|
|
470
|
+
onSelect: () => O("italic")
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
id: Fr,
|
|
474
|
+
label: yr,
|
|
475
|
+
onSelect: () => O("underline")
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
id: xr,
|
|
479
|
+
label: vr,
|
|
480
|
+
onSelect: () => O("strikethrough")
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
id: Kr,
|
|
484
|
+
label: Xr,
|
|
485
|
+
onSelect: () => O("heading2")
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
id: Vr,
|
|
489
|
+
label: Wr,
|
|
490
|
+
onSelect: () => O("bulletList")
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
id: Yr,
|
|
494
|
+
label: Gr,
|
|
495
|
+
onSelect: () => O("orderedList")
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
id: jr,
|
|
499
|
+
label: zr,
|
|
500
|
+
onSelect: () => He()
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
id: qr,
|
|
504
|
+
label: $r,
|
|
505
|
+
onSelect: () => O("clearFormat")
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
id: Qr,
|
|
509
|
+
label: Zr,
|
|
510
|
+
disabled: !d.findReplace,
|
|
511
|
+
onSelect: () => ie(!0)
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
id: el,
|
|
515
|
+
label: Jr,
|
|
516
|
+
disabled: !d.signature,
|
|
517
|
+
onSelect: () => Le(!0)
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
id: nl,
|
|
521
|
+
label: tl,
|
|
522
|
+
disabled: !d.comments,
|
|
523
|
+
onSelect: () => It()
|
|
524
|
+
},
|
|
525
|
+
..._t ? [
|
|
526
|
+
{
|
|
527
|
+
id: ko,
|
|
528
|
+
label: Mo,
|
|
529
|
+
onSelect: () => ke(!1)
|
|
530
|
+
}
|
|
531
|
+
] : []
|
|
532
|
+
], gt = (e) => {
|
|
533
|
+
if (!n.current) return;
|
|
534
|
+
const t = ml(n.current.innerHTML, e);
|
|
535
|
+
U(t), Q(
|
|
536
|
+
D.map((o) => o.id === e ? { ...o, accepted: !0 } : o)
|
|
219
537
|
);
|
|
220
|
-
},
|
|
221
|
-
if (!
|
|
222
|
-
const t =
|
|
223
|
-
|
|
224
|
-
|
|
538
|
+
}, ht = (e) => {
|
|
539
|
+
if (!n.current) return;
|
|
540
|
+
const t = fl(n.current.innerHTML, e);
|
|
541
|
+
U(t), Q(
|
|
542
|
+
D.map((o) => o.id === e ? { ...o, rejected: !0 } : o)
|
|
225
543
|
);
|
|
226
|
-
},
|
|
227
|
-
const t = await
|
|
228
|
-
if (
|
|
229
|
-
const
|
|
230
|
-
|
|
544
|
+
}, At = async (e) => {
|
|
545
|
+
const t = await Ct(e), o = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
|
|
546
|
+
if (X && d.trackChanges) {
|
|
547
|
+
const r = ye("insert", o, H);
|
|
548
|
+
Q([...D, r]), M(Yt(o, r.id));
|
|
231
549
|
} else
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
},
|
|
235
|
-
if (
|
|
550
|
+
xe(t);
|
|
551
|
+
u();
|
|
552
|
+
}, _o = async (e) => {
|
|
553
|
+
if (l || i) return;
|
|
236
554
|
const t = e.clipboardData;
|
|
237
555
|
if (!t) return;
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
556
|
+
if (On) {
|
|
557
|
+
const r = Il(t);
|
|
558
|
+
if (r) {
|
|
241
559
|
e.preventDefault();
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
for (const
|
|
247
|
-
if (!
|
|
248
|
-
const
|
|
249
|
-
|
|
560
|
+
const E = gl(r);
|
|
561
|
+
E && (M(E), u());
|
|
562
|
+
const N = t.items;
|
|
563
|
+
if (We && N)
|
|
564
|
+
for (const w of Array.from(N)) {
|
|
565
|
+
if (!w.type.startsWith("image/")) continue;
|
|
566
|
+
const B = w.getAsFile();
|
|
567
|
+
B && await At(B);
|
|
250
568
|
}
|
|
251
569
|
return;
|
|
252
570
|
}
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
e.preventDefault(),
|
|
571
|
+
const c = hl(t);
|
|
572
|
+
if (c) {
|
|
573
|
+
e.preventDefault(), M(c.replace(/\n/g, "<br />")), u();
|
|
256
574
|
return;
|
|
257
575
|
}
|
|
258
576
|
}
|
|
259
|
-
if (!
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
for (const
|
|
263
|
-
if (!
|
|
577
|
+
if (!We) return;
|
|
578
|
+
const o = t.items;
|
|
579
|
+
if (o)
|
|
580
|
+
for (const r of Array.from(o)) {
|
|
581
|
+
if (!r.type.startsWith("image/")) continue;
|
|
264
582
|
e.preventDefault();
|
|
265
|
-
const
|
|
266
|
-
|
|
583
|
+
const c = r.getAsFile();
|
|
584
|
+
c && await At(c);
|
|
267
585
|
}
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
|
|
586
|
+
}, To = (e) => {
|
|
587
|
+
O(e);
|
|
588
|
+
}, Eo = (e) => {
|
|
589
|
+
if (e.key === vo && R.visible && R.suggestion) {
|
|
590
|
+
e.preventDefault(), Et();
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (e.key === xo) {
|
|
594
|
+
b();
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (xl(e.nativeEvent)) {
|
|
598
|
+
u();
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (e.key === Xo) {
|
|
602
|
+
if (R.visible) {
|
|
603
|
+
e.preventDefault(), b();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
le([]), W((t) => t.open ? { ...t, open: !1 } : t);
|
|
607
|
+
}
|
|
608
|
+
(e.metaKey || e.ctrlKey) && e.key === Ko && (e.preventDefault(), e.shiftKey ? Nt() : Ot());
|
|
609
|
+
}, po = (e) => {
|
|
610
|
+
var o;
|
|
611
|
+
T(n.current);
|
|
273
612
|
const t = window.getSelection();
|
|
274
613
|
if ((o = t == null ? void 0 : t.anchorNode) != null && o.textContent) {
|
|
275
|
-
const
|
|
276
|
-
t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent =
|
|
614
|
+
const c = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
|
|
615
|
+
t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = c);
|
|
277
616
|
}
|
|
278
|
-
switch (
|
|
617
|
+
switch (le([]), e.insert) {
|
|
279
618
|
case "heading1":
|
|
280
|
-
|
|
619
|
+
L("formatBlock", "h1");
|
|
281
620
|
break;
|
|
282
621
|
case "heading2":
|
|
283
|
-
|
|
622
|
+
L("formatBlock", "h2");
|
|
284
623
|
break;
|
|
285
624
|
case "bulletList":
|
|
286
|
-
|
|
625
|
+
L("insertUnorderedList");
|
|
287
626
|
break;
|
|
288
627
|
case "orderedList":
|
|
289
|
-
|
|
628
|
+
L("insertOrderedList");
|
|
290
629
|
break;
|
|
291
630
|
case "table":
|
|
292
|
-
|
|
631
|
+
Lt();
|
|
293
632
|
return;
|
|
294
633
|
case "ai":
|
|
295
|
-
|
|
634
|
+
Ce(!0);
|
|
296
635
|
break;
|
|
297
636
|
}
|
|
298
|
-
|
|
299
|
-
},
|
|
300
|
-
if (!
|
|
301
|
-
const t = window.getSelection(),
|
|
302
|
-
|
|
303
|
-
},
|
|
637
|
+
u();
|
|
638
|
+
}, bt = (e) => {
|
|
639
|
+
if (!n.current) return;
|
|
640
|
+
const t = window.getSelection(), o = ee((t == null ? void 0 : t.anchorNode) ?? null, n.current);
|
|
641
|
+
o && al(o, e) && (u(), J());
|
|
642
|
+
}, Co = (e) => {
|
|
643
|
+
if (!n.current) return;
|
|
644
|
+
const t = window.getSelection(), o = ee((t == null ? void 0 : t.anchorNode) ?? null, n.current), r = n.current.querySelector(`.${Cr}`), c = o ?? (r instanceof HTMLElement ? r : null);
|
|
645
|
+
if (!c) {
|
|
646
|
+
e.preventDefault();
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
k.current = c, Pe(n.current), Wt(n.current, c), sl(c), e.dataTransfer.setData(ei, ti), e.dataTransfer.effectAllowed = Zt;
|
|
650
|
+
}, Lo = (e) => {
|
|
651
|
+
if (!n.current || !k.current) return;
|
|
652
|
+
e.preventDefault(), e.dataTransfer.dropEffect = Zt;
|
|
653
|
+
const t = ee(e.target, n.current);
|
|
654
|
+
if (!t || t === k.current) {
|
|
655
|
+
Gt(n.current, null, null);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
const o = Vt(e.clientY, t);
|
|
659
|
+
Gt(n.current, t, o);
|
|
660
|
+
}, Oo = (e) => {
|
|
661
|
+
if (!n.current || !k.current) return;
|
|
662
|
+
e.preventDefault();
|
|
663
|
+
const t = ee(e.target, n.current), o = k.current;
|
|
664
|
+
t && t !== o && (Vt(e.clientY, t) === Jo ? ul(o, t) : dl(o, t)) && (u(), J()), Pe(n.current), k.current = null;
|
|
665
|
+
}, No = () => {
|
|
666
|
+
n.current && Pe(n.current), k.current = null;
|
|
667
|
+
}, Io = (e, t) => {
|
|
304
668
|
if (e === "divider")
|
|
305
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ s("span", { className: Er }, `divider-${t}`);
|
|
306
670
|
if (e === "headingDropdown")
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
|
|
671
|
+
return /* @__PURE__ */ s(
|
|
672
|
+
ae,
|
|
309
673
|
{
|
|
310
674
|
title: "Heading",
|
|
311
|
-
options:
|
|
312
|
-
value:
|
|
313
|
-
disabled:
|
|
314
|
-
onChange:
|
|
675
|
+
options: pr,
|
|
676
|
+
value: In || "p",
|
|
677
|
+
disabled: l || i,
|
|
678
|
+
onChange: ro
|
|
315
679
|
},
|
|
316
680
|
"heading"
|
|
317
681
|
);
|
|
682
|
+
if (e === St)
|
|
683
|
+
return /* @__PURE__ */ s(
|
|
684
|
+
ae,
|
|
685
|
+
{
|
|
686
|
+
title: Go,
|
|
687
|
+
options: Vo,
|
|
688
|
+
value: Xn,
|
|
689
|
+
disabled: l || i,
|
|
690
|
+
onChange: lo
|
|
691
|
+
},
|
|
692
|
+
St
|
|
693
|
+
);
|
|
694
|
+
if (e === Mt)
|
|
695
|
+
return /* @__PURE__ */ s(
|
|
696
|
+
ae,
|
|
697
|
+
{
|
|
698
|
+
title: jo,
|
|
699
|
+
options: zo,
|
|
700
|
+
value: Wn,
|
|
701
|
+
disabled: l || i,
|
|
702
|
+
onChange: io
|
|
703
|
+
},
|
|
704
|
+
Mt
|
|
705
|
+
);
|
|
318
706
|
if (e === "textColor")
|
|
319
|
-
return /* @__PURE__ */
|
|
320
|
-
|
|
707
|
+
return /* @__PURE__ */ s(
|
|
708
|
+
$t,
|
|
321
709
|
{
|
|
322
710
|
title: "Text color",
|
|
323
711
|
type: "text",
|
|
324
|
-
value:
|
|
325
|
-
disabled:
|
|
326
|
-
onChange: (
|
|
327
|
-
|
|
328
|
-
(s = r.current) == null || s.focus(), vn(o), kt(o), l();
|
|
712
|
+
value: An,
|
|
713
|
+
disabled: l || i,
|
|
714
|
+
onChange: (r) => {
|
|
715
|
+
T(n.current), Hl(r), bn(r), u();
|
|
329
716
|
}
|
|
330
717
|
},
|
|
331
718
|
"textColor"
|
|
332
719
|
);
|
|
333
720
|
if (e === "highlightColor")
|
|
334
|
-
return /* @__PURE__ */
|
|
335
|
-
|
|
721
|
+
return /* @__PURE__ */ s(
|
|
722
|
+
$t,
|
|
336
723
|
{
|
|
337
724
|
title: "Highlight color",
|
|
338
725
|
type: "highlight",
|
|
339
|
-
value:
|
|
340
|
-
disabled:
|
|
341
|
-
onChange: (
|
|
342
|
-
|
|
343
|
-
(s = r.current) == null || s.focus(), On(o), It(o), l();
|
|
726
|
+
value: Rn,
|
|
727
|
+
disabled: l || i,
|
|
728
|
+
onChange: (r) => {
|
|
729
|
+
T(n.current), Pl(r), Dn(r), u();
|
|
344
730
|
}
|
|
345
731
|
},
|
|
346
732
|
"highlightColor"
|
|
347
733
|
);
|
|
348
734
|
if (e === "link")
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
|
|
735
|
+
return /* @__PURE__ */ s(
|
|
736
|
+
C,
|
|
351
737
|
{
|
|
352
|
-
icon:
|
|
738
|
+
icon: m.link,
|
|
353
739
|
title: "Insert link",
|
|
354
|
-
disabled:
|
|
355
|
-
onClick:
|
|
740
|
+
disabled: l || i,
|
|
741
|
+
onClick: He
|
|
356
742
|
},
|
|
357
743
|
"link"
|
|
358
744
|
);
|
|
359
745
|
if (e === "image")
|
|
360
|
-
return /* @__PURE__ */
|
|
361
|
-
|
|
746
|
+
return /* @__PURE__ */ s(
|
|
747
|
+
C,
|
|
362
748
|
{
|
|
363
|
-
icon:
|
|
749
|
+
icon: m.image,
|
|
364
750
|
title: "Insert image",
|
|
365
|
-
disabled:
|
|
751
|
+
disabled: l || i,
|
|
366
752
|
onClick: () => {
|
|
367
|
-
|
|
753
|
+
so();
|
|
368
754
|
}
|
|
369
755
|
},
|
|
370
756
|
"image"
|
|
371
757
|
);
|
|
372
758
|
if (e === "table")
|
|
373
|
-
return
|
|
374
|
-
|
|
759
|
+
return d.table ? /* @__PURE__ */ s(
|
|
760
|
+
C,
|
|
375
761
|
{
|
|
376
|
-
icon:
|
|
762
|
+
icon: m.table,
|
|
377
763
|
title: "Insert table",
|
|
378
|
-
disabled:
|
|
379
|
-
onClick:
|
|
764
|
+
disabled: l || i,
|
|
765
|
+
onClick: Lt
|
|
380
766
|
},
|
|
381
767
|
"table"
|
|
382
768
|
) : null;
|
|
383
|
-
if (e ===
|
|
384
|
-
return
|
|
385
|
-
|
|
769
|
+
if (e === kt)
|
|
770
|
+
return d.signature ? /* @__PURE__ */ s(
|
|
771
|
+
C,
|
|
386
772
|
{
|
|
387
|
-
icon:
|
|
773
|
+
icon: m.signature,
|
|
388
774
|
title: "Sign pad",
|
|
389
|
-
active:
|
|
390
|
-
disabled:
|
|
391
|
-
onClick: () =>
|
|
775
|
+
active: it,
|
|
776
|
+
disabled: l || i,
|
|
777
|
+
onClick: () => Le(!0)
|
|
392
778
|
},
|
|
393
|
-
|
|
779
|
+
kt
|
|
394
780
|
) : null;
|
|
395
|
-
if (e ===
|
|
396
|
-
return
|
|
397
|
-
|
|
781
|
+
if (e === Ut)
|
|
782
|
+
return d.findReplace ? /* @__PURE__ */ s(
|
|
783
|
+
C,
|
|
398
784
|
{
|
|
399
|
-
icon:
|
|
785
|
+
icon: m.findReplace,
|
|
400
786
|
title: "Find and replace",
|
|
401
|
-
active:
|
|
402
|
-
disabled:
|
|
403
|
-
onClick: () =>
|
|
787
|
+
active: Oe,
|
|
788
|
+
disabled: l || i,
|
|
789
|
+
onClick: () => {
|
|
790
|
+
Oe ? ie(!1) : pt(se);
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
Ut
|
|
794
|
+
) : null;
|
|
795
|
+
if (e === wt)
|
|
796
|
+
return d.findReplace ? /* @__PURE__ */ s(
|
|
797
|
+
ae,
|
|
798
|
+
{
|
|
799
|
+
title: qo,
|
|
800
|
+
options: $o,
|
|
801
|
+
value: Vn,
|
|
802
|
+
disabled: l || i,
|
|
803
|
+
onChange: co
|
|
404
804
|
},
|
|
405
|
-
|
|
805
|
+
wt
|
|
406
806
|
) : null;
|
|
407
|
-
if (e ===
|
|
408
|
-
return
|
|
409
|
-
|
|
807
|
+
if (e === Ht)
|
|
808
|
+
return d.horizontalRule ? /* @__PURE__ */ s(
|
|
809
|
+
C,
|
|
410
810
|
{
|
|
411
|
-
icon:
|
|
811
|
+
icon: m.horizontalRule,
|
|
412
812
|
title: "Horizontal rule",
|
|
413
|
-
disabled:
|
|
813
|
+
disabled: l || i,
|
|
414
814
|
onClick: () => {
|
|
415
|
-
|
|
416
|
-
(o = r.current) == null || o.focus(), I("<hr />"), l();
|
|
815
|
+
T(n.current), M("<hr />"), u();
|
|
417
816
|
}
|
|
418
817
|
},
|
|
419
|
-
|
|
818
|
+
Ht
|
|
420
819
|
) : null;
|
|
421
820
|
if (e === "undo")
|
|
422
|
-
return /* @__PURE__ */
|
|
423
|
-
|
|
821
|
+
return /* @__PURE__ */ s(
|
|
822
|
+
C,
|
|
424
823
|
{
|
|
425
|
-
icon:
|
|
824
|
+
icon: m.undo,
|
|
426
825
|
title: "Undo",
|
|
427
|
-
disabled:
|
|
428
|
-
onClick:
|
|
826
|
+
disabled: l || i,
|
|
827
|
+
onClick: Ot
|
|
429
828
|
},
|
|
430
829
|
"undo"
|
|
431
830
|
);
|
|
432
831
|
if (e === "redo")
|
|
433
|
-
return /* @__PURE__ */
|
|
434
|
-
|
|
832
|
+
return /* @__PURE__ */ s(
|
|
833
|
+
C,
|
|
435
834
|
{
|
|
436
|
-
icon:
|
|
835
|
+
icon: m.redo,
|
|
437
836
|
title: "Redo",
|
|
438
|
-
disabled:
|
|
439
|
-
onClick:
|
|
837
|
+
disabled: l || i,
|
|
838
|
+
onClick: Nt
|
|
440
839
|
},
|
|
441
840
|
"redo"
|
|
442
841
|
);
|
|
443
842
|
if (e === "trackChanges")
|
|
444
|
-
return
|
|
445
|
-
|
|
843
|
+
return d.trackChanges ? /* @__PURE__ */ s(
|
|
844
|
+
C,
|
|
446
845
|
{
|
|
447
|
-
icon:
|
|
846
|
+
icon: m.trackChanges,
|
|
448
847
|
title: "Track changes",
|
|
449
|
-
active:
|
|
450
|
-
disabled:
|
|
451
|
-
onClick: () =>
|
|
848
|
+
active: X,
|
|
849
|
+
disabled: l || i,
|
|
850
|
+
onClick: () => eo(!X)
|
|
452
851
|
},
|
|
453
852
|
"trackChanges"
|
|
454
853
|
) : null;
|
|
455
854
|
if (e === "comments")
|
|
456
|
-
return
|
|
457
|
-
|
|
855
|
+
return d.comments ? /* @__PURE__ */ s(
|
|
856
|
+
C,
|
|
458
857
|
{
|
|
459
|
-
icon:
|
|
858
|
+
icon: m.comments,
|
|
460
859
|
title: "Comments",
|
|
461
|
-
active:
|
|
462
|
-
disabled:
|
|
860
|
+
active: Re,
|
|
861
|
+
disabled: l || i,
|
|
463
862
|
onClick: () => {
|
|
464
|
-
|
|
863
|
+
Re ? we(!1) : It();
|
|
465
864
|
}
|
|
466
865
|
},
|
|
467
866
|
"comments"
|
|
468
867
|
) : null;
|
|
469
868
|
if (e === "ai")
|
|
470
|
-
return !
|
|
471
|
-
|
|
869
|
+
return !d.ai || !(f != null && f.enabled) ? null : /* @__PURE__ */ s(
|
|
870
|
+
C,
|
|
472
871
|
{
|
|
473
|
-
icon:
|
|
872
|
+
icon: m.ai,
|
|
474
873
|
title: "Ink AI",
|
|
475
|
-
active:
|
|
476
|
-
disabled:
|
|
477
|
-
onClick: () =>
|
|
874
|
+
active: tt,
|
|
875
|
+
disabled: l || i,
|
|
876
|
+
onClick: () => Ce((r) => !r)
|
|
478
877
|
},
|
|
479
878
|
"ai"
|
|
480
879
|
);
|
|
481
|
-
const
|
|
482
|
-
return
|
|
483
|
-
|
|
880
|
+
const o = yt[e];
|
|
881
|
+
return o ? /* @__PURE__ */ s(
|
|
882
|
+
C,
|
|
484
883
|
{
|
|
485
|
-
icon:
|
|
486
|
-
title:
|
|
487
|
-
active:
|
|
488
|
-
disabled:
|
|
489
|
-
onClick: () =>
|
|
884
|
+
icon: m[e] ?? e.slice(0, 1).toUpperCase(),
|
|
885
|
+
title: o.title,
|
|
886
|
+
active: $e.has(e),
|
|
887
|
+
disabled: l || i,
|
|
888
|
+
onClick: () => O(e)
|
|
490
889
|
},
|
|
491
890
|
e
|
|
492
891
|
) : null;
|
|
493
|
-
},
|
|
494
|
-
return /* @__PURE__ */
|
|
892
|
+
}, go = typeof ue == "number" ? `${ue}px` : ue, ho = typeof de == "number" ? `${de}px` : de, Ao = !!(f != null && f.enabled && tt);
|
|
893
|
+
return /* @__PURE__ */ ce(
|
|
495
894
|
"div",
|
|
496
895
|
{
|
|
497
|
-
className:
|
|
498
|
-
"data-testid":
|
|
499
|
-
"data-disabled":
|
|
500
|
-
"data-variant":
|
|
501
|
-
"data-
|
|
502
|
-
"data-
|
|
503
|
-
|
|
504
|
-
|
|
896
|
+
className: ol(Lr, Qt),
|
|
897
|
+
"data-testid": Jt,
|
|
898
|
+
"data-disabled": l || void 0,
|
|
899
|
+
"data-variant": tn,
|
|
900
|
+
"data-chrome": nn,
|
|
901
|
+
"data-color-mode": De,
|
|
902
|
+
"data-premium": v.active || void 0,
|
|
903
|
+
"data-wysiwyg": Cn || void 0,
|
|
904
|
+
style: { ...Ln, ...fn },
|
|
905
|
+
...mn,
|
|
505
906
|
children: [
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
|
|
508
|
-
jn,
|
|
907
|
+
_t ? /* @__PURE__ */ s("div", { className: ur, children: /* @__PURE__ */ s(
|
|
908
|
+
wl,
|
|
509
909
|
{
|
|
510
|
-
|
|
511
|
-
|
|
910
|
+
type: "button",
|
|
911
|
+
"aria-label": So,
|
|
912
|
+
onClick: () => ke(!1),
|
|
913
|
+
children: Bo
|
|
914
|
+
}
|
|
915
|
+
) }) : /* @__PURE__ */ s(
|
|
916
|
+
"div",
|
|
917
|
+
{
|
|
918
|
+
className: dr,
|
|
919
|
+
role: "toolbar",
|
|
920
|
+
"aria-label": "Ink formatting toolbar",
|
|
921
|
+
onContextMenu: uo,
|
|
922
|
+
children: be.map(Io)
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ s(
|
|
926
|
+
mi,
|
|
927
|
+
{
|
|
928
|
+
open: jn,
|
|
929
|
+
options: qn,
|
|
930
|
+
visibleItems: be,
|
|
931
|
+
onToggle: Jn,
|
|
932
|
+
onClose: () => dt(!1)
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ s(
|
|
936
|
+
di,
|
|
937
|
+
{
|
|
938
|
+
open: it,
|
|
939
|
+
onClose: () => Le(!1),
|
|
512
940
|
onConfirm: (e) => {
|
|
513
|
-
|
|
514
|
-
(t = r.current) == null || t.focus(), ee(e), l();
|
|
941
|
+
T(n.current), xe(e), u();
|
|
515
942
|
}
|
|
516
943
|
}
|
|
517
944
|
),
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
|
|
945
|
+
/* @__PURE__ */ s(
|
|
946
|
+
fi,
|
|
520
947
|
{
|
|
521
|
-
open:
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
948
|
+
open: Oe,
|
|
949
|
+
focusField: vn,
|
|
950
|
+
onClose: () => ie(!1),
|
|
951
|
+
onReplace: (e, t, o) => {
|
|
952
|
+
if (!n.current) return;
|
|
953
|
+
const r = Rl(n.current.innerHTML, e, t, o);
|
|
954
|
+
U(r);
|
|
527
955
|
}
|
|
528
956
|
}
|
|
529
957
|
),
|
|
530
|
-
|
|
531
|
-
|
|
958
|
+
X && d.trackChanges ? /* @__PURE__ */ s(
|
|
959
|
+
ui,
|
|
532
960
|
{
|
|
533
|
-
changes:
|
|
534
|
-
onAccept:
|
|
535
|
-
onReject:
|
|
536
|
-
onAcceptAll: () =>
|
|
537
|
-
onRejectAll: () =>
|
|
961
|
+
changes: D,
|
|
962
|
+
onAccept: gt,
|
|
963
|
+
onReject: ht,
|
|
964
|
+
onAcceptAll: () => D.forEach((e) => gt(e.id)),
|
|
965
|
+
onRejectAll: () => D.forEach((e) => ht(e.id))
|
|
538
966
|
}
|
|
539
967
|
) : null,
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
|
|
543
|
-
|
|
968
|
+
/* @__PURE__ */ ce("div", { className: fr, children: [
|
|
969
|
+
/* @__PURE__ */ ce("div", { className: mr, children: [
|
|
970
|
+
d.blocks ? /* @__PURE__ */ s(
|
|
971
|
+
Jl,
|
|
544
972
|
{
|
|
545
|
-
visible:
|
|
546
|
-
top:
|
|
547
|
-
onMoveUp: () =>
|
|
548
|
-
onMoveDown: () =>
|
|
973
|
+
visible: Pn && !l && !i,
|
|
974
|
+
top: wn,
|
|
975
|
+
onMoveUp: () => bt("up"),
|
|
976
|
+
onMoveDown: () => bt("down"),
|
|
977
|
+
onDragStart: Co
|
|
549
978
|
}
|
|
550
979
|
) : null,
|
|
551
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ s(
|
|
552
981
|
"div",
|
|
553
982
|
{
|
|
554
|
-
ref:
|
|
555
|
-
className:
|
|
556
|
-
contentEditable: !
|
|
983
|
+
ref: n,
|
|
984
|
+
className: _r,
|
|
985
|
+
contentEditable: !l && !i,
|
|
557
986
|
role: "textbox",
|
|
558
987
|
"aria-multiline": "true",
|
|
559
|
-
"aria-placeholder":
|
|
560
|
-
"data-placeholder":
|
|
988
|
+
"aria-placeholder": Ke,
|
|
989
|
+
"data-placeholder": Ke,
|
|
561
990
|
suppressContentEditableWarning: !0,
|
|
562
|
-
style: { minHeight:
|
|
563
|
-
onInput:
|
|
564
|
-
onBlur:
|
|
565
|
-
onKeyUp:
|
|
566
|
-
onKeyDown:
|
|
567
|
-
onMouseUp:
|
|
991
|
+
style: { minHeight: go, maxHeight: ho },
|
|
992
|
+
onInput: u,
|
|
993
|
+
onBlur: oo,
|
|
994
|
+
onKeyUp: J,
|
|
995
|
+
onKeyDown: Eo,
|
|
996
|
+
onMouseUp: J,
|
|
997
|
+
onContextMenu: ao,
|
|
998
|
+
onDragOver: Lo,
|
|
999
|
+
onDrop: Oo,
|
|
1000
|
+
onDragEnd: No,
|
|
568
1001
|
onPaste: (e) => {
|
|
569
|
-
|
|
1002
|
+
_o(e);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
mt ? /* @__PURE__ */ s(
|
|
1007
|
+
ai,
|
|
1008
|
+
{
|
|
1009
|
+
items: yn,
|
|
1010
|
+
top: lt.top,
|
|
1011
|
+
left: lt.left,
|
|
1012
|
+
onSelect: po
|
|
1013
|
+
}
|
|
1014
|
+
) : null,
|
|
1015
|
+
Be ? /* @__PURE__ */ s(
|
|
1016
|
+
$l,
|
|
1017
|
+
{
|
|
1018
|
+
suggestion: R.suggestion,
|
|
1019
|
+
position: { top: R.top, left: R.left },
|
|
1020
|
+
visible: R.visible,
|
|
1021
|
+
onAccept: Et,
|
|
1022
|
+
onDismiss: b
|
|
1023
|
+
}
|
|
1024
|
+
) : null,
|
|
1025
|
+
/* @__PURE__ */ s(
|
|
1026
|
+
ni,
|
|
1027
|
+
{
|
|
1028
|
+
open: Ae.open,
|
|
1029
|
+
top: Ae.top,
|
|
1030
|
+
left: Ae.left,
|
|
1031
|
+
icons: {
|
|
1032
|
+
bold: m.bold,
|
|
1033
|
+
italic: m.italic,
|
|
1034
|
+
underline: m.underline,
|
|
1035
|
+
code: m.code,
|
|
1036
|
+
link: m.link,
|
|
1037
|
+
clearFormat: m.clearFormat
|
|
1038
|
+
},
|
|
1039
|
+
activeFormats: $e,
|
|
1040
|
+
disabled: l || i,
|
|
1041
|
+
onFormat: To,
|
|
1042
|
+
onLink: He,
|
|
1043
|
+
onClose: () => W((e) => ({ ...e, open: !1 }))
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ s(
|
|
1047
|
+
zt,
|
|
1048
|
+
{
|
|
1049
|
+
open: Ne.open,
|
|
1050
|
+
x: Ne.x,
|
|
1051
|
+
y: Ne.y,
|
|
1052
|
+
items: mo,
|
|
1053
|
+
colorMode: De,
|
|
1054
|
+
onClose: () => {
|
|
1055
|
+
st(!1), Ie((e) => ({ ...e, open: !1 }));
|
|
570
1056
|
}
|
|
571
1057
|
}
|
|
572
1058
|
),
|
|
573
|
-
|
|
574
|
-
|
|
1059
|
+
/* @__PURE__ */ s(
|
|
1060
|
+
zt,
|
|
575
1061
|
{
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
1062
|
+
open: ge.open,
|
|
1063
|
+
x: ge.x,
|
|
1064
|
+
y: ge.y,
|
|
1065
|
+
items: fo,
|
|
1066
|
+
colorMode: De,
|
|
1067
|
+
onClose: () => he((e) => ({ ...e, open: !1 }))
|
|
580
1068
|
}
|
|
581
|
-
)
|
|
1069
|
+
)
|
|
582
1070
|
] }),
|
|
583
|
-
|
|
584
|
-
|
|
1071
|
+
Re && d.comments ? /* @__PURE__ */ s(
|
|
1072
|
+
zl,
|
|
585
1073
|
{
|
|
586
|
-
comments:
|
|
587
|
-
author:
|
|
588
|
-
onClose: () =>
|
|
1074
|
+
comments: Z,
|
|
1075
|
+
author: H,
|
|
1076
|
+
onClose: () => we(!1),
|
|
589
1077
|
onResolve: (e) => {
|
|
590
|
-
const t =
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
(
|
|
1078
|
+
const t = Z.find((o) => o.id === e);
|
|
1079
|
+
Ue(
|
|
1080
|
+
Z.map(
|
|
1081
|
+
(o) => o.id === e ? { ...o, resolved: !0 } : o
|
|
594
1082
|
)
|
|
595
|
-
), t &&
|
|
1083
|
+
), t && n.current && U(Tl(n.current.innerHTML, t.highlightId));
|
|
596
1084
|
},
|
|
597
1085
|
onAddReply: (e, t) => {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
(
|
|
601
|
-
...
|
|
1086
|
+
Ue(
|
|
1087
|
+
Z.map(
|
|
1088
|
+
(o) => o.id === e ? {
|
|
1089
|
+
...o,
|
|
602
1090
|
replies: [
|
|
603
|
-
...
|
|
1091
|
+
...o.replies,
|
|
604
1092
|
{
|
|
605
|
-
id:
|
|
606
|
-
author:
|
|
1093
|
+
id: vt("reply"),
|
|
1094
|
+
author: H,
|
|
607
1095
|
body: t,
|
|
608
1096
|
timestamp: Date.now()
|
|
609
1097
|
}
|
|
610
1098
|
]
|
|
611
|
-
} :
|
|
1099
|
+
} : o
|
|
612
1100
|
)
|
|
613
1101
|
);
|
|
614
1102
|
}
|
|
615
1103
|
}
|
|
616
1104
|
) : null,
|
|
617
|
-
|
|
618
|
-
|
|
1105
|
+
Ao && f ? /* @__PURE__ */ s(
|
|
1106
|
+
jl,
|
|
619
1107
|
{
|
|
620
|
-
config:
|
|
621
|
-
documentHtml: ((
|
|
622
|
-
selectionHtml:
|
|
623
|
-
|
|
1108
|
+
config: f,
|
|
1109
|
+
documentHtml: ((Rt = n.current) == null ? void 0 : Rt.innerHTML) ?? p ?? "",
|
|
1110
|
+
selectionHtml: ot,
|
|
1111
|
+
onBusyChange: kn,
|
|
1112
|
+
onClose: () => Ce(!1),
|
|
624
1113
|
onApplyHtml: (e) => {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
I(e);
|
|
1114
|
+
if (T(n.current), ot)
|
|
1115
|
+
M(e);
|
|
628
1116
|
else {
|
|
629
|
-
|
|
1117
|
+
U(e);
|
|
630
1118
|
return;
|
|
631
1119
|
}
|
|
632
|
-
|
|
1120
|
+
u();
|
|
633
1121
|
}
|
|
634
1122
|
}
|
|
635
1123
|
) : null
|
|
636
1124
|
] }),
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
1125
|
+
Ve ? /* @__PURE__ */ ce("div", { className: Tr, children: [
|
|
1126
|
+
gn,
|
|
1127
|
+
Ge ? ` / ${Ge}` : ""
|
|
640
1128
|
] }) : null
|
|
641
1129
|
]
|
|
642
1130
|
}
|
|
643
1131
|
);
|
|
644
1132
|
};
|
|
645
1133
|
export {
|
|
646
|
-
|
|
1134
|
+
_c as InkEditor
|
|
647
1135
|
};
|