@kopexa/tiptap 17.6.18 → 17.7.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/dist/index.d.mts +691 -24
- package/dist/index.d.ts +691 -24
- package/dist/index.js +1081 -668
- package/dist/index.mjs +7686 -112
- package/package.json +57 -52
- package/dist/chunk-2SI7MRAE.mjs +0 -64
- package/dist/chunk-2U5CQUZH.mjs +0 -91
- package/dist/chunk-2UDCL55K.mjs +0 -55
- package/dist/chunk-2V6VOAPI.mjs +0 -139
- package/dist/chunk-2Z2QVW67.mjs +0 -1
- package/dist/chunk-32SUXCAQ.mjs +0 -115
- package/dist/chunk-33QD5PYJ.mjs +0 -63
- package/dist/chunk-3VRQUYYW.mjs +0 -169
- package/dist/chunk-42HKGCOO.mjs +0 -129
- package/dist/chunk-4ALV4UA5.mjs +0 -1
- package/dist/chunk-4CDZ547I.mjs +0 -185
- package/dist/chunk-4HO7BWDC.mjs +0 -89
- package/dist/chunk-4JRYQZ4A.mjs +0 -174
- package/dist/chunk-552JLRNB.mjs +0 -35
- package/dist/chunk-5SMDMQDF.mjs +0 -34
- package/dist/chunk-6552DQWB.mjs +0 -416
- package/dist/chunk-7FDDRVUE.mjs +0 -143
- package/dist/chunk-7VGROP26.mjs +0 -262
- package/dist/chunk-7VW67NVL.mjs +0 -80
- package/dist/chunk-AAV7ZNBP.mjs +0 -83
- package/dist/chunk-ATRHILCH.mjs +0 -1
- package/dist/chunk-B7WJOQ3X.mjs +0 -103
- package/dist/chunk-BEV5U2DK.mjs +0 -131
- package/dist/chunk-BXHPO3T7.mjs +0 -152
- package/dist/chunk-BXJYNSWQ.mjs +0 -30
- package/dist/chunk-C5RQWJKE.mjs +0 -155
- package/dist/chunk-CNVACBGT.mjs +0 -51
- package/dist/chunk-DQK6PA4U.mjs +0 -276
- package/dist/chunk-DSBJFMHK.mjs +0 -38
- package/dist/chunk-DT7ML2P4.mjs +0 -42
- package/dist/chunk-DZLGLP7R.mjs +0 -99
- package/dist/chunk-EAAQE5ZV.mjs +0 -283
- package/dist/chunk-EHY2NAW7.mjs +0 -120
- package/dist/chunk-EIIWU5FR.mjs +0 -61
- package/dist/chunk-ERPGWXFK.mjs +0 -163
- package/dist/chunk-F73FCUD5.mjs +0 -1
- package/dist/chunk-FRJX2F4T.mjs +0 -55
- package/dist/chunk-GYIYX2JH.mjs +0 -73
- package/dist/chunk-H6LC4LDQ.mjs +0 -63
- package/dist/chunk-H7MS2UMO.mjs +0 -168
- package/dist/chunk-HLLA2HRV.mjs +0 -1
- package/dist/chunk-HTJ2RXOG.mjs +0 -32
- package/dist/chunk-IFXRPGIJ.mjs +0 -98
- package/dist/chunk-IOB3REX6.mjs +0 -173
- package/dist/chunk-IQERE7KP.mjs +0 -115
- package/dist/chunk-JCV5SEKN.mjs +0 -65
- package/dist/chunk-JVSH5T4B.mjs +0 -72
- package/dist/chunk-KK4K43WM.mjs +0 -59
- package/dist/chunk-KR42JAVB.mjs +0 -60
- package/dist/chunk-KYLBKQ2E.mjs +0 -203
- package/dist/chunk-L5RDMV3H.mjs +0 -216
- package/dist/chunk-LNVWG34E.mjs +0 -165
- package/dist/chunk-LVNUU67N.mjs +0 -1
- package/dist/chunk-MNTOOEHA.mjs +0 -1
- package/dist/chunk-N3JE67CS.mjs +0 -81
- package/dist/chunk-N4CT5RNC.mjs +0 -123
- package/dist/chunk-OEVR5N7X.mjs +0 -65
- package/dist/chunk-P55PLOHR.mjs +0 -34
- package/dist/chunk-Q5FK7SFY.mjs +0 -75
- package/dist/chunk-Q7DFJ5NI.mjs +0 -153
- package/dist/chunk-QIELBKP3.mjs +0 -104
- package/dist/chunk-R2GM4A3T.mjs +0 -71
- package/dist/chunk-REJEJXOZ.mjs +0 -10
- package/dist/chunk-RFWNKE7D.mjs +0 -238
- package/dist/chunk-TAM3VMJT.mjs +0 -80
- package/dist/chunk-TDFS3DCZ.mjs +0 -79
- package/dist/chunk-TLM5ALHZ.mjs +0 -1
- package/dist/chunk-TZQQ6C2Q.mjs +0 -101
- package/dist/chunk-U5XAL46P.mjs +0 -39
- package/dist/chunk-UJ4BNZ63.mjs +0 -178
- package/dist/chunk-UVHVCION.mjs +0 -168
- package/dist/chunk-V6TAZMQN.mjs +0 -105
- package/dist/chunk-VF3G2URZ.mjs +0 -83
- package/dist/chunk-VRQ6OSAZ.mjs +0 -76
- package/dist/chunk-VTKJPVNM.mjs +0 -148
- package/dist/chunk-VX3HSJ76.mjs +0 -73
- package/dist/chunk-W2FLOOJ6.mjs +0 -75
- package/dist/chunk-XGAABDMW.mjs +0 -159
- package/dist/chunk-Y2KSWMG5.mjs +0 -1
- package/dist/chunk-YJAHZXLG.mjs +0 -92
- package/dist/chunk-Z365KVQY.mjs +0 -34
- package/dist/chunk-ZVTJ6XD7.mjs +0 -88
- package/dist/chunk-ZZ4OU46C.mjs +0 -131
- package/dist/context/editor-context.d.mts +0 -10
- package/dist/context/editor-context.d.ts +0 -10
- package/dist/context/editor-context.js +0 -34
- package/dist/context/editor-context.mjs +0 -9
- package/dist/context/editor-file-context.d.mts +0 -70
- package/dist/context/editor-file-context.d.ts +0 -70
- package/dist/context/editor-file-context.js +0 -96
- package/dist/context/editor-file-context.mjs +0 -12
- package/dist/extensions/callout/callout-settings.d.mts +0 -13
- package/dist/extensions/callout/callout-settings.d.ts +0 -13
- package/dist/extensions/callout/callout-settings.js +0 -206
- package/dist/extensions/callout/callout-settings.mjs +0 -9
- package/dist/extensions/callout/callout-view.d.mts +0 -12
- package/dist/extensions/callout/callout-view.d.ts +0 -12
- package/dist/extensions/callout/callout-view.js +0 -273
- package/dist/extensions/callout/callout-view.mjs +0 -12
- package/dist/extensions/callout/index.d.mts +0 -44
- package/dist/extensions/callout/index.d.ts +0 -44
- package/dist/extensions/callout/index.js +0 -380
- package/dist/extensions/callout/index.mjs +0 -13
- package/dist/extensions/callout/messages.d.mts +0 -59
- package/dist/extensions/callout/messages.d.ts +0 -59
- package/dist/extensions/callout/messages.js +0 -88
- package/dist/extensions/callout/messages.mjs +0 -7
- package/dist/extensions/image/image-view.d.mts +0 -15
- package/dist/extensions/image/image-view.d.ts +0 -15
- package/dist/extensions/image/image-view.js +0 -255
- package/dist/extensions/image/image-view.mjs +0 -12
- package/dist/extensions/image/index.d.mts +0 -29
- package/dist/extensions/image/index.d.ts +0 -29
- package/dist/extensions/image/index.js +0 -282
- package/dist/extensions/image/index.mjs +0 -16
- package/dist/extensions/image/messages.d.mts +0 -28
- package/dist/extensions/image/messages.d.ts +0 -28
- package/dist/extensions/image/messages.js +0 -57
- package/dist/extensions/image/messages.mjs +0 -7
- package/dist/extensions/image-upload/image-upload-view.d.mts +0 -12
- package/dist/extensions/image-upload/image-upload-view.d.ts +0 -12
- package/dist/extensions/image-upload/image-upload-view.js +0 -338
- package/dist/extensions/image-upload/image-upload-view.mjs +0 -12
- package/dist/extensions/image-upload/index.d.mts +0 -46
- package/dist/extensions/image-upload/index.d.ts +0 -46
- package/dist/extensions/image-upload/index.js +0 -414
- package/dist/extensions/image-upload/index.mjs +0 -16
- package/dist/extensions/image-upload/messages.d.mts +0 -32
- package/dist/extensions/image-upload/messages.d.ts +0 -32
- package/dist/extensions/image-upload/messages.js +0 -61
- package/dist/extensions/image-upload/messages.mjs +0 -7
- package/dist/extensions/link/index.d.mts +0 -6
- package/dist/extensions/link/index.d.ts +0 -6
- package/dist/extensions/link/index.js +0 -94
- package/dist/extensions/link/index.mjs +0 -7
- package/dist/extensions/math/index.d.mts +0 -38
- package/dist/extensions/math/index.d.ts +0 -38
- package/dist/extensions/math/index.js +0 -544
- package/dist/extensions/math/index.mjs +0 -17
- package/dist/extensions/math/inline-math-view.d.mts +0 -12
- package/dist/extensions/math/inline-math-view.d.ts +0 -12
- package/dist/extensions/math/inline-math-view.js +0 -232
- package/dist/extensions/math/inline-math-view.mjs +0 -11
- package/dist/extensions/math/inline-math.d.mts +0 -32
- package/dist/extensions/math/inline-math.d.ts +0 -32
- package/dist/extensions/math/inline-math.js +0 -304
- package/dist/extensions/math/inline-math.mjs +0 -12
- package/dist/extensions/math/math-block-view.d.mts +0 -11
- package/dist/extensions/math/math-block-view.d.ts +0 -11
- package/dist/extensions/math/math-block-view.js +0 -248
- package/dist/extensions/math/math-block-view.mjs +0 -11
- package/dist/extensions/math/messages.d.mts +0 -49
- package/dist/extensions/math/messages.d.ts +0 -49
- package/dist/extensions/math/messages.js +0 -78
- package/dist/extensions/math/messages.mjs +0 -7
- package/dist/extensions/selection/index.d.mts +0 -5
- package/dist/extensions/selection/index.d.ts +0 -5
- package/dist/extensions/selection/index.js +0 -62
- package/dist/extensions/selection/index.mjs +0 -7
- package/dist/extensions/toc/index.d.mts +0 -53
- package/dist/extensions/toc/index.d.ts +0 -53
- package/dist/extensions/toc/index.js +0 -501
- package/dist/extensions/toc/index.mjs +0 -13
- package/dist/extensions/toc/messages.d.mts +0 -74
- package/dist/extensions/toc/messages.d.ts +0 -74
- package/dist/extensions/toc/messages.js +0 -103
- package/dist/extensions/toc/messages.mjs +0 -7
- package/dist/extensions/toc/toc-settings.d.mts +0 -13
- package/dist/extensions/toc/toc-settings.d.ts +0 -13
- package/dist/extensions/toc/toc-settings.js +0 -283
- package/dist/extensions/toc/toc-settings.mjs +0 -9
- package/dist/extensions/toc/toc-view.d.mts +0 -12
- package/dist/extensions/toc/toc-view.d.ts +0 -12
- package/dist/extensions/toc/toc-view.js +0 -411
- package/dist/extensions/toc/toc-view.mjs +0 -12
- package/dist/extensions/trailing-node/index.d.mts +0 -9
- package/dist/extensions/trailing-node/index.d.ts +0 -9
- package/dist/extensions/trailing-node/index.js +0 -86
- package/dist/extensions/trailing-node/index.mjs +0 -7
- package/dist/extensions/ui-state/index.d.mts +0 -34
- package/dist/extensions/ui-state/index.d.ts +0 -34
- package/dist/extensions/ui-state/index.js +0 -84
- package/dist/extensions/ui-state/index.mjs +0 -9
- package/dist/extensions/variable/extract-variables.d.mts +0 -16
- package/dist/extensions/variable/extract-variables.d.ts +0 -16
- package/dist/extensions/variable/extract-variables.js +0 -58
- package/dist/extensions/variable/extract-variables.mjs +0 -7
- package/dist/extensions/variable/index.d.mts +0 -38
- package/dist/extensions/variable/index.d.ts +0 -38
- package/dist/extensions/variable/index.js +0 -190
- package/dist/extensions/variable/index.mjs +0 -11
- package/dist/extensions/variable/messages.d.mts +0 -69
- package/dist/extensions/variable/messages.d.ts +0 -69
- package/dist/extensions/variable/messages.js +0 -98
- package/dist/extensions/variable/messages.mjs +0 -7
- package/dist/extensions/variable/variable-context.d.mts +0 -56
- package/dist/extensions/variable/variable-context.d.ts +0 -56
- package/dist/extensions/variable/variable-context.js +0 -70
- package/dist/extensions/variable/variable-context.mjs +0 -12
- package/dist/extensions/variable/variable-filler-dialog.d.mts +0 -43
- package/dist/extensions/variable/variable-filler-dialog.d.ts +0 -43
- package/dist/extensions/variable/variable-filler-dialog.js +0 -207
- package/dist/extensions/variable/variable-filler-dialog.mjs +0 -9
- package/dist/extensions/variable/variable-suggestion.d.mts +0 -31
- package/dist/extensions/variable/variable-suggestion.d.ts +0 -31
- package/dist/extensions/variable/variable-suggestion.js +0 -615
- package/dist/extensions/variable/variable-suggestion.mjs +0 -14
- package/dist/extensions/variable/variable-view.d.mts +0 -13
- package/dist/extensions/variable/variable-view.d.ts +0 -13
- package/dist/extensions/variable/variable-view.js +0 -110
- package/dist/extensions/variable/variable-view.mjs +0 -11
- package/dist/hooks/use-create-editor.d.mts +0 -46
- package/dist/hooks/use-create-editor.d.ts +0 -46
- package/dist/hooks/use-create-editor.js +0 -2726
- package/dist/hooks/use-create-editor.mjs +0 -37
- package/dist/hooks/use-cursor-visibility.d.mts +0 -37
- package/dist/hooks/use-cursor-visibility.d.ts +0 -37
- package/dist/hooks/use-cursor-visibility.js +0 -140
- package/dist/hooks/use-cursor-visibility.mjs +0 -8
- package/dist/hooks/use-floating-element.d.mts +0 -43
- package/dist/hooks/use-floating-element.d.ts +0 -43
- package/dist/hooks/use-floating-element.js +0 -88
- package/dist/hooks/use-floating-element.mjs +0 -8
- package/dist/hooks/use-floating-toolbar-visibility.d.mts +0 -32
- package/dist/hooks/use-floating-toolbar-visibility.d.ts +0 -32
- package/dist/hooks/use-floating-toolbar-visibility.js +0 -115
- package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -13
- package/dist/hooks/use-menu-navigation.d.mts +0 -55
- package/dist/hooks/use-menu-navigation.d.ts +0 -55
- package/dist/hooks/use-menu-navigation.js +0 -163
- package/dist/hooks/use-menu-navigation.mjs +0 -8
- package/dist/hooks/use-tiptap-editor.d.mts +0 -20
- package/dist/hooks/use-tiptap-editor.d.ts +0 -20
- package/dist/hooks/use-tiptap-editor.js +0 -58
- package/dist/hooks/use-tiptap-editor.mjs +0 -8
- package/dist/hooks/use-ui-editor-state.d.mts +0 -7
- package/dist/hooks/use-ui-editor-state.d.ts +0 -7
- package/dist/hooks/use-ui-editor-state.js +0 -107
- package/dist/hooks/use-ui-editor-state.mjs +0 -11
- package/dist/hooks/use-window-size.d.mts +0 -12
- package/dist/hooks/use-window-size.d.ts +0 -12
- package/dist/hooks/use-window-size.js +0 -75
- package/dist/hooks/use-window-size.mjs +0 -7
- package/dist/presets/basic/editor-header.d.mts +0 -23
- package/dist/presets/basic/editor-header.d.ts +0 -23
- package/dist/presets/basic/editor-header.js +0 -2750
- package/dist/presets/basic/editor-header.mjs +0 -43
- package/dist/presets/basic/index.d.mts +0 -38
- package/dist/presets/basic/index.d.ts +0 -38
- package/dist/presets/basic/index.js +0 -6891
- package/dist/presets/basic/index.mjs +0 -85
- package/dist/ui/blockquote-button/blockquote-button.d.mts +0 -20
- package/dist/ui/blockquote-button/blockquote-button.d.ts +0 -20
- package/dist/ui/blockquote-button/blockquote-button.js +0 -247
- package/dist/ui/blockquote-button/blockquote-button.mjs +0 -9
- package/dist/ui/blockquote-button/index.d.mts +0 -6
- package/dist/ui/blockquote-button/index.d.ts +0 -6
- package/dist/ui/blockquote-button/index.js +0 -259
- package/dist/ui/blockquote-button/index.mjs +0 -21
- package/dist/ui/blockquote-button/use-blockquote.d.mts +0 -85
- package/dist/ui/blockquote-button/use-blockquote.d.ts +0 -85
- package/dist/ui/blockquote-button/use-blockquote.js +0 -192
- package/dist/ui/blockquote-button/use-blockquote.mjs +0 -17
- package/dist/ui/bubble-menu/index.d.mts +0 -13
- package/dist/ui/bubble-menu/index.d.ts +0 -13
- package/dist/ui/bubble-menu/index.js +0 -673
- package/dist/ui/bubble-menu/index.mjs +0 -16
- package/dist/ui/codeblock-button/code-block-button.d.mts +0 -20
- package/dist/ui/codeblock-button/code-block-button.d.ts +0 -20
- package/dist/ui/codeblock-button/code-block-button.js +0 -237
- package/dist/ui/codeblock-button/code-block-button.mjs +0 -9
- package/dist/ui/codeblock-button/index.d.mts +0 -6
- package/dist/ui/codeblock-button/index.d.ts +0 -6
- package/dist/ui/codeblock-button/index.js +0 -249
- package/dist/ui/codeblock-button/index.mjs +0 -21
- package/dist/ui/codeblock-button/use-code-block.d.mts +0 -92
- package/dist/ui/codeblock-button/use-code-block.d.ts +0 -92
- package/dist/ui/codeblock-button/use-code-block.js +0 -192
- package/dist/ui/codeblock-button/use-code-block.mjs +0 -17
- package/dist/ui/color-highlight-button/color-highlight-button.d.mts +0 -25
- package/dist/ui/color-highlight-button/color-highlight-button.d.ts +0 -25
- package/dist/ui/color-highlight-button/color-highlight-button.js +0 -266
- package/dist/ui/color-highlight-button/color-highlight-button.mjs +0 -9
- package/dist/ui/color-highlight-button/index.d.mts +0 -6
- package/dist/ui/color-highlight-button/index.d.ts +0 -6
- package/dist/ui/color-highlight-button/index.js +0 -342
- package/dist/ui/color-highlight-button/index.mjs +0 -27
- package/dist/ui/color-highlight-button/use-color-highlight.d.mts +0 -64
- package/dist/ui/color-highlight-button/use-color-highlight.d.ts +0 -64
- package/dist/ui/color-highlight-button/use-color-highlight.js +0 -247
- package/dist/ui/color-highlight-button/use-color-highlight.mjs +0 -23
- package/dist/ui/color-highlight-popover/color-highlight-popover.d.mts +0 -29
- package/dist/ui/color-highlight-popover/color-highlight-popover.d.ts +0 -29
- package/dist/ui/color-highlight-popover/color-highlight-popover.js +0 -590
- package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +0 -17
- package/dist/ui/color-highlight-popover/index.d.mts +0 -6
- package/dist/ui/color-highlight-popover/index.d.ts +0 -6
- package/dist/ui/color-highlight-popover/index.js +0 -591
- package/dist/ui/color-highlight-popover/index.mjs +0 -17
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.mts +0 -30
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.ts +0 -30
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +0 -171
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +0 -10
- package/dist/ui/heading-button/index.d.mts +0 -45
- package/dist/ui/heading-button/index.d.ts +0 -45
- package/dist/ui/heading-button/index.js +0 -222
- package/dist/ui/heading-button/index.mjs +0 -16
- package/dist/ui/heading-button/utils.d.mts +0 -17
- package/dist/ui/heading-button/utils.d.ts +0 -17
- package/dist/ui/heading-button/utils.js +0 -92
- package/dist/ui/heading-button/utils.mjs +0 -19
- package/dist/ui/heading-dropdown-menu/index.d.mts +0 -14
- package/dist/ui/heading-dropdown-menu/index.d.ts +0 -14
- package/dist/ui/heading-dropdown-menu/index.js +0 -308
- package/dist/ui/heading-dropdown-menu/index.mjs +0 -10
- package/dist/ui/link-bubble/index.d.mts +0 -13
- package/dist/ui/link-bubble/index.d.ts +0 -13
- package/dist/ui/link-bubble/index.js +0 -183
- package/dist/ui/link-bubble/index.mjs +0 -10
- package/dist/ui/link-popover/index.d.mts +0 -7
- package/dist/ui/link-popover/index.d.ts +0 -7
- package/dist/ui/link-popover/index.js +0 -512
- package/dist/ui/link-popover/index.mjs +0 -30
- package/dist/ui/link-popover/link-popover.d.mts +0 -85
- package/dist/ui/link-popover/link-popover.d.ts +0 -85
- package/dist/ui/link-popover/link-popover.js +0 -498
- package/dist/ui/link-popover/link-popover.mjs +0 -16
- package/dist/ui/link-popover/use-link-popover.d.mts +0 -123
- package/dist/ui/link-popover/use-link-popover.d.ts +0 -123
- package/dist/ui/link-popover/use-link-popover.js +0 -259
- package/dist/ui/link-popover/use-link-popover.mjs +0 -20
- package/dist/ui/list-button/index.d.mts +0 -50
- package/dist/ui/list-button/index.d.ts +0 -50
- package/dist/ui/list-button/index.js +0 -232
- package/dist/ui/list-button/index.mjs +0 -24
- package/dist/ui/list-dropdown-menu/index.d.mts +0 -45
- package/dist/ui/list-dropdown-menu/index.d.ts +0 -45
- package/dist/ui/list-dropdown-menu/index.js +0 -361
- package/dist/ui/list-dropdown-menu/index.mjs +0 -21
- package/dist/ui/mark-button/index.d.mts +0 -59
- package/dist/ui/mark-button/index.d.ts +0 -59
- package/dist/ui/mark-button/index.js +0 -217
- package/dist/ui/mark-button/index.mjs +0 -26
- package/dist/ui/reset-all-formatting-button/index.d.mts +0 -7
- package/dist/ui/reset-all-formatting-button/index.d.ts +0 -7
- package/dist/ui/reset-all-formatting-button/index.js +0 -286
- package/dist/ui/reset-all-formatting-button/index.mjs +0 -26
- package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.mts +0 -30
- package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.ts +0 -30
- package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.js +0 -271
- package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -12
- package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.mts +0 -103
- package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.ts +0 -103
- package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.js +0 -211
- package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -21
- package/dist/ui/slash-dropdown-menu/index.d.mts +0 -10
- package/dist/ui/slash-dropdown-menu/index.d.ts +0 -10
- package/dist/ui/slash-dropdown-menu/index.js +0 -1056
- package/dist/ui/slash-dropdown-menu/index.mjs +0 -19
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.mts +0 -16
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.ts +0 -16
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +0 -1053
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +0 -16
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.mts +0 -162
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.ts +0 -162
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +0 -457
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +0 -10
- package/dist/ui/suggestion-menu/index.d.mts +0 -10
- package/dist/ui/suggestion-menu/index.d.ts +0 -10
- package/dist/ui/suggestion-menu/index.js +0 -489
- package/dist/ui/suggestion-menu/index.mjs +0 -17
- package/dist/ui/suggestion-menu/suggestion-menu-types.d.mts +0 -89
- package/dist/ui/suggestion-menu/suggestion-menu-types.d.ts +0 -89
- package/dist/ui/suggestion-menu/suggestion-menu-types.js +0 -19
- package/dist/ui/suggestion-menu/suggestion-menu-types.mjs +0 -1
- package/dist/ui/suggestion-menu/suggestion-menu-utils.d.mts +0 -27
- package/dist/ui/suggestion-menu/suggestion-menu-utils.d.ts +0 -27
- package/dist/ui/suggestion-menu/suggestion-menu-utils.js +0 -75
- package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -9
- package/dist/ui/suggestion-menu/suggestion-menu.d.mts +0 -15
- package/dist/ui/suggestion-menu/suggestion-menu.d.ts +0 -15
- package/dist/ui/suggestion-menu/suggestion-menu.js +0 -453
- package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -12
- package/dist/ui/table-button/index.d.mts +0 -15
- package/dist/ui/table-button/index.d.ts +0 -15
- package/dist/ui/table-button/index.js +0 -202
- package/dist/ui/table-button/index.mjs +0 -9
- package/dist/ui/table-button/use-table.d.mts +0 -51
- package/dist/ui/table-button/use-table.d.ts +0 -51
- package/dist/ui/table-button/use-table.js +0 -146
- package/dist/ui/table-button/use-table.mjs +0 -14
- package/dist/ui/text-align-button/index.d.mts +0 -6
- package/dist/ui/text-align-button/index.d.ts +0 -6
- package/dist/ui/text-align-button/index.js +0 -235
- package/dist/ui/text-align-button/index.mjs +0 -29
- package/dist/ui/text-align-button/text-align-button.d.mts +0 -20
- package/dist/ui/text-align-button/text-align-button.d.ts +0 -20
- package/dist/ui/text-align-button/text-align-button.js +0 -215
- package/dist/ui/text-align-button/text-align-button.mjs +0 -9
- package/dist/ui/text-align-button/use-text-align.d.mts +0 -106
- package/dist/ui/text-align-button/use-text-align.d.ts +0 -106
- package/dist/ui/text-align-button/use-text-align.js +0 -169
- package/dist/ui/text-align-button/use-text-align.mjs +0 -24
- package/dist/ui/undo-redo-button/index.d.mts +0 -6
- package/dist/ui/undo-redo-button/index.d.ts +0 -6
- package/dist/ui/undo-redo-button/index.js +0 -202
- package/dist/ui/undo-redo-button/index.mjs +0 -25
- package/dist/ui/undo-redo-button/undo-redo-button.d.mts +0 -23
- package/dist/ui/undo-redo-button/undo-redo-button.d.ts +0 -23
- package/dist/ui/undo-redo-button/undo-redo-button.js +0 -187
- package/dist/ui/undo-redo-button/undo-redo-button.mjs +0 -10
- package/dist/ui/undo-redo-button/use-undo-redo.d.mts +0 -95
- package/dist/ui/undo-redo-button/use-undo-redo.d.ts +0 -95
- package/dist/ui/undo-redo-button/use-undo-redo.js +0 -146
- package/dist/ui/undo-redo-button/use-undo-redo.mjs +0 -21
- package/dist/utils/index.d.mts +0 -38
- package/dist/utils/index.d.ts +0 -38
- package/dist/utils/index.js +0 -128
- package/dist/utils/index.mjs +0 -15
- package/dist/utils/safe-parse.d.mts +0 -14
- package/dist/utils/safe-parse.d.ts +0 -14
- package/dist/utils/safe-parse.js +0 -203
- package/dist/utils/safe-parse.mjs +0 -8
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
CalloutNode: () => CalloutNode,
|
|
35
|
+
CollaborationProvider: () => CollaborationProvider,
|
|
35
36
|
Editor: () => BasicEditor,
|
|
36
37
|
EditorFileProvider: () => EditorFileProvider,
|
|
37
38
|
ImageNode: () => ImageNode,
|
|
@@ -45,21 +46,296 @@ __export(index_exports, {
|
|
|
45
46
|
VariableSuggestion: () => VariableSuggestion,
|
|
46
47
|
convertFileToBase64: () => convertFileToBase64,
|
|
47
48
|
extractVariablesFromContent: () => extractVariablesFromContent,
|
|
49
|
+
generateColorFromId: () => generateColorFromId,
|
|
48
50
|
getExtensions: () => getExtensions,
|
|
49
51
|
handleImageUpload: () => handleImageUpload,
|
|
50
52
|
isAllowedUri: () => isAllowedUri,
|
|
51
53
|
sanitizeUrl: () => sanitizeUrl,
|
|
54
|
+
useCollaboration: () => useCollaboration,
|
|
55
|
+
useCollaborationRequired: () => useCollaborationRequired,
|
|
56
|
+
useDocumentVisibility: () => useDocumentVisibility,
|
|
52
57
|
useEditorFile: () => useEditorFile,
|
|
53
58
|
useEditorFileRequired: () => useEditorFileRequired,
|
|
59
|
+
useIdle: () => useIdle,
|
|
54
60
|
useVariables: () => useVariables,
|
|
55
61
|
useVariablesWithFallback: () => useVariablesWithFallback
|
|
56
62
|
});
|
|
57
63
|
module.exports = __toCommonJS(index_exports);
|
|
58
64
|
|
|
59
|
-
// src/context/
|
|
65
|
+
// src/context/collaboration-context.tsx
|
|
66
|
+
var import_provider = require("@hocuspocus/provider");
|
|
67
|
+
var import_react3 = require("react");
|
|
68
|
+
var import_y_indexeddb = require("y-indexeddb");
|
|
69
|
+
var Y = __toESM(require("yjs"));
|
|
70
|
+
|
|
71
|
+
// src/hooks/use-document-visibility.ts
|
|
60
72
|
var import_react = require("react");
|
|
73
|
+
function subscribe(callback) {
|
|
74
|
+
document.addEventListener("visibilitychange", callback);
|
|
75
|
+
return () => document.removeEventListener("visibilitychange", callback);
|
|
76
|
+
}
|
|
77
|
+
function getSnapshot() {
|
|
78
|
+
return document.visibilityState;
|
|
79
|
+
}
|
|
80
|
+
function getServerSnapshot() {
|
|
81
|
+
return "hidden";
|
|
82
|
+
}
|
|
83
|
+
function useDocumentVisibility() {
|
|
84
|
+
return (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/hooks/use-idle.ts
|
|
88
|
+
var import_react2 = require("react");
|
|
89
|
+
var EVENTS = [
|
|
90
|
+
"keypress",
|
|
91
|
+
"mousemove",
|
|
92
|
+
"touchmove",
|
|
93
|
+
"click",
|
|
94
|
+
"scroll"
|
|
95
|
+
];
|
|
96
|
+
function useIdle(timeout, options = {}) {
|
|
97
|
+
const { initialState = false } = options;
|
|
98
|
+
const [isIdle, setIsIdle] = (0, import_react2.useState)(initialState);
|
|
99
|
+
const timerRef = (0, import_react2.useRef)(null);
|
|
100
|
+
const resetIdle = (0, import_react2.useCallback)(() => {
|
|
101
|
+
setIsIdle(false);
|
|
102
|
+
if (timerRef.current) {
|
|
103
|
+
clearTimeout(timerRef.current);
|
|
104
|
+
}
|
|
105
|
+
timerRef.current = setTimeout(() => setIsIdle(true), timeout);
|
|
106
|
+
}, [timeout]);
|
|
107
|
+
(0, import_react2.useEffect)(() => {
|
|
108
|
+
timerRef.current = setTimeout(() => setIsIdle(true), timeout);
|
|
109
|
+
const handler = () => resetIdle();
|
|
110
|
+
for (const event of EVENTS) {
|
|
111
|
+
document.addEventListener(event, handler, { passive: true });
|
|
112
|
+
}
|
|
113
|
+
return () => {
|
|
114
|
+
if (timerRef.current) {
|
|
115
|
+
clearTimeout(timerRef.current);
|
|
116
|
+
}
|
|
117
|
+
for (const event of EVENTS) {
|
|
118
|
+
document.removeEventListener(event, handler);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [timeout, resetIdle]);
|
|
122
|
+
return { isIdle, resetIdle };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/utils/collab-color.ts
|
|
126
|
+
function hslToHex(h, s, l) {
|
|
127
|
+
const sNorm = s / 100;
|
|
128
|
+
const lNorm = l / 100;
|
|
129
|
+
const a = sNorm * Math.min(lNorm, 1 - lNorm);
|
|
130
|
+
const f = (n) => {
|
|
131
|
+
const k = (n + h / 30) % 12;
|
|
132
|
+
const color = lNorm - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
133
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
134
|
+
};
|
|
135
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
136
|
+
}
|
|
137
|
+
function generateColorFromId(id) {
|
|
138
|
+
let hash = 0;
|
|
139
|
+
for (let i = 0; i < id.length; i++) {
|
|
140
|
+
hash = id.charCodeAt(i) + ((hash << 5) - hash);
|
|
141
|
+
}
|
|
142
|
+
const hue = Math.abs(hash) % 360;
|
|
143
|
+
return hslToHex(hue, 65, 55);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/context/collaboration-context.tsx
|
|
61
147
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
|
-
var
|
|
148
|
+
var CollaborationContext = (0, import_react3.createContext)(null);
|
|
149
|
+
var IDLE_TIMEOUT = 5e3;
|
|
150
|
+
function mapStatus(ws) {
|
|
151
|
+
switch (ws) {
|
|
152
|
+
case import_provider.WebSocketStatus.Connected:
|
|
153
|
+
return "connected";
|
|
154
|
+
case import_provider.WebSocketStatus.Connecting:
|
|
155
|
+
return "connecting";
|
|
156
|
+
default:
|
|
157
|
+
return "disconnected";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function CollaborationProvider({
|
|
161
|
+
documentId,
|
|
162
|
+
url,
|
|
163
|
+
getToken,
|
|
164
|
+
user,
|
|
165
|
+
enableLocalPersistence = true,
|
|
166
|
+
children
|
|
167
|
+
}) {
|
|
168
|
+
const resolvedUser = (0, import_react3.useMemo)(
|
|
169
|
+
() => {
|
|
170
|
+
var _a;
|
|
171
|
+
return {
|
|
172
|
+
id: user.id,
|
|
173
|
+
name: user.name,
|
|
174
|
+
color: (_a = user.color) != null ? _a : generateColorFromId(user.id),
|
|
175
|
+
avatar: user.avatar
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
[user.id, user.name, user.color, user.avatar]
|
|
179
|
+
);
|
|
180
|
+
const ydocRef = (0, import_react3.useRef)(null);
|
|
181
|
+
if (!ydocRef.current) {
|
|
182
|
+
ydocRef.current = new Y.Doc();
|
|
183
|
+
}
|
|
184
|
+
const ydoc = ydocRef.current;
|
|
185
|
+
const localRef = (0, import_react3.useRef)(null);
|
|
186
|
+
const [status, setStatus] = (0, import_react3.useState)("connecting");
|
|
187
|
+
const [remoteSynced, setRemoteSynced] = (0, import_react3.useState)(false);
|
|
188
|
+
const [localSynced, setLocalSynced] = (0, import_react3.useState)(!enableLocalPersistence);
|
|
189
|
+
const [lastSyncedAt, setLastSyncedAt] = (0, import_react3.useState)(null);
|
|
190
|
+
const [isReconnecting, setIsReconnecting] = (0, import_react3.useState)(false);
|
|
191
|
+
const [collabUsers, setCollabUsers] = (0, import_react3.useState)([]);
|
|
192
|
+
const [ready, setReady] = (0, import_react3.useState)(false);
|
|
193
|
+
const getTokenRef = (0, import_react3.useRef)(getToken);
|
|
194
|
+
getTokenRef.current = getToken;
|
|
195
|
+
const remoteRef = (0, import_react3.useRef)(null);
|
|
196
|
+
if (!remoteRef.current) {
|
|
197
|
+
remoteRef.current = new import_provider.HocuspocusProvider({
|
|
198
|
+
name: documentId,
|
|
199
|
+
url,
|
|
200
|
+
document: ydoc,
|
|
201
|
+
token: async () => getTokenRef.current(),
|
|
202
|
+
connect: false,
|
|
203
|
+
// connect is managed by the effect below
|
|
204
|
+
preserveConnection: false
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const provider = remoteRef.current;
|
|
208
|
+
(0, import_react3.useEffect)(() => {
|
|
209
|
+
const remote = remoteRef.current;
|
|
210
|
+
if (!remote) return;
|
|
211
|
+
if (enableLocalPersistence) {
|
|
212
|
+
const local = new import_y_indexeddb.IndexeddbPersistence(documentId, ydoc);
|
|
213
|
+
local.on("synced", () => setLocalSynced(true));
|
|
214
|
+
localRef.current = local;
|
|
215
|
+
}
|
|
216
|
+
const onAuthFailed = () => {
|
|
217
|
+
remote.disconnect();
|
|
218
|
+
setIsReconnecting(true);
|
|
219
|
+
setTimeout(() => remote.connect(), 100);
|
|
220
|
+
};
|
|
221
|
+
const onSynced = () => {
|
|
222
|
+
setRemoteSynced(true);
|
|
223
|
+
setLastSyncedAt(/* @__PURE__ */ new Date());
|
|
224
|
+
};
|
|
225
|
+
const onStatus = ({ status: ws }) => {
|
|
226
|
+
const mapped = mapStatus(ws);
|
|
227
|
+
setStatus(mapped);
|
|
228
|
+
if (mapped === "connected") {
|
|
229
|
+
setIsReconnecting(false);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
remote.on("authenticationFailed", onAuthFailed);
|
|
233
|
+
remote.on("synced", onSynced);
|
|
234
|
+
remote.on("status", onStatus);
|
|
235
|
+
const awareness = remote.awareness;
|
|
236
|
+
let updateUsers = null;
|
|
237
|
+
if (awareness) {
|
|
238
|
+
updateUsers = () => {
|
|
239
|
+
const states = awareness.getStates();
|
|
240
|
+
const users = [];
|
|
241
|
+
states.forEach((state, clientId) => {
|
|
242
|
+
var _a;
|
|
243
|
+
if (!state.user || clientId === awareness.clientID) return;
|
|
244
|
+
const u = state.user;
|
|
245
|
+
users.push({
|
|
246
|
+
...u,
|
|
247
|
+
color: (_a = u.color) != null ? _a : generateColorFromId(u.id)
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
setCollabUsers(users);
|
|
251
|
+
};
|
|
252
|
+
awareness.on("change", updateUsers);
|
|
253
|
+
updateUsers();
|
|
254
|
+
}
|
|
255
|
+
remote.connect();
|
|
256
|
+
setReady(true);
|
|
257
|
+
return () => {
|
|
258
|
+
var _a;
|
|
259
|
+
if (awareness && updateUsers) {
|
|
260
|
+
awareness.off("change", updateUsers);
|
|
261
|
+
}
|
|
262
|
+
remote.off("authenticationFailed", onAuthFailed);
|
|
263
|
+
remote.off("synced", onSynced);
|
|
264
|
+
remote.off("status", onStatus);
|
|
265
|
+
remote.destroy();
|
|
266
|
+
(_a = localRef.current) == null ? void 0 : _a.destroy();
|
|
267
|
+
localRef.current = null;
|
|
268
|
+
remoteRef.current = null;
|
|
269
|
+
};
|
|
270
|
+
}, [documentId, ydoc, enableLocalPersistence]);
|
|
271
|
+
(0, import_react3.useEffect)(() => {
|
|
272
|
+
var _a;
|
|
273
|
+
const awareness = (_a = remoteRef.current) == null ? void 0 : _a.awareness;
|
|
274
|
+
if (awareness) {
|
|
275
|
+
awareness.setLocalStateField("user", resolvedUser);
|
|
276
|
+
}
|
|
277
|
+
}, [resolvedUser]);
|
|
278
|
+
const { isIdle, resetIdle } = useIdle(IDLE_TIMEOUT);
|
|
279
|
+
const visibility = useDocumentVisibility();
|
|
280
|
+
(0, import_react3.useEffect)(() => {
|
|
281
|
+
if (!ready || !remoteRef.current) return;
|
|
282
|
+
const remote = remoteRef.current;
|
|
283
|
+
if (isIdle && visibility === "hidden" && remote.status === import_provider.WebSocketStatus.Connected) {
|
|
284
|
+
remote.disconnect();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (visibility === "visible" && remote.status === import_provider.WebSocketStatus.Disconnected) {
|
|
288
|
+
resetIdle();
|
|
289
|
+
setIsReconnecting(true);
|
|
290
|
+
remote.connect();
|
|
291
|
+
}
|
|
292
|
+
}, [isIdle, visibility, ready, resetIdle]);
|
|
293
|
+
const synced = remoteSynced && localSynced;
|
|
294
|
+
const value = (0, import_react3.useMemo)(
|
|
295
|
+
() => ({
|
|
296
|
+
status,
|
|
297
|
+
isReconnecting,
|
|
298
|
+
synced,
|
|
299
|
+
remoteSynced,
|
|
300
|
+
localSynced,
|
|
301
|
+
lastSyncedAt,
|
|
302
|
+
collabUsers,
|
|
303
|
+
provider,
|
|
304
|
+
ydoc,
|
|
305
|
+
user: resolvedUser
|
|
306
|
+
}),
|
|
307
|
+
[
|
|
308
|
+
status,
|
|
309
|
+
isReconnecting,
|
|
310
|
+
synced,
|
|
311
|
+
remoteSynced,
|
|
312
|
+
localSynced,
|
|
313
|
+
lastSyncedAt,
|
|
314
|
+
collabUsers,
|
|
315
|
+
provider,
|
|
316
|
+
ydoc,
|
|
317
|
+
resolvedUser
|
|
318
|
+
]
|
|
319
|
+
);
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollaborationContext.Provider, { value, children });
|
|
321
|
+
}
|
|
322
|
+
function useCollaboration() {
|
|
323
|
+
return (0, import_react3.useContext)(CollaborationContext);
|
|
324
|
+
}
|
|
325
|
+
function useCollaborationRequired() {
|
|
326
|
+
const ctx = (0, import_react3.useContext)(CollaborationContext);
|
|
327
|
+
if (!ctx) {
|
|
328
|
+
throw new Error(
|
|
329
|
+
"useCollaborationRequired must be used within a CollaborationProvider"
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
return ctx;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// src/context/editor-file-context.tsx
|
|
336
|
+
var import_react4 = require("react");
|
|
337
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
338
|
+
var EditorFileContext = (0, import_react4.createContext)(null);
|
|
63
339
|
var DEFAULT_CACHE_BUFFER = 2 * 60 * 1e3;
|
|
64
340
|
var DEFAULT_CACHE_TTL = 10 * 60 * 1e3;
|
|
65
341
|
var defaultIsReference = (src) => {
|
|
@@ -77,8 +353,8 @@ function EditorFileProvider({
|
|
|
77
353
|
cacheBuffer = DEFAULT_CACHE_BUFFER,
|
|
78
354
|
defaultCacheTtl = DEFAULT_CACHE_TTL
|
|
79
355
|
}) {
|
|
80
|
-
const cacheRef = (0,
|
|
81
|
-
const resolve = (0,
|
|
356
|
+
const cacheRef = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
|
|
357
|
+
const resolve = (0, import_react4.useCallback)(
|
|
82
358
|
async (ref) => {
|
|
83
359
|
const cache = cacheRef.current;
|
|
84
360
|
const now = Date.now();
|
|
@@ -95,7 +371,7 @@ function EditorFileProvider({
|
|
|
95
371
|
},
|
|
96
372
|
[onResolve, cacheBuffer, defaultCacheTtl]
|
|
97
373
|
);
|
|
98
|
-
const value = (0,
|
|
374
|
+
const value = (0, import_react4.useMemo)(
|
|
99
375
|
() => ({
|
|
100
376
|
isAvailable: true,
|
|
101
377
|
upload: onUpload,
|
|
@@ -104,13 +380,13 @@ function EditorFileProvider({
|
|
|
104
380
|
}),
|
|
105
381
|
[onUpload, resolve, isReference]
|
|
106
382
|
);
|
|
107
|
-
return /* @__PURE__ */ (0,
|
|
383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EditorFileContext.Provider, { value, children });
|
|
108
384
|
}
|
|
109
385
|
function useEditorFile() {
|
|
110
|
-
return (0,
|
|
386
|
+
return (0, import_react4.useContext)(EditorFileContext);
|
|
111
387
|
}
|
|
112
388
|
function useEditorFileRequired() {
|
|
113
|
-
const context = (0,
|
|
389
|
+
const context = (0, import_react4.useContext)(EditorFileContext);
|
|
114
390
|
if (!context) {
|
|
115
391
|
throw new Error(
|
|
116
392
|
"useEditorFileRequired must be used within an EditorFileProvider"
|
|
@@ -121,13 +397,13 @@ function useEditorFileRequired() {
|
|
|
121
397
|
|
|
122
398
|
// src/extensions/callout/index.ts
|
|
123
399
|
var import_core = require("@tiptap/core");
|
|
124
|
-
var
|
|
400
|
+
var import_react8 = require("@tiptap/react");
|
|
125
401
|
|
|
126
402
|
// src/extensions/callout/callout-view.tsx
|
|
127
403
|
var import_icons2 = require("@kopexa/icons");
|
|
128
404
|
var import_theme = require("@kopexa/theme");
|
|
129
|
-
var
|
|
130
|
-
var
|
|
405
|
+
var import_react6 = require("@tiptap/react");
|
|
406
|
+
var import_react7 = require("react");
|
|
131
407
|
|
|
132
408
|
// src/extensions/callout/callout-settings.tsx
|
|
133
409
|
var import_button = require("@kopexa/button");
|
|
@@ -136,7 +412,7 @@ var import_icons = require("@kopexa/icons");
|
|
|
136
412
|
var import_input = require("@kopexa/input");
|
|
137
413
|
var import_label = require("@kopexa/label");
|
|
138
414
|
var import_select = require("@kopexa/select");
|
|
139
|
-
var
|
|
415
|
+
var import_react5 = require("react");
|
|
140
416
|
var import_react_intl2 = require("react-intl");
|
|
141
417
|
|
|
142
418
|
// src/extensions/callout/messages.ts
|
|
@@ -200,7 +476,7 @@ var messages = (0, import_react_intl.defineMessages)({
|
|
|
200
476
|
});
|
|
201
477
|
|
|
202
478
|
// src/extensions/callout/callout-settings.tsx
|
|
203
|
-
var
|
|
479
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
204
480
|
var VARIANTS = [
|
|
205
481
|
{ value: "default", messageKey: "variant_default" },
|
|
206
482
|
{ value: "info", messageKey: "variant_info" },
|
|
@@ -214,14 +490,14 @@ function CalloutSettings({
|
|
|
214
490
|
getPos
|
|
215
491
|
}) {
|
|
216
492
|
const intl = (0, import_react_intl2.useIntl)();
|
|
217
|
-
const [isOpen, setIsOpen] = (0,
|
|
218
|
-
const [localAttrs, setLocalAttrs] = (0,
|
|
219
|
-
(0,
|
|
493
|
+
const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
|
|
494
|
+
const [localAttrs, setLocalAttrs] = (0, import_react5.useState)(attrs);
|
|
495
|
+
(0, import_react5.useEffect)(() => {
|
|
220
496
|
if (isOpen) {
|
|
221
497
|
setLocalAttrs(attrs);
|
|
222
498
|
}
|
|
223
499
|
}, [isOpen, attrs]);
|
|
224
|
-
const handleSave = (0,
|
|
500
|
+
const handleSave = (0, import_react5.useCallback)(() => {
|
|
225
501
|
const pos = getPos();
|
|
226
502
|
if (pos === void 0) return;
|
|
227
503
|
editor.view.dispatch(
|
|
@@ -229,17 +505,17 @@ function CalloutSettings({
|
|
|
229
505
|
);
|
|
230
506
|
setIsOpen(false);
|
|
231
507
|
}, [editor, localAttrs, getPos]);
|
|
232
|
-
const handleCancel = (0,
|
|
508
|
+
const handleCancel = (0, import_react5.useCallback)(() => {
|
|
233
509
|
setLocalAttrs(attrs);
|
|
234
510
|
setIsOpen(false);
|
|
235
511
|
}, [attrs]);
|
|
236
|
-
const handleVariantChange = (0,
|
|
512
|
+
const handleVariantChange = (0, import_react5.useCallback)((value) => {
|
|
237
513
|
setLocalAttrs((prev) => ({
|
|
238
514
|
...prev,
|
|
239
515
|
variant: String(value)
|
|
240
516
|
}));
|
|
241
517
|
}, []);
|
|
242
|
-
const handleTitleChange = (0,
|
|
518
|
+
const handleTitleChange = (0, import_react5.useCallback)(
|
|
243
519
|
(e) => {
|
|
244
520
|
const value = e.target.value;
|
|
245
521
|
setLocalAttrs((prev) => ({
|
|
@@ -252,8 +528,8 @@ function CalloutSettings({
|
|
|
252
528
|
if (!editor.isEditable) {
|
|
253
529
|
return null;
|
|
254
530
|
}
|
|
255
|
-
return /* @__PURE__ */ (0,
|
|
256
|
-
/* @__PURE__ */ (0,
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
532
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
257
533
|
import_button.IconButton,
|
|
258
534
|
{
|
|
259
535
|
size: "sm",
|
|
@@ -264,30 +540,30 @@ function CalloutSettings({
|
|
|
264
540
|
e.preventDefault();
|
|
265
541
|
setIsOpen(true);
|
|
266
542
|
},
|
|
267
|
-
children: /* @__PURE__ */ (0,
|
|
543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
|
|
268
544
|
}
|
|
269
545
|
),
|
|
270
|
-
/* @__PURE__ */ (0,
|
|
271
|
-
/* @__PURE__ */ (0,
|
|
272
|
-
/* @__PURE__ */ (0,
|
|
273
|
-
/* @__PURE__ */ (0,
|
|
274
|
-
/* @__PURE__ */ (0,
|
|
275
|
-
/* @__PURE__ */ (0,
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog.Dialog.Content, { children: [
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Title, { children: intl.formatMessage(messages.settings) }) }),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-4", children: [
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
276
552
|
import_select.Select,
|
|
277
553
|
{
|
|
278
554
|
size: "sm",
|
|
279
555
|
value: localAttrs.variant,
|
|
280
556
|
onValueChange: handleVariantChange,
|
|
281
557
|
children: [
|
|
282
|
-
/* @__PURE__ */ (0,
|
|
283
|
-
/* @__PURE__ */ (0,
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_select.Select.Value, {}) }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_select.Select.Content, { children: VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_select.Select.Item, { value: v.value, children: intl.formatMessage(messages[v.messageKey]) }, v.value)) })
|
|
284
560
|
]
|
|
285
561
|
}
|
|
286
562
|
)
|
|
287
563
|
] }),
|
|
288
|
-
/* @__PURE__ */ (0,
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
290
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
|
|
566
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
291
567
|
import_input.Input,
|
|
292
568
|
{
|
|
293
569
|
size: "sm",
|
|
@@ -298,41 +574,41 @@ function CalloutSettings({
|
|
|
298
574
|
)
|
|
299
575
|
] })
|
|
300
576
|
] }) }),
|
|
301
|
-
/* @__PURE__ */ (0,
|
|
302
|
-
/* @__PURE__ */ (0,
|
|
303
|
-
/* @__PURE__ */ (0,
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog.Dialog.Footer, { children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
|
|
304
580
|
] })
|
|
305
581
|
] }) })
|
|
306
582
|
] });
|
|
307
583
|
}
|
|
308
584
|
|
|
309
585
|
// src/extensions/callout/callout-view.tsx
|
|
310
|
-
var
|
|
586
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
311
587
|
function getVariantIcon(variant, iconClass) {
|
|
312
588
|
switch (variant) {
|
|
313
589
|
case "info":
|
|
314
|
-
return /* @__PURE__ */ (0,
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.InfoIcon, { className: iconClass });
|
|
315
591
|
case "success":
|
|
316
|
-
return /* @__PURE__ */ (0,
|
|
592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
|
|
317
593
|
case "warning":
|
|
318
|
-
return /* @__PURE__ */ (0,
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.AlertIcon, { className: iconClass });
|
|
319
595
|
case "destructive":
|
|
320
|
-
return /* @__PURE__ */ (0,
|
|
596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
|
|
321
597
|
default:
|
|
322
|
-
return /* @__PURE__ */ (0,
|
|
598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ShellIcon, { className: iconClass });
|
|
323
599
|
}
|
|
324
600
|
}
|
|
325
601
|
function CalloutNodeView({ editor, node, getPos }) {
|
|
326
602
|
const attrs = node.attrs;
|
|
327
603
|
const { variant = "info", title } = attrs;
|
|
328
|
-
const isEditable = (0,
|
|
604
|
+
const isEditable = (0, import_react6.useEditorState)({
|
|
329
605
|
editor,
|
|
330
606
|
selector: ({ editor: e }) => {
|
|
331
607
|
var _a;
|
|
332
608
|
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
333
609
|
}
|
|
334
610
|
});
|
|
335
|
-
const styles = (0,
|
|
611
|
+
const styles = (0, import_react7.useMemo)(
|
|
336
612
|
() => (0, import_theme.callout)({
|
|
337
613
|
variant,
|
|
338
614
|
radius: "md",
|
|
@@ -340,19 +616,19 @@ function CalloutNodeView({ editor, node, getPos }) {
|
|
|
340
616
|
}),
|
|
341
617
|
[variant]
|
|
342
618
|
);
|
|
343
|
-
return /* @__PURE__ */ (0,
|
|
344
|
-
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
620
|
+
import_react6.NodeViewWrapper,
|
|
345
621
|
{
|
|
346
622
|
className: styles.root(),
|
|
347
623
|
"data-type": "callout",
|
|
348
624
|
"data-variant": variant,
|
|
349
625
|
children: [
|
|
350
|
-
/* @__PURE__ */ (0,
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
352
|
-
title && /* @__PURE__ */ (0,
|
|
353
|
-
/* @__PURE__ */ (0,
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.content(), children: [
|
|
628
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.title(), children: title }),
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewContent, { className: "callout-content" })
|
|
354
630
|
] }),
|
|
355
|
-
isEditable && /* @__PURE__ */ (0,
|
|
631
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
356
632
|
CalloutSettings,
|
|
357
633
|
{
|
|
358
634
|
editor,
|
|
@@ -415,7 +691,7 @@ var CalloutNode = import_core.Node.create({
|
|
|
415
691
|
];
|
|
416
692
|
},
|
|
417
693
|
addNodeView() {
|
|
418
|
-
return (0,
|
|
694
|
+
return (0, import_react8.ReactNodeViewRenderer)(CalloutNodeView);
|
|
419
695
|
},
|
|
420
696
|
addCommands() {
|
|
421
697
|
return {
|
|
@@ -470,14 +746,14 @@ var CalloutNode = import_core.Node.create({
|
|
|
470
746
|
|
|
471
747
|
// src/extensions/image/index.ts
|
|
472
748
|
var import_extension_image = require("@tiptap/extension-image");
|
|
473
|
-
var
|
|
749
|
+
var import_react11 = require("@tiptap/react");
|
|
474
750
|
|
|
475
751
|
// src/extensions/image/image-view.tsx
|
|
476
752
|
var import_button2 = require("@kopexa/button");
|
|
477
753
|
var import_icons3 = require("@kopexa/icons");
|
|
478
754
|
var import_theme2 = require("@kopexa/theme");
|
|
479
|
-
var
|
|
480
|
-
var
|
|
755
|
+
var import_react9 = require("@tiptap/react");
|
|
756
|
+
var import_react10 = require("react");
|
|
481
757
|
var import_react_intl4 = require("react-intl");
|
|
482
758
|
|
|
483
759
|
// src/extensions/image/messages.ts
|
|
@@ -510,23 +786,24 @@ var messages2 = (0, import_react_intl3.defineMessages)({
|
|
|
510
786
|
});
|
|
511
787
|
|
|
512
788
|
// src/extensions/image/image-view.tsx
|
|
513
|
-
var
|
|
789
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
514
790
|
function ImageNodeView({ editor, node, getPos }) {
|
|
515
791
|
var _a;
|
|
516
792
|
const intl = (0, import_react_intl4.useIntl)();
|
|
517
793
|
const fileHandler = useEditorFile();
|
|
518
794
|
const { src, alt, title, uploadState, uploadProgress } = node.attrs;
|
|
519
|
-
const isEditable = (0,
|
|
795
|
+
const isEditable = (0, import_react9.useEditorState)({
|
|
520
796
|
editor,
|
|
521
797
|
selector: ({ editor: e }) => {
|
|
522
798
|
var _a2;
|
|
523
799
|
return (_a2 = e == null ? void 0 : e.isEditable) != null ? _a2 : false;
|
|
524
800
|
}
|
|
525
801
|
});
|
|
526
|
-
const [resolvedUrl, setResolvedUrl] = (0,
|
|
527
|
-
const [resolveState, setResolveState] = (0,
|
|
802
|
+
const [resolvedUrl, setResolvedUrl] = (0, import_react10.useState)(null);
|
|
803
|
+
const [resolveState, setResolveState] = (0, import_react10.useState)("idle");
|
|
804
|
+
const retryCountRef = (0, import_react10.useRef)(0);
|
|
528
805
|
const needsResolve = (_a = fileHandler == null ? void 0 : fileHandler.isReference(src)) != null ? _a : false;
|
|
529
|
-
const resolveImage = (0,
|
|
806
|
+
const resolveImage = (0, import_react10.useCallback)(async () => {
|
|
530
807
|
if (!src) return;
|
|
531
808
|
if (!needsResolve) {
|
|
532
809
|
setResolvedUrl(src);
|
|
@@ -543,17 +820,19 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
543
820
|
const url = await fileHandler.resolve(src);
|
|
544
821
|
setResolvedUrl(url);
|
|
545
822
|
setResolveState("resolved");
|
|
823
|
+
retryCountRef.current = 0;
|
|
546
824
|
} catch {
|
|
547
825
|
setResolveState("error");
|
|
548
826
|
}
|
|
549
827
|
}, [src, needsResolve, fileHandler]);
|
|
550
|
-
(0,
|
|
828
|
+
(0, import_react10.useEffect)(() => {
|
|
551
829
|
resolveImage();
|
|
552
830
|
}, [resolveImage]);
|
|
553
|
-
const handleRetry = (0,
|
|
831
|
+
const handleRetry = (0, import_react10.useCallback)(() => {
|
|
832
|
+
retryCountRef.current += 1;
|
|
554
833
|
resolveImage();
|
|
555
834
|
}, [resolveImage]);
|
|
556
|
-
const handleRemove = (0,
|
|
835
|
+
const handleRemove = (0, import_react10.useCallback)(() => {
|
|
557
836
|
const pos = getPos();
|
|
558
837
|
if (pos === void 0) return;
|
|
559
838
|
editor.commands.deleteRange({
|
|
@@ -561,25 +840,25 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
561
840
|
to: pos + node.nodeSize
|
|
562
841
|
});
|
|
563
842
|
}, [editor, getPos, node.nodeSize]);
|
|
564
|
-
const errorStyles = (0,
|
|
843
|
+
const errorStyles = (0, import_react10.useMemo)(
|
|
565
844
|
() => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "error" }),
|
|
566
845
|
[]
|
|
567
846
|
);
|
|
568
|
-
const loadingStyles = (0,
|
|
847
|
+
const loadingStyles = (0, import_react10.useMemo)(
|
|
569
848
|
() => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "uploading" }),
|
|
570
849
|
[]
|
|
571
850
|
);
|
|
572
851
|
if (uploadState === "uploading") {
|
|
573
|
-
return /* @__PURE__ */ (0,
|
|
574
|
-
/* @__PURE__ */ (0,
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: loadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: loadingStyles.content(), children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative size-12", children: [
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
576
855
|
"svg",
|
|
577
856
|
{
|
|
578
857
|
className: "size-12 -rotate-90",
|
|
579
858
|
viewBox: "0 0 36 36",
|
|
580
859
|
"aria-hidden": "true",
|
|
581
860
|
children: [
|
|
582
|
-
/* @__PURE__ */ (0,
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
583
862
|
"circle",
|
|
584
863
|
{
|
|
585
864
|
cx: "18",
|
|
@@ -590,14 +869,14 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
590
869
|
strokeWidth: "2"
|
|
591
870
|
}
|
|
592
871
|
),
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
594
873
|
"circle",
|
|
595
874
|
{
|
|
596
875
|
cx: "18",
|
|
597
876
|
cy: "18",
|
|
598
877
|
r: "16",
|
|
599
878
|
fill: "none",
|
|
600
|
-
className: "stroke-primary",
|
|
879
|
+
className: "stroke-primary transition-[stroke-dashoffset] duration-300 ease-out",
|
|
601
880
|
strokeWidth: "2",
|
|
602
881
|
strokeDasharray: 100,
|
|
603
882
|
strokeDashoffset: 100 - (uploadProgress != null ? uploadProgress : 0),
|
|
@@ -607,83 +886,120 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
607
886
|
]
|
|
608
887
|
}
|
|
609
888
|
),
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "absolute inset-0 flex items-center justify-center text-xs font-medium", children: [
|
|
611
890
|
uploadProgress != null ? uploadProgress : 0,
|
|
612
891
|
"%"
|
|
613
892
|
] })
|
|
614
893
|
] }),
|
|
615
|
-
/* @__PURE__ */ (0,
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: loadingStyles.text(), children: intl.formatMessage(messages2.uploading) })
|
|
616
895
|
] }) }) });
|
|
617
896
|
}
|
|
618
897
|
if (uploadState === "error") {
|
|
619
|
-
return /* @__PURE__ */ (0,
|
|
620
|
-
/* @__PURE__ */ (0,
|
|
621
|
-
/* @__PURE__ */ (0,
|
|
622
|
-
isEditable && /* @__PURE__ */ (0,
|
|
898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: errorStyles.content(), children: [
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.upload_error) }),
|
|
901
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
623
902
|
import_button2.IconButton,
|
|
624
903
|
{
|
|
625
904
|
size: "sm",
|
|
626
905
|
variant: "ghost",
|
|
627
906
|
onClick: handleRemove,
|
|
628
907
|
"aria-label": intl.formatMessage(messages2.remove),
|
|
629
|
-
children: /* @__PURE__ */ (0,
|
|
908
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.TrashIcon, { className: "size-4" })
|
|
630
909
|
}
|
|
631
910
|
)
|
|
632
911
|
] }) }) });
|
|
633
912
|
}
|
|
634
|
-
if (resolveState === "
|
|
635
|
-
return /* @__PURE__ */ (0,
|
|
913
|
+
if (resolveState === "resolved" && resolvedUrl) {
|
|
914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react9.NodeViewWrapper, { className: "my-4 relative group", "data-type": "image", children: [
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
916
|
+
"img",
|
|
917
|
+
{
|
|
918
|
+
src: resolvedUrl,
|
|
919
|
+
alt: alt != null ? alt : "",
|
|
920
|
+
title: title != null ? title : void 0,
|
|
921
|
+
className: "max-w-full h-auto rounded-lg",
|
|
922
|
+
draggable: false
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
926
|
+
import_button2.IconButton,
|
|
927
|
+
{
|
|
928
|
+
size: "sm",
|
|
929
|
+
variant: "outline",
|
|
930
|
+
onClick: handleRemove,
|
|
931
|
+
"aria-label": intl.formatMessage(messages2.remove),
|
|
932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
|
|
933
|
+
}
|
|
934
|
+
) })
|
|
935
|
+
] });
|
|
636
936
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
937
|
+
const isLoading = resolveState === "loading" || resolveState === "idle";
|
|
938
|
+
const isError = resolveState === "error";
|
|
939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
940
|
+
"div",
|
|
941
|
+
{
|
|
942
|
+
className: [
|
|
943
|
+
"relative flex items-center justify-center",
|
|
944
|
+
"rounded-lg border-2 border-dashed",
|
|
945
|
+
"min-h-32 py-6 px-8",
|
|
946
|
+
"transition-colors duration-300 ease-out",
|
|
947
|
+
isError ? "border-destructive/50 bg-destructive/10" : "border-border bg-muted/30"
|
|
948
|
+
].join(" "),
|
|
949
|
+
children: [
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
951
|
+
"div",
|
|
644
952
|
{
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
953
|
+
className: [
|
|
954
|
+
"absolute inset-0 flex items-center justify-center",
|
|
955
|
+
"transition-opacity duration-200 ease-out",
|
|
956
|
+
isLoading ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
957
|
+
].join(" "),
|
|
958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "size-5 rounded-full border-2 border-muted-foreground/30 border-t-muted-foreground animate-spin" }),
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm text-muted-foreground", children: intl.formatMessage(messages2.loading) })
|
|
961
|
+
] })
|
|
650
962
|
}
|
|
651
963
|
),
|
|
652
|
-
/* @__PURE__ */ (0,
|
|
653
|
-
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
965
|
+
"div",
|
|
654
966
|
{
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
967
|
+
className: [
|
|
968
|
+
"flex flex-col items-center gap-2",
|
|
969
|
+
"transition-opacity duration-200 ease-out",
|
|
970
|
+
isError ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
971
|
+
].join(" "),
|
|
972
|
+
children: [
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.AlertCircleIcon, { className: "size-8 text-destructive" }),
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm text-destructive", children: intl.formatMessage(messages2.error) }),
|
|
975
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
977
|
+
import_button2.IconButton,
|
|
978
|
+
{
|
|
979
|
+
size: "sm",
|
|
980
|
+
variant: "outline",
|
|
981
|
+
onClick: handleRetry,
|
|
982
|
+
"aria-label": intl.formatMessage(messages2.retry),
|
|
983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.ArrowCounterClockwiseIcon, { className: "size-4" })
|
|
984
|
+
}
|
|
985
|
+
),
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
987
|
+
import_button2.IconButton,
|
|
988
|
+
{
|
|
989
|
+
size: "sm",
|
|
990
|
+
variant: "ghost",
|
|
991
|
+
onClick: handleRemove,
|
|
992
|
+
"aria-label": intl.formatMessage(messages2.remove),
|
|
993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.TrashIcon, { className: "size-4" })
|
|
994
|
+
}
|
|
995
|
+
)
|
|
996
|
+
] })
|
|
997
|
+
]
|
|
660
998
|
}
|
|
661
999
|
)
|
|
662
|
-
]
|
|
663
|
-
|
|
664
|
-
}
|
|
665
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react6.NodeViewWrapper, { className: "my-4 relative group", "data-type": "image", children: [
|
|
666
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
667
|
-
"img",
|
|
668
|
-
{
|
|
669
|
-
src: resolvedUrl != null ? resolvedUrl : src,
|
|
670
|
-
alt: alt != null ? alt : "",
|
|
671
|
-
title: title != null ? title : void 0,
|
|
672
|
-
className: "max-w-full h-auto rounded-lg",
|
|
673
|
-
draggable: false
|
|
674
|
-
}
|
|
675
|
-
),
|
|
676
|
-
isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
677
|
-
import_button2.IconButton,
|
|
678
|
-
{
|
|
679
|
-
size: "sm",
|
|
680
|
-
variant: "outline",
|
|
681
|
-
onClick: handleRemove,
|
|
682
|
-
"aria-label": intl.formatMessage(messages2.remove),
|
|
683
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
|
|
684
|
-
}
|
|
685
|
-
) })
|
|
686
|
-
] });
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
) });
|
|
687
1003
|
}
|
|
688
1004
|
|
|
689
1005
|
// src/extensions/image/index.ts
|
|
@@ -704,20 +1020,28 @@ var ImageNode = import_extension_image.Image.extend({
|
|
|
704
1020
|
};
|
|
705
1021
|
},
|
|
706
1022
|
addNodeView() {
|
|
707
|
-
return (0,
|
|
1023
|
+
return (0, import_react11.ReactNodeViewRenderer)(ImageNodeView, {
|
|
1024
|
+
stopEvent: ({ event }) => {
|
|
1025
|
+
const target = event.target;
|
|
1026
|
+
if (target.closest("button, [role='button'], input, a")) {
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
return false;
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
708
1032
|
}
|
|
709
1033
|
});
|
|
710
1034
|
|
|
711
1035
|
// src/extensions/image-upload/index.ts
|
|
712
1036
|
var import_core2 = require("@tiptap/core");
|
|
713
|
-
var
|
|
1037
|
+
var import_react14 = require("@tiptap/react");
|
|
714
1038
|
|
|
715
1039
|
// src/extensions/image-upload/image-upload-view.tsx
|
|
716
1040
|
var import_button3 = require("@kopexa/button");
|
|
717
1041
|
var import_icons4 = require("@kopexa/icons");
|
|
718
1042
|
var import_theme3 = require("@kopexa/theme");
|
|
719
|
-
var
|
|
720
|
-
var
|
|
1043
|
+
var import_react12 = require("@tiptap/react");
|
|
1044
|
+
var import_react13 = require("react");
|
|
721
1045
|
var import_react_intl6 = require("react-intl");
|
|
722
1046
|
|
|
723
1047
|
// src/extensions/image-upload/messages.ts
|
|
@@ -754,22 +1078,22 @@ var messages3 = (0, import_react_intl5.defineMessages)({
|
|
|
754
1078
|
});
|
|
755
1079
|
|
|
756
1080
|
// src/extensions/image-upload/image-upload-view.tsx
|
|
757
|
-
var
|
|
1081
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
758
1082
|
function ImageUploadNodeView({ editor, node, getPos }) {
|
|
759
1083
|
const intl = (0, import_react_intl6.useIntl)();
|
|
760
1084
|
const fileHandler = useEditorFile();
|
|
761
|
-
const isEditable = (0,
|
|
1085
|
+
const isEditable = (0, import_react12.useEditorState)({
|
|
762
1086
|
editor,
|
|
763
1087
|
selector: ({ editor: e }) => {
|
|
764
1088
|
var _a;
|
|
765
1089
|
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
766
1090
|
}
|
|
767
1091
|
});
|
|
768
|
-
const [uploadState, setUploadState] = (0,
|
|
769
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
770
|
-
const [isDragOver, setIsDragOver] = (0,
|
|
771
|
-
const fileInputRef = (0,
|
|
772
|
-
const handleRemove = (0,
|
|
1092
|
+
const [uploadState, setUploadState] = (0, import_react13.useState)("idle");
|
|
1093
|
+
const [uploadProgress, setUploadProgress] = (0, import_react13.useState)(0);
|
|
1094
|
+
const [isDragOver, setIsDragOver] = (0, import_react13.useState)(false);
|
|
1095
|
+
const fileInputRef = (0, import_react13.useRef)(null);
|
|
1096
|
+
const handleRemove = (0, import_react13.useCallback)(() => {
|
|
773
1097
|
const pos = getPos();
|
|
774
1098
|
if (pos === void 0) return;
|
|
775
1099
|
editor.commands.deleteRange({
|
|
@@ -777,7 +1101,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
777
1101
|
to: pos + node.nodeSize
|
|
778
1102
|
});
|
|
779
1103
|
}, [editor, getPos, node.nodeSize]);
|
|
780
|
-
const handleFileSelect = (0,
|
|
1104
|
+
const handleFileSelect = (0, import_react13.useCallback)(
|
|
781
1105
|
async (file) => {
|
|
782
1106
|
if (!fileHandler) return;
|
|
783
1107
|
const pos = getPos();
|
|
@@ -806,7 +1130,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
806
1130
|
},
|
|
807
1131
|
[fileHandler, editor, getPos, node.nodeSize]
|
|
808
1132
|
);
|
|
809
|
-
const handleInputChange = (0,
|
|
1133
|
+
const handleInputChange = (0, import_react13.useCallback)(
|
|
810
1134
|
(e) => {
|
|
811
1135
|
var _a;
|
|
812
1136
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -817,7 +1141,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
817
1141
|
},
|
|
818
1142
|
[handleFileSelect]
|
|
819
1143
|
);
|
|
820
|
-
const handleDrop = (0,
|
|
1144
|
+
const handleDrop = (0, import_react13.useCallback)(
|
|
821
1145
|
(e) => {
|
|
822
1146
|
e.preventDefault();
|
|
823
1147
|
e.stopPropagation();
|
|
@@ -829,74 +1153,74 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
829
1153
|
},
|
|
830
1154
|
[handleFileSelect]
|
|
831
1155
|
);
|
|
832
|
-
const handleDragOver = (0,
|
|
1156
|
+
const handleDragOver = (0, import_react13.useCallback)((e) => {
|
|
833
1157
|
e.preventDefault();
|
|
834
1158
|
e.stopPropagation();
|
|
835
1159
|
}, []);
|
|
836
|
-
const handleDragEnter = (0,
|
|
1160
|
+
const handleDragEnter = (0, import_react13.useCallback)((e) => {
|
|
837
1161
|
e.preventDefault();
|
|
838
1162
|
e.stopPropagation();
|
|
839
1163
|
setIsDragOver(true);
|
|
840
1164
|
}, []);
|
|
841
|
-
const handleDragLeave = (0,
|
|
1165
|
+
const handleDragLeave = (0, import_react13.useCallback)((e) => {
|
|
842
1166
|
e.preventDefault();
|
|
843
1167
|
e.stopPropagation();
|
|
844
1168
|
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
845
1169
|
setIsDragOver(false);
|
|
846
1170
|
}
|
|
847
1171
|
}, []);
|
|
848
|
-
const handleClick = (0,
|
|
1172
|
+
const handleClick = (0, import_react13.useCallback)(() => {
|
|
849
1173
|
var _a;
|
|
850
1174
|
if (uploadState === "idle" || uploadState === "error") {
|
|
851
1175
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
852
1176
|
}
|
|
853
1177
|
}, [uploadState]);
|
|
854
|
-
const styles = (0,
|
|
1178
|
+
const styles = (0, import_react13.useMemo)(
|
|
855
1179
|
() => (0, import_theme3.imagePlaceholder)({
|
|
856
1180
|
size: "md",
|
|
857
1181
|
variant: isDragOver ? "default" : void 0
|
|
858
1182
|
}),
|
|
859
1183
|
[isDragOver]
|
|
860
1184
|
);
|
|
861
|
-
const errorStyles = (0,
|
|
1185
|
+
const errorStyles = (0, import_react13.useMemo)(
|
|
862
1186
|
() => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "error" }),
|
|
863
1187
|
[]
|
|
864
1188
|
);
|
|
865
|
-
const uploadingStyles = (0,
|
|
1189
|
+
const uploadingStyles = (0, import_react13.useMemo)(
|
|
866
1190
|
() => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "uploading" }),
|
|
867
1191
|
[]
|
|
868
1192
|
);
|
|
869
|
-
const disabledStyles = (0,
|
|
1193
|
+
const disabledStyles = (0, import_react13.useMemo)(
|
|
870
1194
|
() => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "disabled" }),
|
|
871
1195
|
[]
|
|
872
1196
|
);
|
|
873
1197
|
if (!fileHandler) {
|
|
874
|
-
return /* @__PURE__ */ (0,
|
|
875
|
-
/* @__PURE__ */ (0,
|
|
876
|
-
/* @__PURE__ */ (0,
|
|
877
|
-
isEditable && /* @__PURE__ */ (0,
|
|
1198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: disabledStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: disabledStyles.content(), children: [
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.ImageIcon, { className: disabledStyles.icon() }),
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages3.files_not_supported) }),
|
|
1201
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
878
1202
|
import_button3.IconButton,
|
|
879
1203
|
{
|
|
880
1204
|
size: "sm",
|
|
881
1205
|
variant: "ghost",
|
|
882
1206
|
onClick: handleRemove,
|
|
883
1207
|
"aria-label": intl.formatMessage(messages3.remove),
|
|
884
|
-
children: /* @__PURE__ */ (0,
|
|
1208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.TrashIcon, { className: "size-4" })
|
|
885
1209
|
}
|
|
886
1210
|
)
|
|
887
1211
|
] }) }) });
|
|
888
1212
|
}
|
|
889
1213
|
if (uploadState === "uploading") {
|
|
890
|
-
return /* @__PURE__ */ (0,
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
892
|
-
/* @__PURE__ */ (0,
|
|
1214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: uploadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: uploadingStyles.content(), children: [
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative size-12", children: [
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
893
1217
|
"svg",
|
|
894
1218
|
{
|
|
895
1219
|
className: "size-12 -rotate-90",
|
|
896
1220
|
viewBox: "0 0 36 36",
|
|
897
1221
|
"aria-hidden": "true",
|
|
898
1222
|
children: [
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
900
1224
|
"circle",
|
|
901
1225
|
{
|
|
902
1226
|
cx: "18",
|
|
@@ -907,7 +1231,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
907
1231
|
strokeWidth: "2"
|
|
908
1232
|
}
|
|
909
1233
|
),
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
911
1235
|
"circle",
|
|
912
1236
|
{
|
|
913
1237
|
cx: "18",
|
|
@@ -924,22 +1248,22 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
924
1248
|
]
|
|
925
1249
|
}
|
|
926
1250
|
),
|
|
927
|
-
/* @__PURE__ */ (0,
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "absolute inset-0 flex items-center justify-center text-xs font-medium", children: [
|
|
928
1252
|
uploadProgress,
|
|
929
1253
|
"%"
|
|
930
1254
|
] })
|
|
931
1255
|
] }),
|
|
932
|
-
/* @__PURE__ */ (0,
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages3.uploading) })
|
|
933
1257
|
] }) }) });
|
|
934
1258
|
}
|
|
935
1259
|
if (uploadState === "error") {
|
|
936
|
-
return /* @__PURE__ */ (0,
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
938
|
-
/* @__PURE__ */ (0,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
940
|
-
/* @__PURE__ */ (0,
|
|
1260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: errorStyles.root(), onClick: handleClick, children: [
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: errorStyles.content(), children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.AlertCircleIcon, { className: errorStyles.icon() }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages3.upload_error) }),
|
|
1264
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: errorStyles.hint(), children: intl.formatMessage(messages3.click_to_retry) })
|
|
941
1265
|
] }),
|
|
942
|
-
/* @__PURE__ */ (0,
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
943
1267
|
"input",
|
|
944
1268
|
{
|
|
945
1269
|
ref: fileInputRef,
|
|
@@ -949,7 +1273,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
949
1273
|
onChange: handleInputChange
|
|
950
1274
|
}
|
|
951
1275
|
),
|
|
952
|
-
isEditable && /* @__PURE__ */ (0,
|
|
1276
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
953
1277
|
import_button3.IconButton,
|
|
954
1278
|
{
|
|
955
1279
|
size: "sm",
|
|
@@ -960,12 +1284,12 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
960
1284
|
handleRemove();
|
|
961
1285
|
},
|
|
962
1286
|
"aria-label": intl.formatMessage(messages3.remove),
|
|
963
|
-
children: /* @__PURE__ */ (0,
|
|
1287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.TrashIcon, { className: "size-3.5" })
|
|
964
1288
|
}
|
|
965
1289
|
)
|
|
966
1290
|
] }) });
|
|
967
1291
|
}
|
|
968
|
-
return /* @__PURE__ */ (0,
|
|
1292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
969
1293
|
"div",
|
|
970
1294
|
{
|
|
971
1295
|
className: `${styles.root()} ${isDragOver ? "border-primary bg-primary/10" : ""}`,
|
|
@@ -975,12 +1299,12 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
975
1299
|
onDragEnter: handleDragEnter,
|
|
976
1300
|
onDragLeave: handleDragLeave,
|
|
977
1301
|
children: [
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
980
|
-
/* @__PURE__ */ (0,
|
|
981
|
-
/* @__PURE__ */ (0,
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.content(), children: [
|
|
1303
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.UploadIcon, { className: styles.icon() }),
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages3.upload_placeholder) }),
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages3.upload_hint) })
|
|
982
1306
|
] }),
|
|
983
|
-
/* @__PURE__ */ (0,
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
984
1308
|
"input",
|
|
985
1309
|
{
|
|
986
1310
|
ref: fileInputRef,
|
|
@@ -990,7 +1314,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
990
1314
|
onChange: handleInputChange
|
|
991
1315
|
}
|
|
992
1316
|
),
|
|
993
|
-
isEditable && /* @__PURE__ */ (0,
|
|
1317
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
994
1318
|
import_button3.IconButton,
|
|
995
1319
|
{
|
|
996
1320
|
size: "sm",
|
|
@@ -1001,7 +1325,7 @@ function ImageUploadNodeView({ editor, node, getPos }) {
|
|
|
1001
1325
|
handleRemove();
|
|
1002
1326
|
},
|
|
1003
1327
|
"aria-label": intl.formatMessage(messages3.remove),
|
|
1004
|
-
children: /* @__PURE__ */ (0,
|
|
1328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.TrashIcon, { className: "size-3.5" })
|
|
1005
1329
|
}
|
|
1006
1330
|
)
|
|
1007
1331
|
]
|
|
@@ -1047,7 +1371,15 @@ var ImageUploadNode = import_core2.Node.create({
|
|
|
1047
1371
|
return ["div", { ...HTMLAttributes, "data-type": "image-upload" }];
|
|
1048
1372
|
},
|
|
1049
1373
|
addNodeView() {
|
|
1050
|
-
return (0,
|
|
1374
|
+
return (0, import_react14.ReactNodeViewRenderer)(ImageUploadNodeView, {
|
|
1375
|
+
stopEvent: ({ event }) => {
|
|
1376
|
+
const target = event.target;
|
|
1377
|
+
if (target.closest("button, [role='button'], input, a")) {
|
|
1378
|
+
return true;
|
|
1379
|
+
}
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1051
1383
|
},
|
|
1052
1384
|
addCommands() {
|
|
1053
1385
|
return {
|
|
@@ -1082,17 +1414,17 @@ var ImageUploadNode = import_core2.Node.create({
|
|
|
1082
1414
|
|
|
1083
1415
|
// src/extensions/math/index.ts
|
|
1084
1416
|
var import_core4 = require("@tiptap/core");
|
|
1085
|
-
var
|
|
1417
|
+
var import_react20 = require("@tiptap/react");
|
|
1086
1418
|
|
|
1087
1419
|
// src/extensions/math/math-block-view.tsx
|
|
1088
1420
|
var import_button4 = require("@kopexa/button");
|
|
1089
1421
|
var import_dialog2 = require("@kopexa/dialog");
|
|
1090
1422
|
var import_icons5 = require("@kopexa/icons");
|
|
1091
1423
|
var import_label2 = require("@kopexa/label");
|
|
1092
|
-
var
|
|
1424
|
+
var import_react15 = require("@tiptap/react");
|
|
1093
1425
|
var import_katex = __toESM(require("katex"));
|
|
1094
1426
|
var import_katex_min = require("katex/dist/katex.min.css");
|
|
1095
|
-
var
|
|
1427
|
+
var import_react16 = require("react");
|
|
1096
1428
|
var import_react_intl8 = require("react-intl");
|
|
1097
1429
|
|
|
1098
1430
|
// src/extensions/math/messages.ts
|
|
@@ -1146,28 +1478,28 @@ var messages4 = (0, import_react_intl7.defineMessages)({
|
|
|
1146
1478
|
});
|
|
1147
1479
|
|
|
1148
1480
|
// src/extensions/math/math-block-view.tsx
|
|
1149
|
-
var
|
|
1481
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1150
1482
|
function MathBlockView({ editor, node, getPos }) {
|
|
1151
1483
|
const intl = (0, import_react_intl8.useIntl)();
|
|
1152
1484
|
const attrs = node.attrs;
|
|
1153
1485
|
const { latex = "" } = attrs;
|
|
1154
|
-
const isEditable = (0,
|
|
1486
|
+
const isEditable = (0, import_react15.useEditorState)({
|
|
1155
1487
|
editor,
|
|
1156
1488
|
selector: ({ editor: e }) => {
|
|
1157
1489
|
var _a;
|
|
1158
1490
|
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
1159
1491
|
}
|
|
1160
1492
|
});
|
|
1161
|
-
const [isOpen, setIsOpen] = (0,
|
|
1162
|
-
const [localLatex, setLocalLatex] = (0,
|
|
1163
|
-
const [error, setError] = (0,
|
|
1164
|
-
(0,
|
|
1493
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
1494
|
+
const [localLatex, setLocalLatex] = (0, import_react16.useState)(latex);
|
|
1495
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
1496
|
+
(0, import_react16.useEffect)(() => {
|
|
1165
1497
|
if (isOpen) {
|
|
1166
1498
|
setLocalLatex(latex);
|
|
1167
1499
|
setError(null);
|
|
1168
1500
|
}
|
|
1169
1501
|
}, [isOpen, latex]);
|
|
1170
|
-
const renderedHtml = (0,
|
|
1502
|
+
const renderedHtml = (0, import_react16.useMemo)(() => {
|
|
1171
1503
|
if (!latex) return null;
|
|
1172
1504
|
try {
|
|
1173
1505
|
return import_katex.default.renderToString(latex, {
|
|
@@ -1179,7 +1511,7 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1179
1511
|
return null;
|
|
1180
1512
|
}
|
|
1181
1513
|
}, [latex]);
|
|
1182
|
-
const previewHtml = (0,
|
|
1514
|
+
const previewHtml = (0, import_react16.useMemo)(() => {
|
|
1183
1515
|
if (!localLatex) return null;
|
|
1184
1516
|
try {
|
|
1185
1517
|
setError(null);
|
|
@@ -1193,7 +1525,7 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1193
1525
|
return null;
|
|
1194
1526
|
}
|
|
1195
1527
|
}, [localLatex, intl]);
|
|
1196
|
-
const handleSave = (0,
|
|
1528
|
+
const handleSave = (0, import_react16.useCallback)(() => {
|
|
1197
1529
|
const pos = getPos();
|
|
1198
1530
|
if (pos === void 0) return;
|
|
1199
1531
|
editor.view.dispatch(
|
|
@@ -1201,12 +1533,12 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1201
1533
|
);
|
|
1202
1534
|
setIsOpen(false);
|
|
1203
1535
|
}, [editor, localLatex, getPos]);
|
|
1204
|
-
const handleCancel = (0,
|
|
1536
|
+
const handleCancel = (0, import_react16.useCallback)(() => {
|
|
1205
1537
|
setLocalLatex(latex);
|
|
1206
1538
|
setError(null);
|
|
1207
1539
|
setIsOpen(false);
|
|
1208
1540
|
}, [latex]);
|
|
1209
|
-
const handleOpenEditor = (0,
|
|
1541
|
+
const handleOpenEditor = (0, import_react16.useCallback)(
|
|
1210
1542
|
(e) => {
|
|
1211
1543
|
e.stopPropagation();
|
|
1212
1544
|
e.preventDefault();
|
|
@@ -1217,32 +1549,32 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1217
1549
|
[isEditable]
|
|
1218
1550
|
);
|
|
1219
1551
|
const isEmpty = !latex;
|
|
1220
|
-
return /* @__PURE__ */ (0,
|
|
1221
|
-
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1553
|
+
import_react15.NodeViewWrapper,
|
|
1222
1554
|
{
|
|
1223
1555
|
className: "my-4 relative group",
|
|
1224
1556
|
"data-type": "math-block",
|
|
1225
1557
|
"data-latex": latex,
|
|
1226
1558
|
children: [
|
|
1227
|
-
/* @__PURE__ */ (0,
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1228
1560
|
"button",
|
|
1229
1561
|
{
|
|
1230
1562
|
type: "button",
|
|
1231
1563
|
className: "w-full flex items-center justify-center min-h-16 p-4 rounded-md border border-border bg-muted/30 cursor-pointer hover:bg-muted/50 transition-colors",
|
|
1232
1564
|
onClick: handleOpenEditor,
|
|
1233
|
-
children: isEmpty ? /* @__PURE__ */ (0,
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1235
|
-
/* @__PURE__ */ (0,
|
|
1236
|
-
] }) : renderedHtml ? /* @__PURE__ */ (0,
|
|
1565
|
+
children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages4.empty_formula) })
|
|
1568
|
+
] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1237
1569
|
"div",
|
|
1238
1570
|
{
|
|
1239
1571
|
className: "katex-display",
|
|
1240
1572
|
dangerouslySetInnerHTML: { __html: renderedHtml }
|
|
1241
1573
|
}
|
|
1242
|
-
) : /* @__PURE__ */ (0,
|
|
1574
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages4.invalid_latex) })
|
|
1243
1575
|
}
|
|
1244
1576
|
),
|
|
1245
|
-
isEditable && !isEmpty && /* @__PURE__ */ (0,
|
|
1577
|
+
isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1246
1578
|
import_button4.IconButton,
|
|
1247
1579
|
{
|
|
1248
1580
|
size: "sm",
|
|
@@ -1250,15 +1582,15 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1250
1582
|
className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1251
1583
|
"aria-label": intl.formatMessage(messages4.edit),
|
|
1252
1584
|
onClick: handleOpenEditor,
|
|
1253
|
-
children: /* @__PURE__ */ (0,
|
|
1585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons5.EditIcon, { className: "size-3.5" })
|
|
1254
1586
|
}
|
|
1255
1587
|
),
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1261
|
-
/* @__PURE__ */ (0,
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog2.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog2.Dialog.Content, { children: [
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog2.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog2.Dialog.Title, { children: intl.formatMessage(messages4.title) }) }),
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages4.latex_input) }),
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1262
1594
|
"textarea",
|
|
1263
1595
|
{
|
|
1264
1596
|
className: "w-full min-h-24 p-3 rounded-md border border-input bg-background font-mono text-sm resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
@@ -1268,22 +1600,22 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1268
1600
|
spellCheck: false
|
|
1269
1601
|
}
|
|
1270
1602
|
),
|
|
1271
|
-
error && /* @__PURE__ */ (0,
|
|
1603
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-destructive", children: error })
|
|
1272
1604
|
] }),
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages4.preview) }),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1276
1608
|
"div",
|
|
1277
1609
|
{
|
|
1278
1610
|
className: "katex-display",
|
|
1279
1611
|
dangerouslySetInnerHTML: { __html: previewHtml }
|
|
1280
1612
|
}
|
|
1281
|
-
) : localLatex ? /* @__PURE__ */ (0,
|
|
1613
|
+
) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.latex_placeholder) }) })
|
|
1282
1614
|
] })
|
|
1283
1615
|
] }) }),
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog2.Dialog.Footer, { children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button4.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages4.save) })
|
|
1287
1619
|
] })
|
|
1288
1620
|
] }) })
|
|
1289
1621
|
]
|
|
@@ -1293,39 +1625,39 @@ function MathBlockView({ editor, node, getPos }) {
|
|
|
1293
1625
|
|
|
1294
1626
|
// src/extensions/math/inline-math.ts
|
|
1295
1627
|
var import_core3 = require("@tiptap/core");
|
|
1296
|
-
var
|
|
1628
|
+
var import_react19 = require("@tiptap/react");
|
|
1297
1629
|
|
|
1298
1630
|
// src/extensions/math/inline-math-view.tsx
|
|
1299
1631
|
var import_button5 = require("@kopexa/button");
|
|
1300
1632
|
var import_dialog3 = require("@kopexa/dialog");
|
|
1301
1633
|
var import_label3 = require("@kopexa/label");
|
|
1302
|
-
var
|
|
1634
|
+
var import_react17 = require("@tiptap/react");
|
|
1303
1635
|
var import_katex2 = __toESM(require("katex"));
|
|
1304
1636
|
var import_katex_min2 = require("katex/dist/katex.min.css");
|
|
1305
|
-
var
|
|
1637
|
+
var import_react18 = require("react");
|
|
1306
1638
|
var import_react_intl9 = require("react-intl");
|
|
1307
|
-
var
|
|
1639
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1308
1640
|
function InlineMathView({ editor, node, getPos }) {
|
|
1309
1641
|
const intl = (0, import_react_intl9.useIntl)();
|
|
1310
1642
|
const attrs = node.attrs;
|
|
1311
1643
|
const { latex = "" } = attrs;
|
|
1312
|
-
const isEditable = (0,
|
|
1644
|
+
const isEditable = (0, import_react17.useEditorState)({
|
|
1313
1645
|
editor,
|
|
1314
1646
|
selector: ({ editor: e }) => {
|
|
1315
1647
|
var _a;
|
|
1316
1648
|
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
1317
1649
|
}
|
|
1318
1650
|
});
|
|
1319
|
-
const [isOpen, setIsOpen] = (0,
|
|
1320
|
-
const [localLatex, setLocalLatex] = (0,
|
|
1321
|
-
const [error, setError] = (0,
|
|
1322
|
-
(0,
|
|
1651
|
+
const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
|
|
1652
|
+
const [localLatex, setLocalLatex] = (0, import_react18.useState)(latex);
|
|
1653
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
1654
|
+
(0, import_react18.useEffect)(() => {
|
|
1323
1655
|
if (isOpen) {
|
|
1324
1656
|
setLocalLatex(latex);
|
|
1325
1657
|
setError(null);
|
|
1326
1658
|
}
|
|
1327
1659
|
}, [isOpen, latex]);
|
|
1328
|
-
const renderedHtml = (0,
|
|
1660
|
+
const renderedHtml = (0, import_react18.useMemo)(() => {
|
|
1329
1661
|
if (!latex) return null;
|
|
1330
1662
|
try {
|
|
1331
1663
|
return import_katex2.default.renderToString(latex, {
|
|
@@ -1337,7 +1669,7 @@ function InlineMathView({ editor, node, getPos }) {
|
|
|
1337
1669
|
return null;
|
|
1338
1670
|
}
|
|
1339
1671
|
}, [latex]);
|
|
1340
|
-
const previewHtml = (0,
|
|
1672
|
+
const previewHtml = (0, import_react18.useMemo)(() => {
|
|
1341
1673
|
if (!localLatex) return null;
|
|
1342
1674
|
try {
|
|
1343
1675
|
setError(null);
|
|
@@ -1351,7 +1683,7 @@ function InlineMathView({ editor, node, getPos }) {
|
|
|
1351
1683
|
return null;
|
|
1352
1684
|
}
|
|
1353
1685
|
}, [localLatex, intl]);
|
|
1354
|
-
const handleSave = (0,
|
|
1686
|
+
const handleSave = (0, import_react18.useCallback)(() => {
|
|
1355
1687
|
const pos = getPos();
|
|
1356
1688
|
if (pos === void 0) return;
|
|
1357
1689
|
editor.view.dispatch(
|
|
@@ -1359,12 +1691,12 @@ function InlineMathView({ editor, node, getPos }) {
|
|
|
1359
1691
|
);
|
|
1360
1692
|
setIsOpen(false);
|
|
1361
1693
|
}, [editor, localLatex, getPos]);
|
|
1362
|
-
const handleCancel = (0,
|
|
1694
|
+
const handleCancel = (0, import_react18.useCallback)(() => {
|
|
1363
1695
|
setLocalLatex(latex);
|
|
1364
1696
|
setError(null);
|
|
1365
1697
|
setIsOpen(false);
|
|
1366
1698
|
}, [latex]);
|
|
1367
|
-
const handleClick = (0,
|
|
1699
|
+
const handleClick = (0, import_react18.useCallback)(
|
|
1368
1700
|
(e) => {
|
|
1369
1701
|
e.stopPropagation();
|
|
1370
1702
|
e.preventDefault();
|
|
@@ -1375,33 +1707,33 @@ function InlineMathView({ editor, node, getPos }) {
|
|
|
1375
1707
|
[isEditable]
|
|
1376
1708
|
);
|
|
1377
1709
|
const isEmpty = !latex;
|
|
1378
|
-
return /* @__PURE__ */ (0,
|
|
1379
|
-
|
|
1710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1711
|
+
import_react17.NodeViewWrapper,
|
|
1380
1712
|
{
|
|
1381
1713
|
as: "span",
|
|
1382
1714
|
className: "inline-math-wrapper",
|
|
1383
1715
|
"data-type": "inline-math",
|
|
1384
1716
|
"data-latex": latex,
|
|
1385
1717
|
children: [
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1718
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1387
1719
|
"span",
|
|
1388
1720
|
{
|
|
1389
1721
|
className: `inline-math cursor-pointer rounded px-0.5 transition-colors ${isEditable ? "hover:bg-primary/10 hover:ring-1 hover:ring-primary/20" : ""} ${isEmpty ? "text-muted-foreground italic" : ""}`,
|
|
1390
1722
|
onClick: handleClick,
|
|
1391
|
-
children: isEmpty ? /* @__PURE__ */ (0,
|
|
1723
|
+
children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1392
1724
|
"span",
|
|
1393
1725
|
{
|
|
1394
1726
|
dangerouslySetInnerHTML: { __html: renderedHtml }
|
|
1395
1727
|
}
|
|
1396
|
-
) : /* @__PURE__ */ (0,
|
|
1728
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-destructive text-xs", children: latex })
|
|
1397
1729
|
}
|
|
1398
1730
|
),
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1401
|
-
/* @__PURE__ */ (0,
|
|
1402
|
-
/* @__PURE__ */ (0,
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog3.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_dialog3.Dialog.Content, { children: [
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog3.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog3.Dialog.Title, { children: intl.formatMessage(messages4.title) }) }),
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-4", children: [
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages4.latex_input) }),
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1405
1737
|
"input",
|
|
1406
1738
|
{
|
|
1407
1739
|
type: "text",
|
|
@@ -1412,21 +1744,21 @@ function InlineMathView({ editor, node, getPos }) {
|
|
|
1412
1744
|
spellCheck: false
|
|
1413
1745
|
}
|
|
1414
1746
|
),
|
|
1415
|
-
error && /* @__PURE__ */ (0,
|
|
1747
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-destructive", children: error })
|
|
1416
1748
|
] }),
|
|
1417
|
-
/* @__PURE__ */ (0,
|
|
1418
|
-
/* @__PURE__ */ (0,
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1.5", children: [
|
|
1750
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages4.preview) }),
|
|
1751
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "min-h-10 p-3 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1420
1752
|
"span",
|
|
1421
1753
|
{
|
|
1422
1754
|
dangerouslySetInnerHTML: { __html: previewHtml }
|
|
1423
1755
|
}
|
|
1424
|
-
) : localLatex ? /* @__PURE__ */ (0,
|
|
1756
|
+
) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground text-sm", children: "$...$" }) })
|
|
1425
1757
|
] })
|
|
1426
1758
|
] }) }),
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1428
|
-
/* @__PURE__ */ (0,
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_dialog3.Dialog.Footer, { children: [
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button5.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button5.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages4.save) })
|
|
1430
1762
|
] })
|
|
1431
1763
|
] }) })
|
|
1432
1764
|
]
|
|
@@ -1472,7 +1804,7 @@ var InlineMath = import_core3.Node.create({
|
|
|
1472
1804
|
];
|
|
1473
1805
|
},
|
|
1474
1806
|
addNodeView() {
|
|
1475
|
-
return (0,
|
|
1807
|
+
return (0, import_react19.ReactNodeViewRenderer)(InlineMathView, {
|
|
1476
1808
|
as: "span"
|
|
1477
1809
|
});
|
|
1478
1810
|
},
|
|
@@ -1540,7 +1872,7 @@ var MathBlock = import_core4.Node.create({
|
|
|
1540
1872
|
];
|
|
1541
1873
|
},
|
|
1542
1874
|
addNodeView() {
|
|
1543
|
-
return (0,
|
|
1875
|
+
return (0, import_react20.ReactNodeViewRenderer)(MathBlockView);
|
|
1544
1876
|
},
|
|
1545
1877
|
addCommands() {
|
|
1546
1878
|
return {
|
|
@@ -1583,13 +1915,13 @@ var MathBlock = import_core4.Node.create({
|
|
|
1583
1915
|
|
|
1584
1916
|
// src/extensions/toc/index.ts
|
|
1585
1917
|
var import_core5 = require("@tiptap/core");
|
|
1586
|
-
var
|
|
1918
|
+
var import_react24 = require("@tiptap/react");
|
|
1587
1919
|
|
|
1588
1920
|
// src/extensions/toc/toc-view.tsx
|
|
1589
1921
|
var import_icons7 = require("@kopexa/icons");
|
|
1590
1922
|
var import_theme4 = require("@kopexa/theme");
|
|
1591
|
-
var
|
|
1592
|
-
var
|
|
1923
|
+
var import_react22 = require("@tiptap/react");
|
|
1924
|
+
var import_react23 = require("react");
|
|
1593
1925
|
var import_react_intl12 = require("react-intl");
|
|
1594
1926
|
|
|
1595
1927
|
// src/extensions/toc/messages.ts
|
|
@@ -1674,9 +2006,9 @@ var import_icons6 = require("@kopexa/icons");
|
|
|
1674
2006
|
var import_label4 = require("@kopexa/label");
|
|
1675
2007
|
var import_select2 = require("@kopexa/select");
|
|
1676
2008
|
var import_switch = require("@kopexa/switch");
|
|
1677
|
-
var
|
|
2009
|
+
var import_react21 = require("react");
|
|
1678
2010
|
var import_react_intl11 = require("react-intl");
|
|
1679
|
-
var
|
|
2011
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1680
2012
|
var HEADING_LEVELS = [
|
|
1681
2013
|
{ value: "1", label: "H1" },
|
|
1682
2014
|
{ value: "2", label: "H2" },
|
|
@@ -1687,14 +2019,14 @@ var HEADING_LEVELS = [
|
|
|
1687
2019
|
];
|
|
1688
2020
|
function TocSettings({ editor, attrs, getPos }) {
|
|
1689
2021
|
const intl = (0, import_react_intl11.useIntl)();
|
|
1690
|
-
const [isOpen, setIsOpen] = (0,
|
|
1691
|
-
const [localAttrs, setLocalAttrs] = (0,
|
|
1692
|
-
(0,
|
|
2022
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
2023
|
+
const [localAttrs, setLocalAttrs] = (0, import_react21.useState)(attrs);
|
|
2024
|
+
(0, import_react21.useEffect)(() => {
|
|
1693
2025
|
if (isOpen) {
|
|
1694
2026
|
setLocalAttrs(attrs);
|
|
1695
2027
|
}
|
|
1696
2028
|
}, [isOpen, attrs]);
|
|
1697
|
-
const handleSave = (0,
|
|
2029
|
+
const handleSave = (0, import_react21.useCallback)(() => {
|
|
1698
2030
|
const pos = getPos();
|
|
1699
2031
|
if (pos === void 0) return;
|
|
1700
2032
|
editor.view.dispatch(
|
|
@@ -1702,11 +2034,11 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1702
2034
|
);
|
|
1703
2035
|
setIsOpen(false);
|
|
1704
2036
|
}, [editor, localAttrs, getPos]);
|
|
1705
|
-
const handleCancel = (0,
|
|
2037
|
+
const handleCancel = (0, import_react21.useCallback)(() => {
|
|
1706
2038
|
setLocalAttrs(attrs);
|
|
1707
2039
|
setIsOpen(false);
|
|
1708
2040
|
}, [attrs]);
|
|
1709
|
-
const handleMinLevelChange = (0,
|
|
2041
|
+
const handleMinLevelChange = (0, import_react21.useCallback)((value) => {
|
|
1710
2042
|
const minLevel = Number.parseInt(String(value), 10);
|
|
1711
2043
|
setLocalAttrs((prev) => ({
|
|
1712
2044
|
...prev,
|
|
@@ -1715,7 +2047,7 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1715
2047
|
maxLevel: Math.max(prev.maxLevel, minLevel)
|
|
1716
2048
|
}));
|
|
1717
2049
|
}, []);
|
|
1718
|
-
const handleMaxLevelChange = (0,
|
|
2050
|
+
const handleMaxLevelChange = (0, import_react21.useCallback)((value) => {
|
|
1719
2051
|
const maxLevel = Number.parseInt(String(value), 10);
|
|
1720
2052
|
setLocalAttrs((prev) => ({
|
|
1721
2053
|
...prev,
|
|
@@ -1724,10 +2056,10 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1724
2056
|
minLevel: Math.min(prev.minLevel, maxLevel)
|
|
1725
2057
|
}));
|
|
1726
2058
|
}, []);
|
|
1727
|
-
const handleNumberedChange = (0,
|
|
2059
|
+
const handleNumberedChange = (0, import_react21.useCallback)((checked) => {
|
|
1728
2060
|
setLocalAttrs((prev) => ({ ...prev, numbered: checked }));
|
|
1729
2061
|
}, []);
|
|
1730
|
-
const handleStyleChange = (0,
|
|
2062
|
+
const handleStyleChange = (0, import_react21.useCallback)((value) => {
|
|
1731
2063
|
setLocalAttrs((prev) => ({
|
|
1732
2064
|
...prev,
|
|
1733
2065
|
style: String(value)
|
|
@@ -1736,8 +2068,8 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1736
2068
|
if (!editor.isEditable) {
|
|
1737
2069
|
return null;
|
|
1738
2070
|
}
|
|
1739
|
-
return /* @__PURE__ */ (0,
|
|
1740
|
-
/* @__PURE__ */ (0,
|
|
2071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1741
2073
|
import_button6.IconButton,
|
|
1742
2074
|
{
|
|
1743
2075
|
size: "sm",
|
|
@@ -1748,24 +2080,24 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1748
2080
|
e.preventDefault();
|
|
1749
2081
|
setIsOpen(true);
|
|
1750
2082
|
},
|
|
1751
|
-
children: /* @__PURE__ */ (0,
|
|
2083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.SettingsIcon, { className: "size-3.5" })
|
|
1752
2084
|
}
|
|
1753
2085
|
),
|
|
1754
|
-
/* @__PURE__ */ (0,
|
|
1755
|
-
/* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1757
|
-
/* @__PURE__ */ (0,
|
|
1758
|
-
/* @__PURE__ */ (0,
|
|
1759
|
-
/* @__PURE__ */ (0,
|
|
1760
|
-
/* @__PURE__ */ (0,
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dialog4.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_dialog4.Dialog.Content, { children: [
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dialog4.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dialog4.Dialog.Title, { children: intl.formatMessage(messages5.settings) }) }),
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-4", children: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2091
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.min_level) }),
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1761
2093
|
import_select2.Select,
|
|
1762
2094
|
{
|
|
1763
2095
|
size: "sm",
|
|
1764
2096
|
value: String(localAttrs.minLevel),
|
|
1765
2097
|
onValueChange: handleMinLevelChange,
|
|
1766
2098
|
children: [
|
|
1767
|
-
/* @__PURE__ */ (0,
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Value, {}) }),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1769
2101
|
import_select2.Select.Item,
|
|
1770
2102
|
{
|
|
1771
2103
|
value: level.value,
|
|
@@ -1778,17 +2110,17 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1778
2110
|
}
|
|
1779
2111
|
)
|
|
1780
2112
|
] }),
|
|
1781
|
-
/* @__PURE__ */ (0,
|
|
1782
|
-
/* @__PURE__ */ (0,
|
|
1783
|
-
/* @__PURE__ */ (0,
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2114
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.max_level) }),
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1784
2116
|
import_select2.Select,
|
|
1785
2117
|
{
|
|
1786
2118
|
size: "sm",
|
|
1787
2119
|
value: String(localAttrs.maxLevel),
|
|
1788
2120
|
onValueChange: handleMaxLevelChange,
|
|
1789
2121
|
children: [
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Value, {}) }),
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1792
2124
|
import_select2.Select.Item,
|
|
1793
2125
|
{
|
|
1794
2126
|
value: level.value,
|
|
@@ -1802,12 +2134,12 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1802
2134
|
)
|
|
1803
2135
|
] })
|
|
1804
2136
|
] }),
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1807
|
-
/* @__PURE__ */ (0,
|
|
1808
|
-
/* @__PURE__ */ (0,
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-0.5", children: [
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.numbered) }),
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages5.numbered_hint) })
|
|
1809
2141
|
] }),
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1811
2143
|
import_switch.Switch,
|
|
1812
2144
|
{
|
|
1813
2145
|
size: "sm",
|
|
@@ -1816,36 +2148,36 @@ function TocSettings({ editor, attrs, getPos }) {
|
|
|
1816
2148
|
}
|
|
1817
2149
|
)
|
|
1818
2150
|
] }),
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1820
|
-
/* @__PURE__ */ (0,
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.style) }),
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1822
2154
|
import_select2.Select,
|
|
1823
2155
|
{
|
|
1824
2156
|
size: "sm",
|
|
1825
2157
|
value: localAttrs.style,
|
|
1826
2158
|
onValueChange: handleStyleChange,
|
|
1827
2159
|
children: [
|
|
1828
|
-
/* @__PURE__ */ (0,
|
|
1829
|
-
/* @__PURE__ */ (0,
|
|
1830
|
-
/* @__PURE__ */ (0,
|
|
1831
|
-
/* @__PURE__ */ (0,
|
|
1832
|
-
/* @__PURE__ */ (0,
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Value, {}) }),
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_select2.Select.Content, { children: [
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages5.style_default) }),
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages5.style_flat) }),
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages5.style_compact) })
|
|
1833
2165
|
] })
|
|
1834
2166
|
]
|
|
1835
2167
|
}
|
|
1836
2168
|
)
|
|
1837
2169
|
] })
|
|
1838
2170
|
] }) }),
|
|
1839
|
-
/* @__PURE__ */ (0,
|
|
1840
|
-
/* @__PURE__ */ (0,
|
|
1841
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_dialog4.Dialog.Footer, { children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_button6.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages5.cancel) }),
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_button6.Button, { onClick: handleSave, children: intl.formatMessage(messages5.save) })
|
|
1842
2174
|
] })
|
|
1843
2175
|
] }) })
|
|
1844
2176
|
] });
|
|
1845
2177
|
}
|
|
1846
2178
|
|
|
1847
2179
|
// src/extensions/toc/toc-view.tsx
|
|
1848
|
-
var
|
|
2180
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1849
2181
|
function generateHeadingNumbers(headings, minLevel) {
|
|
1850
2182
|
const counters = [0, 0, 0, 0, 0, 0];
|
|
1851
2183
|
return headings.map((heading) => {
|
|
@@ -1867,7 +2199,7 @@ function generateHeadingNumbers(headings, minLevel) {
|
|
|
1867
2199
|
});
|
|
1868
2200
|
}
|
|
1869
2201
|
function TocNodeView({ editor, node, getPos }) {
|
|
1870
|
-
const [headings, setHeadings] = (0,
|
|
2202
|
+
const [headings, setHeadings] = (0, import_react23.useState)([]);
|
|
1871
2203
|
const intl = (0, import_react_intl12.useIntl)();
|
|
1872
2204
|
const attrs = node.attrs;
|
|
1873
2205
|
const {
|
|
@@ -1876,8 +2208,8 @@ function TocNodeView({ editor, node, getPos }) {
|
|
|
1876
2208
|
numbered = false,
|
|
1877
2209
|
style = "default"
|
|
1878
2210
|
} = attrs;
|
|
1879
|
-
const styles = (0,
|
|
1880
|
-
const updateHeadings = (0,
|
|
2211
|
+
const styles = (0, import_react23.useMemo)(() => (0, import_theme4.toc)({ style }), [style]);
|
|
2212
|
+
const updateHeadings = (0, import_react23.useCallback)(() => {
|
|
1881
2213
|
const items = [];
|
|
1882
2214
|
const { doc } = editor.state;
|
|
1883
2215
|
doc.descendants((docNode, pos) => {
|
|
@@ -1897,14 +2229,14 @@ function TocNodeView({ editor, node, getPos }) {
|
|
|
1897
2229
|
const numberedHeadings = generateHeadingNumbers(items, minLevel);
|
|
1898
2230
|
setHeadings(numberedHeadings);
|
|
1899
2231
|
}, [editor, minLevel, maxLevel]);
|
|
1900
|
-
(0,
|
|
2232
|
+
(0, import_react23.useEffect)(() => {
|
|
1901
2233
|
updateHeadings();
|
|
1902
2234
|
editor.on("update", updateHeadings);
|
|
1903
2235
|
return () => {
|
|
1904
2236
|
editor.off("update", updateHeadings);
|
|
1905
2237
|
};
|
|
1906
2238
|
}, [editor, updateHeadings]);
|
|
1907
|
-
const handleClick = (0,
|
|
2239
|
+
const handleClick = (0, import_react23.useCallback)(
|
|
1908
2240
|
(pos, id) => {
|
|
1909
2241
|
var _a;
|
|
1910
2242
|
editor.chain().focus().setTextSelection(pos).run();
|
|
@@ -1925,13 +2257,13 @@ function TocNodeView({ editor, node, getPos }) {
|
|
|
1925
2257
|
const getIndent = (level) => {
|
|
1926
2258
|
return (level - minLevel) * 16;
|
|
1927
2259
|
};
|
|
1928
|
-
return /* @__PURE__ */ (0,
|
|
1929
|
-
/* @__PURE__ */ (0,
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
1931
|
-
/* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react22.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
|
|
2261
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: styles.header(), children: [
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: styles.headerContent(), children: [
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.ListIcon, { className: styles.headerIcon() }),
|
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages5.title) })
|
|
1933
2265
|
] }),
|
|
1934
|
-
/* @__PURE__ */ (0,
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1935
2267
|
TocSettings,
|
|
1936
2268
|
{
|
|
1937
2269
|
editor,
|
|
@@ -1940,7 +2272,7 @@ function TocNodeView({ editor, node, getPos }) {
|
|
|
1940
2272
|
}
|
|
1941
2273
|
) })
|
|
1942
2274
|
] }),
|
|
1943
|
-
isEmpty ? /* @__PURE__ */ (0,
|
|
2275
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: styles.emptyState(), children: intl.formatMessage(messages5.empty_state) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("nav", { className: styles.nav(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: styles.list(), children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1944
2276
|
"li",
|
|
1945
2277
|
{
|
|
1946
2278
|
className: styles.item(),
|
|
@@ -1948,8 +2280,8 @@ function TocNodeView({ editor, node, getPos }) {
|
|
|
1948
2280
|
paddingLeft: `${getIndent(heading.level)}px`
|
|
1949
2281
|
},
|
|
1950
2282
|
children: [
|
|
1951
|
-
numbered && heading.number && /* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
2283
|
+
numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
|
|
2284
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1953
2285
|
"button",
|
|
1954
2286
|
{
|
|
1955
2287
|
type: "button",
|
|
@@ -2024,7 +2356,7 @@ var TocNode = import_core5.Node.create({
|
|
|
2024
2356
|
];
|
|
2025
2357
|
},
|
|
2026
2358
|
addNodeView() {
|
|
2027
|
-
return (0,
|
|
2359
|
+
return (0, import_react24.ReactNodeViewRenderer)(TocNodeView);
|
|
2028
2360
|
},
|
|
2029
2361
|
addCommands() {
|
|
2030
2362
|
return {
|
|
@@ -2053,15 +2385,15 @@ var TocNode = import_core5.Node.create({
|
|
|
2053
2385
|
|
|
2054
2386
|
// src/extensions/variable/index.ts
|
|
2055
2387
|
var import_core6 = require("@tiptap/core");
|
|
2056
|
-
var
|
|
2388
|
+
var import_react26 = require("@tiptap/react");
|
|
2057
2389
|
|
|
2058
2390
|
// src/extensions/variable/variable-view.tsx
|
|
2059
2391
|
var import_theme5 = require("@kopexa/theme");
|
|
2060
|
-
var
|
|
2392
|
+
var import_react25 = require("@tiptap/react");
|
|
2061
2393
|
|
|
2062
2394
|
// src/extensions/variable/variable-context.tsx
|
|
2063
2395
|
var React = __toESM(require("react"));
|
|
2064
|
-
var
|
|
2396
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2065
2397
|
var VariableContext = React.createContext(null);
|
|
2066
2398
|
function VariableProvider({
|
|
2067
2399
|
children,
|
|
@@ -2075,7 +2407,7 @@ function VariableProvider({
|
|
|
2075
2407
|
}),
|
|
2076
2408
|
[variables, resolveVariable]
|
|
2077
2409
|
);
|
|
2078
|
-
return /* @__PURE__ */ (0,
|
|
2410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(VariableContext.Provider, { value, children });
|
|
2079
2411
|
}
|
|
2080
2412
|
function useVariables() {
|
|
2081
2413
|
return React.useContext(VariableContext);
|
|
@@ -2087,13 +2419,13 @@ function useVariablesWithFallback(fallbackVariables = []) {
|
|
|
2087
2419
|
}
|
|
2088
2420
|
|
|
2089
2421
|
// src/extensions/variable/variable-view.tsx
|
|
2090
|
-
var
|
|
2422
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2091
2423
|
function VariableNodeView({ node, editor }) {
|
|
2092
2424
|
var _a;
|
|
2093
2425
|
const attrs = node.attrs;
|
|
2094
2426
|
const { name, fallback, category } = attrs;
|
|
2095
2427
|
const context = useVariables();
|
|
2096
|
-
const isEditable = (0,
|
|
2428
|
+
const isEditable = (0, import_react25.useEditorState)({
|
|
2097
2429
|
editor,
|
|
2098
2430
|
selector: ({ editor: e }) => {
|
|
2099
2431
|
var _a2;
|
|
@@ -2105,8 +2437,8 @@ function VariableNodeView({ node, editor }) {
|
|
|
2105
2437
|
const displayValue = resolvedValue || fallback;
|
|
2106
2438
|
const styles = (0, import_theme5.variableNode)({ resolved: hasValue });
|
|
2107
2439
|
if (!isEditable && hasValue) {
|
|
2108
|
-
return /* @__PURE__ */ (0,
|
|
2109
|
-
|
|
2440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2441
|
+
import_react25.NodeViewWrapper,
|
|
2110
2442
|
{
|
|
2111
2443
|
as: "span",
|
|
2112
2444
|
"data-type": "variable",
|
|
@@ -2116,8 +2448,8 @@ function VariableNodeView({ node, editor }) {
|
|
|
2116
2448
|
}
|
|
2117
2449
|
);
|
|
2118
2450
|
}
|
|
2119
|
-
return /* @__PURE__ */ (0,
|
|
2120
|
-
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2452
|
+
import_react25.NodeViewWrapper,
|
|
2121
2453
|
{
|
|
2122
2454
|
as: "span",
|
|
2123
2455
|
className: styles.wrapper(),
|
|
@@ -2125,17 +2457,17 @@ function VariableNodeView({ node, editor }) {
|
|
|
2125
2457
|
"data-name": name,
|
|
2126
2458
|
"data-category": category,
|
|
2127
2459
|
"data-resolved": hasValue ? "true" : "false",
|
|
2128
|
-
children: hasValue ? /* @__PURE__ */ (0,
|
|
2460
|
+
children: hasValue ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.chip(), title: `{{${name}}}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.value(), children: displayValue }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2129
2461
|
"span",
|
|
2130
2462
|
{
|
|
2131
2463
|
className: styles.chip(),
|
|
2132
2464
|
title: fallback ? `Fallback: ${fallback}` : void 0,
|
|
2133
2465
|
children: [
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2135
|
-
/* @__PURE__ */ (0,
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
2137
|
-
/* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.bracket(), children: "{" }),
|
|
2467
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.bracket(), children: "{" }),
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.name(), children: name }),
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.bracket(), children: "}" }),
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.bracket(), children: "}" })
|
|
2139
2471
|
]
|
|
2140
2472
|
}
|
|
2141
2473
|
)
|
|
@@ -2206,7 +2538,7 @@ var VariableNode = import_core6.Node.create({
|
|
|
2206
2538
|
];
|
|
2207
2539
|
},
|
|
2208
2540
|
addNodeView() {
|
|
2209
|
-
return (0,
|
|
2541
|
+
return (0, import_react26.ReactNodeViewRenderer)(VariableNodeView);
|
|
2210
2542
|
},
|
|
2211
2543
|
addCommands() {
|
|
2212
2544
|
return {
|
|
@@ -2329,7 +2661,7 @@ var messages6 = (0, import_react_intl13.defineMessages)({
|
|
|
2329
2661
|
});
|
|
2330
2662
|
|
|
2331
2663
|
// src/extensions/variable/variable-filler-dialog.tsx
|
|
2332
|
-
var
|
|
2664
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2333
2665
|
function VariableFillerDialog({
|
|
2334
2666
|
open,
|
|
2335
2667
|
onOpenChange,
|
|
@@ -2379,19 +2711,19 @@ function VariableFillerDialog({
|
|
|
2379
2711
|
return (_a = localValues[v.name]) == null ? void 0 : _a.trim();
|
|
2380
2712
|
}).length;
|
|
2381
2713
|
}, [variables, localValues]);
|
|
2382
|
-
return /* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2385
|
-
description && /* @__PURE__ */ (0,
|
|
2714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dialog5.Dialog.Root, { open, onOpenChange, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_dialog5.Dialog.Content, { children: [
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_dialog5.Dialog.Header, { children: [
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dialog5.Dialog.Title, { children: title || intl.formatMessage(messages6.filler_title) }),
|
|
2717
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dialog5.Dialog.Description, { children: description })
|
|
2386
2718
|
] }),
|
|
2387
|
-
/* @__PURE__ */ (0,
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2719
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dialog5.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-6", children: Object.entries(groupedVariables).map(([category, vars]) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h4", { className: "text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3", children: category }),
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-3", children: vars.map((v) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5", children: [
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_label5.Label, { htmlFor: `var-${v.name}`, className: "text-sm", children: [
|
|
2391
2723
|
v.label,
|
|
2392
|
-
v.description && /* @__PURE__ */ (0,
|
|
2724
|
+
v.description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "ml-2 text-xs text-muted-foreground font-normal", children: v.description })
|
|
2393
2725
|
] }),
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2395
2727
|
import_input2.Input,
|
|
2396
2728
|
{
|
|
2397
2729
|
id: `var-${v.name}`,
|
|
@@ -2402,17 +2734,17 @@ function VariableFillerDialog({
|
|
|
2402
2734
|
)
|
|
2403
2735
|
] }, v.name)) })
|
|
2404
2736
|
] }, category)) }) }),
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_dialog5.Dialog.Footer, { className: "flex items-center justify-between", children: [
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
|
|
2407
2739
|
filledCount,
|
|
2408
2740
|
" / ",
|
|
2409
2741
|
variables.length,
|
|
2410
2742
|
" ",
|
|
2411
2743
|
intl.formatMessage(messages6.filler_filled)
|
|
2412
2744
|
] }),
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-2", children: [
|
|
2746
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_button7.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages6.cancel) }),
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_button7.Button, { onClick: handleSave, children: intl.formatMessage(messages6.save) })
|
|
2416
2748
|
] })
|
|
2417
2749
|
] })
|
|
2418
2750
|
] }) });
|
|
@@ -2425,23 +2757,23 @@ var import_state2 = require("@tiptap/pm/state");
|
|
|
2425
2757
|
var React6 = __toESM(require("react"));
|
|
2426
2758
|
|
|
2427
2759
|
// src/ui/suggestion-menu/suggestion-menu.tsx
|
|
2428
|
-
var
|
|
2760
|
+
var import_react30 = require("@floating-ui/react");
|
|
2429
2761
|
var import_state = require("@tiptap/pm/state");
|
|
2430
2762
|
var import_suggestion = require("@tiptap/suggestion");
|
|
2431
2763
|
var React5 = __toESM(require("react"));
|
|
2432
2764
|
|
|
2433
2765
|
// src/hooks/use-floating-element.ts
|
|
2434
|
-
var
|
|
2766
|
+
var import_react27 = require("@floating-ui/react");
|
|
2435
2767
|
var React3 = __toESM(require("react"));
|
|
2436
2768
|
function useFloatingElement(show, referencePos, zIndex, options) {
|
|
2437
2769
|
const { dismissOptions, ...floatingOptions } = options || {};
|
|
2438
|
-
const { refs, update, context, floatingStyles } = (0,
|
|
2770
|
+
const { refs, update, context, floatingStyles } = (0, import_react27.useFloating)({
|
|
2439
2771
|
open: show,
|
|
2440
2772
|
...floatingOptions
|
|
2441
2773
|
});
|
|
2442
|
-
const { isMounted, styles } = (0,
|
|
2443
|
-
const dismiss = (0,
|
|
2444
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
2774
|
+
const { isMounted, styles } = (0, import_react27.useTransitionStyles)(context);
|
|
2775
|
+
const dismiss = (0, import_react27.useDismiss)(context, dismissOptions);
|
|
2776
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react27.useInteractions)([dismiss]);
|
|
2445
2777
|
React3.useEffect(() => {
|
|
2446
2778
|
update();
|
|
2447
2779
|
}, [referencePos, update]);
|
|
@@ -2604,15 +2936,15 @@ function useMenuNavigation({
|
|
|
2604
2936
|
}
|
|
2605
2937
|
|
|
2606
2938
|
// src/hooks/use-tiptap-editor.ts
|
|
2607
|
-
var
|
|
2608
|
-
var
|
|
2939
|
+
var import_react28 = require("@tiptap/react");
|
|
2940
|
+
var import_react29 = require("react");
|
|
2609
2941
|
function useTiptapEditor(providedEditor) {
|
|
2610
|
-
const { editor: coreEditor } = (0,
|
|
2611
|
-
const mainEditor = (0,
|
|
2942
|
+
const { editor: coreEditor } = (0, import_react28.useCurrentEditor)();
|
|
2943
|
+
const mainEditor = (0, import_react29.useMemo)(
|
|
2612
2944
|
() => providedEditor || coreEditor,
|
|
2613
2945
|
[providedEditor, coreEditor]
|
|
2614
2946
|
);
|
|
2615
|
-
const editorState = (0,
|
|
2947
|
+
const editorState = (0, import_react28.useEditorState)({
|
|
2616
2948
|
editor: mainEditor,
|
|
2617
2949
|
selector(context) {
|
|
2618
2950
|
if (!context.editor) {
|
|
@@ -2678,7 +3010,7 @@ function filterSuggestionItems(items, query) {
|
|
|
2678
3010
|
}
|
|
2679
3011
|
|
|
2680
3012
|
// src/ui/suggestion-menu/suggestion-menu.tsx
|
|
2681
|
-
var
|
|
3013
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2682
3014
|
var SuggestionMenu = ({
|
|
2683
3015
|
editor: providedEditor,
|
|
2684
3016
|
floatingOptions,
|
|
@@ -2704,13 +3036,13 @@ var SuggestionMenu = ({
|
|
|
2704
3036
|
{
|
|
2705
3037
|
placement: "bottom-start",
|
|
2706
3038
|
middleware: [
|
|
2707
|
-
(0,
|
|
2708
|
-
(0,
|
|
3039
|
+
(0, import_react30.offset)(10),
|
|
3040
|
+
(0, import_react30.flip)({
|
|
2709
3041
|
mainAxis: true,
|
|
2710
3042
|
crossAxis: false
|
|
2711
3043
|
}),
|
|
2712
|
-
(0,
|
|
2713
|
-
(0,
|
|
3044
|
+
(0, import_react30.shift)(),
|
|
3045
|
+
(0, import_react30.size)({
|
|
2714
3046
|
apply({ availableHeight, elements }) {
|
|
2715
3047
|
if (elements.floating) {
|
|
2716
3048
|
const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
|
|
@@ -2849,7 +3181,7 @@ var SuggestionMenu = ({
|
|
|
2849
3181
|
if (!isMounted || !show || !editor) {
|
|
2850
3182
|
return null;
|
|
2851
3183
|
}
|
|
2852
|
-
return /* @__PURE__ */ (0,
|
|
3184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react30.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2853
3185
|
"div",
|
|
2854
3186
|
{
|
|
2855
3187
|
ref,
|
|
@@ -2870,7 +3202,7 @@ var SuggestionMenu = ({
|
|
|
2870
3202
|
};
|
|
2871
3203
|
|
|
2872
3204
|
// src/extensions/variable/variable-suggestion.tsx
|
|
2873
|
-
var
|
|
3205
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2874
3206
|
var VariableSuggestionPluginKey = new import_state2.PluginKey("variableSuggestion");
|
|
2875
3207
|
function VariableSuggestion({
|
|
2876
3208
|
editor,
|
|
@@ -2920,7 +3252,7 @@ function VariableSuggestion({
|
|
|
2920
3252
|
},
|
|
2921
3253
|
[variables]
|
|
2922
3254
|
);
|
|
2923
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2924
3256
|
SuggestionMenu,
|
|
2925
3257
|
{
|
|
2926
3258
|
editor,
|
|
@@ -2929,7 +3261,7 @@ function VariableSuggestion({
|
|
|
2929
3261
|
items: getItems,
|
|
2930
3262
|
allowSpaces: false,
|
|
2931
3263
|
selector: "tiptap-variable-suggestion-menu",
|
|
2932
|
-
children: (props) => /* @__PURE__ */ (0,
|
|
3264
|
+
children: (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VariableList, { ...props })
|
|
2933
3265
|
}
|
|
2934
3266
|
);
|
|
2935
3267
|
}
|
|
@@ -2951,7 +3283,7 @@ var VariableItem = ({
|
|
|
2951
3283
|
itemRef.current.scrollIntoView(false);
|
|
2952
3284
|
}
|
|
2953
3285
|
}, [isSelected]);
|
|
2954
|
-
return /* @__PURE__ */ (0,
|
|
3286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2955
3287
|
"button",
|
|
2956
3288
|
{
|
|
2957
3289
|
ref: itemRef,
|
|
@@ -2960,8 +3292,8 @@ var VariableItem = ({
|
|
|
2960
3292
|
onClick: onSelect,
|
|
2961
3293
|
className: "w-full flex items-center justify-between gap-3 px-2 py-1.5 text-sm rounded-sm outline-none hover:bg-muted data-[active-state=on]:bg-muted",
|
|
2962
3294
|
children: [
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2964
|
-
/* @__PURE__ */ (0,
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "font-medium truncate", children: item.title }),
|
|
3296
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "text-xs text-muted-foreground font-mono shrink-0", children: item.subtext })
|
|
2965
3297
|
]
|
|
2966
3298
|
}
|
|
2967
3299
|
);
|
|
@@ -2986,7 +3318,7 @@ var VariableList = ({
|
|
|
2986
3318
|
Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
|
|
2987
3319
|
const groupItems = groupData.items.map((item, itemIndex) => {
|
|
2988
3320
|
const originalIndex = groupData.indices[itemIndex];
|
|
2989
|
-
return /* @__PURE__ */ (0,
|
|
3321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2990
3322
|
VariableItem,
|
|
2991
3323
|
{
|
|
2992
3324
|
item,
|
|
@@ -2998,8 +3330,8 @@ var VariableList = ({
|
|
|
2998
3330
|
});
|
|
2999
3331
|
if (groupLabel) {
|
|
3000
3332
|
rendered.push(
|
|
3001
|
-
/* @__PURE__ */ (0,
|
|
3002
|
-
/* @__PURE__ */ (0,
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "py-1", children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-2 py-1 text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: groupLabel }),
|
|
3003
3335
|
groupItems
|
|
3004
3336
|
] }, `group-${groupIndex}-${groupLabel}`)
|
|
3005
3337
|
);
|
|
@@ -3012,7 +3344,7 @@ var VariableList = ({
|
|
|
3012
3344
|
if (!renderedItems.length) {
|
|
3013
3345
|
return null;
|
|
3014
3346
|
}
|
|
3015
|
-
return /* @__PURE__ */ (0,
|
|
3347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3016
3348
|
"div",
|
|
3017
3349
|
{
|
|
3018
3350
|
className: styles.card(),
|
|
@@ -3020,7 +3352,7 @@ var VariableList = ({
|
|
|
3020
3352
|
maxHeight: "var(--suggestion-menu-max-height)",
|
|
3021
3353
|
minWidth: "240px"
|
|
3022
3354
|
},
|
|
3023
|
-
children: /* @__PURE__ */ (0,
|
|
3355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: styles.body(), children: renderedItems })
|
|
3024
3356
|
}
|
|
3025
3357
|
);
|
|
3026
3358
|
};
|
|
@@ -3028,7 +3360,10 @@ var VariableList = ({
|
|
|
3028
3360
|
// src/hooks/use-create-editor.ts
|
|
3029
3361
|
var import_extension_code = require("@kopexa/extension-code");
|
|
3030
3362
|
var import_extension_controlref = require("@kopexa/extension-controlref");
|
|
3363
|
+
var import_extension_pages = require("@kopexa/extension-pages");
|
|
3031
3364
|
var import_extension_table = require("@kopexa/extension-table");
|
|
3365
|
+
var import_extension_collaboration = require("@tiptap/extension-collaboration");
|
|
3366
|
+
var import_extension_collaboration_caret = require("@tiptap/extension-collaboration-caret");
|
|
3032
3367
|
var import_extension_file_handler = require("@tiptap/extension-file-handler");
|
|
3033
3368
|
var import_extension_highlight = require("@tiptap/extension-highlight");
|
|
3034
3369
|
var import_extension_invisible_characters = __toESM(require("@tiptap/extension-invisible-characters"));
|
|
@@ -3041,14 +3376,14 @@ var import_extension_text_style = require("@tiptap/extension-text-style");
|
|
|
3041
3376
|
var import_extension_typography = require("@tiptap/extension-typography");
|
|
3042
3377
|
var import_extension_unique_id = require("@tiptap/extension-unique-id");
|
|
3043
3378
|
var import_extensions = require("@tiptap/extensions");
|
|
3044
|
-
var
|
|
3379
|
+
var import_react34 = require("@tiptap/react");
|
|
3045
3380
|
var import_starter_kit = require("@tiptap/starter-kit");
|
|
3046
|
-
var
|
|
3381
|
+
var import_react35 = require("react");
|
|
3047
3382
|
|
|
3048
3383
|
// src/extensions/link/index.ts
|
|
3049
3384
|
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
3050
3385
|
var import_state3 = require("@tiptap/pm/state");
|
|
3051
|
-
var
|
|
3386
|
+
var import_react31 = require("@tiptap/react");
|
|
3052
3387
|
var Link = import_extension_link.default.extend({
|
|
3053
3388
|
inclusive: false,
|
|
3054
3389
|
parseHTML() {
|
|
@@ -3077,7 +3412,7 @@ var Link = import_extension_link.default.extend({
|
|
|
3077
3412
|
const { schema, doc, tr } = view.state;
|
|
3078
3413
|
let range;
|
|
3079
3414
|
if (schema.marks.link) {
|
|
3080
|
-
range = (0,
|
|
3415
|
+
range = (0, import_react31.getMarkRange)(doc.resolve(pos), schema.marks.link);
|
|
3081
3416
|
}
|
|
3082
3417
|
if (!range) {
|
|
3083
3418
|
return;
|
|
@@ -3104,8 +3439,8 @@ var Link = import_extension_link.default.extend({
|
|
|
3104
3439
|
// src/extensions/selection/index.ts
|
|
3105
3440
|
var import_state4 = require("@tiptap/pm/state");
|
|
3106
3441
|
var import_view = require("@tiptap/pm/view");
|
|
3107
|
-
var
|
|
3108
|
-
var Selection =
|
|
3442
|
+
var import_react32 = require("@tiptap/react");
|
|
3443
|
+
var Selection = import_react32.Extension.create({
|
|
3109
3444
|
name: "selection",
|
|
3110
3445
|
addProseMirrorPlugins() {
|
|
3111
3446
|
const { editor } = this;
|
|
@@ -3120,7 +3455,7 @@ var Selection = import_react29.Extension.create({
|
|
|
3120
3455
|
if (editor.isFocused === true || !editor.isEditable) {
|
|
3121
3456
|
return null;
|
|
3122
3457
|
}
|
|
3123
|
-
if ((0,
|
|
3458
|
+
if ((0, import_react32.isNodeSelection)(state.selection)) {
|
|
3124
3459
|
return null;
|
|
3125
3460
|
}
|
|
3126
3461
|
return import_view.DecorationSet.create(state.doc, [
|
|
@@ -3137,7 +3472,7 @@ var Selection = import_react29.Extension.create({
|
|
|
3137
3472
|
|
|
3138
3473
|
// src/extensions/trailing-node/index.ts
|
|
3139
3474
|
var import_state5 = require("@tiptap/pm/state");
|
|
3140
|
-
var
|
|
3475
|
+
var import_react33 = require("@tiptap/react");
|
|
3141
3476
|
function nodeEqualsType({
|
|
3142
3477
|
types,
|
|
3143
3478
|
node
|
|
@@ -3148,7 +3483,7 @@ function nodeEqualsType({
|
|
|
3148
3483
|
}
|
|
3149
3484
|
return node.type === types;
|
|
3150
3485
|
}
|
|
3151
|
-
var TrailingNode =
|
|
3486
|
+
var TrailingNode = import_react33.Extension.create({
|
|
3152
3487
|
name: "trailingNode",
|
|
3153
3488
|
addOptions() {
|
|
3154
3489
|
return {
|
|
@@ -3421,21 +3756,29 @@ var useCreateEditor = ({
|
|
|
3421
3756
|
controlResolver,
|
|
3422
3757
|
fileHandler: fileHandlerProp,
|
|
3423
3758
|
enableVariables = false,
|
|
3759
|
+
pagesOptions,
|
|
3760
|
+
customExtensions,
|
|
3761
|
+
disabled,
|
|
3424
3762
|
...options
|
|
3425
3763
|
}) => {
|
|
3426
3764
|
const fileHandlerFromContext = useEditorFile();
|
|
3427
3765
|
const fileHandler = fileHandlerProp != null ? fileHandlerProp : fileHandlerFromContext;
|
|
3428
|
-
const
|
|
3766
|
+
const collaboration = useCollaboration();
|
|
3767
|
+
const [extensions] = (0, import_react35.useState)(
|
|
3429
3768
|
() => getExtensions({
|
|
3430
3769
|
editable,
|
|
3431
3770
|
placeholder,
|
|
3432
3771
|
enableControls,
|
|
3433
3772
|
controlResolver,
|
|
3434
3773
|
fileHandler,
|
|
3435
|
-
enableVariables
|
|
3774
|
+
enableVariables,
|
|
3775
|
+
pagesOptions,
|
|
3776
|
+
collaboration,
|
|
3777
|
+
customExtensions,
|
|
3778
|
+
disabled
|
|
3436
3779
|
})
|
|
3437
3780
|
);
|
|
3438
|
-
const editor = (0,
|
|
3781
|
+
const editor = (0, import_react34.useEditor)({
|
|
3439
3782
|
editorProps: {
|
|
3440
3783
|
attributes: {
|
|
3441
3784
|
autocomplete: "off",
|
|
@@ -3454,7 +3797,7 @@ var useCreateEditor = ({
|
|
|
3454
3797
|
content: safeParseContent(content),
|
|
3455
3798
|
...options
|
|
3456
3799
|
});
|
|
3457
|
-
(0,
|
|
3800
|
+
(0, import_react35.useEffect)(() => {
|
|
3458
3801
|
if (editor && editor.isEditable !== editable) {
|
|
3459
3802
|
editor.setEditable(editable);
|
|
3460
3803
|
}
|
|
@@ -3467,8 +3810,13 @@ function getExtensions({
|
|
|
3467
3810
|
enableControls = false,
|
|
3468
3811
|
controlResolver,
|
|
3469
3812
|
fileHandler,
|
|
3470
|
-
enableVariables = false
|
|
3813
|
+
enableVariables = false,
|
|
3814
|
+
pagesOptions,
|
|
3815
|
+
collaboration,
|
|
3816
|
+
customExtensions,
|
|
3817
|
+
disabled
|
|
3471
3818
|
}) {
|
|
3819
|
+
const isCollab = !!collaboration;
|
|
3472
3820
|
const extensions = [
|
|
3473
3821
|
import_starter_kit.StarterKit.configure({
|
|
3474
3822
|
trailingNode: false,
|
|
@@ -3477,9 +3825,10 @@ function getExtensions({
|
|
|
3477
3825
|
// we use our custom link extension
|
|
3478
3826
|
code: false,
|
|
3479
3827
|
// we use our own
|
|
3480
|
-
codeBlock: false
|
|
3828
|
+
codeBlock: false,
|
|
3481
3829
|
// we use our own
|
|
3482
|
-
// undoRedo
|
|
3830
|
+
// Disable undoRedo when using collaboration — Yjs provides its own undo
|
|
3831
|
+
undoRedo: isCollab ? false : void 0
|
|
3483
3832
|
}),
|
|
3484
3833
|
import_extension_text_align.TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
3485
3834
|
import_extension_list.TaskList,
|
|
@@ -3530,12 +3879,41 @@ function getExtensions({
|
|
|
3530
3879
|
emptyNodeClass: "is-empty with-slash"
|
|
3531
3880
|
})
|
|
3532
3881
|
];
|
|
3882
|
+
if (collaboration) {
|
|
3883
|
+
extensions.push(
|
|
3884
|
+
import_extension_collaboration.Collaboration.configure({
|
|
3885
|
+
document: collaboration.ydoc,
|
|
3886
|
+
field: "default"
|
|
3887
|
+
})
|
|
3888
|
+
);
|
|
3889
|
+
if (collaboration.provider) {
|
|
3890
|
+
extensions.push(
|
|
3891
|
+
import_extension_collaboration_caret.CollaborationCaret.configure({
|
|
3892
|
+
provider: collaboration.provider,
|
|
3893
|
+
user: {
|
|
3894
|
+
name: collaboration.user.name,
|
|
3895
|
+
color: collaboration.user.color
|
|
3896
|
+
}
|
|
3897
|
+
})
|
|
3898
|
+
);
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3533
3901
|
if (enableControls) {
|
|
3534
3902
|
extensions.push(import_extension_controlref.ControlKit.configure({ resolver: controlResolver }));
|
|
3535
3903
|
}
|
|
3536
3904
|
if (enableVariables) {
|
|
3537
3905
|
extensions.push(VariableNode);
|
|
3538
3906
|
}
|
|
3907
|
+
if (pagesOptions) {
|
|
3908
|
+
extensions.push(
|
|
3909
|
+
import_extension_pages.Pages.configure({
|
|
3910
|
+
pageFormat: "A4",
|
|
3911
|
+
header: "",
|
|
3912
|
+
footer: "",
|
|
3913
|
+
...pagesOptions
|
|
3914
|
+
})
|
|
3915
|
+
);
|
|
3916
|
+
}
|
|
3539
3917
|
if (fileHandler) {
|
|
3540
3918
|
extensions.push(
|
|
3541
3919
|
import_extension_file_handler.FileHandler.configure({
|
|
@@ -3559,6 +3937,20 @@ function getExtensions({
|
|
|
3559
3937
|
})
|
|
3560
3938
|
);
|
|
3561
3939
|
}
|
|
3940
|
+
if (disabled) {
|
|
3941
|
+
const disabledNames = new Set(
|
|
3942
|
+
Object.entries(disabled).filter(([, value]) => value === false).map(([name]) => name)
|
|
3943
|
+
);
|
|
3944
|
+
const filtered = extensions.filter((ext) => {
|
|
3945
|
+
const name = typeof ext === "object" && "name" in ext ? ext.name : ext.name;
|
|
3946
|
+
return !name || !disabledNames.has(name);
|
|
3947
|
+
});
|
|
3948
|
+
extensions.length = 0;
|
|
3949
|
+
extensions.push(...filtered);
|
|
3950
|
+
}
|
|
3951
|
+
if (customExtensions == null ? void 0 : customExtensions.length) {
|
|
3952
|
+
extensions.push(...customExtensions);
|
|
3953
|
+
}
|
|
3562
3954
|
return extensions;
|
|
3563
3955
|
}
|
|
3564
3956
|
async function handleFileUpload(editor, file, fileHandler, pos) {
|
|
@@ -3621,18 +4013,18 @@ async function handleFileUpload(editor, file, fileHandler, pos) {
|
|
|
3621
4013
|
|
|
3622
4014
|
// src/presets/basic/index.tsx
|
|
3623
4015
|
var import_theme9 = require("@kopexa/theme");
|
|
3624
|
-
var
|
|
3625
|
-
var
|
|
4016
|
+
var import_react59 = require("@tiptap/react");
|
|
4017
|
+
var import_react60 = require("react");
|
|
3626
4018
|
|
|
3627
4019
|
// src/context/editor-context.ts
|
|
3628
4020
|
var import_react_utils = require("@kopexa/react-utils");
|
|
3629
4021
|
var [EditorUIProvider, useEditorUIContext] = (0, import_react_utils.createContext)();
|
|
3630
4022
|
|
|
3631
4023
|
// src/hooks/use-ui-editor-state.ts
|
|
3632
|
-
var
|
|
4024
|
+
var import_react36 = require("@tiptap/react");
|
|
3633
4025
|
function useUiEditorState(editor) {
|
|
3634
4026
|
var _a;
|
|
3635
|
-
return (_a = (0,
|
|
4027
|
+
return (_a = (0, import_react36.useEditorState)({
|
|
3636
4028
|
editor,
|
|
3637
4029
|
selector: ({ editor: editor2 }) => {
|
|
3638
4030
|
if (!editor2) return defaultUiState;
|
|
@@ -3658,7 +4050,7 @@ var import_icons9 = require("@kopexa/icons");
|
|
|
3658
4050
|
var import_input3 = require("@kopexa/input");
|
|
3659
4051
|
var import_popover = require("@kopexa/popover");
|
|
3660
4052
|
var import_toolbar = require("@kopexa/toolbar");
|
|
3661
|
-
var
|
|
4053
|
+
var import_react37 = require("react");
|
|
3662
4054
|
|
|
3663
4055
|
// src/ui/link-popover/use-link-popover.ts
|
|
3664
4056
|
var import_editor_utils2 = require("@kopexa/editor-utils");
|
|
@@ -3887,9 +4279,9 @@ function useLinkPopover(config) {
|
|
|
3887
4279
|
}
|
|
3888
4280
|
|
|
3889
4281
|
// src/ui/link-popover/link-popover.tsx
|
|
3890
|
-
var
|
|
4282
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3891
4283
|
var LinkButton = ({ className, children, ...props }) => {
|
|
3892
|
-
return /* @__PURE__ */ (0,
|
|
4284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3893
4285
|
import_toolbar.ToolbarButton,
|
|
3894
4286
|
{
|
|
3895
4287
|
type: "button",
|
|
@@ -3901,7 +4293,7 @@ var LinkButton = ({ className, children, ...props }) => {
|
|
|
3901
4293
|
title: "Link",
|
|
3902
4294
|
isIconOnly: !children,
|
|
3903
4295
|
...props,
|
|
3904
|
-
children: children || /* @__PURE__ */ (0,
|
|
4296
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons9.LinkIcon, {})
|
|
3905
4297
|
}
|
|
3906
4298
|
);
|
|
3907
4299
|
};
|
|
@@ -3914,8 +4306,8 @@ var LinkMain = ({
|
|
|
3914
4306
|
isActive,
|
|
3915
4307
|
onSave
|
|
3916
4308
|
}) => {
|
|
3917
|
-
const [isEditing, setIsEditing] = (0,
|
|
3918
|
-
(0,
|
|
4309
|
+
const [isEditing, setIsEditing] = (0, import_react37.useState)(!isActive || !url);
|
|
4310
|
+
(0, import_react37.useEffect)(() => {
|
|
3919
4311
|
setIsEditing(!isActive || !url);
|
|
3920
4312
|
}, [isActive, url]);
|
|
3921
4313
|
const handleKeyDown = (event) => {
|
|
@@ -3938,8 +4330,8 @@ var LinkMain = ({
|
|
|
3938
4330
|
setIsEditing(true);
|
|
3939
4331
|
};
|
|
3940
4332
|
if (isEditing) {
|
|
3941
|
-
return /* @__PURE__ */ (0,
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
4333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
|
|
4334
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3943
4335
|
import_input3.Input,
|
|
3944
4336
|
{
|
|
3945
4337
|
type: "url",
|
|
@@ -3954,7 +4346,7 @@ var LinkMain = ({
|
|
|
3954
4346
|
autoFocus: true
|
|
3955
4347
|
}
|
|
3956
4348
|
),
|
|
3957
|
-
/* @__PURE__ */ (0,
|
|
4349
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3958
4350
|
import_button8.IconButton,
|
|
3959
4351
|
{
|
|
3960
4352
|
type: "button",
|
|
@@ -3963,13 +4355,13 @@ var LinkMain = ({
|
|
|
3963
4355
|
onClick: handleSave,
|
|
3964
4356
|
"aria-label": "Save link",
|
|
3965
4357
|
disabled: !url,
|
|
3966
|
-
children: /* @__PURE__ */ (0,
|
|
4358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons9.CheckIcon, { className: "size-4" })
|
|
3967
4359
|
}
|
|
3968
4360
|
)
|
|
3969
4361
|
] });
|
|
3970
4362
|
}
|
|
3971
|
-
return /* @__PURE__ */ (0,
|
|
3972
|
-
/* @__PURE__ */ (0,
|
|
4363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3973
4365
|
"a",
|
|
3974
4366
|
{
|
|
3975
4367
|
href: url,
|
|
@@ -3983,8 +4375,8 @@ var LinkMain = ({
|
|
|
3983
4375
|
children: url
|
|
3984
4376
|
}
|
|
3985
4377
|
),
|
|
3986
|
-
/* @__PURE__ */ (0,
|
|
3987
|
-
/* @__PURE__ */ (0,
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
|
|
4379
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3988
4380
|
import_button8.IconButton,
|
|
3989
4381
|
{
|
|
3990
4382
|
type: "button",
|
|
@@ -3992,10 +4384,10 @@ var LinkMain = ({
|
|
|
3992
4384
|
variant: "ghost",
|
|
3993
4385
|
onClick: openLink,
|
|
3994
4386
|
"aria-label": "Open link in new tab",
|
|
3995
|
-
children: /* @__PURE__ */ (0,
|
|
4387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons9.ExternalLinkIcon, { className: "size-4" })
|
|
3996
4388
|
}
|
|
3997
4389
|
),
|
|
3998
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3999
4391
|
import_button8.IconButton,
|
|
4000
4392
|
{
|
|
4001
4393
|
type: "button",
|
|
@@ -4003,10 +4395,10 @@ var LinkMain = ({
|
|
|
4003
4395
|
variant: "ghost",
|
|
4004
4396
|
onClick: handleEdit,
|
|
4005
4397
|
"aria-label": "Edit link",
|
|
4006
|
-
children: /* @__PURE__ */ (0,
|
|
4398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons9.EditIcon, { className: "size-4" })
|
|
4007
4399
|
}
|
|
4008
4400
|
),
|
|
4009
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4010
4402
|
import_button8.IconButton,
|
|
4011
4403
|
{
|
|
4012
4404
|
type: "button",
|
|
@@ -4014,7 +4406,7 @@ var LinkMain = ({
|
|
|
4014
4406
|
variant: "ghost",
|
|
4015
4407
|
onClick: removeLink,
|
|
4016
4408
|
"aria-label": "Remove link",
|
|
4017
|
-
children: /* @__PURE__ */ (0,
|
|
4409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons9.TrashIcon, { className: "size-4" })
|
|
4018
4410
|
}
|
|
4019
4411
|
)
|
|
4020
4412
|
] })
|
|
@@ -4031,7 +4423,7 @@ function LinkPopover({
|
|
|
4031
4423
|
...buttonProps
|
|
4032
4424
|
}) {
|
|
4033
4425
|
const { editor } = useTiptapEditor(providedEditor);
|
|
4034
|
-
const [isOpen, setIsOpen] = (0,
|
|
4426
|
+
const [isOpen, setIsOpen] = (0, import_react37.useState)(false);
|
|
4035
4427
|
const {
|
|
4036
4428
|
isVisible,
|
|
4037
4429
|
canSet,
|
|
@@ -4047,18 +4439,18 @@ function LinkPopover({
|
|
|
4047
4439
|
hideWhenUnavailable,
|
|
4048
4440
|
onSetLink
|
|
4049
4441
|
});
|
|
4050
|
-
const handleOnOpenChange = (0,
|
|
4442
|
+
const handleOnOpenChange = (0, import_react37.useCallback)(
|
|
4051
4443
|
(nextIsOpen) => {
|
|
4052
4444
|
setIsOpen(nextIsOpen);
|
|
4053
4445
|
onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
|
|
4054
4446
|
},
|
|
4055
4447
|
[onOpenChange]
|
|
4056
4448
|
);
|
|
4057
|
-
const handleSetLink = (0,
|
|
4449
|
+
const handleSetLink = (0, import_react37.useCallback)(() => {
|
|
4058
4450
|
setLink();
|
|
4059
4451
|
setIsOpen(false);
|
|
4060
4452
|
}, [setLink]);
|
|
4061
|
-
const handleClick = (0,
|
|
4453
|
+
const handleClick = (0, import_react37.useCallback)(
|
|
4062
4454
|
(event) => {
|
|
4063
4455
|
onClick == null ? void 0 : onClick(event);
|
|
4064
4456
|
if (event.defaultPrevented) return;
|
|
@@ -4066,7 +4458,7 @@ function LinkPopover({
|
|
|
4066
4458
|
},
|
|
4067
4459
|
[onClick, isOpen]
|
|
4068
4460
|
);
|
|
4069
|
-
(0,
|
|
4461
|
+
(0, import_react37.useEffect)(() => {
|
|
4070
4462
|
if (autoOpenOnLinkActive && isActive) {
|
|
4071
4463
|
setIsOpen(true);
|
|
4072
4464
|
}
|
|
@@ -4074,17 +4466,17 @@ function LinkPopover({
|
|
|
4074
4466
|
if (!isVisible) {
|
|
4075
4467
|
return null;
|
|
4076
4468
|
}
|
|
4077
|
-
return /* @__PURE__ */ (0,
|
|
4469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4078
4470
|
import_popover.Popover.Root,
|
|
4079
4471
|
{
|
|
4080
4472
|
open: isOpen,
|
|
4081
4473
|
onOpenChange: handleOnOpenChange,
|
|
4082
4474
|
spacing: "dense",
|
|
4083
4475
|
children: [
|
|
4084
|
-
/* @__PURE__ */ (0,
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4085
4477
|
import_popover.Popover.Trigger,
|
|
4086
4478
|
{
|
|
4087
|
-
render: /* @__PURE__ */ (0,
|
|
4479
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4088
4480
|
LinkButton,
|
|
4089
4481
|
{
|
|
4090
4482
|
"data-disabled": !canSet,
|
|
@@ -4098,7 +4490,7 @@ function LinkPopover({
|
|
|
4098
4490
|
)
|
|
4099
4491
|
}
|
|
4100
4492
|
),
|
|
4101
|
-
/* @__PURE__ */ (0,
|
|
4493
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4102
4494
|
LinkMain,
|
|
4103
4495
|
{
|
|
4104
4496
|
url,
|
|
@@ -4120,9 +4512,9 @@ LinkButton.displayName = "LinkButton";
|
|
|
4120
4512
|
var import_editor_utils3 = require("@kopexa/editor-utils");
|
|
4121
4513
|
var import_icons10 = require("@kopexa/icons");
|
|
4122
4514
|
var import_toolbar2 = require("@kopexa/toolbar");
|
|
4123
|
-
var
|
|
4124
|
-
var
|
|
4125
|
-
var
|
|
4515
|
+
var import_react38 = require("@tiptap/react");
|
|
4516
|
+
var import_react39 = require("react");
|
|
4517
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4126
4518
|
var markIcons = {
|
|
4127
4519
|
bold: import_icons10.BoldIcon,
|
|
4128
4520
|
italic: import_icons10.ItalicIcon,
|
|
@@ -4168,7 +4560,7 @@ function shouldShowMarkButton(params) {
|
|
|
4168
4560
|
return false;
|
|
4169
4561
|
}
|
|
4170
4562
|
if (hideWhenUnavailable) {
|
|
4171
|
-
if ((0,
|
|
4563
|
+
if ((0, import_react38.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
|
|
4172
4564
|
return false;
|
|
4173
4565
|
}
|
|
4174
4566
|
}
|
|
@@ -4213,7 +4605,7 @@ var MarkButton = ({
|
|
|
4213
4605
|
shortcutKey,
|
|
4214
4606
|
formattedName
|
|
4215
4607
|
} = useMarkState(editor, type, disabled);
|
|
4216
|
-
const handleClick = (0,
|
|
4608
|
+
const handleClick = (0, import_react39.useCallback)(
|
|
4217
4609
|
(e) => {
|
|
4218
4610
|
onClick == null ? void 0 : onClick(e);
|
|
4219
4611
|
if (!e.defaultPrevented && !isDisabled && editor) {
|
|
@@ -4222,7 +4614,7 @@ var MarkButton = ({
|
|
|
4222
4614
|
},
|
|
4223
4615
|
[onClick, isDisabled, editor, type]
|
|
4224
4616
|
);
|
|
4225
|
-
const show = (0,
|
|
4617
|
+
const show = (0, import_react39.useMemo)(() => {
|
|
4226
4618
|
return shouldShowMarkButton({
|
|
4227
4619
|
editor,
|
|
4228
4620
|
type,
|
|
@@ -4233,7 +4625,7 @@ var MarkButton = ({
|
|
|
4233
4625
|
if (!show || !editor || !editor.isEditable) {
|
|
4234
4626
|
return null;
|
|
4235
4627
|
}
|
|
4236
|
-
return /* @__PURE__ */ (0,
|
|
4628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4237
4629
|
import_toolbar2.ToolbarButton,
|
|
4238
4630
|
{
|
|
4239
4631
|
type: "button",
|
|
@@ -4251,18 +4643,18 @@ var MarkButton = ({
|
|
|
4251
4643
|
onClick: handleClick,
|
|
4252
4644
|
isIconOnly: true,
|
|
4253
4645
|
...buttonProps,
|
|
4254
|
-
children: /* @__PURE__ */ (0,
|
|
4646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, {})
|
|
4255
4647
|
}
|
|
4256
4648
|
);
|
|
4257
4649
|
};
|
|
4258
4650
|
|
|
4259
4651
|
// src/ui/bubble-menu/index.tsx
|
|
4260
|
-
var
|
|
4652
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4261
4653
|
function BubbleMenu({ editor }) {
|
|
4262
4654
|
if (!editor) {
|
|
4263
4655
|
return null;
|
|
4264
4656
|
}
|
|
4265
|
-
return /* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4266
4658
|
import_menus.BubbleMenu,
|
|
4267
4659
|
{
|
|
4268
4660
|
editor,
|
|
@@ -4282,15 +4674,15 @@ function BubbleMenu({ editor }) {
|
|
|
4282
4674
|
offset: 8
|
|
4283
4675
|
},
|
|
4284
4676
|
className: "rounded-lg border bg-background shadow-md",
|
|
4285
|
-
children: /* @__PURE__ */ (0,
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4287
|
-
/* @__PURE__ */ (0,
|
|
4288
|
-
/* @__PURE__ */ (0,
|
|
4289
|
-
/* @__PURE__ */ (0,
|
|
4290
|
-
/* @__PURE__ */ (0,
|
|
4677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
|
|
4678
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_toolbar3.ToolbarGroup, { children: [
|
|
4679
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkButton, { type: "bold" }),
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkButton, { type: "italic" }),
|
|
4681
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkButton, { type: "strike" }),
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkButton, { type: "code" })
|
|
4291
4683
|
] }),
|
|
4292
|
-
/* @__PURE__ */ (0,
|
|
4293
|
-
/* @__PURE__ */ (0,
|
|
4684
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_toolbar3.ToolbarSeparator, {}),
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
|
|
4294
4686
|
] })
|
|
4295
4687
|
}
|
|
4296
4688
|
);
|
|
@@ -4302,7 +4694,7 @@ var React9 = __toESM(require("react"));
|
|
|
4302
4694
|
|
|
4303
4695
|
// src/hooks/use-floating-toolbar-visibility.ts
|
|
4304
4696
|
var import_state6 = require("@tiptap/pm/state");
|
|
4305
|
-
var
|
|
4697
|
+
var import_react40 = require("@tiptap/react");
|
|
4306
4698
|
var React8 = __toESM(require("react"));
|
|
4307
4699
|
var HIDE_FLOATING_META = "hideFloatingToolbar";
|
|
4308
4700
|
var selectNodeAndHideFloating = (editor, pos) => {
|
|
@@ -4404,37 +4796,37 @@ var import_button9 = require("@kopexa/button");
|
|
|
4404
4796
|
var import_icons11 = require("@kopexa/icons");
|
|
4405
4797
|
var import_input4 = require("@kopexa/input");
|
|
4406
4798
|
var import_menus2 = require("@tiptap/react/menus");
|
|
4407
|
-
var
|
|
4408
|
-
var
|
|
4799
|
+
var import_react41 = require("react");
|
|
4800
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4409
4801
|
function LinkBubble({ editor }) {
|
|
4410
|
-
const [isEditing, setIsEditing] = (0,
|
|
4411
|
-
const [url, setUrl] = (0,
|
|
4412
|
-
const getCurrentUrl = (0,
|
|
4802
|
+
const [isEditing, setIsEditing] = (0, import_react41.useState)(false);
|
|
4803
|
+
const [url, setUrl] = (0, import_react41.useState)("");
|
|
4804
|
+
const getCurrentUrl = (0, import_react41.useCallback)(() => {
|
|
4413
4805
|
if (!editor) return "";
|
|
4414
4806
|
const attrs = editor.getAttributes("link");
|
|
4415
4807
|
return attrs.href || "";
|
|
4416
4808
|
}, [editor]);
|
|
4417
|
-
(0,
|
|
4809
|
+
(0, import_react41.useEffect)(() => {
|
|
4418
4810
|
const isLinkActive2 = editor == null ? void 0 : editor.isActive("link");
|
|
4419
4811
|
if (isLinkActive2) {
|
|
4420
4812
|
setUrl(getCurrentUrl());
|
|
4421
4813
|
setIsEditing(false);
|
|
4422
4814
|
}
|
|
4423
4815
|
}, [editor, getCurrentUrl]);
|
|
4424
|
-
const handleOpenLink = (0,
|
|
4816
|
+
const handleOpenLink = (0, import_react41.useCallback)(() => {
|
|
4425
4817
|
const href = getCurrentUrl();
|
|
4426
4818
|
if (href) {
|
|
4427
4819
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
4428
4820
|
}
|
|
4429
4821
|
}, [getCurrentUrl]);
|
|
4430
|
-
const handleRemoveLink = (0,
|
|
4822
|
+
const handleRemoveLink = (0, import_react41.useCallback)(() => {
|
|
4431
4823
|
editor == null ? void 0 : editor.chain().focus().unsetLink().run();
|
|
4432
4824
|
}, [editor]);
|
|
4433
|
-
const handleEdit = (0,
|
|
4825
|
+
const handleEdit = (0, import_react41.useCallback)(() => {
|
|
4434
4826
|
setUrl(getCurrentUrl());
|
|
4435
4827
|
setIsEditing(true);
|
|
4436
4828
|
}, [getCurrentUrl]);
|
|
4437
|
-
const handleSave = (0,
|
|
4829
|
+
const handleSave = (0, import_react41.useCallback)(() => {
|
|
4438
4830
|
if (url) {
|
|
4439
4831
|
editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
4440
4832
|
} else {
|
|
@@ -4442,7 +4834,7 @@ function LinkBubble({ editor }) {
|
|
|
4442
4834
|
}
|
|
4443
4835
|
setIsEditing(false);
|
|
4444
4836
|
}, [editor, url]);
|
|
4445
|
-
const handleKeyDown = (0,
|
|
4837
|
+
const handleKeyDown = (0, import_react41.useCallback)(
|
|
4446
4838
|
(e) => {
|
|
4447
4839
|
if (e.key === "Enter") {
|
|
4448
4840
|
e.preventDefault();
|
|
@@ -4458,7 +4850,7 @@ function LinkBubble({ editor }) {
|
|
|
4458
4850
|
if (!editor) {
|
|
4459
4851
|
return null;
|
|
4460
4852
|
}
|
|
4461
|
-
return /* @__PURE__ */ (0,
|
|
4853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4462
4854
|
import_menus2.BubbleMenu,
|
|
4463
4855
|
{
|
|
4464
4856
|
editor,
|
|
@@ -4472,8 +4864,8 @@ function LinkBubble({ editor }) {
|
|
|
4472
4864
|
offset: 8
|
|
4473
4865
|
},
|
|
4474
4866
|
className: "rounded-lg border bg-background shadow-md",
|
|
4475
|
-
children: /* @__PURE__ */ (0,
|
|
4476
|
-
/* @__PURE__ */ (0,
|
|
4867
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center gap-1 p-1.5 min-w-[280px]", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4868
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4477
4869
|
import_input4.Input,
|
|
4478
4870
|
{
|
|
4479
4871
|
type: "url",
|
|
@@ -4485,7 +4877,7 @@ function LinkBubble({ editor }) {
|
|
|
4485
4877
|
autoFocus: true
|
|
4486
4878
|
}
|
|
4487
4879
|
),
|
|
4488
|
-
/* @__PURE__ */ (0,
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4489
4881
|
import_button9.IconButton,
|
|
4490
4882
|
{
|
|
4491
4883
|
type: "button",
|
|
@@ -4493,11 +4885,11 @@ function LinkBubble({ editor }) {
|
|
|
4493
4885
|
variant: "ghost",
|
|
4494
4886
|
onClick: handleSave,
|
|
4495
4887
|
"aria-label": "Save link",
|
|
4496
|
-
children: /* @__PURE__ */ (0,
|
|
4888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.EditIcon, { className: "size-4" })
|
|
4497
4889
|
}
|
|
4498
4890
|
)
|
|
4499
|
-
] }) : /* @__PURE__ */ (0,
|
|
4500
|
-
/* @__PURE__ */ (0,
|
|
4891
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4892
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4501
4893
|
"a",
|
|
4502
4894
|
{
|
|
4503
4895
|
href: getCurrentUrl(),
|
|
@@ -4511,8 +4903,8 @@ function LinkBubble({ editor }) {
|
|
|
4511
4903
|
children: getCurrentUrl()
|
|
4512
4904
|
}
|
|
4513
4905
|
),
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
4515
|
-
/* @__PURE__ */ (0,
|
|
4906
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
|
|
4907
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4516
4908
|
import_button9.IconButton,
|
|
4517
4909
|
{
|
|
4518
4910
|
type: "button",
|
|
@@ -4520,10 +4912,10 @@ function LinkBubble({ editor }) {
|
|
|
4520
4912
|
variant: "ghost",
|
|
4521
4913
|
onClick: handleOpenLink,
|
|
4522
4914
|
"aria-label": "Open link in new tab",
|
|
4523
|
-
children: /* @__PURE__ */ (0,
|
|
4915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.ExternalLinkIcon, { className: "size-4" })
|
|
4524
4916
|
}
|
|
4525
4917
|
),
|
|
4526
|
-
/* @__PURE__ */ (0,
|
|
4918
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4527
4919
|
import_button9.IconButton,
|
|
4528
4920
|
{
|
|
4529
4921
|
type: "button",
|
|
@@ -4531,10 +4923,10 @@ function LinkBubble({ editor }) {
|
|
|
4531
4923
|
variant: "ghost",
|
|
4532
4924
|
onClick: handleEdit,
|
|
4533
4925
|
"aria-label": "Edit link",
|
|
4534
|
-
children: /* @__PURE__ */ (0,
|
|
4926
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.EditIcon, { className: "size-4" })
|
|
4535
4927
|
}
|
|
4536
4928
|
),
|
|
4537
|
-
/* @__PURE__ */ (0,
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4538
4930
|
import_button9.IconButton,
|
|
4539
4931
|
{
|
|
4540
4932
|
type: "button",
|
|
@@ -4542,7 +4934,7 @@ function LinkBubble({ editor }) {
|
|
|
4542
4934
|
variant: "ghost",
|
|
4543
4935
|
onClick: handleRemoveLink,
|
|
4544
4936
|
"aria-label": "Remove link",
|
|
4545
|
-
children: /* @__PURE__ */ (0,
|
|
4937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons11.TrashIcon, { className: "size-4" })
|
|
4546
4938
|
}
|
|
4547
4939
|
)
|
|
4548
4940
|
] })
|
|
@@ -4566,8 +4958,8 @@ var React10 = __toESM(require("react"));
|
|
|
4566
4958
|
// src/ui/table-button/use-table.ts
|
|
4567
4959
|
var import_editor_utils5 = require("@kopexa/editor-utils");
|
|
4568
4960
|
var import_icons12 = require("@kopexa/icons");
|
|
4569
|
-
var
|
|
4570
|
-
var
|
|
4961
|
+
var import_react42 = require("@tiptap/react");
|
|
4962
|
+
var import_react43 = require("react");
|
|
4571
4963
|
function canToggle(editor) {
|
|
4572
4964
|
if (!editor || !editor.isEditable) return false;
|
|
4573
4965
|
if (!(0, import_editor_utils5.isNodeInSchema)("table", editor) || (0, import_editor_utils5.isNodeTypeSelected)(editor, ["image"])) {
|
|
@@ -4598,7 +4990,7 @@ function shouldShowButton(props) {
|
|
|
4598
4990
|
if (!editor || !editor.isEditable) return false;
|
|
4599
4991
|
if (!(0, import_editor_utils5.isNodeInSchema)("table", editor)) return false;
|
|
4600
4992
|
if (hideWhenUnavailable) {
|
|
4601
|
-
if ((0,
|
|
4993
|
+
if ((0, import_react42.isNodeSelection)(editor.state.selection) || !canToggle) {
|
|
4602
4994
|
return false;
|
|
4603
4995
|
}
|
|
4604
4996
|
}
|
|
@@ -4611,10 +5003,10 @@ function useTableBlock(config) {
|
|
|
4611
5003
|
onToggled
|
|
4612
5004
|
} = config || {};
|
|
4613
5005
|
const { editor } = useTiptapEditor(providedEditor);
|
|
4614
|
-
const [isVisible, setIsVisible] = (0,
|
|
5006
|
+
const [isVisible, setIsVisible] = (0, import_react43.useState)(true);
|
|
4615
5007
|
const canToggleState = canToggle(editor);
|
|
4616
5008
|
const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
|
|
4617
|
-
(0,
|
|
5009
|
+
(0, import_react43.useEffect)(() => {
|
|
4618
5010
|
if (!editor) return;
|
|
4619
5011
|
const handleSelectionUpdate = () => {
|
|
4620
5012
|
setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
|
|
@@ -4625,7 +5017,7 @@ function useTableBlock(config) {
|
|
|
4625
5017
|
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
4626
5018
|
};
|
|
4627
5019
|
}, [editor, hideWhenUnavailable]);
|
|
4628
|
-
const handleToggle = (0,
|
|
5020
|
+
const handleToggle = (0, import_react43.useCallback)(() => {
|
|
4629
5021
|
if (!editor) return false;
|
|
4630
5022
|
const success = toggleTable(editor);
|
|
4631
5023
|
if (success) {
|
|
@@ -5027,11 +5419,11 @@ function useSlashDropdownMenu(config) {
|
|
|
5027
5419
|
}
|
|
5028
5420
|
|
|
5029
5421
|
// src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
|
|
5030
|
-
var
|
|
5422
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5031
5423
|
var SlashDropdownMenu = (props) => {
|
|
5032
5424
|
const { config, ...restProps } = props;
|
|
5033
5425
|
const { getSlashMenuItems } = useSlashDropdownMenu(config);
|
|
5034
|
-
return /* @__PURE__ */ (0,
|
|
5426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5035
5427
|
SuggestionMenu,
|
|
5036
5428
|
{
|
|
5037
5429
|
char: "/",
|
|
@@ -5041,7 +5433,7 @@ var SlashDropdownMenu = (props) => {
|
|
|
5041
5433
|
selector: "tiptap-slash-dropdown-menu",
|
|
5042
5434
|
items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
|
|
5043
5435
|
...restProps,
|
|
5044
|
-
children: (props2) => /* @__PURE__ */ (0,
|
|
5436
|
+
children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(List, { ...props2, config })
|
|
5045
5437
|
}
|
|
5046
5438
|
);
|
|
5047
5439
|
};
|
|
@@ -5061,13 +5453,13 @@ var Item = (props) => {
|
|
|
5061
5453
|
}
|
|
5062
5454
|
}, [isSelected]);
|
|
5063
5455
|
const BadgeIcon = item.badge;
|
|
5064
|
-
return /* @__PURE__ */ (0,
|
|
5456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5065
5457
|
import_button10.Button,
|
|
5066
5458
|
{
|
|
5067
5459
|
ref: itemRef,
|
|
5068
5460
|
variant: "ghost",
|
|
5069
5461
|
color: "default",
|
|
5070
|
-
startContent: BadgeIcon && /* @__PURE__ */ (0,
|
|
5462
|
+
startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BadgeIcon, {}),
|
|
5071
5463
|
"data-active-state": isSelected ? "on" : "off",
|
|
5072
5464
|
onClick: onSelect,
|
|
5073
5465
|
fullWidth: true,
|
|
@@ -5089,7 +5481,7 @@ var List = ({
|
|
|
5089
5481
|
if (!showGroups) {
|
|
5090
5482
|
items.forEach((item, index) => {
|
|
5091
5483
|
rendered.push(
|
|
5092
|
-
/* @__PURE__ */ (0,
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5093
5485
|
Item,
|
|
5094
5486
|
{
|
|
5095
5487
|
item,
|
|
@@ -5114,7 +5506,7 @@ var List = ({
|
|
|
5114
5506
|
Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
|
|
5115
5507
|
if (groupIndex > 0) {
|
|
5116
5508
|
rendered.push(
|
|
5117
|
-
/* @__PURE__ */ (0,
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5118
5510
|
import_separator.Separator,
|
|
5119
5511
|
{
|
|
5120
5512
|
orientation: "horizontal"
|
|
@@ -5125,7 +5517,7 @@ var List = ({
|
|
|
5125
5517
|
}
|
|
5126
5518
|
const groupItems = groupData.items.map((item, itemIndex) => {
|
|
5127
5519
|
const originalIndex = groupData.indices[itemIndex];
|
|
5128
|
-
return /* @__PURE__ */ (0,
|
|
5520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5129
5521
|
Item,
|
|
5130
5522
|
{
|
|
5131
5523
|
item,
|
|
@@ -5137,13 +5529,13 @@ var List = ({
|
|
|
5137
5529
|
});
|
|
5138
5530
|
if (groupLabel) {
|
|
5139
5531
|
rendered.push(
|
|
5140
|
-
/* @__PURE__ */ (0,
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
5141
5533
|
"div",
|
|
5142
5534
|
{
|
|
5143
5535
|
className: styles.cardItemGroup(),
|
|
5144
5536
|
children: [
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5146
|
-
/* @__PURE__ */ (0,
|
|
5537
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: styles.cardGroup(), children: groupItems })
|
|
5147
5539
|
]
|
|
5148
5540
|
},
|
|
5149
5541
|
`group-${groupIndex}-${groupLabel}`
|
|
@@ -5158,14 +5550,14 @@ var List = ({
|
|
|
5158
5550
|
if (!renderedItems.length) {
|
|
5159
5551
|
return null;
|
|
5160
5552
|
}
|
|
5161
|
-
return /* @__PURE__ */ (0,
|
|
5553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5162
5554
|
"div",
|
|
5163
5555
|
{
|
|
5164
5556
|
className: styles.card(),
|
|
5165
5557
|
style: {
|
|
5166
5558
|
maxHeight: "var(--suggestion-menu-max-height)"
|
|
5167
5559
|
},
|
|
5168
|
-
children: /* @__PURE__ */ (0,
|
|
5560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: styles.body(), children: renderedItems })
|
|
5169
5561
|
}
|
|
5170
5562
|
);
|
|
5171
5563
|
};
|
|
@@ -5175,7 +5567,7 @@ var import_icons25 = require("@kopexa/icons");
|
|
|
5175
5567
|
var import_popover3 = require("@kopexa/popover");
|
|
5176
5568
|
var import_toolbar10 = require("@kopexa/toolbar");
|
|
5177
5569
|
var import_use_is_mobile2 = require("@kopexa/use-is-mobile");
|
|
5178
|
-
var
|
|
5570
|
+
var import_react58 = require("react");
|
|
5179
5571
|
|
|
5180
5572
|
// src/hooks/use-cursor-visibility.ts
|
|
5181
5573
|
var React13 = __toESM(require("react"));
|
|
@@ -5398,7 +5790,7 @@ function useBlockquote(config) {
|
|
|
5398
5790
|
}
|
|
5399
5791
|
|
|
5400
5792
|
// src/ui/blockquote-button/blockquote-button.tsx
|
|
5401
|
-
var
|
|
5793
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5402
5794
|
var BlockquoteButton = ({
|
|
5403
5795
|
editor: providedEditor,
|
|
5404
5796
|
text,
|
|
@@ -5434,7 +5826,7 @@ var BlockquoteButton = ({
|
|
|
5434
5826
|
if (!isVisible) {
|
|
5435
5827
|
return null;
|
|
5436
5828
|
}
|
|
5437
|
-
return /* @__PURE__ */ (0,
|
|
5829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5438
5830
|
import_toolbar4.ToolbarButton,
|
|
5439
5831
|
{
|
|
5440
5832
|
type: "button",
|
|
@@ -5451,9 +5843,9 @@ var BlockquoteButton = ({
|
|
|
5451
5843
|
onClick: handleClick,
|
|
5452
5844
|
isIconOnly: !text && !children,
|
|
5453
5845
|
...buttonProps,
|
|
5454
|
-
children: children != null ? children : /* @__PURE__ */ (0,
|
|
5455
|
-
/* @__PURE__ */ (0,
|
|
5456
|
-
text && /* @__PURE__ */ (0,
|
|
5846
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
|
|
5848
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: text })
|
|
5457
5849
|
] })
|
|
5458
5850
|
}
|
|
5459
5851
|
);
|
|
@@ -5462,7 +5854,7 @@ var BlockquoteButton = ({
|
|
|
5462
5854
|
// src/ui/codeblock-button/code-block-button.tsx
|
|
5463
5855
|
var import_icons16 = require("@kopexa/icons");
|
|
5464
5856
|
var import_toolbar5 = require("@kopexa/toolbar");
|
|
5465
|
-
var
|
|
5857
|
+
var import_react44 = require("react");
|
|
5466
5858
|
|
|
5467
5859
|
// src/ui/codeblock-button/use-code-block.ts
|
|
5468
5860
|
var import_editor_utils9 = require("@kopexa/editor-utils");
|
|
@@ -5579,7 +5971,7 @@ function useCodeBlock(config) {
|
|
|
5579
5971
|
}
|
|
5580
5972
|
|
|
5581
5973
|
// src/ui/codeblock-button/code-block-button.tsx
|
|
5582
|
-
var
|
|
5974
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5583
5975
|
var CodeBlockButton = ({
|
|
5584
5976
|
editor: providedEditor,
|
|
5585
5977
|
text,
|
|
@@ -5596,7 +5988,7 @@ var CodeBlockButton = ({
|
|
|
5596
5988
|
hideWhenUnavailable,
|
|
5597
5989
|
onToggled
|
|
5598
5990
|
});
|
|
5599
|
-
const handleClick = (0,
|
|
5991
|
+
const handleClick = (0, import_react44.useCallback)(
|
|
5600
5992
|
(event) => {
|
|
5601
5993
|
onClick == null ? void 0 : onClick(event);
|
|
5602
5994
|
if (event.defaultPrevented) return;
|
|
@@ -5607,7 +5999,7 @@ var CodeBlockButton = ({
|
|
|
5607
5999
|
if (!isVisible) {
|
|
5608
6000
|
return null;
|
|
5609
6001
|
}
|
|
5610
|
-
return /* @__PURE__ */ (0,
|
|
6002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5611
6003
|
import_toolbar5.ToolbarButton,
|
|
5612
6004
|
{
|
|
5613
6005
|
type: "button",
|
|
@@ -5624,7 +6016,7 @@ var CodeBlockButton = ({
|
|
|
5624
6016
|
onClick: handleClick,
|
|
5625
6017
|
isIconOnly: true,
|
|
5626
6018
|
...buttonProps,
|
|
5627
|
-
children: /* @__PURE__ */ (0,
|
|
6019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons16.CodeblockIcon, {})
|
|
5628
6020
|
}
|
|
5629
6021
|
);
|
|
5630
6022
|
};
|
|
@@ -5634,12 +6026,12 @@ var import_button11 = require("@kopexa/button");
|
|
|
5634
6026
|
var import_icons18 = require("@kopexa/icons");
|
|
5635
6027
|
var import_popover2 = require("@kopexa/popover");
|
|
5636
6028
|
var import_toolbar7 = require("@kopexa/toolbar");
|
|
5637
|
-
var
|
|
6029
|
+
var import_react46 = require("react");
|
|
5638
6030
|
|
|
5639
6031
|
// src/ui/color-highlight-button/color-highlight-button.tsx
|
|
5640
6032
|
var import_theme8 = require("@kopexa/theme");
|
|
5641
6033
|
var import_toolbar6 = require("@kopexa/toolbar");
|
|
5642
|
-
var
|
|
6034
|
+
var import_react45 = require("react");
|
|
5643
6035
|
|
|
5644
6036
|
// src/ui/color-highlight-button/use-color-highlight.ts
|
|
5645
6037
|
var import_editor_utils10 = require("@kopexa/editor-utils");
|
|
@@ -5805,7 +6197,7 @@ function useColorHighlight(config) {
|
|
|
5805
6197
|
}
|
|
5806
6198
|
|
|
5807
6199
|
// src/ui/color-highlight-button/color-highlight-button.tsx
|
|
5808
|
-
var
|
|
6200
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5809
6201
|
var ColorHighlightButton = ({
|
|
5810
6202
|
editor: providedEditor,
|
|
5811
6203
|
highlightColor,
|
|
@@ -5834,7 +6226,7 @@ var ColorHighlightButton = ({
|
|
|
5834
6226
|
hideWhenUnavailable,
|
|
5835
6227
|
onApplied
|
|
5836
6228
|
});
|
|
5837
|
-
const handleClick = (0,
|
|
6229
|
+
const handleClick = (0, import_react45.useCallback)(
|
|
5838
6230
|
(event) => {
|
|
5839
6231
|
onClick == null ? void 0 : onClick(event);
|
|
5840
6232
|
if (event.defaultPrevented) return;
|
|
@@ -5842,7 +6234,7 @@ var ColorHighlightButton = ({
|
|
|
5842
6234
|
},
|
|
5843
6235
|
[handleColorHighlight, onClick]
|
|
5844
6236
|
);
|
|
5845
|
-
const buttonStyle = (0,
|
|
6237
|
+
const buttonStyle = (0, import_react45.useMemo)(
|
|
5846
6238
|
() => ({
|
|
5847
6239
|
...style,
|
|
5848
6240
|
"--highlight-color": highlightColor
|
|
@@ -5853,7 +6245,7 @@ var ColorHighlightButton = ({
|
|
|
5853
6245
|
return null;
|
|
5854
6246
|
}
|
|
5855
6247
|
const styles = (0, import_theme8.colorHighlightButton)();
|
|
5856
|
-
return /* @__PURE__ */ (0,
|
|
6248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5857
6249
|
import_toolbar6.ToolbarButton,
|
|
5858
6250
|
{
|
|
5859
6251
|
type: "button",
|
|
@@ -5872,15 +6264,15 @@ var ColorHighlightButton = ({
|
|
|
5872
6264
|
isIconOnly: true,
|
|
5873
6265
|
...buttonProps,
|
|
5874
6266
|
children: [
|
|
5875
|
-
/* @__PURE__ */ (0,
|
|
6267
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5876
6268
|
"span",
|
|
5877
6269
|
{
|
|
5878
6270
|
"data-active-state": isActive ? "on" : "off",
|
|
5879
6271
|
className: styles.mark()
|
|
5880
6272
|
}
|
|
5881
6273
|
),
|
|
5882
|
-
children || /* @__PURE__ */ (0,
|
|
5883
|
-
/* @__PURE__ */ (0,
|
|
6274
|
+
children || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5884
6276
|
"span",
|
|
5885
6277
|
{
|
|
5886
6278
|
style: { "--highlight-color": highlightColor }
|
|
@@ -5894,12 +6286,12 @@ var ColorHighlightButton = ({
|
|
|
5894
6286
|
};
|
|
5895
6287
|
|
|
5896
6288
|
// src/ui/color-highlight-popover/color-highlight-popover.tsx
|
|
5897
|
-
var
|
|
6289
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5898
6290
|
var ColorHighlightPopoverButton = ({
|
|
5899
6291
|
className,
|
|
5900
6292
|
children,
|
|
5901
6293
|
...props
|
|
5902
|
-
}) => /* @__PURE__ */ (0,
|
|
6294
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5903
6295
|
import_button11.IconButton,
|
|
5904
6296
|
{
|
|
5905
6297
|
type: "button",
|
|
@@ -5911,7 +6303,7 @@ var ColorHighlightPopoverButton = ({
|
|
|
5911
6303
|
tooltip: "Highlight",
|
|
5912
6304
|
isIconOnly: !children,
|
|
5913
6305
|
...props,
|
|
5914
|
-
children: children != null ? children : /* @__PURE__ */ (0,
|
|
6306
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons18.HighlighterIcon, {})
|
|
5915
6307
|
}
|
|
5916
6308
|
);
|
|
5917
6309
|
function ColorHighlightPopoverContent({
|
|
@@ -5925,8 +6317,8 @@ function ColorHighlightPopoverContent({
|
|
|
5925
6317
|
])
|
|
5926
6318
|
}) {
|
|
5927
6319
|
const { handleRemoveHighlight } = useColorHighlight({ editor });
|
|
5928
|
-
const containerRef = (0,
|
|
5929
|
-
const menuItems = (0,
|
|
6320
|
+
const containerRef = (0, import_react46.useRef)(null);
|
|
6321
|
+
const menuItems = (0, import_react46.useMemo)(
|
|
5930
6322
|
() => [...colors, { label: "Remove highlight", value: "none" }],
|
|
5931
6323
|
[colors]
|
|
5932
6324
|
);
|
|
@@ -5944,13 +6336,13 @@ function ColorHighlightPopoverContent({
|
|
|
5944
6336
|
},
|
|
5945
6337
|
autoSelectFirstItem: false
|
|
5946
6338
|
});
|
|
5947
|
-
return /* @__PURE__ */ (0,
|
|
5948
|
-
/* @__PURE__ */ (0,
|
|
6339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5949
6341
|
"div",
|
|
5950
6342
|
{
|
|
5951
6343
|
className: "flex items-center gap-1 outline-none",
|
|
5952
6344
|
"data-orientation": "horizontal",
|
|
5953
|
-
children: colors.map((color, index) => /* @__PURE__ */ (0,
|
|
6345
|
+
children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5954
6346
|
ColorHighlightButton,
|
|
5955
6347
|
{
|
|
5956
6348
|
editor,
|
|
@@ -5963,8 +6355,8 @@ function ColorHighlightPopoverContent({
|
|
|
5963
6355
|
))
|
|
5964
6356
|
}
|
|
5965
6357
|
),
|
|
5966
|
-
/* @__PURE__ */ (0,
|
|
5967
|
-
/* @__PURE__ */ (0,
|
|
6358
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
|
|
6359
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5968
6360
|
import_button11.IconButton,
|
|
5969
6361
|
{
|
|
5970
6362
|
onClick: handleRemoveHighlight,
|
|
@@ -5975,7 +6367,7 @@ function ColorHighlightPopoverContent({
|
|
|
5975
6367
|
variant: "ghost",
|
|
5976
6368
|
color: "default",
|
|
5977
6369
|
"data-highlighted": selectedIndex === colors.length,
|
|
5978
|
-
children: /* @__PURE__ */ (0,
|
|
6370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons18.BanIcon, {})
|
|
5979
6371
|
}
|
|
5980
6372
|
) })
|
|
5981
6373
|
] });
|
|
@@ -5994,18 +6386,18 @@ function ColorHighlightPopover({
|
|
|
5994
6386
|
...props
|
|
5995
6387
|
}) {
|
|
5996
6388
|
const { editor } = useTiptapEditor(providedEditor);
|
|
5997
|
-
const [isOpen, setIsOpen] = (0,
|
|
6389
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(false);
|
|
5998
6390
|
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
|
|
5999
6391
|
editor,
|
|
6000
6392
|
hideWhenUnavailable,
|
|
6001
6393
|
onApplied
|
|
6002
6394
|
});
|
|
6003
6395
|
if (!isVisible) return null;
|
|
6004
|
-
return /* @__PURE__ */ (0,
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6006
6398
|
import_popover2.Popover.Trigger,
|
|
6007
6399
|
{
|
|
6008
|
-
render: /* @__PURE__ */ (0,
|
|
6400
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6009
6401
|
ColorHighlightPopoverButton,
|
|
6010
6402
|
{
|
|
6011
6403
|
disabled: !canColorHighlight2,
|
|
@@ -6019,7 +6411,7 @@ function ColorHighlightPopover({
|
|
|
6019
6411
|
)
|
|
6020
6412
|
}
|
|
6021
6413
|
),
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
|
|
6023
6415
|
] });
|
|
6024
6416
|
}
|
|
6025
6417
|
|
|
@@ -6028,7 +6420,7 @@ var import_button13 = require("@kopexa/button");
|
|
|
6028
6420
|
var import_dropdown_menu = require("@kopexa/dropdown-menu");
|
|
6029
6421
|
var import_editor_utils12 = require("@kopexa/editor-utils");
|
|
6030
6422
|
var import_icons20 = require("@kopexa/icons");
|
|
6031
|
-
var
|
|
6423
|
+
var import_react48 = require("@tiptap/react");
|
|
6032
6424
|
var React19 = __toESM(require("react"));
|
|
6033
6425
|
|
|
6034
6426
|
// src/ui/heading-button/index.tsx
|
|
@@ -6038,7 +6430,7 @@ var import_icons19 = require("@kopexa/icons");
|
|
|
6038
6430
|
var React18 = __toESM(require("react"));
|
|
6039
6431
|
|
|
6040
6432
|
// src/ui/heading-button/utils.ts
|
|
6041
|
-
var
|
|
6433
|
+
var import_react47 = require("@tiptap/react");
|
|
6042
6434
|
var headingShortcutKeys = {
|
|
6043
6435
|
1: "Ctrl-Alt-1",
|
|
6044
6436
|
2: "Ctrl-Alt-2",
|
|
@@ -6079,7 +6471,7 @@ function shouldShowHeadingButton(params) {
|
|
|
6079
6471
|
return false;
|
|
6080
6472
|
}
|
|
6081
6473
|
if (hideWhenUnavailable) {
|
|
6082
|
-
if ((0,
|
|
6474
|
+
if ((0, import_react47.isNodeSelection)(editor.state.selection)) {
|
|
6083
6475
|
return false;
|
|
6084
6476
|
}
|
|
6085
6477
|
}
|
|
@@ -6090,7 +6482,7 @@ function getFormattedHeadingName(level) {
|
|
|
6090
6482
|
}
|
|
6091
6483
|
|
|
6092
6484
|
// src/ui/heading-button/index.tsx
|
|
6093
|
-
var
|
|
6485
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6094
6486
|
var headingIcons = {
|
|
6095
6487
|
1: import_icons19.HeadingOneIcon,
|
|
6096
6488
|
2: import_icons19.HeadingTwoIcon,
|
|
@@ -6156,7 +6548,7 @@ var HeadingButton = ({
|
|
|
6156
6548
|
if (!show || !editor || !editor.isEditable) {
|
|
6157
6549
|
return null;
|
|
6158
6550
|
}
|
|
6159
|
-
return /* @__PURE__ */ (0,
|
|
6551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6160
6552
|
import_button12.Button,
|
|
6161
6553
|
{
|
|
6162
6554
|
type: "button",
|
|
@@ -6172,7 +6564,7 @@ var HeadingButton = ({
|
|
|
6172
6564
|
tooltip: formattedName,
|
|
6173
6565
|
shortcutKeys: shortcutKey,
|
|
6174
6566
|
onClick: handleClick,
|
|
6175
|
-
startContent: /* @__PURE__ */ (0,
|
|
6567
|
+
startContent: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, {}),
|
|
6176
6568
|
...buttonProps,
|
|
6177
6569
|
ref,
|
|
6178
6570
|
children: children || text
|
|
@@ -6181,7 +6573,7 @@ var HeadingButton = ({
|
|
|
6181
6573
|
};
|
|
6182
6574
|
|
|
6183
6575
|
// src/ui/heading-dropdown-menu/index.tsx
|
|
6184
|
-
var
|
|
6576
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6185
6577
|
function HeadingDropdownMenu({
|
|
6186
6578
|
editor: providedEditor,
|
|
6187
6579
|
levels = [1, 2, 3, 4, 5, 6],
|
|
@@ -6201,13 +6593,13 @@ function HeadingDropdownMenu({
|
|
|
6201
6593
|
[onOpenChange]
|
|
6202
6594
|
);
|
|
6203
6595
|
const getActiveIcon = React19.useCallback(() => {
|
|
6204
|
-
if (!editor) return /* @__PURE__ */ (0,
|
|
6596
|
+
if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons20.HeadingIcon, {});
|
|
6205
6597
|
const activeLevel = levels.find(
|
|
6206
6598
|
(level) => editor.isActive("heading", { level })
|
|
6207
6599
|
);
|
|
6208
|
-
if (!activeLevel) return /* @__PURE__ */ (0,
|
|
6600
|
+
if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons20.HeadingIcon, {});
|
|
6209
6601
|
const ActiveIcon = headingIcons[activeLevel];
|
|
6210
|
-
return /* @__PURE__ */ (0,
|
|
6602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ActiveIcon, {});
|
|
6211
6603
|
}, [editor, levels]);
|
|
6212
6604
|
const canToggleAnyHeading = React19.useCallback(() => {
|
|
6213
6605
|
if (!editor) return false;
|
|
@@ -6222,7 +6614,7 @@ function HeadingDropdownMenu({
|
|
|
6222
6614
|
return false;
|
|
6223
6615
|
}
|
|
6224
6616
|
if (hideWhenUnavailable) {
|
|
6225
|
-
if ((0,
|
|
6617
|
+
if ((0, import_react48.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
|
|
6226
6618
|
return false;
|
|
6227
6619
|
}
|
|
6228
6620
|
}
|
|
@@ -6231,8 +6623,8 @@ function HeadingDropdownMenu({
|
|
|
6231
6623
|
if (!show || !editor || !editor.isEditable) {
|
|
6232
6624
|
return null;
|
|
6233
6625
|
}
|
|
6234
|
-
return /* @__PURE__ */ (0,
|
|
6235
|
-
/* @__PURE__ */ (0,
|
|
6626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6236
6628
|
import_button13.Button,
|
|
6237
6629
|
{
|
|
6238
6630
|
type: "button",
|
|
@@ -6245,12 +6637,12 @@ function HeadingDropdownMenu({
|
|
|
6245
6637
|
"aria-label": "Format text as heading",
|
|
6246
6638
|
"aria-pressed": isAnyHeadingActive,
|
|
6247
6639
|
tooltip: "Heading",
|
|
6248
|
-
endContent: /* @__PURE__ */ (0,
|
|
6640
|
+
endContent: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons20.ChevronDownIcon, {}),
|
|
6249
6641
|
...props,
|
|
6250
6642
|
children: getActiveIcon()
|
|
6251
6643
|
}
|
|
6252
6644
|
) }),
|
|
6253
|
-
/* @__PURE__ */ (0,
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dropdown_menu.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dropdown_menu.DropdownMenu.Group, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dropdown_menu.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6254
6646
|
HeadingButton,
|
|
6255
6647
|
{
|
|
6256
6648
|
editor,
|
|
@@ -6269,16 +6661,16 @@ var import_button15 = require("@kopexa/button");
|
|
|
6269
6661
|
var import_dropdown_menu2 = require("@kopexa/dropdown-menu");
|
|
6270
6662
|
var import_editor_utils14 = require("@kopexa/editor-utils");
|
|
6271
6663
|
var import_icons22 = require("@kopexa/icons");
|
|
6272
|
-
var
|
|
6273
|
-
var
|
|
6664
|
+
var import_react51 = require("@tiptap/react");
|
|
6665
|
+
var import_react52 = require("react");
|
|
6274
6666
|
|
|
6275
6667
|
// src/ui/list-button/index.tsx
|
|
6276
6668
|
var import_button14 = require("@kopexa/button");
|
|
6277
6669
|
var import_editor_utils13 = require("@kopexa/editor-utils");
|
|
6278
6670
|
var import_icons21 = require("@kopexa/icons");
|
|
6279
|
-
var
|
|
6280
|
-
var
|
|
6281
|
-
var
|
|
6671
|
+
var import_react49 = require("@tiptap/react");
|
|
6672
|
+
var import_react50 = require("react");
|
|
6673
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
6282
6674
|
var listOptions = [
|
|
6283
6675
|
{
|
|
6284
6676
|
label: "Bullet List",
|
|
@@ -6352,7 +6744,7 @@ function shouldShowListButton(params) {
|
|
|
6352
6744
|
return false;
|
|
6353
6745
|
}
|
|
6354
6746
|
if (hideWhenUnavailable) {
|
|
6355
|
-
if ((0,
|
|
6747
|
+
if ((0, import_react49.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
|
|
6356
6748
|
return false;
|
|
6357
6749
|
}
|
|
6358
6750
|
}
|
|
@@ -6387,7 +6779,7 @@ var ListButton = ({
|
|
|
6387
6779
|
type
|
|
6388
6780
|
);
|
|
6389
6781
|
const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons21.ListIcon;
|
|
6390
|
-
const handleClick = (0,
|
|
6782
|
+
const handleClick = (0, import_react50.useCallback)(
|
|
6391
6783
|
(e) => {
|
|
6392
6784
|
onClick == null ? void 0 : onClick(e);
|
|
6393
6785
|
if (!e.defaultPrevented && editor) {
|
|
@@ -6396,7 +6788,7 @@ var ListButton = ({
|
|
|
6396
6788
|
},
|
|
6397
6789
|
[onClick, editor, type]
|
|
6398
6790
|
);
|
|
6399
|
-
const show = (0,
|
|
6791
|
+
const show = (0, import_react50.useMemo)(() => {
|
|
6400
6792
|
return shouldShowListButton({
|
|
6401
6793
|
editor,
|
|
6402
6794
|
type,
|
|
@@ -6407,7 +6799,7 @@ var ListButton = ({
|
|
|
6407
6799
|
if (!show || !editor || !editor.isEditable) {
|
|
6408
6800
|
return null;
|
|
6409
6801
|
}
|
|
6410
|
-
return /* @__PURE__ */ (0,
|
|
6802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
6411
6803
|
import_button14.Button,
|
|
6412
6804
|
{
|
|
6413
6805
|
type: "button",
|
|
@@ -6421,7 +6813,7 @@ var ListButton = ({
|
|
|
6421
6813
|
tooltip: (listOption == null ? void 0 : listOption.label) || type,
|
|
6422
6814
|
shortcutKeys: shortcutKey,
|
|
6423
6815
|
onClick: handleClick,
|
|
6424
|
-
startContent: /* @__PURE__ */ (0,
|
|
6816
|
+
startContent: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, {}),
|
|
6425
6817
|
...buttonProps,
|
|
6426
6818
|
ref,
|
|
6427
6819
|
children: children || text
|
|
@@ -6430,7 +6822,7 @@ var ListButton = ({
|
|
|
6430
6822
|
};
|
|
6431
6823
|
|
|
6432
6824
|
// src/ui/list-dropdown-menu/index.tsx
|
|
6433
|
-
var
|
|
6825
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6434
6826
|
function canToggleAnyList(editor, listTypes) {
|
|
6435
6827
|
if (!editor) return false;
|
|
6436
6828
|
return listTypes.some((type) => canToggleList(editor, type));
|
|
@@ -6450,24 +6842,24 @@ function shouldShowListDropdown(params) {
|
|
|
6450
6842
|
return false;
|
|
6451
6843
|
}
|
|
6452
6844
|
if (hideWhenUnavailable) {
|
|
6453
|
-
if ((0,
|
|
6845
|
+
if ((0, import_react51.isNodeSelection)(editor.state.selection) || !canToggleAny) {
|
|
6454
6846
|
return false;
|
|
6455
6847
|
}
|
|
6456
6848
|
}
|
|
6457
6849
|
return true;
|
|
6458
6850
|
}
|
|
6459
6851
|
function useListDropdownState(editor, availableTypes) {
|
|
6460
|
-
const [isOpen, setIsOpen] = (0,
|
|
6852
|
+
const [isOpen, setIsOpen] = (0, import_react52.useState)(false);
|
|
6461
6853
|
const listInSchema = availableTypes.some(
|
|
6462
6854
|
(type) => (0, import_editor_utils14.isNodeInSchema)(type, editor)
|
|
6463
6855
|
);
|
|
6464
|
-
const filteredLists = (0,
|
|
6856
|
+
const filteredLists = (0, import_react52.useMemo)(
|
|
6465
6857
|
() => getFilteredListOptions(availableTypes),
|
|
6466
6858
|
[availableTypes]
|
|
6467
6859
|
);
|
|
6468
6860
|
const canToggleAny = canToggleAnyList(editor, availableTypes);
|
|
6469
6861
|
const isAnyActive = isAnyListActive(editor, availableTypes);
|
|
6470
|
-
const handleOpenChange = (0,
|
|
6862
|
+
const handleOpenChange = (0, import_react52.useCallback)(
|
|
6471
6863
|
(open, callback) => {
|
|
6472
6864
|
setIsOpen(open);
|
|
6473
6865
|
callback == null ? void 0 : callback(open);
|
|
@@ -6485,11 +6877,11 @@ function useListDropdownState(editor, availableTypes) {
|
|
|
6485
6877
|
};
|
|
6486
6878
|
}
|
|
6487
6879
|
function useActiveListIcon(editor, filteredLists) {
|
|
6488
|
-
return (0,
|
|
6880
|
+
return (0, import_react52.useCallback)(() => {
|
|
6489
6881
|
const activeOption = filteredLists.find(
|
|
6490
6882
|
(option) => isListActive(editor, option.type)
|
|
6491
6883
|
);
|
|
6492
|
-
return activeOption ? /* @__PURE__ */ (0,
|
|
6884
|
+
return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_icons22.ListIcon, {});
|
|
6493
6885
|
}, [editor, filteredLists]);
|
|
6494
6886
|
}
|
|
6495
6887
|
function ListDropdownMenu({
|
|
@@ -6509,7 +6901,7 @@ function ListDropdownMenu({
|
|
|
6509
6901
|
handleOpenChange
|
|
6510
6902
|
} = useListDropdownState(editor, types);
|
|
6511
6903
|
const getActiveIcon = useActiveListIcon(editor, filteredLists);
|
|
6512
|
-
const show = (0,
|
|
6904
|
+
const show = (0, import_react52.useMemo)(() => {
|
|
6513
6905
|
return shouldShowListDropdown({
|
|
6514
6906
|
editor,
|
|
6515
6907
|
listTypes: types,
|
|
@@ -6518,15 +6910,15 @@ function ListDropdownMenu({
|
|
|
6518
6910
|
canToggleAny
|
|
6519
6911
|
});
|
|
6520
6912
|
}, [editor, types, hideWhenUnavailable, listInSchema, canToggleAny]);
|
|
6521
|
-
const handleOnOpenChange = (0,
|
|
6913
|
+
const handleOnOpenChange = (0, import_react52.useCallback)(
|
|
6522
6914
|
(open) => handleOpenChange(open, onOpenChange),
|
|
6523
6915
|
[handleOpenChange, onOpenChange]
|
|
6524
6916
|
);
|
|
6525
6917
|
if (!show || !editor || !editor.isEditable) {
|
|
6526
6918
|
return null;
|
|
6527
6919
|
}
|
|
6528
|
-
return /* @__PURE__ */ (0,
|
|
6529
|
-
/* @__PURE__ */ (0,
|
|
6920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
|
|
6921
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6530
6922
|
import_button15.Button,
|
|
6531
6923
|
{
|
|
6532
6924
|
type: "button",
|
|
@@ -6536,12 +6928,12 @@ function ListDropdownMenu({
|
|
|
6536
6928
|
tabIndex: -1,
|
|
6537
6929
|
"aria-label": "List options",
|
|
6538
6930
|
tooltip: "List",
|
|
6539
|
-
endContent: /* @__PURE__ */ (0,
|
|
6931
|
+
endContent: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_icons22.ChevronDownIcon, {}),
|
|
6540
6932
|
...props,
|
|
6541
6933
|
children: getActiveIcon()
|
|
6542
6934
|
}
|
|
6543
6935
|
) }),
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6936
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_dropdown_menu2.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredLists.map((option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_dropdown_menu2.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6545
6937
|
ListButton,
|
|
6546
6938
|
{
|
|
6547
6939
|
editor,
|
|
@@ -6558,8 +6950,8 @@ function ListDropdownMenu({
|
|
|
6558
6950
|
|
|
6559
6951
|
// src/ui/table-button/index.tsx
|
|
6560
6952
|
var import_toolbar8 = require("@kopexa/toolbar");
|
|
6561
|
-
var
|
|
6562
|
-
var
|
|
6953
|
+
var import_react53 = require("react");
|
|
6954
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6563
6955
|
var TableButton = ({
|
|
6564
6956
|
editor: providedEditor,
|
|
6565
6957
|
text,
|
|
@@ -6583,7 +6975,7 @@ var TableButton = ({
|
|
|
6583
6975
|
hideWhenUnavailable,
|
|
6584
6976
|
onToggled
|
|
6585
6977
|
});
|
|
6586
|
-
const handleClick = (0,
|
|
6978
|
+
const handleClick = (0, import_react53.useCallback)(
|
|
6587
6979
|
(event) => {
|
|
6588
6980
|
onClick == null ? void 0 : onClick(event);
|
|
6589
6981
|
if (event.defaultPrevented) return;
|
|
@@ -6594,7 +6986,7 @@ var TableButton = ({
|
|
|
6594
6986
|
if (!isVisible) {
|
|
6595
6987
|
return null;
|
|
6596
6988
|
}
|
|
6597
|
-
return /* @__PURE__ */ (0,
|
|
6989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6598
6990
|
import_toolbar8.ToolbarButton,
|
|
6599
6991
|
{
|
|
6600
6992
|
type: "button",
|
|
@@ -6610,9 +7002,9 @@ var TableButton = ({
|
|
|
6610
7002
|
onClick: handleClick,
|
|
6611
7003
|
isIconOnly: !text && !children,
|
|
6612
7004
|
...buttonProps,
|
|
6613
|
-
children: children || /* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
text && /* @__PURE__ */ (0,
|
|
7005
|
+
children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, {}),
|
|
7007
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: text })
|
|
6616
7008
|
] })
|
|
6617
7009
|
}
|
|
6618
7010
|
);
|
|
@@ -6620,12 +7012,12 @@ var TableButton = ({
|
|
|
6620
7012
|
|
|
6621
7013
|
// src/ui/text-align-button/text-align-button.tsx
|
|
6622
7014
|
var import_button16 = require("@kopexa/button");
|
|
6623
|
-
var
|
|
7015
|
+
var import_react55 = require("react");
|
|
6624
7016
|
|
|
6625
7017
|
// src/ui/text-align-button/use-text-align.ts
|
|
6626
7018
|
var import_editor_utils15 = require("@kopexa/editor-utils");
|
|
6627
7019
|
var import_icons23 = require("@kopexa/icons");
|
|
6628
|
-
var
|
|
7020
|
+
var import_react54 = require("react");
|
|
6629
7021
|
var TEXT_ALIGN_SHORTCUT_KEYS = {
|
|
6630
7022
|
left: "mod+shift+l",
|
|
6631
7023
|
center: "mod+shift+e",
|
|
@@ -6683,10 +7075,10 @@ function useTextAlign(config) {
|
|
|
6683
7075
|
onAligned
|
|
6684
7076
|
} = config;
|
|
6685
7077
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6686
|
-
const [isVisible, setIsVisible] = (0,
|
|
7078
|
+
const [isVisible, setIsVisible] = (0, import_react54.useState)(true);
|
|
6687
7079
|
const canAlign = canSetTextAlign(editor, align);
|
|
6688
7080
|
const isActive = isTextAlignActive(editor, align);
|
|
6689
|
-
(0,
|
|
7081
|
+
(0, import_react54.useEffect)(() => {
|
|
6690
7082
|
if (!editor) return;
|
|
6691
7083
|
const handleSelectionUpdate = () => {
|
|
6692
7084
|
setIsVisible(shouldShowButton5({ editor, align, hideWhenUnavailable }));
|
|
@@ -6697,7 +7089,7 @@ function useTextAlign(config) {
|
|
|
6697
7089
|
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
6698
7090
|
};
|
|
6699
7091
|
}, [editor, hideWhenUnavailable, align]);
|
|
6700
|
-
const handleTextAlign = (0,
|
|
7092
|
+
const handleTextAlign = (0, import_react54.useCallback)(() => {
|
|
6701
7093
|
if (!editor) return false;
|
|
6702
7094
|
const success = setTextAlign(editor, align);
|
|
6703
7095
|
if (success) {
|
|
@@ -6717,7 +7109,7 @@ function useTextAlign(config) {
|
|
|
6717
7109
|
}
|
|
6718
7110
|
|
|
6719
7111
|
// src/ui/text-align-button/text-align-button.tsx
|
|
6720
|
-
var
|
|
7112
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6721
7113
|
var TextAlignButton = ({
|
|
6722
7114
|
editor: providedEditor,
|
|
6723
7115
|
align,
|
|
@@ -6744,7 +7136,7 @@ var TextAlignButton = ({
|
|
|
6744
7136
|
hideWhenUnavailable,
|
|
6745
7137
|
onAligned
|
|
6746
7138
|
});
|
|
6747
|
-
const handleClick = (0,
|
|
7139
|
+
const handleClick = (0, import_react55.useCallback)(
|
|
6748
7140
|
(e) => {
|
|
6749
7141
|
onClick == null ? void 0 : onClick(e);
|
|
6750
7142
|
if (e.defaultPrevented) return;
|
|
@@ -6755,7 +7147,7 @@ var TextAlignButton = ({
|
|
|
6755
7147
|
if (!isVisible) {
|
|
6756
7148
|
return null;
|
|
6757
7149
|
}
|
|
6758
|
-
return /* @__PURE__ */ (0,
|
|
7150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6759
7151
|
import_button16.IconButton,
|
|
6760
7152
|
{
|
|
6761
7153
|
type: "button",
|
|
@@ -6771,19 +7163,19 @@ var TextAlignButton = ({
|
|
|
6771
7163
|
shortcutKeys,
|
|
6772
7164
|
onClick: handleClick,
|
|
6773
7165
|
...buttonProps,
|
|
6774
|
-
children: /* @__PURE__ */ (0,
|
|
7166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, {})
|
|
6775
7167
|
}
|
|
6776
7168
|
);
|
|
6777
7169
|
};
|
|
6778
7170
|
|
|
6779
7171
|
// src/ui/undo-redo-button/undo-redo-button.tsx
|
|
6780
7172
|
var import_toolbar9 = require("@kopexa/toolbar");
|
|
6781
|
-
var
|
|
7173
|
+
var import_react57 = require("react");
|
|
6782
7174
|
|
|
6783
7175
|
// src/ui/undo-redo-button/use-undo-redo.ts
|
|
6784
7176
|
var import_editor_utils16 = require("@kopexa/editor-utils");
|
|
6785
7177
|
var import_icons24 = require("@kopexa/icons");
|
|
6786
|
-
var
|
|
7178
|
+
var import_react56 = require("react");
|
|
6787
7179
|
var UNDO_REDO_SHORTCUT_KEYS = {
|
|
6788
7180
|
undo: "mod+z",
|
|
6789
7181
|
redo: "mod+shift+z"
|
|
@@ -6823,9 +7215,9 @@ function useUndoRedo(config) {
|
|
|
6823
7215
|
onExecuted
|
|
6824
7216
|
} = config;
|
|
6825
7217
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6826
|
-
const [isVisible, setIsVisible] = (0,
|
|
7218
|
+
const [isVisible, setIsVisible] = (0, import_react56.useState)(true);
|
|
6827
7219
|
const canExecute = canExecuteUndoRedoAction(editor, action);
|
|
6828
|
-
(0,
|
|
7220
|
+
(0, import_react56.useEffect)(() => {
|
|
6829
7221
|
if (!editor) return;
|
|
6830
7222
|
const handleUpdate = () => {
|
|
6831
7223
|
setIsVisible(shouldShowButton6({ editor, hideWhenUnavailable, action }));
|
|
@@ -6836,7 +7228,7 @@ function useUndoRedo(config) {
|
|
|
6836
7228
|
editor.off("transaction", handleUpdate);
|
|
6837
7229
|
};
|
|
6838
7230
|
}, [editor, hideWhenUnavailable, action]);
|
|
6839
|
-
const handleAction = (0,
|
|
7231
|
+
const handleAction = (0, import_react56.useCallback)(() => {
|
|
6840
7232
|
if (!editor) return false;
|
|
6841
7233
|
const success = executeUndoRedoAction(editor, action);
|
|
6842
7234
|
if (success) {
|
|
@@ -6855,7 +7247,7 @@ function useUndoRedo(config) {
|
|
|
6855
7247
|
}
|
|
6856
7248
|
|
|
6857
7249
|
// src/ui/undo-redo-button/undo-redo-button.tsx
|
|
6858
|
-
var
|
|
7250
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6859
7251
|
var UndoRedoButton = ({
|
|
6860
7252
|
editor: providedEditor,
|
|
6861
7253
|
action,
|
|
@@ -6874,7 +7266,7 @@ var UndoRedoButton = ({
|
|
|
6874
7266
|
hideWhenUnavailable,
|
|
6875
7267
|
onExecuted
|
|
6876
7268
|
});
|
|
6877
|
-
const handleClick = (0,
|
|
7269
|
+
const handleClick = (0, import_react57.useCallback)(
|
|
6878
7270
|
(event) => {
|
|
6879
7271
|
onClick == null ? void 0 : onClick(event);
|
|
6880
7272
|
if (event.defaultPrevented) return;
|
|
@@ -6885,7 +7277,7 @@ var UndoRedoButton = ({
|
|
|
6885
7277
|
if (!isVisible) {
|
|
6886
7278
|
return null;
|
|
6887
7279
|
}
|
|
6888
|
-
return /* @__PURE__ */ (0,
|
|
7280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6889
7281
|
import_toolbar9.ToolbarButton,
|
|
6890
7282
|
{
|
|
6891
7283
|
type: "button",
|
|
@@ -6900,13 +7292,13 @@ var UndoRedoButton = ({
|
|
|
6900
7292
|
onClick: handleClick,
|
|
6901
7293
|
isIconOnly: true,
|
|
6902
7294
|
...buttonProps,
|
|
6903
|
-
children: /* @__PURE__ */ (0,
|
|
7295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, {})
|
|
6904
7296
|
}
|
|
6905
7297
|
);
|
|
6906
7298
|
};
|
|
6907
7299
|
|
|
6908
7300
|
// src/presets/basic/editor-header.tsx
|
|
6909
|
-
var
|
|
7301
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6910
7302
|
var EditorHeader = ({
|
|
6911
7303
|
editor: providedEditor,
|
|
6912
7304
|
variant
|
|
@@ -6916,7 +7308,7 @@ var EditorHeader = ({
|
|
|
6916
7308
|
const isMobile = (0, import_use_is_mobile2.useIsMobile)();
|
|
6917
7309
|
const windowSize = useWindowSize();
|
|
6918
7310
|
const { styles } = useEditorUIContext();
|
|
6919
|
-
const toolbarRef = (0,
|
|
7311
|
+
const toolbarRef = (0, import_react58.useRef)(null);
|
|
6920
7312
|
const bodyRect = useCursorVisibility({
|
|
6921
7313
|
editor,
|
|
6922
7314
|
overlayHeight: (_b = (_a = toolbarRef.current) == null ? void 0 : _a.getBoundingClientRect().height) != null ? _b : 0
|
|
@@ -6925,7 +7317,7 @@ var EditorHeader = ({
|
|
|
6925
7317
|
return null;
|
|
6926
7318
|
}
|
|
6927
7319
|
const ToolbarContent = variant === "comment" ? CommentToolbarContent : variant === "field" ? FieldToolbarContent : MainToolbarContent;
|
|
6928
|
-
return /* @__PURE__ */ (0,
|
|
7320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6929
7321
|
import_toolbar10.Toolbar,
|
|
6930
7322
|
{
|
|
6931
7323
|
sticky: true,
|
|
@@ -6935,54 +7327,54 @@ var EditorHeader = ({
|
|
|
6935
7327
|
bottom: `calc(100% - ${windowSize.height - bodyRect.y}px)`
|
|
6936
7328
|
} : {},
|
|
6937
7329
|
className: styles.toolbar(),
|
|
6938
|
-
children: /* @__PURE__ */ (0,
|
|
7330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ToolbarContent, {})
|
|
6939
7331
|
}
|
|
6940
7332
|
) });
|
|
6941
7333
|
};
|
|
6942
|
-
var MainToolbarContent = () => /* @__PURE__ */ (0,
|
|
6943
|
-
/* @__PURE__ */ (0,
|
|
6944
|
-
/* @__PURE__ */ (0,
|
|
6945
|
-
/* @__PURE__ */ (0,
|
|
7334
|
+
var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7335
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7336
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(UndoRedoButton, { action: "undo" }),
|
|
7337
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(UndoRedoButton, { action: "redo" })
|
|
6946
7338
|
] }),
|
|
6947
|
-
/* @__PURE__ */ (0,
|
|
6948
|
-
/* @__PURE__ */ (0,
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
6950
|
-
/* @__PURE__ */ (0,
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7340
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7341
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
|
|
7342
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BlockquoteButton, {}),
|
|
7344
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CodeBlockButton, {})
|
|
6953
7345
|
] }),
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
6955
|
-
/* @__PURE__ */ (0,
|
|
6956
|
-
/* @__PURE__ */ (0,
|
|
6957
|
-
/* @__PURE__ */ (0,
|
|
6958
|
-
/* @__PURE__ */ (0,
|
|
6959
|
-
/* @__PURE__ */ (0,
|
|
6960
|
-
/* @__PURE__ */ (0,
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
6962
|
-
/* @__PURE__ */ (0,
|
|
7346
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7347
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7348
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "bold" }),
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "italic" }),
|
|
7350
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "strike" }),
|
|
7351
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "code" }),
|
|
7352
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "underline" }),
|
|
7353
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorHighlightPopover, {}),
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkPopover, {})
|
|
6963
7355
|
] }),
|
|
6964
|
-
/* @__PURE__ */ (0,
|
|
6965
|
-
/* @__PURE__ */ (0,
|
|
6966
|
-
/* @__PURE__ */ (0,
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7357
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TableButton, {}) }),
|
|
7358
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MoreOptions, { hideWhenUnavailable: true })
|
|
6967
7359
|
] });
|
|
6968
|
-
var CommentToolbarContent = () => /* @__PURE__ */ (0,
|
|
6969
|
-
/* @__PURE__ */ (0,
|
|
6970
|
-
/* @__PURE__ */ (0,
|
|
6971
|
-
/* @__PURE__ */ (0,
|
|
6972
|
-
/* @__PURE__ */ (0,
|
|
6973
|
-
/* @__PURE__ */ (0,
|
|
7360
|
+
var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7361
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7362
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "bold" }),
|
|
7363
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "italic" }),
|
|
7364
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "strike" }),
|
|
7365
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "code" })
|
|
6974
7366
|
] }),
|
|
6975
|
-
/* @__PURE__ */ (0,
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
6977
|
-
/* @__PURE__ */ (0,
|
|
6978
|
-
/* @__PURE__ */ (0,
|
|
7367
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7368
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7369
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkPopover, {}),
|
|
7370
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
|
|
6979
7371
|
] })
|
|
6980
7372
|
] });
|
|
6981
|
-
var FieldToolbarContent = () => /* @__PURE__ */ (0,
|
|
6982
|
-
/* @__PURE__ */ (0,
|
|
6983
|
-
/* @__PURE__ */ (0,
|
|
6984
|
-
/* @__PURE__ */ (0,
|
|
6985
|
-
/* @__PURE__ */ (0,
|
|
7373
|
+
var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7374
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "bold" }),
|
|
7375
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "italic" }),
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "strike" }),
|
|
7377
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkPopover, {})
|
|
6986
7378
|
] });
|
|
6987
7379
|
function MoreOptions({
|
|
6988
7380
|
editor: providedEditor,
|
|
@@ -6990,8 +7382,8 @@ function MoreOptions({
|
|
|
6990
7382
|
...props
|
|
6991
7383
|
}) {
|
|
6992
7384
|
const { editor } = useTiptapEditor(providedEditor);
|
|
6993
|
-
const [show, setShow] = (0,
|
|
6994
|
-
(0,
|
|
7385
|
+
const [show, setShow] = (0, import_react58.useState)(false);
|
|
7386
|
+
(0, import_react58.useEffect)(() => {
|
|
6995
7387
|
if (!editor) return;
|
|
6996
7388
|
const handleSelectionUpdate = () => {
|
|
6997
7389
|
setShow(
|
|
@@ -7010,13 +7402,13 @@ function MoreOptions({
|
|
|
7010
7402
|
if (!show || !editor || !editor.isEditable) {
|
|
7011
7403
|
return null;
|
|
7012
7404
|
}
|
|
7013
|
-
return /* @__PURE__ */ (0,
|
|
7014
|
-
/* @__PURE__ */ (0,
|
|
7015
|
-
/* @__PURE__ */ (0,
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
7406
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7407
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_popover3.Popover.Root, { spacing: "dense", width: "auto", children: [
|
|
7408
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7017
7409
|
import_popover3.Popover.Trigger,
|
|
7018
7410
|
{
|
|
7019
|
-
render: /* @__PURE__ */ (0,
|
|
7411
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7020
7412
|
import_toolbar10.ToolbarButton,
|
|
7021
7413
|
{
|
|
7022
7414
|
type: "button",
|
|
@@ -7028,29 +7420,29 @@ function MoreOptions({
|
|
|
7028
7420
|
title: "More options",
|
|
7029
7421
|
isIconOnly: true,
|
|
7030
7422
|
...props,
|
|
7031
|
-
children: /* @__PURE__ */ (0,
|
|
7423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_icons25.MoreVerticalIcon, {})
|
|
7032
7424
|
}
|
|
7033
7425
|
)
|
|
7034
7426
|
}
|
|
7035
7427
|
),
|
|
7036
|
-
/* @__PURE__ */ (0,
|
|
7428
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7037
7429
|
import_popover3.Popover.Content,
|
|
7038
7430
|
{
|
|
7039
7431
|
side: "top",
|
|
7040
7432
|
align: "end",
|
|
7041
7433
|
alignOffset: 4,
|
|
7042
7434
|
sideOffset: 4,
|
|
7043
|
-
children: /* @__PURE__ */ (0,
|
|
7044
|
-
/* @__PURE__ */ (0,
|
|
7045
|
-
/* @__PURE__ */ (0,
|
|
7046
|
-
/* @__PURE__ */ (0,
|
|
7435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.Toolbar, { children: [
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7437
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "superscript" }),
|
|
7438
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MarkButton, { type: "subscript" })
|
|
7047
7439
|
] }),
|
|
7048
|
-
/* @__PURE__ */ (0,
|
|
7049
|
-
/* @__PURE__ */ (0,
|
|
7050
|
-
/* @__PURE__ */ (0,
|
|
7051
|
-
/* @__PURE__ */ (0,
|
|
7052
|
-
/* @__PURE__ */ (0,
|
|
7053
|
-
/* @__PURE__ */ (0,
|
|
7440
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_toolbar10.ToolbarSeparator, {}),
|
|
7441
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_toolbar10.ToolbarGroup, { children: [
|
|
7442
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TextAlignButton, { align: "left" }),
|
|
7443
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TextAlignButton, { align: "center" }),
|
|
7444
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TextAlignButton, { align: "right" }),
|
|
7445
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TextAlignButton, { align: "justify" })
|
|
7054
7446
|
] })
|
|
7055
7447
|
] })
|
|
7056
7448
|
}
|
|
@@ -7082,7 +7474,7 @@ function shouldShowMoreOptions(params) {
|
|
|
7082
7474
|
}
|
|
7083
7475
|
|
|
7084
7476
|
// src/presets/basic/index.tsx
|
|
7085
|
-
var
|
|
7477
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7086
7478
|
var BasicEditor = ({
|
|
7087
7479
|
variant,
|
|
7088
7480
|
bordered,
|
|
@@ -7090,39 +7482,53 @@ var BasicEditor = ({
|
|
|
7090
7482
|
variables,
|
|
7091
7483
|
variableValues,
|
|
7092
7484
|
showToolbar = true,
|
|
7485
|
+
pagesOptions,
|
|
7093
7486
|
...options
|
|
7094
7487
|
}) => {
|
|
7095
7488
|
const editor = useCreateEditor({
|
|
7096
7489
|
content,
|
|
7097
7490
|
enableVariables: !!(variables == null ? void 0 : variables.length),
|
|
7491
|
+
pagesOptions,
|
|
7098
7492
|
...options
|
|
7099
7493
|
});
|
|
7100
7494
|
const styles = (0, import_theme9.editorBasic)({ variant, bordered });
|
|
7101
|
-
const resolveVariable = (0,
|
|
7495
|
+
const resolveVariable = (0, import_react60.useCallback)(
|
|
7102
7496
|
(name) => variableValues == null ? void 0 : variableValues[name],
|
|
7103
7497
|
[variableValues]
|
|
7104
7498
|
);
|
|
7105
7499
|
if (!editor) {
|
|
7106
|
-
return /* @__PURE__ */ (0,
|
|
7500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LoadingSpinner, {});
|
|
7107
7501
|
}
|
|
7108
7502
|
const isBottomToolbar = variant === "field";
|
|
7109
7503
|
const hasVariables = variables && variables.length > 0;
|
|
7110
|
-
const
|
|
7111
|
-
|
|
7112
|
-
/* @__PURE__ */ (0,
|
|
7113
|
-
|
|
7504
|
+
const hasPagination = !!pagesOptions;
|
|
7505
|
+
const editorContent = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EditorUIProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: styles.root(), "data-slot": "editor", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react59.EditorContext.Provider, { value: { editor }, children: [
|
|
7506
|
+
showToolbar && !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EditorHeader, { editor, variant }),
|
|
7507
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7508
|
+
EditorContentArea,
|
|
7509
|
+
{
|
|
7510
|
+
variant,
|
|
7511
|
+
variables,
|
|
7512
|
+
hasPagination
|
|
7513
|
+
}
|
|
7514
|
+
),
|
|
7515
|
+
showToolbar && isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EditorHeader, { editor, variant })
|
|
7114
7516
|
] }) }) });
|
|
7115
7517
|
if (hasVariables) {
|
|
7116
|
-
return /* @__PURE__ */ (0,
|
|
7518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(VariableProvider, { variables, resolveVariable, children: editorContent });
|
|
7117
7519
|
}
|
|
7118
7520
|
return editorContent;
|
|
7119
7521
|
};
|
|
7120
|
-
var EditorContentArea = ({
|
|
7522
|
+
var EditorContentArea = ({
|
|
7523
|
+
variant,
|
|
7524
|
+
variables,
|
|
7525
|
+
hasPagination
|
|
7526
|
+
}) => {
|
|
7121
7527
|
const styles = (0, import_theme9.editorBasic)({ variant });
|
|
7122
|
-
const { editor } = (0,
|
|
7528
|
+
const { editor } = (0, import_react60.useContext)(import_react59.EditorContext);
|
|
7123
7529
|
const { isDragging } = useUiEditorState(editor);
|
|
7124
7530
|
useScrollToHash();
|
|
7125
|
-
const handleKeyDown = (0,
|
|
7531
|
+
const handleKeyDown = (0, import_react60.useCallback)(
|
|
7126
7532
|
(e) => {
|
|
7127
7533
|
if (!(editor == null ? void 0 : editor.isFocused)) return;
|
|
7128
7534
|
const isMod = e.metaKey || e.ctrlKey;
|
|
@@ -7161,33 +7567,34 @@ var EditorContentArea = ({ variant, variables }) => {
|
|
|
7161
7567
|
return null;
|
|
7162
7568
|
}
|
|
7163
7569
|
const isEditable = editor.isEditable;
|
|
7570
|
+
const contentClassName = hasPagination ? "w-full min-w-0 h-auto min-h-0" : styles.content();
|
|
7164
7571
|
return (
|
|
7165
7572
|
// biome-ignore lint/a11y/noStaticElementInteractions: Wrapper intercepts keyboard shortcuts to prevent propagation
|
|
7166
|
-
/* @__PURE__ */ (0,
|
|
7167
|
-
/* @__PURE__ */ (0,
|
|
7168
|
-
|
|
7573
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: styles.wrapper(), onKeyDown: handleKeyDown, children: [
|
|
7574
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
7575
|
+
import_react59.EditorContent,
|
|
7169
7576
|
{
|
|
7170
7577
|
editor,
|
|
7171
7578
|
role: "presentation",
|
|
7172
|
-
className:
|
|
7579
|
+
className: contentClassName,
|
|
7173
7580
|
style: {
|
|
7174
7581
|
cursor: isDragging ? "grabbing" : "auto"
|
|
7175
7582
|
},
|
|
7176
7583
|
children: [
|
|
7177
|
-
isEditable && /* @__PURE__ */ (0,
|
|
7178
|
-
isEditable && variables && variables.length > 0 && /* @__PURE__ */ (0,
|
|
7584
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SlashDropdownMenu, {}),
|
|
7585
|
+
isEditable && variables && variables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(VariableSuggestion, { editor, variables })
|
|
7179
7586
|
]
|
|
7180
7587
|
}
|
|
7181
7588
|
),
|
|
7182
|
-
isEditable && /* @__PURE__ */ (0,
|
|
7183
|
-
isEditable && /* @__PURE__ */ (0,
|
|
7589
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BubbleMenu, { editor }),
|
|
7590
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkBubble, { editor })
|
|
7184
7591
|
] })
|
|
7185
7592
|
);
|
|
7186
7593
|
};
|
|
7187
7594
|
function LoadingSpinner({ text = "Connecting..." }) {
|
|
7188
7595
|
const styles = (0, import_theme9.editorSpinner)();
|
|
7189
|
-
return /* @__PURE__ */ (0,
|
|
7190
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: styles.content(), children: [
|
|
7597
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
7191
7598
|
"svg",
|
|
7192
7599
|
{
|
|
7193
7600
|
className: styles.svg(),
|
|
@@ -7195,9 +7602,9 @@ function LoadingSpinner({ text = "Connecting..." }) {
|
|
|
7195
7602
|
fill: "none",
|
|
7196
7603
|
viewBox: "0 0 24 24",
|
|
7197
7604
|
children: [
|
|
7198
|
-
/* @__PURE__ */ (0,
|
|
7199
|
-
/* @__PURE__ */ (0,
|
|
7200
|
-
/* @__PURE__ */ (0,
|
|
7605
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("title", { children: "Loading Spinner" }),
|
|
7606
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
|
|
7607
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7201
7608
|
"path",
|
|
7202
7609
|
{
|
|
7203
7610
|
className: styles.path(),
|
|
@@ -7207,12 +7614,13 @@ function LoadingSpinner({ text = "Connecting..." }) {
|
|
|
7207
7614
|
]
|
|
7208
7615
|
}
|
|
7209
7616
|
),
|
|
7210
|
-
/* @__PURE__ */ (0,
|
|
7617
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: styles.text(), children: text })
|
|
7211
7618
|
] }) });
|
|
7212
7619
|
}
|
|
7213
7620
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7214
7621
|
0 && (module.exports = {
|
|
7215
7622
|
CalloutNode,
|
|
7623
|
+
CollaborationProvider,
|
|
7216
7624
|
Editor,
|
|
7217
7625
|
EditorFileProvider,
|
|
7218
7626
|
ImageNode,
|
|
@@ -7226,12 +7634,17 @@ function LoadingSpinner({ text = "Connecting..." }) {
|
|
|
7226
7634
|
VariableSuggestion,
|
|
7227
7635
|
convertFileToBase64,
|
|
7228
7636
|
extractVariablesFromContent,
|
|
7637
|
+
generateColorFromId,
|
|
7229
7638
|
getExtensions,
|
|
7230
7639
|
handleImageUpload,
|
|
7231
7640
|
isAllowedUri,
|
|
7232
7641
|
sanitizeUrl,
|
|
7642
|
+
useCollaboration,
|
|
7643
|
+
useCollaborationRequired,
|
|
7644
|
+
useDocumentVisibility,
|
|
7233
7645
|
useEditorFile,
|
|
7234
7646
|
useEditorFileRequired,
|
|
7647
|
+
useIdle,
|
|
7235
7648
|
useVariables,
|
|
7236
7649
|
useVariablesWithFallback
|
|
7237
7650
|
});
|