@kopexa/tiptap 17.6.18 → 17.7.2
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 +1478 -786
- package/dist/index.mjs +7987 -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
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/ui/text-align-button/index.tsx
|
|
22
|
-
var text_align_button_exports = {};
|
|
23
|
-
__export(text_align_button_exports, {
|
|
24
|
-
TEXT_ALIGN_SHORTCUT_KEYS: () => TEXT_ALIGN_SHORTCUT_KEYS,
|
|
25
|
-
TextAlignButton: () => TextAlignButton,
|
|
26
|
-
canSetTextAlign: () => canSetTextAlign,
|
|
27
|
-
hasSetTextAlign: () => hasSetTextAlign,
|
|
28
|
-
isTextAlignActive: () => isTextAlignActive,
|
|
29
|
-
setTextAlign: () => setTextAlign,
|
|
30
|
-
shouldShowButton: () => shouldShowButton,
|
|
31
|
-
textAlignIcons: () => textAlignIcons,
|
|
32
|
-
textAlignLabels: () => textAlignLabels,
|
|
33
|
-
useTextAlign: () => useTextAlign
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(text_align_button_exports);
|
|
36
|
-
|
|
37
|
-
// src/ui/text-align-button/text-align-button.tsx
|
|
38
|
-
var import_button = require("@kopexa/button");
|
|
39
|
-
var import_react4 = require("react");
|
|
40
|
-
|
|
41
|
-
// src/hooks/use-tiptap-editor.ts
|
|
42
|
-
var import_react = require("@tiptap/react");
|
|
43
|
-
var import_react2 = require("react");
|
|
44
|
-
function useTiptapEditor(providedEditor) {
|
|
45
|
-
const { editor: coreEditor } = (0, import_react.useCurrentEditor)();
|
|
46
|
-
const mainEditor = (0, import_react2.useMemo)(
|
|
47
|
-
() => providedEditor || coreEditor,
|
|
48
|
-
[providedEditor, coreEditor]
|
|
49
|
-
);
|
|
50
|
-
const editorState = (0, import_react.useEditorState)({
|
|
51
|
-
editor: mainEditor,
|
|
52
|
-
selector(context) {
|
|
53
|
-
if (!context.editor) {
|
|
54
|
-
return {
|
|
55
|
-
editor: null,
|
|
56
|
-
editorState: void 0,
|
|
57
|
-
canCommand: void 0
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
editor: context.editor,
|
|
62
|
-
editorState: context.editor.state,
|
|
63
|
-
canCommand: context.editor.can
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return editorState || { editor: null };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/ui/text-align-button/use-text-align.ts
|
|
71
|
-
var import_editor_utils = require("@kopexa/editor-utils");
|
|
72
|
-
var import_icons = require("@kopexa/icons");
|
|
73
|
-
var import_react3 = require("react");
|
|
74
|
-
var TEXT_ALIGN_SHORTCUT_KEYS = {
|
|
75
|
-
left: "mod+shift+l",
|
|
76
|
-
center: "mod+shift+e",
|
|
77
|
-
right: "mod+shift+r",
|
|
78
|
-
justify: "mod+shift+j"
|
|
79
|
-
};
|
|
80
|
-
var textAlignIcons = {
|
|
81
|
-
left: import_icons.AlignLeftIcon,
|
|
82
|
-
center: import_icons.AlignCenterIcon,
|
|
83
|
-
right: import_icons.AlignRightIcon,
|
|
84
|
-
justify: import_icons.AlignJustifyIcon
|
|
85
|
-
};
|
|
86
|
-
var textAlignLabels = {
|
|
87
|
-
left: "Align left",
|
|
88
|
-
center: "Align center",
|
|
89
|
-
right: "Align right",
|
|
90
|
-
justify: "Align justify"
|
|
91
|
-
};
|
|
92
|
-
function canSetTextAlign(editor, align) {
|
|
93
|
-
if (!editor || !editor.isEditable) return false;
|
|
94
|
-
if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign") || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
|
|
95
|
-
return false;
|
|
96
|
-
return editor.can().setTextAlign(align);
|
|
97
|
-
}
|
|
98
|
-
function hasSetTextAlign(commands) {
|
|
99
|
-
return "setTextAlign" in commands;
|
|
100
|
-
}
|
|
101
|
-
function isTextAlignActive(editor, align) {
|
|
102
|
-
if (!editor || !editor.isEditable) return false;
|
|
103
|
-
return editor.isActive({ textAlign: align });
|
|
104
|
-
}
|
|
105
|
-
function setTextAlign(editor, align) {
|
|
106
|
-
if (!editor || !editor.isEditable) return false;
|
|
107
|
-
if (!canSetTextAlign(editor, align)) return false;
|
|
108
|
-
const chain = editor.chain().focus();
|
|
109
|
-
if (hasSetTextAlign(chain)) {
|
|
110
|
-
return chain.setTextAlign(align).run();
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
function shouldShowButton(props) {
|
|
115
|
-
const { editor, hideWhenUnavailable, align } = props;
|
|
116
|
-
if (!editor || !editor.isEditable) return false;
|
|
117
|
-
if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign")) return false;
|
|
118
|
-
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
119
|
-
return canSetTextAlign(editor, align);
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
function useTextAlign(config) {
|
|
124
|
-
const {
|
|
125
|
-
editor: providedEditor,
|
|
126
|
-
align,
|
|
127
|
-
hideWhenUnavailable = false,
|
|
128
|
-
onAligned
|
|
129
|
-
} = config;
|
|
130
|
-
const { editor } = useTiptapEditor(providedEditor);
|
|
131
|
-
const [isVisible, setIsVisible] = (0, import_react3.useState)(true);
|
|
132
|
-
const canAlign = canSetTextAlign(editor, align);
|
|
133
|
-
const isActive = isTextAlignActive(editor, align);
|
|
134
|
-
(0, import_react3.useEffect)(() => {
|
|
135
|
-
if (!editor) return;
|
|
136
|
-
const handleSelectionUpdate = () => {
|
|
137
|
-
setIsVisible(shouldShowButton({ editor, align, hideWhenUnavailable }));
|
|
138
|
-
};
|
|
139
|
-
handleSelectionUpdate();
|
|
140
|
-
editor.on("selectionUpdate", handleSelectionUpdate);
|
|
141
|
-
return () => {
|
|
142
|
-
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
143
|
-
};
|
|
144
|
-
}, [editor, hideWhenUnavailable, align]);
|
|
145
|
-
const handleTextAlign = (0, import_react3.useCallback)(() => {
|
|
146
|
-
if (!editor) return false;
|
|
147
|
-
const success = setTextAlign(editor, align);
|
|
148
|
-
if (success) {
|
|
149
|
-
onAligned == null ? void 0 : onAligned();
|
|
150
|
-
}
|
|
151
|
-
return success;
|
|
152
|
-
}, [editor, align, onAligned]);
|
|
153
|
-
return {
|
|
154
|
-
isVisible,
|
|
155
|
-
isActive,
|
|
156
|
-
handleTextAlign,
|
|
157
|
-
canAlign,
|
|
158
|
-
label: textAlignLabels[align],
|
|
159
|
-
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
160
|
-
Icon: textAlignIcons[align]
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/ui/text-align-button/text-align-button.tsx
|
|
165
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
166
|
-
var TextAlignButton = ({
|
|
167
|
-
editor: providedEditor,
|
|
168
|
-
align,
|
|
169
|
-
text,
|
|
170
|
-
hideWhenUnavailable = false,
|
|
171
|
-
onAligned,
|
|
172
|
-
showShortcut = false,
|
|
173
|
-
onClick,
|
|
174
|
-
children,
|
|
175
|
-
...buttonProps
|
|
176
|
-
}) => {
|
|
177
|
-
const { editor } = useTiptapEditor(providedEditor);
|
|
178
|
-
const {
|
|
179
|
-
isVisible,
|
|
180
|
-
handleTextAlign,
|
|
181
|
-
label,
|
|
182
|
-
canAlign,
|
|
183
|
-
isActive,
|
|
184
|
-
Icon,
|
|
185
|
-
shortcutKeys
|
|
186
|
-
} = useTextAlign({
|
|
187
|
-
editor,
|
|
188
|
-
align,
|
|
189
|
-
hideWhenUnavailable,
|
|
190
|
-
onAligned
|
|
191
|
-
});
|
|
192
|
-
const handleClick = (0, import_react4.useCallback)(
|
|
193
|
-
(e) => {
|
|
194
|
-
onClick == null ? void 0 : onClick(e);
|
|
195
|
-
if (e.defaultPrevented) return;
|
|
196
|
-
handleTextAlign();
|
|
197
|
-
},
|
|
198
|
-
[handleTextAlign, onClick]
|
|
199
|
-
);
|
|
200
|
-
if (!isVisible) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
-
import_button.IconButton,
|
|
205
|
-
{
|
|
206
|
-
type: "button",
|
|
207
|
-
disabled: canAlign,
|
|
208
|
-
variant: "ghost",
|
|
209
|
-
color: "default",
|
|
210
|
-
"data-active-state": isActive ? "on" : "off",
|
|
211
|
-
"data-disabled": canAlign,
|
|
212
|
-
tabIndex: -1,
|
|
213
|
-
"aria-label": label,
|
|
214
|
-
"aria-pressed": isActive,
|
|
215
|
-
tooltip: label,
|
|
216
|
-
shortcutKeys,
|
|
217
|
-
onClick: handleClick,
|
|
218
|
-
...buttonProps,
|
|
219
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {})
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
};
|
|
223
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
224
|
-
0 && (module.exports = {
|
|
225
|
-
TEXT_ALIGN_SHORTCUT_KEYS,
|
|
226
|
-
TextAlignButton,
|
|
227
|
-
canSetTextAlign,
|
|
228
|
-
hasSetTextAlign,
|
|
229
|
-
isTextAlignActive,
|
|
230
|
-
setTextAlign,
|
|
231
|
-
shouldShowButton,
|
|
232
|
-
textAlignIcons,
|
|
233
|
-
textAlignLabels,
|
|
234
|
-
useTextAlign
|
|
235
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../chunk-4ALV4UA5.mjs";
|
|
3
|
-
import {
|
|
4
|
-
TextAlignButton
|
|
5
|
-
} from "../../chunk-GYIYX2JH.mjs";
|
|
6
|
-
import {
|
|
7
|
-
TEXT_ALIGN_SHORTCUT_KEYS,
|
|
8
|
-
canSetTextAlign,
|
|
9
|
-
hasSetTextAlign,
|
|
10
|
-
isTextAlignActive,
|
|
11
|
-
setTextAlign,
|
|
12
|
-
shouldShowButton,
|
|
13
|
-
textAlignIcons,
|
|
14
|
-
textAlignLabels,
|
|
15
|
-
useTextAlign
|
|
16
|
-
} from "../../chunk-IQERE7KP.mjs";
|
|
17
|
-
import "../../chunk-P55PLOHR.mjs";
|
|
18
|
-
export {
|
|
19
|
-
TEXT_ALIGN_SHORTCUT_KEYS,
|
|
20
|
-
TextAlignButton,
|
|
21
|
-
canSetTextAlign,
|
|
22
|
-
hasSetTextAlign,
|
|
23
|
-
isTextAlignActive,
|
|
24
|
-
setTextAlign,
|
|
25
|
-
shouldShowButton,
|
|
26
|
-
textAlignIcons,
|
|
27
|
-
textAlignLabels,
|
|
28
|
-
useTextAlign
|
|
29
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ButtonProps } from '@kopexa/button';
|
|
3
|
-
import { UseTextAlignConfig } from './use-text-align.mjs';
|
|
4
|
-
import '@kopexa/icons';
|
|
5
|
-
import '@tiptap/react';
|
|
6
|
-
|
|
7
|
-
interface TextAlignButtonProps extends Omit<ButtonProps, "type">, UseTextAlignConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Optional text to display alongside the icon.
|
|
10
|
-
*/
|
|
11
|
-
text?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Optional show shortcut keys in the button.
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
showShortcut?: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare const TextAlignButton: ({ editor: providedEditor, align, text, hideWhenUnavailable, onAligned, showShortcut, onClick, children, ...buttonProps }: TextAlignButtonProps) => react_jsx_runtime.JSX.Element | null;
|
|
19
|
-
|
|
20
|
-
export { TextAlignButton, type TextAlignButtonProps };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ButtonProps } from '@kopexa/button';
|
|
3
|
-
import { UseTextAlignConfig } from './use-text-align.js';
|
|
4
|
-
import '@kopexa/icons';
|
|
5
|
-
import '@tiptap/react';
|
|
6
|
-
|
|
7
|
-
interface TextAlignButtonProps extends Omit<ButtonProps, "type">, UseTextAlignConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Optional text to display alongside the icon.
|
|
10
|
-
*/
|
|
11
|
-
text?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Optional show shortcut keys in the button.
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
showShortcut?: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare const TextAlignButton: ({ editor: providedEditor, align, text, hideWhenUnavailable, onAligned, showShortcut, onClick, children, ...buttonProps }: TextAlignButtonProps) => react_jsx_runtime.JSX.Element | null;
|
|
19
|
-
|
|
20
|
-
export { TextAlignButton, type TextAlignButtonProps };
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/ui/text-align-button/text-align-button.tsx
|
|
22
|
-
var text_align_button_exports = {};
|
|
23
|
-
__export(text_align_button_exports, {
|
|
24
|
-
TextAlignButton: () => TextAlignButton
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(text_align_button_exports);
|
|
27
|
-
var import_button = require("@kopexa/button");
|
|
28
|
-
var import_react4 = require("react");
|
|
29
|
-
|
|
30
|
-
// src/hooks/use-tiptap-editor.ts
|
|
31
|
-
var import_react = require("@tiptap/react");
|
|
32
|
-
var import_react2 = require("react");
|
|
33
|
-
function useTiptapEditor(providedEditor) {
|
|
34
|
-
const { editor: coreEditor } = (0, import_react.useCurrentEditor)();
|
|
35
|
-
const mainEditor = (0, import_react2.useMemo)(
|
|
36
|
-
() => providedEditor || coreEditor,
|
|
37
|
-
[providedEditor, coreEditor]
|
|
38
|
-
);
|
|
39
|
-
const editorState = (0, import_react.useEditorState)({
|
|
40
|
-
editor: mainEditor,
|
|
41
|
-
selector(context) {
|
|
42
|
-
if (!context.editor) {
|
|
43
|
-
return {
|
|
44
|
-
editor: null,
|
|
45
|
-
editorState: void 0,
|
|
46
|
-
canCommand: void 0
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
editor: context.editor,
|
|
51
|
-
editorState: context.editor.state,
|
|
52
|
-
canCommand: context.editor.can
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return editorState || { editor: null };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/ui/text-align-button/use-text-align.ts
|
|
60
|
-
var import_editor_utils = require("@kopexa/editor-utils");
|
|
61
|
-
var import_icons = require("@kopexa/icons");
|
|
62
|
-
var import_react3 = require("react");
|
|
63
|
-
var TEXT_ALIGN_SHORTCUT_KEYS = {
|
|
64
|
-
left: "mod+shift+l",
|
|
65
|
-
center: "mod+shift+e",
|
|
66
|
-
right: "mod+shift+r",
|
|
67
|
-
justify: "mod+shift+j"
|
|
68
|
-
};
|
|
69
|
-
var textAlignIcons = {
|
|
70
|
-
left: import_icons.AlignLeftIcon,
|
|
71
|
-
center: import_icons.AlignCenterIcon,
|
|
72
|
-
right: import_icons.AlignRightIcon,
|
|
73
|
-
justify: import_icons.AlignJustifyIcon
|
|
74
|
-
};
|
|
75
|
-
var textAlignLabels = {
|
|
76
|
-
left: "Align left",
|
|
77
|
-
center: "Align center",
|
|
78
|
-
right: "Align right",
|
|
79
|
-
justify: "Align justify"
|
|
80
|
-
};
|
|
81
|
-
function canSetTextAlign(editor, align) {
|
|
82
|
-
if (!editor || !editor.isEditable) return false;
|
|
83
|
-
if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign") || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
|
|
84
|
-
return false;
|
|
85
|
-
return editor.can().setTextAlign(align);
|
|
86
|
-
}
|
|
87
|
-
function hasSetTextAlign(commands) {
|
|
88
|
-
return "setTextAlign" in commands;
|
|
89
|
-
}
|
|
90
|
-
function isTextAlignActive(editor, align) {
|
|
91
|
-
if (!editor || !editor.isEditable) return false;
|
|
92
|
-
return editor.isActive({ textAlign: align });
|
|
93
|
-
}
|
|
94
|
-
function setTextAlign(editor, align) {
|
|
95
|
-
if (!editor || !editor.isEditable) return false;
|
|
96
|
-
if (!canSetTextAlign(editor, align)) return false;
|
|
97
|
-
const chain = editor.chain().focus();
|
|
98
|
-
if (hasSetTextAlign(chain)) {
|
|
99
|
-
return chain.setTextAlign(align).run();
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
function shouldShowButton(props) {
|
|
104
|
-
const { editor, hideWhenUnavailable, align } = props;
|
|
105
|
-
if (!editor || !editor.isEditable) return false;
|
|
106
|
-
if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign")) return false;
|
|
107
|
-
if (hideWhenUnavailable && !editor.isActive("code")) {
|
|
108
|
-
return canSetTextAlign(editor, align);
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
function useTextAlign(config) {
|
|
113
|
-
const {
|
|
114
|
-
editor: providedEditor,
|
|
115
|
-
align,
|
|
116
|
-
hideWhenUnavailable = false,
|
|
117
|
-
onAligned
|
|
118
|
-
} = config;
|
|
119
|
-
const { editor } = useTiptapEditor(providedEditor);
|
|
120
|
-
const [isVisible, setIsVisible] = (0, import_react3.useState)(true);
|
|
121
|
-
const canAlign = canSetTextAlign(editor, align);
|
|
122
|
-
const isActive = isTextAlignActive(editor, align);
|
|
123
|
-
(0, import_react3.useEffect)(() => {
|
|
124
|
-
if (!editor) return;
|
|
125
|
-
const handleSelectionUpdate = () => {
|
|
126
|
-
setIsVisible(shouldShowButton({ editor, align, hideWhenUnavailable }));
|
|
127
|
-
};
|
|
128
|
-
handleSelectionUpdate();
|
|
129
|
-
editor.on("selectionUpdate", handleSelectionUpdate);
|
|
130
|
-
return () => {
|
|
131
|
-
editor.off("selectionUpdate", handleSelectionUpdate);
|
|
132
|
-
};
|
|
133
|
-
}, [editor, hideWhenUnavailable, align]);
|
|
134
|
-
const handleTextAlign = (0, import_react3.useCallback)(() => {
|
|
135
|
-
if (!editor) return false;
|
|
136
|
-
const success = setTextAlign(editor, align);
|
|
137
|
-
if (success) {
|
|
138
|
-
onAligned == null ? void 0 : onAligned();
|
|
139
|
-
}
|
|
140
|
-
return success;
|
|
141
|
-
}, [editor, align, onAligned]);
|
|
142
|
-
return {
|
|
143
|
-
isVisible,
|
|
144
|
-
isActive,
|
|
145
|
-
handleTextAlign,
|
|
146
|
-
canAlign,
|
|
147
|
-
label: textAlignLabels[align],
|
|
148
|
-
shortcutKeys: TEXT_ALIGN_SHORTCUT_KEYS[align],
|
|
149
|
-
Icon: textAlignIcons[align]
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// src/ui/text-align-button/text-align-button.tsx
|
|
154
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
155
|
-
var TextAlignButton = ({
|
|
156
|
-
editor: providedEditor,
|
|
157
|
-
align,
|
|
158
|
-
text,
|
|
159
|
-
hideWhenUnavailable = false,
|
|
160
|
-
onAligned,
|
|
161
|
-
showShortcut = false,
|
|
162
|
-
onClick,
|
|
163
|
-
children,
|
|
164
|
-
...buttonProps
|
|
165
|
-
}) => {
|
|
166
|
-
const { editor } = useTiptapEditor(providedEditor);
|
|
167
|
-
const {
|
|
168
|
-
isVisible,
|
|
169
|
-
handleTextAlign,
|
|
170
|
-
label,
|
|
171
|
-
canAlign,
|
|
172
|
-
isActive,
|
|
173
|
-
Icon,
|
|
174
|
-
shortcutKeys
|
|
175
|
-
} = useTextAlign({
|
|
176
|
-
editor,
|
|
177
|
-
align,
|
|
178
|
-
hideWhenUnavailable,
|
|
179
|
-
onAligned
|
|
180
|
-
});
|
|
181
|
-
const handleClick = (0, import_react4.useCallback)(
|
|
182
|
-
(e) => {
|
|
183
|
-
onClick == null ? void 0 : onClick(e);
|
|
184
|
-
if (e.defaultPrevented) return;
|
|
185
|
-
handleTextAlign();
|
|
186
|
-
},
|
|
187
|
-
[handleTextAlign, onClick]
|
|
188
|
-
);
|
|
189
|
-
if (!isVisible) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
-
import_button.IconButton,
|
|
194
|
-
{
|
|
195
|
-
type: "button",
|
|
196
|
-
disabled: canAlign,
|
|
197
|
-
variant: "ghost",
|
|
198
|
-
color: "default",
|
|
199
|
-
"data-active-state": isActive ? "on" : "off",
|
|
200
|
-
"data-disabled": canAlign,
|
|
201
|
-
tabIndex: -1,
|
|
202
|
-
"aria-label": label,
|
|
203
|
-
"aria-pressed": isActive,
|
|
204
|
-
tooltip: label,
|
|
205
|
-
shortcutKeys,
|
|
206
|
-
onClick: handleClick,
|
|
207
|
-
...buttonProps,
|
|
208
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {})
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
};
|
|
212
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
213
|
-
0 && (module.exports = {
|
|
214
|
-
TextAlignButton
|
|
215
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as _kopexa_icons from '@kopexa/icons';
|
|
3
|
-
import { Editor, ChainedCommands } from '@tiptap/react';
|
|
4
|
-
|
|
5
|
-
type TextAlign = "left" | "center" | "right" | "justify";
|
|
6
|
-
/**
|
|
7
|
-
* Configuration for the text align functionality
|
|
8
|
-
*/
|
|
9
|
-
interface UseTextAlignConfig {
|
|
10
|
-
/**
|
|
11
|
-
* The Tiptap editor instance.
|
|
12
|
-
*/
|
|
13
|
-
editor?: Editor | null;
|
|
14
|
-
/**
|
|
15
|
-
* The text alignment to apply.
|
|
16
|
-
*/
|
|
17
|
-
align: TextAlign;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the button should hide when alignment is not available.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
hideWhenUnavailable?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Callback function called after a successful alignment change.
|
|
25
|
-
*/
|
|
26
|
-
onAligned?: () => void;
|
|
27
|
-
}
|
|
28
|
-
declare const TEXT_ALIGN_SHORTCUT_KEYS: Record<TextAlign, string>;
|
|
29
|
-
declare const textAlignIcons: {
|
|
30
|
-
left: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
-
center: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
|
|
32
|
-
right: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
|
|
33
|
-
justify: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
-
};
|
|
35
|
-
declare const textAlignLabels: Record<TextAlign, string>;
|
|
36
|
-
/**
|
|
37
|
-
* Checks if text alignment can be performed in the current editor state
|
|
38
|
-
*/
|
|
39
|
-
declare function canSetTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
40
|
-
declare function hasSetTextAlign(commands: ChainedCommands): commands is ChainedCommands & {
|
|
41
|
-
setTextAlign: (align: TextAlign) => ChainedCommands;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Checks if the text alignment is currently active
|
|
45
|
-
*/
|
|
46
|
-
declare function isTextAlignActive(editor: Editor | null, align: TextAlign): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Sets text alignment in the editor
|
|
49
|
-
*/
|
|
50
|
-
declare function setTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Determines if the text align button should be shown
|
|
53
|
-
*/
|
|
54
|
-
declare function shouldShowButton(props: {
|
|
55
|
-
editor: Editor | null;
|
|
56
|
-
hideWhenUnavailable: boolean;
|
|
57
|
-
align: TextAlign;
|
|
58
|
-
}): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Custom hook that provides text align functionality for Tiptap editor
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```tsx
|
|
64
|
-
* // Simple usage
|
|
65
|
-
* function MySimpleAlignButton() {
|
|
66
|
-
* const { isVisible, handleTextAlign } = useTextAlign({ align: "center" })
|
|
67
|
-
*
|
|
68
|
-
* if (!isVisible) return null
|
|
69
|
-
*
|
|
70
|
-
* return <button onClick={handleTextAlign}>Align Center</button>
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* // Advanced usage with configuration
|
|
74
|
-
* function MyAdvancedAlignButton() {
|
|
75
|
-
* const { isVisible, handleTextAlign, label, isActive } = useTextAlign({
|
|
76
|
-
* editor: myEditor,
|
|
77
|
-
* align: "right",
|
|
78
|
-
* hideWhenUnavailable: true,
|
|
79
|
-
* onAligned: () => console.log('Text aligned!')
|
|
80
|
-
* })
|
|
81
|
-
*
|
|
82
|
-
* if (!isVisible) return null
|
|
83
|
-
*
|
|
84
|
-
* return (
|
|
85
|
-
* <MyButton
|
|
86
|
-
* onClick={handleTextAlign}
|
|
87
|
-
* aria-pressed={isActive}
|
|
88
|
-
* aria-label={label}
|
|
89
|
-
* >
|
|
90
|
-
* Align Right
|
|
91
|
-
* </MyButton>
|
|
92
|
-
* )
|
|
93
|
-
* }
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function useTextAlign(config: UseTextAlignConfig): {
|
|
97
|
-
isVisible: boolean;
|
|
98
|
-
isActive: boolean;
|
|
99
|
-
handleTextAlign: () => boolean;
|
|
100
|
-
canAlign: boolean;
|
|
101
|
-
label: string;
|
|
102
|
-
shortcutKeys: string;
|
|
103
|
-
Icon: (({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element) | (({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element) | (({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element) | (({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export { TEXT_ALIGN_SHORTCUT_KEYS, type TextAlign, type UseTextAlignConfig, canSetTextAlign, hasSetTextAlign, isTextAlignActive, setTextAlign, shouldShowButton, textAlignIcons, textAlignLabels, useTextAlign };
|