@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/chunk-TAM3VMJT.mjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/toc/messages.ts
|
|
4
|
-
import { defineMessages } from "react-intl";
|
|
5
|
-
var messages = defineMessages({
|
|
6
|
-
title: {
|
|
7
|
-
id: "editor.toc.title",
|
|
8
|
-
defaultMessage: "Table of Contents",
|
|
9
|
-
description: "Title of the table of contents"
|
|
10
|
-
},
|
|
11
|
-
save: {
|
|
12
|
-
id: "editor.toc.save",
|
|
13
|
-
defaultMessage: "Save",
|
|
14
|
-
description: "Save button label"
|
|
15
|
-
},
|
|
16
|
-
cancel: {
|
|
17
|
-
id: "editor.toc.cancel",
|
|
18
|
-
defaultMessage: "Cancel",
|
|
19
|
-
description: "Cancel button label"
|
|
20
|
-
},
|
|
21
|
-
empty_state: {
|
|
22
|
-
id: "editor.toc.empty_state",
|
|
23
|
-
defaultMessage: "No headings found. Add headings (H1-H6) to populate the table of contents.",
|
|
24
|
-
description: "Empty state when no headings are present"
|
|
25
|
-
},
|
|
26
|
-
empty_heading: {
|
|
27
|
-
id: "editor.toc.empty_heading",
|
|
28
|
-
defaultMessage: "(Empty heading)",
|
|
29
|
-
description: "Placeholder for empty heading text"
|
|
30
|
-
},
|
|
31
|
-
settings: {
|
|
32
|
-
id: "editor.toc.settings",
|
|
33
|
-
defaultMessage: "Settings",
|
|
34
|
-
description: "Settings button label"
|
|
35
|
-
},
|
|
36
|
-
min_level: {
|
|
37
|
-
id: "editor.toc.min_level",
|
|
38
|
-
defaultMessage: "Minimum level",
|
|
39
|
-
description: "Minimum heading level setting"
|
|
40
|
-
},
|
|
41
|
-
max_level: {
|
|
42
|
-
id: "editor.toc.max_level",
|
|
43
|
-
defaultMessage: "Maximum level",
|
|
44
|
-
description: "Maximum heading level setting"
|
|
45
|
-
},
|
|
46
|
-
numbered: {
|
|
47
|
-
id: "editor.toc.numbered",
|
|
48
|
-
defaultMessage: "Numbering",
|
|
49
|
-
description: "Numbering toggle label"
|
|
50
|
-
},
|
|
51
|
-
numbered_hint: {
|
|
52
|
-
id: "editor.toc.numbered_hint",
|
|
53
|
-
defaultMessage: "Show hierarchical numbering (1, 1.1, 1.1.1)",
|
|
54
|
-
description: "Hint for numbering toggle"
|
|
55
|
-
},
|
|
56
|
-
style: {
|
|
57
|
-
id: "editor.toc.style",
|
|
58
|
-
defaultMessage: "Style",
|
|
59
|
-
description: "Style setting label"
|
|
60
|
-
},
|
|
61
|
-
style_default: {
|
|
62
|
-
id: "editor.toc.style_default",
|
|
63
|
-
defaultMessage: "Default",
|
|
64
|
-
description: "Default style option"
|
|
65
|
-
},
|
|
66
|
-
style_flat: {
|
|
67
|
-
id: "editor.toc.style_flat",
|
|
68
|
-
defaultMessage: "Flat",
|
|
69
|
-
description: "Flat style option"
|
|
70
|
-
},
|
|
71
|
-
style_compact: {
|
|
72
|
-
id: "editor.toc.style_compact",
|
|
73
|
-
defaultMessage: "Compact",
|
|
74
|
-
description: "Compact style option"
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
messages
|
|
80
|
-
};
|
package/dist/chunk-TDFS3DCZ.mjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/use-floating-toolbar-visibility.ts
|
|
4
|
-
import { NodeSelection } from "@tiptap/pm/state";
|
|
5
|
-
import { isNodeSelection } from "@tiptap/react";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
var HIDE_FLOATING_META = "hideFloatingToolbar";
|
|
8
|
-
function useFloatingToolbarVisibility(params) {
|
|
9
|
-
const { editor, isSelectionValid, extraHideWhen = false } = params;
|
|
10
|
-
const [shouldShow, setShouldShow] = React.useState(false);
|
|
11
|
-
const hideRef = React.useRef(false);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
if (!editor) return;
|
|
14
|
-
const onTx = ({ transaction }) => {
|
|
15
|
-
if (transaction.getMeta(HIDE_FLOATING_META)) {
|
|
16
|
-
hideRef.current = true;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
editor.on("transaction", onTx);
|
|
20
|
-
return () => {
|
|
21
|
-
editor.off("transaction", onTx);
|
|
22
|
-
};
|
|
23
|
-
}, [editor]);
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
if (!editor) return;
|
|
26
|
-
const dom = editor.view.dom;
|
|
27
|
-
const onPointerDown = (e) => {
|
|
28
|
-
const sel = editor.state.selection;
|
|
29
|
-
if (!(sel instanceof NodeSelection)) return;
|
|
30
|
-
const nodeDom = editor.view.nodeDOM(sel.from);
|
|
31
|
-
if (!nodeDom) return;
|
|
32
|
-
if (nodeDom.contains(e.target)) {
|
|
33
|
-
hideRef.current = false;
|
|
34
|
-
const valid = isSelectionValid(editor, sel);
|
|
35
|
-
setShouldShow(valid && !extraHideWhen);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
dom.addEventListener("pointerdown", onPointerDown, { capture: true });
|
|
39
|
-
return () => dom.removeEventListener("pointerdown", onPointerDown, {
|
|
40
|
-
capture: true
|
|
41
|
-
});
|
|
42
|
-
}, [editor, extraHideWhen, isSelectionValid]);
|
|
43
|
-
React.useEffect(() => {
|
|
44
|
-
if (!editor) return;
|
|
45
|
-
const handleSelectionUpdate = () => {
|
|
46
|
-
const { selection } = editor.state;
|
|
47
|
-
const valid = isSelectionValid(editor, selection);
|
|
48
|
-
if (extraHideWhen || isNodeSelection(selection) && hideRef.current) {
|
|
49
|
-
setShouldShow(false);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
setShouldShow(valid);
|
|
53
|
-
};
|
|
54
|
-
handleSelectionUpdate();
|
|
55
|
-
editor.on("selectionUpdate", handleSelectionUpdate);
|
|
56
|
-
return () => {
|
|
57
|
-
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
58
|
-
};
|
|
59
|
-
}, [editor, extraHideWhen, isSelectionValid]);
|
|
60
|
-
return { shouldShow };
|
|
61
|
-
}
|
|
62
|
-
var selectNodeAndHideFloating = (editor, pos) => {
|
|
63
|
-
if (!editor) return;
|
|
64
|
-
const { state, view } = editor;
|
|
65
|
-
view.dispatch(
|
|
66
|
-
state.tr.setSelection(NodeSelection.create(state.doc, pos)).setMeta(HIDE_FLOATING_META, true)
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
var markHideFloatingOnNext = (editor) => {
|
|
70
|
-
if (!editor) return;
|
|
71
|
-
editor.view.dispatch(editor.state.tr.setMeta(HIDE_FLOATING_META, true));
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
HIDE_FLOATING_META,
|
|
76
|
-
useFloatingToolbarVisibility,
|
|
77
|
-
selectNodeAndHideFloating,
|
|
78
|
-
markHideFloatingOnNext
|
|
79
|
-
};
|
package/dist/chunk-TLM5ALHZ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";
|
package/dist/chunk-TZQQ6C2Q.mjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/utils/index.ts
|
|
4
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
5
|
-
var handleImageUpload = async (file, onProgress, abortSignal) => {
|
|
6
|
-
if (!file) {
|
|
7
|
-
throw new Error("No file provided");
|
|
8
|
-
}
|
|
9
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
10
|
-
throw new Error(
|
|
11
|
-
`File size exceeds maximum allowed (${MAX_FILE_SIZE / (1024 * 1024)}MB)`
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
for (let progress = 0; progress <= 100; progress += 10) {
|
|
15
|
-
if (abortSignal == null ? void 0 : abortSignal.aborted) {
|
|
16
|
-
throw new Error("Upload cancelled");
|
|
17
|
-
}
|
|
18
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
19
|
-
onProgress == null ? void 0 : onProgress({ progress });
|
|
20
|
-
}
|
|
21
|
-
return "/images/placeholder-image.png";
|
|
22
|
-
};
|
|
23
|
-
var convertFileToBase64 = (file, abortSignal) => {
|
|
24
|
-
if (!file) {
|
|
25
|
-
return Promise.reject(new Error("No file provided"));
|
|
26
|
-
}
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
const reader = new FileReader();
|
|
29
|
-
const abortHandler = () => {
|
|
30
|
-
reader.abort();
|
|
31
|
-
reject(new Error("Upload cancelled"));
|
|
32
|
-
};
|
|
33
|
-
if (abortSignal) {
|
|
34
|
-
abortSignal.addEventListener("abort", abortHandler);
|
|
35
|
-
}
|
|
36
|
-
reader.onloadend = () => {
|
|
37
|
-
if (abortSignal) {
|
|
38
|
-
abortSignal.removeEventListener("abort", abortHandler);
|
|
39
|
-
}
|
|
40
|
-
if (typeof reader.result === "string") {
|
|
41
|
-
resolve(reader.result);
|
|
42
|
-
} else {
|
|
43
|
-
reject(new Error("Failed to convert File to base64"));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
reader.onerror = (error) => reject(new Error(`File reading error: ${error}`));
|
|
47
|
-
reader.readAsDataURL(file);
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
var ATTR_WHITESPACE = (
|
|
51
|
-
// eslint-disable-next-line no-control-regex
|
|
52
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
|
|
53
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
54
|
-
);
|
|
55
|
-
function isAllowedUri(uri, protocols) {
|
|
56
|
-
const allowedProtocols = [
|
|
57
|
-
"http",
|
|
58
|
-
"https",
|
|
59
|
-
"ftp",
|
|
60
|
-
"ftps",
|
|
61
|
-
"mailto",
|
|
62
|
-
"tel",
|
|
63
|
-
"callto",
|
|
64
|
-
"sms",
|
|
65
|
-
"cid",
|
|
66
|
-
"xmpp"
|
|
67
|
-
];
|
|
68
|
-
if (protocols) {
|
|
69
|
-
for (const protocol of protocols) {
|
|
70
|
-
const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
|
|
71
|
-
if (nextProtocol) {
|
|
72
|
-
allowedProtocols.push(nextProtocol);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return !uri || uri.replace(ATTR_WHITESPACE, "").match(
|
|
77
|
-
new RegExp(
|
|
78
|
-
// eslint-disable-next-line no-useless-escape
|
|
79
|
-
`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
80
|
-
"i"
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
function sanitizeUrl(inputUrl, baseUrl, protocols) {
|
|
85
|
-
try {
|
|
86
|
-
const url = new URL(inputUrl, baseUrl);
|
|
87
|
-
if (isAllowedUri(url.href, protocols)) {
|
|
88
|
-
return url.href;
|
|
89
|
-
}
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
return "#";
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export {
|
|
96
|
-
MAX_FILE_SIZE,
|
|
97
|
-
handleImageUpload,
|
|
98
|
-
convertFileToBase64,
|
|
99
|
-
isAllowedUri,
|
|
100
|
-
sanitizeUrl
|
|
101
|
-
};
|
package/dist/chunk-U5XAL46P.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/selection/index.ts
|
|
4
|
-
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
5
|
-
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
6
|
-
import { Extension, isNodeSelection } from "@tiptap/react";
|
|
7
|
-
var Selection = Extension.create({
|
|
8
|
-
name: "selection",
|
|
9
|
-
addProseMirrorPlugins() {
|
|
10
|
-
const { editor } = this;
|
|
11
|
-
return [
|
|
12
|
-
new Plugin({
|
|
13
|
-
key: new PluginKey("selection"),
|
|
14
|
-
props: {
|
|
15
|
-
decorations(state) {
|
|
16
|
-
if (state.selection.empty) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
if (editor.isFocused === true || !editor.isEditable) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
if (isNodeSelection(state.selection)) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return DecorationSet.create(state.doc, [
|
|
26
|
-
Decoration.inline(state.selection.from, state.selection.to, {
|
|
27
|
-
class: "selection"
|
|
28
|
-
})
|
|
29
|
-
]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
Selection
|
|
39
|
-
};
|
package/dist/chunk-UJ4BNZ63.mjs
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useTiptapEditor
|
|
4
|
-
} from "./chunk-P55PLOHR.mjs";
|
|
5
|
-
|
|
6
|
-
// src/ui/color-highlight-button/use-color-highlight.ts
|
|
7
|
-
import { isMarkInSchema, isNodeTypeSelected } from "@kopexa/editor-utils";
|
|
8
|
-
import { HighlighterIcon } from "@kopexa/icons";
|
|
9
|
-
import { useIsMobile } from "@kopexa/use-is-mobile";
|
|
10
|
-
import * as React from "react";
|
|
11
|
-
import { useHotkeys } from "react-hotkeys-hook";
|
|
12
|
-
var COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
|
|
13
|
-
var HIGHLIGHT_COLORS = [
|
|
14
|
-
{
|
|
15
|
-
label: "Default background",
|
|
16
|
-
value: "var(--tt-bg-color)",
|
|
17
|
-
border: "var(--tt-bg-color-contrast)"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: "Gray background",
|
|
21
|
-
value: "var(--tt-color-highlight-gray)",
|
|
22
|
-
border: "var(--tt-color-highlight-gray-contrast)"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
label: "Brown background",
|
|
26
|
-
value: "var(--tt-color-highlight-brown)",
|
|
27
|
-
border: "var(--tt-color-highlight-brown-contrast)"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: "Orange background",
|
|
31
|
-
value: "var(--tt-color-highlight-orange)",
|
|
32
|
-
border: "var(--tt-color-highlight-orange-contrast)"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: "Yellow background",
|
|
36
|
-
value: "var(--tt-color-highlight-yellow)",
|
|
37
|
-
border: "var(--tt-color-highlight-yellow-contrast)"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "Green background",
|
|
41
|
-
value: "var(--tt-color-highlight-green)",
|
|
42
|
-
border: "var(--tt-color-highlight-green-contrast)"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
label: "Blue background",
|
|
46
|
-
value: "var(--tt-color-highlight-blue)",
|
|
47
|
-
border: "var(--tt-color-highlight-blue-contrast)"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: "Purple background",
|
|
51
|
-
value: "var(--tt-color-highlight-purple)",
|
|
52
|
-
border: "var(--tt-color-highlight-purple-contrast)"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
label: "Pink background",
|
|
56
|
-
value: "var(--tt-color-highlight-pink)",
|
|
57
|
-
border: "var(--tt-color-highlight-pink-contrast)"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: "Red background",
|
|
61
|
-
value: "var(--tt-color-highlight-red)",
|
|
62
|
-
border: "var(--tt-color-highlight-red-contrast)"
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
function pickHighlightColorsByValue(values) {
|
|
66
|
-
const colorMap = new Map(
|
|
67
|
-
HIGHLIGHT_COLORS.map((color) => [color.value, color])
|
|
68
|
-
);
|
|
69
|
-
return values.map((value) => colorMap.get(value)).filter((color) => !!color);
|
|
70
|
-
}
|
|
71
|
-
function canColorHighlight(editor) {
|
|
72
|
-
if (!editor || !editor.isEditable) return false;
|
|
73
|
-
if (!isMarkInSchema("highlight", editor) || isNodeTypeSelected(editor, ["image"]))
|
|
74
|
-
return false;
|
|
75
|
-
return editor.can().setMark("highlight");
|
|
76
|
-
}
|
|
77
|
-
function isColorHighlightActive(editor, highlightColor) {
|
|
78
|
-
if (!editor || !editor.isEditable) return false;
|
|
79
|
-
return highlightColor ? editor.isActive("highlight", { color: highlightColor }) : editor.isActive("highlight");
|
|
80
|
-
}
|
|
81
|
-
function removeHighlight(editor) {
|
|
82
|
-
if (!editor || !editor.isEditable) return false;
|
|
83
|
-
if (!canColorHighlight(editor)) return false;
|
|
84
|
-
return editor.chain().focus().unsetMark("highlight").run();
|
|
85
|
-
}
|
|
86
|
-
function shouldShowButton(props) {
|
|
87
|
-
const { editor, hideWhenUnavailable } = props;
|
|
88
|
-
if (!editor || !editor.isEditable) return false;
|
|
89
|
-
if (!isMarkInSchema("highlight", editor)) return false;
|
|
90
|
-
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
91
|
-
return canColorHighlight(editor);
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
function useColorHighlight(config) {
|
|
96
|
-
const {
|
|
97
|
-
editor: providedEditor,
|
|
98
|
-
label,
|
|
99
|
-
highlightColor,
|
|
100
|
-
hideWhenUnavailable = false,
|
|
101
|
-
onApplied
|
|
102
|
-
} = config;
|
|
103
|
-
const { editor } = useTiptapEditor(providedEditor);
|
|
104
|
-
const isMobile = useIsMobile();
|
|
105
|
-
const [isVisible, setIsVisible] = React.useState(true);
|
|
106
|
-
const canColorHighlightState = canColorHighlight(editor);
|
|
107
|
-
const isActive = isColorHighlightActive(editor, highlightColor);
|
|
108
|
-
React.useEffect(() => {
|
|
109
|
-
if (!editor) return;
|
|
110
|
-
const handleSelectionUpdate = () => {
|
|
111
|
-
setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
|
|
112
|
-
};
|
|
113
|
-
handleSelectionUpdate();
|
|
114
|
-
editor.on("selectionUpdate", handleSelectionUpdate);
|
|
115
|
-
return () => {
|
|
116
|
-
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
117
|
-
};
|
|
118
|
-
}, [editor, hideWhenUnavailable]);
|
|
119
|
-
const handleColorHighlight = React.useCallback(() => {
|
|
120
|
-
if (!editor || !canColorHighlightState || !highlightColor || !label)
|
|
121
|
-
return false;
|
|
122
|
-
if (editor.state.storedMarks) {
|
|
123
|
-
const highlightMarkType = editor.schema.marks.highlight;
|
|
124
|
-
if (highlightMarkType) {
|
|
125
|
-
editor.view.dispatch(
|
|
126
|
-
editor.state.tr.removeStoredMark(highlightMarkType)
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
const success = editor.chain().focus().toggleMark("highlight", { color: highlightColor }).run();
|
|
132
|
-
if (success) {
|
|
133
|
-
onApplied == null ? void 0 : onApplied({ color: highlightColor, label });
|
|
134
|
-
}
|
|
135
|
-
return success;
|
|
136
|
-
}, 0);
|
|
137
|
-
}, [canColorHighlightState, highlightColor, editor, label, onApplied]);
|
|
138
|
-
const handleRemoveHighlight = React.useCallback(() => {
|
|
139
|
-
const success = removeHighlight(editor);
|
|
140
|
-
if (success) {
|
|
141
|
-
onApplied == null ? void 0 : onApplied({ color: "", label: "Remove highlight" });
|
|
142
|
-
}
|
|
143
|
-
return success;
|
|
144
|
-
}, [editor, onApplied]);
|
|
145
|
-
useHotkeys(
|
|
146
|
-
COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
147
|
-
(event) => {
|
|
148
|
-
event.preventDefault();
|
|
149
|
-
handleColorHighlight();
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
enabled: isVisible && canColorHighlightState,
|
|
153
|
-
enableOnContentEditable: !isMobile,
|
|
154
|
-
enableOnFormTags: true
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
return {
|
|
158
|
-
isVisible,
|
|
159
|
-
isActive,
|
|
160
|
-
handleColorHighlight,
|
|
161
|
-
handleRemoveHighlight,
|
|
162
|
-
canColorHighlight: canColorHighlightState,
|
|
163
|
-
label: label || `Highlight`,
|
|
164
|
-
shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
165
|
-
Icon: HighlighterIcon
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export {
|
|
170
|
-
COLOR_HIGHLIGHT_SHORTCUT_KEY,
|
|
171
|
-
HIGHLIGHT_COLORS,
|
|
172
|
-
pickHighlightColorsByValue,
|
|
173
|
-
canColorHighlight,
|
|
174
|
-
isColorHighlightActive,
|
|
175
|
-
removeHighlight,
|
|
176
|
-
shouldShowButton,
|
|
177
|
-
useColorHighlight
|
|
178
|
-
};
|
package/dist/chunk-UVHVCION.mjs
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
messages
|
|
4
|
-
} from "./chunk-FRJX2F4T.mjs";
|
|
5
|
-
|
|
6
|
-
// src/extensions/math/math-block-view.tsx
|
|
7
|
-
import { Button, IconButton } from "@kopexa/button";
|
|
8
|
-
import { Dialog } from "@kopexa/dialog";
|
|
9
|
-
import { EditIcon } from "@kopexa/icons";
|
|
10
|
-
import { Label } from "@kopexa/label";
|
|
11
|
-
import {
|
|
12
|
-
NodeViewWrapper,
|
|
13
|
-
useEditorState
|
|
14
|
-
} from "@tiptap/react";
|
|
15
|
-
import katex from "katex";
|
|
16
|
-
import "katex/dist/katex.min.css";
|
|
17
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
18
|
-
import { useIntl } from "react-intl";
|
|
19
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
-
function MathBlockView({ editor, node, getPos }) {
|
|
21
|
-
const intl = useIntl();
|
|
22
|
-
const attrs = node.attrs;
|
|
23
|
-
const { latex = "" } = attrs;
|
|
24
|
-
const isEditable = useEditorState({
|
|
25
|
-
editor,
|
|
26
|
-
selector: ({ editor: e }) => {
|
|
27
|
-
var _a;
|
|
28
|
-
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
32
|
-
const [localLatex, setLocalLatex] = useState(latex);
|
|
33
|
-
const [error, setError] = useState(null);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (isOpen) {
|
|
36
|
-
setLocalLatex(latex);
|
|
37
|
-
setError(null);
|
|
38
|
-
}
|
|
39
|
-
}, [isOpen, latex]);
|
|
40
|
-
const renderedHtml = useMemo(() => {
|
|
41
|
-
if (!latex) return null;
|
|
42
|
-
try {
|
|
43
|
-
return katex.renderToString(latex, {
|
|
44
|
-
throwOnError: false,
|
|
45
|
-
displayMode: true,
|
|
46
|
-
output: "html"
|
|
47
|
-
});
|
|
48
|
-
} catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}, [latex]);
|
|
52
|
-
const previewHtml = useMemo(() => {
|
|
53
|
-
if (!localLatex) return null;
|
|
54
|
-
try {
|
|
55
|
-
setError(null);
|
|
56
|
-
return katex.renderToString(localLatex, {
|
|
57
|
-
throwOnError: true,
|
|
58
|
-
displayMode: true,
|
|
59
|
-
output: "html"
|
|
60
|
-
});
|
|
61
|
-
} catch (_e) {
|
|
62
|
-
setError(intl.formatMessage(messages.invalid_latex));
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}, [localLatex, intl]);
|
|
66
|
-
const handleSave = useCallback(() => {
|
|
67
|
-
const pos = getPos();
|
|
68
|
-
if (pos === void 0) return;
|
|
69
|
-
editor.view.dispatch(
|
|
70
|
-
editor.state.tr.setNodeMarkup(pos, void 0, { latex: localLatex })
|
|
71
|
-
);
|
|
72
|
-
setIsOpen(false);
|
|
73
|
-
}, [editor, localLatex, getPos]);
|
|
74
|
-
const handleCancel = useCallback(() => {
|
|
75
|
-
setLocalLatex(latex);
|
|
76
|
-
setError(null);
|
|
77
|
-
setIsOpen(false);
|
|
78
|
-
}, [latex]);
|
|
79
|
-
const handleOpenEditor = useCallback(
|
|
80
|
-
(e) => {
|
|
81
|
-
e.stopPropagation();
|
|
82
|
-
e.preventDefault();
|
|
83
|
-
if (isEditable) {
|
|
84
|
-
setIsOpen(true);
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
[isEditable]
|
|
88
|
-
);
|
|
89
|
-
const isEmpty = !latex;
|
|
90
|
-
return /* @__PURE__ */ jsxs(
|
|
91
|
-
NodeViewWrapper,
|
|
92
|
-
{
|
|
93
|
-
className: "my-4 relative group",
|
|
94
|
-
"data-type": "math-block",
|
|
95
|
-
"data-latex": latex,
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx(
|
|
98
|
-
"button",
|
|
99
|
-
{
|
|
100
|
-
type: "button",
|
|
101
|
-
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",
|
|
102
|
-
onClick: handleOpenEditor,
|
|
103
|
-
children: isEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
104
|
-
/* @__PURE__ */ jsx("span", { className: "text-lg font-serif", children: "\u2211" }),
|
|
105
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: intl.formatMessage(messages.empty_formula) })
|
|
106
|
-
] }) : renderedHtml ? /* @__PURE__ */ jsx(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
className: "katex-display",
|
|
110
|
-
dangerouslySetInnerHTML: { __html: renderedHtml }
|
|
111
|
-
}
|
|
112
|
-
) : /* @__PURE__ */ jsx("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages.invalid_latex) })
|
|
113
|
-
}
|
|
114
|
-
),
|
|
115
|
-
isEditable && !isEmpty && /* @__PURE__ */ jsx(
|
|
116
|
-
IconButton,
|
|
117
|
-
{
|
|
118
|
-
size: "sm",
|
|
119
|
-
variant: "ghost",
|
|
120
|
-
className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
121
|
-
"aria-label": intl.formatMessage(messages.edit),
|
|
122
|
-
onClick: handleOpenEditor,
|
|
123
|
-
children: /* @__PURE__ */ jsx(EditIcon, { className: "size-3.5" })
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
127
|
-
/* @__PURE__ */ jsx(Dialog.Header, { children: /* @__PURE__ */ jsx(Dialog.Title, { children: intl.formatMessage(messages.title) }) }),
|
|
128
|
-
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
129
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
130
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: intl.formatMessage(messages.latex_input) }),
|
|
131
|
-
/* @__PURE__ */ jsx(
|
|
132
|
-
"textarea",
|
|
133
|
-
{
|
|
134
|
-
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",
|
|
135
|
-
value: localLatex,
|
|
136
|
-
onChange: (e) => setLocalLatex(e.target.value),
|
|
137
|
-
placeholder: intl.formatMessage(messages.latex_placeholder),
|
|
138
|
-
spellCheck: false
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
error && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error })
|
|
142
|
-
] }),
|
|
143
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
144
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: intl.formatMessage(messages.preview) }),
|
|
145
|
-
/* @__PURE__ */ jsx("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ jsx(
|
|
146
|
-
"div",
|
|
147
|
-
{
|
|
148
|
-
className: "katex-display",
|
|
149
|
-
dangerouslySetInnerHTML: { __html: previewHtml }
|
|
150
|
-
}
|
|
151
|
-
) : localLatex ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.invalid_latex) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.latex_placeholder) }) })
|
|
152
|
-
] })
|
|
153
|
-
] }) }),
|
|
154
|
-
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
155
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
|
|
156
|
-
/* @__PURE__ */ jsx(Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages.save) })
|
|
157
|
-
] })
|
|
158
|
-
] }) })
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
var math_block_view_default = MathBlockView;
|
|
164
|
-
|
|
165
|
-
export {
|
|
166
|
-
MathBlockView,
|
|
167
|
-
math_block_view_default
|
|
168
|
-
};
|