@kopexa/tiptap 17.7.0 → 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.js +505 -226
- package/dist/index.mjs +387 -86
- package/package.json +24 -24
package/dist/index.mjs
CHANGED
|
@@ -2743,6 +2743,7 @@ import * as React6 from "react";
|
|
|
2743
2743
|
|
|
2744
2744
|
// src/ui/suggestion-menu/suggestion-menu.tsx
|
|
2745
2745
|
import { FloatingPortal, flip, offset, shift, size } from "@floating-ui/react";
|
|
2746
|
+
import { useTiptapEditor } from "@kopexa/editor-utils";
|
|
2746
2747
|
import { PluginKey } from "@tiptap/pm/state";
|
|
2747
2748
|
import {
|
|
2748
2749
|
Suggestion,
|
|
@@ -2928,35 +2929,6 @@ function useMenuNavigation({
|
|
|
2928
2929
|
};
|
|
2929
2930
|
}
|
|
2930
2931
|
|
|
2931
|
-
// src/hooks/use-tiptap-editor.ts
|
|
2932
|
-
import { useCurrentEditor, useEditorState as useEditorState7 } from "@tiptap/react";
|
|
2933
|
-
import { useMemo as useMemo12 } from "react";
|
|
2934
|
-
function useTiptapEditor(providedEditor) {
|
|
2935
|
-
const { editor: coreEditor } = useCurrentEditor();
|
|
2936
|
-
const mainEditor = useMemo12(
|
|
2937
|
-
() => providedEditor || coreEditor,
|
|
2938
|
-
[providedEditor, coreEditor]
|
|
2939
|
-
);
|
|
2940
|
-
const editorState = useEditorState7({
|
|
2941
|
-
editor: mainEditor,
|
|
2942
|
-
selector(context) {
|
|
2943
|
-
if (!context.editor) {
|
|
2944
|
-
return {
|
|
2945
|
-
editor: null,
|
|
2946
|
-
editorState: void 0,
|
|
2947
|
-
canCommand: void 0
|
|
2948
|
-
};
|
|
2949
|
-
}
|
|
2950
|
-
return {
|
|
2951
|
-
editor: context.editor,
|
|
2952
|
-
editorState: context.editor.state,
|
|
2953
|
-
canCommand: context.editor.can
|
|
2954
|
-
};
|
|
2955
|
-
}
|
|
2956
|
-
});
|
|
2957
|
-
return editorState || { editor: null };
|
|
2958
|
-
}
|
|
2959
|
-
|
|
2960
2932
|
// src/ui/suggestion-menu/suggestion-menu-utils.ts
|
|
2961
2933
|
function calculateStartPosition(cursorPosition, previousNode, triggerChar) {
|
|
2962
2934
|
if (!(previousNode == null ? void 0 : previousNode.text) || !triggerChar) {
|
|
@@ -3434,11 +3406,290 @@ var Link = TiptapLink.extend({
|
|
|
3434
3406
|
}
|
|
3435
3407
|
});
|
|
3436
3408
|
|
|
3409
|
+
// src/extensions/node-alignment/index.ts
|
|
3410
|
+
import { getSelectedNodesOfType, updateNodesAttr } from "@kopexa/editor-utils";
|
|
3411
|
+
import { Extension } from "@tiptap/core";
|
|
3412
|
+
function getToggleValue(targets, attributeName, inputValue) {
|
|
3413
|
+
var _a, _b;
|
|
3414
|
+
if (targets.length === 0) return null;
|
|
3415
|
+
for (const target of targets) {
|
|
3416
|
+
const currentValue = (_b = (_a = target.node.attrs) == null ? void 0 : _a[attributeName]) != null ? _b : null;
|
|
3417
|
+
if (currentValue !== inputValue) {
|
|
3418
|
+
return inputValue;
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
return null;
|
|
3422
|
+
}
|
|
3423
|
+
var NodeAlignment = Extension.create({
|
|
3424
|
+
name: "nodeAlignment",
|
|
3425
|
+
addOptions() {
|
|
3426
|
+
return {
|
|
3427
|
+
types: ["paragraph", "heading", "blockquote", "tableCell", "tableHeader"],
|
|
3428
|
+
useStyle: true,
|
|
3429
|
+
textAlignValues: ["left", "center", "right", "justify"],
|
|
3430
|
+
verticalAlignValues: ["top", "middle", "bottom"]
|
|
3431
|
+
};
|
|
3432
|
+
},
|
|
3433
|
+
addGlobalAttributes() {
|
|
3434
|
+
return [
|
|
3435
|
+
{
|
|
3436
|
+
types: this.options.types,
|
|
3437
|
+
attributes: {
|
|
3438
|
+
nodeTextAlign: {
|
|
3439
|
+
default: null,
|
|
3440
|
+
parseHTML: (element) => {
|
|
3441
|
+
var _a;
|
|
3442
|
+
const styleAlign = (_a = element.style) == null ? void 0 : _a.textAlign;
|
|
3443
|
+
if (styleAlign && this.options.textAlignValues.includes(styleAlign)) {
|
|
3444
|
+
return styleAlign;
|
|
3445
|
+
}
|
|
3446
|
+
const dataAlign = element.getAttribute("data-node-text-align");
|
|
3447
|
+
if (dataAlign && this.options.textAlignValues.includes(dataAlign)) {
|
|
3448
|
+
return dataAlign;
|
|
3449
|
+
}
|
|
3450
|
+
return null;
|
|
3451
|
+
},
|
|
3452
|
+
renderHTML: (attributes) => {
|
|
3453
|
+
const align = attributes.nodeTextAlign;
|
|
3454
|
+
if (!align || !this.options.textAlignValues.includes(align))
|
|
3455
|
+
return {};
|
|
3456
|
+
if (this.options.useStyle) {
|
|
3457
|
+
return { style: `text-align: ${align}` };
|
|
3458
|
+
} else {
|
|
3459
|
+
return { "data-node-text-align": align };
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
},
|
|
3463
|
+
nodeVerticalAlign: {
|
|
3464
|
+
default: null,
|
|
3465
|
+
parseHTML: (element) => {
|
|
3466
|
+
var _a;
|
|
3467
|
+
const styleVAlign = (_a = element.style) == null ? void 0 : _a.verticalAlign;
|
|
3468
|
+
if (styleVAlign && this.options.verticalAlignValues.includes(styleVAlign)) {
|
|
3469
|
+
return styleVAlign;
|
|
3470
|
+
}
|
|
3471
|
+
const dataVAlign = element.getAttribute(
|
|
3472
|
+
"data-node-vertical-align"
|
|
3473
|
+
);
|
|
3474
|
+
if (dataVAlign && this.options.verticalAlignValues.includes(dataVAlign)) {
|
|
3475
|
+
return dataVAlign;
|
|
3476
|
+
}
|
|
3477
|
+
return null;
|
|
3478
|
+
},
|
|
3479
|
+
renderHTML: (attributes) => {
|
|
3480
|
+
const vAlign = attributes.nodeVerticalAlign;
|
|
3481
|
+
if (!vAlign || !this.options.verticalAlignValues.includes(vAlign))
|
|
3482
|
+
return {};
|
|
3483
|
+
if (this.options.useStyle) {
|
|
3484
|
+
return { style: `vertical-align: ${vAlign}` };
|
|
3485
|
+
} else {
|
|
3486
|
+
return { "data-node-vertical-align": vAlign };
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
];
|
|
3493
|
+
},
|
|
3494
|
+
addCommands() {
|
|
3495
|
+
const executeAlignmentCommand = (attributeName, getTargetValue) => {
|
|
3496
|
+
return (inputValue) => ({ state, tr }) => {
|
|
3497
|
+
const targets = getSelectedNodesOfType(
|
|
3498
|
+
state.selection,
|
|
3499
|
+
this.options.types
|
|
3500
|
+
);
|
|
3501
|
+
if (targets.length === 0) return false;
|
|
3502
|
+
const targetValue = getTargetValue(targets, inputValue);
|
|
3503
|
+
return updateNodesAttr(tr, targets, attributeName, targetValue);
|
|
3504
|
+
};
|
|
3505
|
+
};
|
|
3506
|
+
return {
|
|
3507
|
+
// TEXT ALIGN
|
|
3508
|
+
setNodeTextAlign: executeAlignmentCommand(
|
|
3509
|
+
"nodeTextAlign",
|
|
3510
|
+
(_, inputValue) => {
|
|
3511
|
+
if (!inputValue || !this.options.textAlignValues.includes(inputValue))
|
|
3512
|
+
return null;
|
|
3513
|
+
return inputValue;
|
|
3514
|
+
}
|
|
3515
|
+
),
|
|
3516
|
+
unsetNodeTextAlign: executeAlignmentCommand("nodeTextAlign", () => null),
|
|
3517
|
+
toggleNodeTextAlign: executeAlignmentCommand(
|
|
3518
|
+
"nodeTextAlign",
|
|
3519
|
+
(targets, inputValue) => {
|
|
3520
|
+
if (!inputValue || !this.options.textAlignValues.includes(inputValue))
|
|
3521
|
+
return null;
|
|
3522
|
+
return getToggleValue(targets, "nodeTextAlign", inputValue);
|
|
3523
|
+
}
|
|
3524
|
+
),
|
|
3525
|
+
// VERTICAL ALIGN
|
|
3526
|
+
setNodeVAlign: executeAlignmentCommand(
|
|
3527
|
+
"nodeVerticalAlign",
|
|
3528
|
+
(_, inputValue) => {
|
|
3529
|
+
if (!inputValue || !this.options.verticalAlignValues.includes(inputValue))
|
|
3530
|
+
return null;
|
|
3531
|
+
return inputValue;
|
|
3532
|
+
}
|
|
3533
|
+
),
|
|
3534
|
+
unsetNodeVAlign: executeAlignmentCommand("nodeVerticalAlign", () => null),
|
|
3535
|
+
toggleNodeVAlign: executeAlignmentCommand(
|
|
3536
|
+
"nodeVerticalAlign",
|
|
3537
|
+
(targets, inputValue) => {
|
|
3538
|
+
if (!inputValue || !this.options.verticalAlignValues.includes(inputValue))
|
|
3539
|
+
return null;
|
|
3540
|
+
return getToggleValue(targets, "nodeVerticalAlign", inputValue);
|
|
3541
|
+
}
|
|
3542
|
+
),
|
|
3543
|
+
// BOTH
|
|
3544
|
+
setNodeAlignment: (textAlign, verticalAlign) => ({ state, tr }) => {
|
|
3545
|
+
const targets = getSelectedNodesOfType(
|
|
3546
|
+
state.selection,
|
|
3547
|
+
this.options.types
|
|
3548
|
+
);
|
|
3549
|
+
if (targets.length === 0) return false;
|
|
3550
|
+
let hasChanges = false;
|
|
3551
|
+
for (const { node, pos } of targets) {
|
|
3552
|
+
const newAttrs = { ...node.attrs };
|
|
3553
|
+
if (textAlign && this.options.textAlignValues.includes(textAlign)) {
|
|
3554
|
+
newAttrs.nodeTextAlign = textAlign;
|
|
3555
|
+
hasChanges = true;
|
|
3556
|
+
}
|
|
3557
|
+
if (verticalAlign && this.options.verticalAlignValues.includes(verticalAlign)) {
|
|
3558
|
+
newAttrs.nodeVerticalAlign = verticalAlign;
|
|
3559
|
+
hasChanges = true;
|
|
3560
|
+
}
|
|
3561
|
+
if (hasChanges) tr.setNodeMarkup(pos, void 0, newAttrs);
|
|
3562
|
+
}
|
|
3563
|
+
return hasChanges;
|
|
3564
|
+
},
|
|
3565
|
+
unsetNodeAlignment: () => ({ state, tr }) => {
|
|
3566
|
+
var _a, _b, _c, _d;
|
|
3567
|
+
const targets = getSelectedNodesOfType(
|
|
3568
|
+
state.selection,
|
|
3569
|
+
this.options.types
|
|
3570
|
+
);
|
|
3571
|
+
if (targets.length === 0) return false;
|
|
3572
|
+
let hasChanges = false;
|
|
3573
|
+
for (const { node, pos } of targets) {
|
|
3574
|
+
const hasText = (_b = (_a = node.attrs) == null ? void 0 : _a.nodeTextAlign) != null ? _b : null;
|
|
3575
|
+
const hasV = (_d = (_c = node.attrs) == null ? void 0 : _c.nodeVerticalAlign) != null ? _d : null;
|
|
3576
|
+
if (hasText || hasV) {
|
|
3577
|
+
const newAttrs = {
|
|
3578
|
+
...node.attrs,
|
|
3579
|
+
nodeTextAlign: null,
|
|
3580
|
+
nodeVerticalAlign: null
|
|
3581
|
+
};
|
|
3582
|
+
tr.setNodeMarkup(pos, void 0, newAttrs);
|
|
3583
|
+
hasChanges = true;
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
return hasChanges;
|
|
3587
|
+
}
|
|
3588
|
+
};
|
|
3589
|
+
}
|
|
3590
|
+
});
|
|
3591
|
+
|
|
3592
|
+
// src/extensions/node-background/index.ts
|
|
3593
|
+
import { getSelectedNodesOfType as getSelectedNodesOfType2, updateNodesAttr as updateNodesAttr2 } from "@kopexa/editor-utils";
|
|
3594
|
+
import { Extension as Extension2 } from "@tiptap/core";
|
|
3595
|
+
function getToggleColor(targets, inputColor) {
|
|
3596
|
+
var _a, _b;
|
|
3597
|
+
if (targets.length === 0) return null;
|
|
3598
|
+
for (const target of targets) {
|
|
3599
|
+
const currentColor = (_b = (_a = target.node.attrs) == null ? void 0 : _a.backgroundColor) != null ? _b : null;
|
|
3600
|
+
if (currentColor !== inputColor) {
|
|
3601
|
+
return inputColor;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
return null;
|
|
3605
|
+
}
|
|
3606
|
+
var NodeBackground = Extension2.create({
|
|
3607
|
+
name: "nodeBackground",
|
|
3608
|
+
addOptions() {
|
|
3609
|
+
return {
|
|
3610
|
+
types: [
|
|
3611
|
+
"paragraph",
|
|
3612
|
+
"heading",
|
|
3613
|
+
"blockquote",
|
|
3614
|
+
"taskList",
|
|
3615
|
+
"bulletList",
|
|
3616
|
+
"orderedList",
|
|
3617
|
+
"tableCell",
|
|
3618
|
+
"tableHeader"
|
|
3619
|
+
],
|
|
3620
|
+
useStyle: true
|
|
3621
|
+
};
|
|
3622
|
+
},
|
|
3623
|
+
addGlobalAttributes() {
|
|
3624
|
+
return [
|
|
3625
|
+
{
|
|
3626
|
+
types: this.options.types,
|
|
3627
|
+
attributes: {
|
|
3628
|
+
backgroundColor: {
|
|
3629
|
+
default: null,
|
|
3630
|
+
parseHTML: (element) => {
|
|
3631
|
+
var _a;
|
|
3632
|
+
const styleColor = (_a = element.style) == null ? void 0 : _a.backgroundColor;
|
|
3633
|
+
if (styleColor) return styleColor;
|
|
3634
|
+
const dataColor = element.getAttribute("data-background-color");
|
|
3635
|
+
return dataColor || null;
|
|
3636
|
+
},
|
|
3637
|
+
renderHTML: (attributes) => {
|
|
3638
|
+
const color = attributes.backgroundColor;
|
|
3639
|
+
if (!color) return {};
|
|
3640
|
+
if (this.options.useStyle) {
|
|
3641
|
+
return {
|
|
3642
|
+
style: `background-color: ${color}`
|
|
3643
|
+
};
|
|
3644
|
+
} else {
|
|
3645
|
+
return {
|
|
3646
|
+
"data-background-color": color
|
|
3647
|
+
};
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
];
|
|
3654
|
+
},
|
|
3655
|
+
addCommands() {
|
|
3656
|
+
const executeBackgroundCommand = (getTargetColor) => {
|
|
3657
|
+
return (inputColor) => ({ state, tr }) => {
|
|
3658
|
+
const targets = getSelectedNodesOfType2(
|
|
3659
|
+
state.selection,
|
|
3660
|
+
this.options.types
|
|
3661
|
+
);
|
|
3662
|
+
if (targets.length === 0) return false;
|
|
3663
|
+
const targetColor = getTargetColor(targets, inputColor);
|
|
3664
|
+
return updateNodesAttr2(tr, targets, "backgroundColor", targetColor);
|
|
3665
|
+
};
|
|
3666
|
+
};
|
|
3667
|
+
return {
|
|
3668
|
+
/**
|
|
3669
|
+
* Set background color to specific value
|
|
3670
|
+
*/
|
|
3671
|
+
setNodeBackgroundColor: executeBackgroundCommand(
|
|
3672
|
+
(_, inputColor) => inputColor || null
|
|
3673
|
+
),
|
|
3674
|
+
/**
|
|
3675
|
+
* Remove background color
|
|
3676
|
+
*/
|
|
3677
|
+
unsetNodeBackgroundColor: executeBackgroundCommand(() => null),
|
|
3678
|
+
/**
|
|
3679
|
+
* Toggle background color (set if different/missing, unset if all have it)
|
|
3680
|
+
*/
|
|
3681
|
+
toggleNodeBackgroundColor: executeBackgroundCommand(
|
|
3682
|
+
(targets, inputColor) => getToggleColor(targets, inputColor || "")
|
|
3683
|
+
)
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
3686
|
+
});
|
|
3687
|
+
|
|
3437
3688
|
// src/extensions/selection/index.ts
|
|
3438
3689
|
import { Plugin as Plugin2, PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
3439
3690
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
3440
|
-
import { Extension, isNodeSelection } from "@tiptap/react";
|
|
3441
|
-
var Selection =
|
|
3691
|
+
import { Extension as Extension3, isNodeSelection } from "@tiptap/react";
|
|
3692
|
+
var Selection = Extension3.create({
|
|
3442
3693
|
name: "selection",
|
|
3443
3694
|
addProseMirrorPlugins() {
|
|
3444
3695
|
const { editor } = this;
|
|
@@ -3470,7 +3721,7 @@ var Selection = Extension.create({
|
|
|
3470
3721
|
|
|
3471
3722
|
// src/extensions/trailing-node/index.ts
|
|
3472
3723
|
import { Plugin as Plugin3, PluginKey as PluginKey5 } from "@tiptap/pm/state";
|
|
3473
|
-
import { Extension as
|
|
3724
|
+
import { Extension as Extension4 } from "@tiptap/react";
|
|
3474
3725
|
function nodeEqualsType({
|
|
3475
3726
|
types,
|
|
3476
3727
|
node
|
|
@@ -3481,7 +3732,7 @@ function nodeEqualsType({
|
|
|
3481
3732
|
}
|
|
3482
3733
|
return node.type === types;
|
|
3483
3734
|
}
|
|
3484
|
-
var TrailingNode =
|
|
3735
|
+
var TrailingNode = Extension4.create({
|
|
3485
3736
|
name: "trailingNode",
|
|
3486
3737
|
addOptions() {
|
|
3487
3738
|
return {
|
|
@@ -3527,7 +3778,7 @@ var TrailingNode = Extension2.create({
|
|
|
3527
3778
|
});
|
|
3528
3779
|
|
|
3529
3780
|
// src/extensions/ui-state/index.ts
|
|
3530
|
-
import { Extension as
|
|
3781
|
+
import { Extension as Extension5 } from "@tiptap/core";
|
|
3531
3782
|
var defaultUiState = {
|
|
3532
3783
|
aiGenerationIsSelection: false,
|
|
3533
3784
|
aiGenerationIsLoading: false,
|
|
@@ -3537,7 +3788,7 @@ var defaultUiState = {
|
|
|
3537
3788
|
lockDragHandle: false,
|
|
3538
3789
|
isDragging: false
|
|
3539
3790
|
};
|
|
3540
|
-
var UiState =
|
|
3791
|
+
var UiState = Extension5.create({
|
|
3541
3792
|
name: "uiState",
|
|
3542
3793
|
addStorage() {
|
|
3543
3794
|
return {
|
|
@@ -3862,6 +4113,8 @@ function getExtensions({
|
|
|
3862
4113
|
}),
|
|
3863
4114
|
UiState,
|
|
3864
4115
|
TableKit,
|
|
4116
|
+
NodeAlignment,
|
|
4117
|
+
NodeBackground,
|
|
3865
4118
|
TocNode,
|
|
3866
4119
|
CalloutNode,
|
|
3867
4120
|
MathBlock,
|
|
@@ -4010,6 +4263,11 @@ async function handleFileUpload(editor, file, fileHandler, pos) {
|
|
|
4010
4263
|
}
|
|
4011
4264
|
|
|
4012
4265
|
// src/presets/basic/index.tsx
|
|
4266
|
+
import {
|
|
4267
|
+
TableCellHandleMenu,
|
|
4268
|
+
TableHandle,
|
|
4269
|
+
TableSelectionOverlay
|
|
4270
|
+
} from "@kopexa/extension-table";
|
|
4013
4271
|
import {
|
|
4014
4272
|
editorBasic,
|
|
4015
4273
|
editorSpinner
|
|
@@ -4025,10 +4283,10 @@ import { createContext as createContext4 } from "@kopexa/react-utils";
|
|
|
4025
4283
|
var [EditorUIProvider, useEditorUIContext] = createContext4();
|
|
4026
4284
|
|
|
4027
4285
|
// src/hooks/use-ui-editor-state.ts
|
|
4028
|
-
import { useEditorState as
|
|
4286
|
+
import { useEditorState as useEditorState7 } from "@tiptap/react";
|
|
4029
4287
|
function useUiEditorState(editor) {
|
|
4030
4288
|
var _a;
|
|
4031
|
-
return (_a =
|
|
4289
|
+
return (_a = useEditorState7({
|
|
4032
4290
|
editor,
|
|
4033
4291
|
selector: ({ editor: editor2 }) => {
|
|
4034
4292
|
if (!editor2) return defaultUiState;
|
|
@@ -4050,6 +4308,7 @@ import { BubbleMenu as TiptapBubbleMenu } from "@tiptap/react/menus";
|
|
|
4050
4308
|
|
|
4051
4309
|
// src/ui/link-popover/link-popover.tsx
|
|
4052
4310
|
import { IconButton as IconButton6 } from "@kopexa/button";
|
|
4311
|
+
import { useTiptapEditor as useTiptapEditor3 } from "@kopexa/editor-utils";
|
|
4053
4312
|
import {
|
|
4054
4313
|
CheckIcon,
|
|
4055
4314
|
EditIcon as EditIcon2,
|
|
@@ -4063,7 +4322,7 @@ import { ToolbarButton } from "@kopexa/toolbar";
|
|
|
4063
4322
|
import { useCallback as useCallback14, useEffect as useEffect16, useState as useState15 } from "react";
|
|
4064
4323
|
|
|
4065
4324
|
// src/ui/link-popover/use-link-popover.ts
|
|
4066
|
-
import { isMarkInSchema } from "@kopexa/editor-utils";
|
|
4325
|
+
import { isMarkInSchema, useTiptapEditor as useTiptapEditor2 } from "@kopexa/editor-utils";
|
|
4067
4326
|
import { LinkIcon } from "@kopexa/icons";
|
|
4068
4327
|
import * as React7 from "react";
|
|
4069
4328
|
|
|
@@ -4269,7 +4528,7 @@ function useLinkPopover(config) {
|
|
|
4269
4528
|
hideWhenUnavailable = false,
|
|
4270
4529
|
onSetLink
|
|
4271
4530
|
} = config || {};
|
|
4272
|
-
const { editor } =
|
|
4531
|
+
const { editor } = useTiptapEditor2(providedEditor);
|
|
4273
4532
|
const { isVisible, canSet, isActive } = useLinkState({
|
|
4274
4533
|
editor,
|
|
4275
4534
|
hideWhenUnavailable
|
|
@@ -4432,7 +4691,7 @@ function LinkPopover({
|
|
|
4432
4691
|
children,
|
|
4433
4692
|
...buttonProps
|
|
4434
4693
|
}) {
|
|
4435
|
-
const { editor } =
|
|
4694
|
+
const { editor } = useTiptapEditor3(providedEditor);
|
|
4436
4695
|
const [isOpen, setIsOpen] = useState15(false);
|
|
4437
4696
|
const {
|
|
4438
4697
|
isVisible,
|
|
@@ -4519,7 +4778,11 @@ function LinkPopover({
|
|
|
4519
4778
|
LinkButton.displayName = "LinkButton";
|
|
4520
4779
|
|
|
4521
4780
|
// src/ui/mark-button/index.tsx
|
|
4522
|
-
import {
|
|
4781
|
+
import {
|
|
4782
|
+
isMarkInSchema as isMarkInSchema2,
|
|
4783
|
+
isNodeTypeSelected,
|
|
4784
|
+
useTiptapEditor as useTiptapEditor4
|
|
4785
|
+
} from "@kopexa/editor-utils";
|
|
4523
4786
|
import {
|
|
4524
4787
|
BoldIcon,
|
|
4525
4788
|
CodeIcon,
|
|
@@ -4531,7 +4794,7 @@ import {
|
|
|
4531
4794
|
} from "@kopexa/icons";
|
|
4532
4795
|
import { ToolbarButton as ToolbarButton2 } from "@kopexa/toolbar";
|
|
4533
4796
|
import { isNodeSelection as isNodeSelection2 } from "@tiptap/react";
|
|
4534
|
-
import { useCallback as useCallback15, useMemo as
|
|
4797
|
+
import { useCallback as useCallback15, useMemo as useMemo13 } from "react";
|
|
4535
4798
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
4536
4799
|
var markIcons = {
|
|
4537
4800
|
bold: BoldIcon,
|
|
@@ -4614,7 +4877,7 @@ var MarkButton = ({
|
|
|
4614
4877
|
children,
|
|
4615
4878
|
...buttonProps
|
|
4616
4879
|
}) => {
|
|
4617
|
-
const { editor } =
|
|
4880
|
+
const { editor } = useTiptapEditor4(providedEditor);
|
|
4618
4881
|
const {
|
|
4619
4882
|
markInSchema,
|
|
4620
4883
|
isDisabled,
|
|
@@ -4632,7 +4895,7 @@ var MarkButton = ({
|
|
|
4632
4895
|
},
|
|
4633
4896
|
[onClick, isDisabled, editor, type]
|
|
4634
4897
|
);
|
|
4635
|
-
const show =
|
|
4898
|
+
const show = useMemo13(() => {
|
|
4636
4899
|
return shouldShowMarkButton({
|
|
4637
4900
|
editor,
|
|
4638
4901
|
type,
|
|
@@ -4707,7 +4970,7 @@ function BubbleMenu({ editor }) {
|
|
|
4707
4970
|
}
|
|
4708
4971
|
|
|
4709
4972
|
// src/ui/copy-anchor-link-button/use-scroll-to-hash.ts
|
|
4710
|
-
import { getEditorExtension } from "@kopexa/editor-utils";
|
|
4973
|
+
import { getEditorExtension, useTiptapEditor as useTiptapEditor5 } from "@kopexa/editor-utils";
|
|
4711
4974
|
import * as React9 from "react";
|
|
4712
4975
|
|
|
4713
4976
|
// src/hooks/use-floating-toolbar-visibility.ts
|
|
@@ -4732,7 +4995,7 @@ function useScrollToHash(config = {}) {
|
|
|
4732
4995
|
onTargetNotFound = () => {
|
|
4733
4996
|
}
|
|
4734
4997
|
} = config;
|
|
4735
|
-
const { editor } =
|
|
4998
|
+
const { editor } = useTiptapEditor5(providedEditor);
|
|
4736
4999
|
const scrollToNode = React9.useCallback(
|
|
4737
5000
|
(id) => {
|
|
4738
5001
|
var _a, _b, _c;
|
|
@@ -4997,7 +5260,11 @@ import {
|
|
|
4997
5260
|
import * as React10 from "react";
|
|
4998
5261
|
|
|
4999
5262
|
// src/ui/table-button/use-table.ts
|
|
5000
|
-
import {
|
|
5263
|
+
import {
|
|
5264
|
+
isNodeInSchema,
|
|
5265
|
+
isNodeTypeSelected as isNodeTypeSelected2,
|
|
5266
|
+
useTiptapEditor as useTiptapEditor6
|
|
5267
|
+
} from "@kopexa/editor-utils";
|
|
5001
5268
|
import { TableIcon } from "@kopexa/icons";
|
|
5002
5269
|
import { isNodeSelection as isNodeSelection4 } from "@tiptap/react";
|
|
5003
5270
|
import { useCallback as useCallback18, useEffect as useEffect20, useState as useState18 } from "react";
|
|
@@ -5043,7 +5310,7 @@ function useTableBlock(config) {
|
|
|
5043
5310
|
hideWhenUnavailable = false,
|
|
5044
5311
|
onToggled
|
|
5045
5312
|
} = config || {};
|
|
5046
|
-
const { editor } =
|
|
5313
|
+
const { editor } = useTiptapEditor6(providedEditor);
|
|
5047
5314
|
const [isVisible, setIsVisible] = useState18(true);
|
|
5048
5315
|
const canToggleState = canToggle(editor);
|
|
5049
5316
|
const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
|
|
@@ -5604,6 +5871,7 @@ var List = ({
|
|
|
5604
5871
|
};
|
|
5605
5872
|
|
|
5606
5873
|
// src/presets/basic/editor-header.tsx
|
|
5874
|
+
import { useTiptapEditor as useTiptapEditor23 } from "@kopexa/editor-utils";
|
|
5607
5875
|
import { MoreVerticalIcon } from "@kopexa/icons";
|
|
5608
5876
|
import { Popover as Popover3 } from "@kopexa/popover";
|
|
5609
5877
|
import {
|
|
@@ -5718,6 +5986,7 @@ function useCursorVisibility({
|
|
|
5718
5986
|
}
|
|
5719
5987
|
|
|
5720
5988
|
// src/ui/blockquote-button/blockquote-button.tsx
|
|
5989
|
+
import { useTiptapEditor as useTiptapEditor8 } from "@kopexa/editor-utils";
|
|
5721
5990
|
import { ToolbarButton as ToolbarButton3 } from "@kopexa/toolbar";
|
|
5722
5991
|
import * as React15 from "react";
|
|
5723
5992
|
|
|
@@ -5726,7 +5995,8 @@ import {
|
|
|
5726
5995
|
findNodePosition,
|
|
5727
5996
|
isNodeInSchema as isNodeInSchema3,
|
|
5728
5997
|
isNodeTypeSelected as isNodeTypeSelected3,
|
|
5729
|
-
isValidPosition
|
|
5998
|
+
isValidPosition,
|
|
5999
|
+
useTiptapEditor as useTiptapEditor7
|
|
5730
6000
|
} from "@kopexa/editor-utils";
|
|
5731
6001
|
import { BlockquoteIcon as BlockquoteIcon2 } from "@kopexa/icons";
|
|
5732
6002
|
import { NodeSelection as NodeSelection2, TextSelection as TextSelection2 } from "@tiptap/pm/state";
|
|
@@ -5806,7 +6076,7 @@ function useBlockquote(config) {
|
|
|
5806
6076
|
hideWhenUnavailable = false,
|
|
5807
6077
|
onToggled
|
|
5808
6078
|
} = config || {};
|
|
5809
|
-
const { editor } =
|
|
6079
|
+
const { editor } = useTiptapEditor7(providedEditor);
|
|
5810
6080
|
const [isVisible, setIsVisible] = React14.useState(true);
|
|
5811
6081
|
const canToggle3 = canToggleBlockquote(editor);
|
|
5812
6082
|
const isActive = (editor == null ? void 0 : editor.isActive("blockquote")) || false;
|
|
@@ -5852,7 +6122,7 @@ var BlockquoteButton = ({
|
|
|
5852
6122
|
children,
|
|
5853
6123
|
...buttonProps
|
|
5854
6124
|
}) => {
|
|
5855
|
-
const { editor } =
|
|
6125
|
+
const { editor } = useTiptapEditor8(providedEditor);
|
|
5856
6126
|
const {
|
|
5857
6127
|
isVisible,
|
|
5858
6128
|
canToggle: canToggle3,
|
|
@@ -5903,6 +6173,7 @@ var BlockquoteButton = ({
|
|
|
5903
6173
|
};
|
|
5904
6174
|
|
|
5905
6175
|
// src/ui/codeblock-button/code-block-button.tsx
|
|
6176
|
+
import { useTiptapEditor as useTiptapEditor10 } from "@kopexa/editor-utils";
|
|
5906
6177
|
import { CodeblockIcon as CodeblockIcon2 } from "@kopexa/icons";
|
|
5907
6178
|
import { ToolbarButton as ToolbarButton4 } from "@kopexa/toolbar";
|
|
5908
6179
|
import { useCallback as useCallback24 } from "react";
|
|
@@ -5912,7 +6183,8 @@ import {
|
|
|
5912
6183
|
findNodePosition as findNodePosition2,
|
|
5913
6184
|
isNodeInSchema as isNodeInSchema4,
|
|
5914
6185
|
isNodeTypeSelected as isNodeTypeSelected4,
|
|
5915
|
-
isValidPosition as isValidPosition2
|
|
6186
|
+
isValidPosition as isValidPosition2,
|
|
6187
|
+
useTiptapEditor as useTiptapEditor9
|
|
5916
6188
|
} from "@kopexa/editor-utils";
|
|
5917
6189
|
import { CodeblockIcon } from "@kopexa/icons";
|
|
5918
6190
|
import { NodeSelection as NodeSelection3, TextSelection as TextSelection3 } from "@tiptap/pm/state";
|
|
@@ -5992,7 +6264,7 @@ function useCodeBlock(config) {
|
|
|
5992
6264
|
hideWhenUnavailable = false,
|
|
5993
6265
|
onToggled
|
|
5994
6266
|
} = config || {};
|
|
5995
|
-
const { editor } =
|
|
6267
|
+
const { editor } = useTiptapEditor9(providedEditor);
|
|
5996
6268
|
const [isVisible, setIsVisible] = React16.useState(true);
|
|
5997
6269
|
const canToggleState = canToggle2(editor);
|
|
5998
6270
|
const isActive = (editor == null ? void 0 : editor.isActive("codeBlock")) || false;
|
|
@@ -6038,7 +6310,7 @@ var CodeBlockButton = ({
|
|
|
6038
6310
|
children,
|
|
6039
6311
|
...buttonProps
|
|
6040
6312
|
}) => {
|
|
6041
|
-
const { editor } =
|
|
6313
|
+
const { editor } = useTiptapEditor10(providedEditor);
|
|
6042
6314
|
const { isVisible, canToggle: canToggle3, isActive, handleToggle, label, shortcutKeys } = useCodeBlock({
|
|
6043
6315
|
editor,
|
|
6044
6316
|
hideWhenUnavailable,
|
|
@@ -6079,18 +6351,24 @@ var CodeBlockButton = ({
|
|
|
6079
6351
|
|
|
6080
6352
|
// src/ui/color-highlight-popover/color-highlight-popover.tsx
|
|
6081
6353
|
import { IconButton as IconButton8 } from "@kopexa/button";
|
|
6354
|
+
import { useTiptapEditor as useTiptapEditor13 } from "@kopexa/editor-utils";
|
|
6082
6355
|
import { BanIcon, HighlighterIcon as HighlighterIcon2 } from "@kopexa/icons";
|
|
6083
6356
|
import { Popover as Popover2 } from "@kopexa/popover";
|
|
6084
6357
|
import { ToolbarSeparator as ToolbarSeparator2 } from "@kopexa/toolbar";
|
|
6085
|
-
import { useMemo as
|
|
6358
|
+
import { useMemo as useMemo16, useRef as useRef10, useState as useState24 } from "react";
|
|
6086
6359
|
|
|
6087
6360
|
// src/ui/color-highlight-button/color-highlight-button.tsx
|
|
6361
|
+
import { useTiptapEditor as useTiptapEditor12 } from "@kopexa/editor-utils";
|
|
6088
6362
|
import { colorHighlightButton } from "@kopexa/theme";
|
|
6089
6363
|
import { ToolbarButton as ToolbarButton5 } from "@kopexa/toolbar";
|
|
6090
|
-
import { useCallback as useCallback26, useMemo as
|
|
6364
|
+
import { useCallback as useCallback26, useMemo as useMemo15 } from "react";
|
|
6091
6365
|
|
|
6092
6366
|
// src/ui/color-highlight-button/use-color-highlight.ts
|
|
6093
|
-
import {
|
|
6367
|
+
import {
|
|
6368
|
+
isMarkInSchema as isMarkInSchema3,
|
|
6369
|
+
isNodeTypeSelected as isNodeTypeSelected5,
|
|
6370
|
+
useTiptapEditor as useTiptapEditor11
|
|
6371
|
+
} from "@kopexa/editor-utils";
|
|
6094
6372
|
import { HighlighterIcon } from "@kopexa/icons";
|
|
6095
6373
|
import { useIsMobile } from "@kopexa/use-is-mobile";
|
|
6096
6374
|
import * as React17 from "react";
|
|
@@ -6186,7 +6464,7 @@ function useColorHighlight(config) {
|
|
|
6186
6464
|
hideWhenUnavailable = false,
|
|
6187
6465
|
onApplied
|
|
6188
6466
|
} = config;
|
|
6189
|
-
const { editor } =
|
|
6467
|
+
const { editor } = useTiptapEditor11(providedEditor);
|
|
6190
6468
|
const isMobile = useIsMobile();
|
|
6191
6469
|
const [isVisible, setIsVisible] = React17.useState(true);
|
|
6192
6470
|
const canColorHighlightState = canColorHighlight(editor);
|
|
@@ -6267,7 +6545,7 @@ var ColorHighlightButton = ({
|
|
|
6267
6545
|
className,
|
|
6268
6546
|
...buttonProps
|
|
6269
6547
|
}) => {
|
|
6270
|
-
const { editor } =
|
|
6548
|
+
const { editor } = useTiptapEditor12(providedEditor);
|
|
6271
6549
|
const {
|
|
6272
6550
|
isVisible,
|
|
6273
6551
|
canColorHighlight: canColorHighlight2,
|
|
@@ -6290,7 +6568,7 @@ var ColorHighlightButton = ({
|
|
|
6290
6568
|
},
|
|
6291
6569
|
[handleColorHighlight, onClick]
|
|
6292
6570
|
);
|
|
6293
|
-
const buttonStyle =
|
|
6571
|
+
const buttonStyle = useMemo15(
|
|
6294
6572
|
() => ({
|
|
6295
6573
|
...style,
|
|
6296
6574
|
"--highlight-color": highlightColor
|
|
@@ -6374,7 +6652,7 @@ function ColorHighlightPopoverContent({
|
|
|
6374
6652
|
}) {
|
|
6375
6653
|
const { handleRemoveHighlight } = useColorHighlight({ editor });
|
|
6376
6654
|
const containerRef = useRef10(null);
|
|
6377
|
-
const menuItems =
|
|
6655
|
+
const menuItems = useMemo16(
|
|
6378
6656
|
() => [...colors, { label: "Remove highlight", value: "none" }],
|
|
6379
6657
|
[colors]
|
|
6380
6658
|
);
|
|
@@ -6441,7 +6719,7 @@ function ColorHighlightPopover({
|
|
|
6441
6719
|
onApplied,
|
|
6442
6720
|
...props
|
|
6443
6721
|
}) {
|
|
6444
|
-
const { editor } =
|
|
6722
|
+
const { editor } = useTiptapEditor13(providedEditor);
|
|
6445
6723
|
const [isOpen, setIsOpen] = useState24(false);
|
|
6446
6724
|
const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
|
|
6447
6725
|
editor,
|
|
@@ -6474,14 +6752,14 @@ function ColorHighlightPopover({
|
|
|
6474
6752
|
// src/ui/heading-dropdown-menu/index.tsx
|
|
6475
6753
|
import { Button as Button8 } from "@kopexa/button";
|
|
6476
6754
|
import { DropdownMenu } from "@kopexa/dropdown-menu";
|
|
6477
|
-
import { isNodeInSchema as isNodeInSchema6 } from "@kopexa/editor-utils";
|
|
6755
|
+
import { isNodeInSchema as isNodeInSchema6, useTiptapEditor as useTiptapEditor15 } from "@kopexa/editor-utils";
|
|
6478
6756
|
import { ChevronDownIcon, HeadingIcon } from "@kopexa/icons";
|
|
6479
6757
|
import { isNodeSelection as isNodeSelection6 } from "@tiptap/react";
|
|
6480
6758
|
import * as React19 from "react";
|
|
6481
6759
|
|
|
6482
6760
|
// src/ui/heading-button/index.tsx
|
|
6483
6761
|
import { Button as Button7 } from "@kopexa/button";
|
|
6484
|
-
import { isNodeInSchema as isNodeInSchema5 } from "@kopexa/editor-utils";
|
|
6762
|
+
import { isNodeInSchema as isNodeInSchema5, useTiptapEditor as useTiptapEditor14 } from "@kopexa/editor-utils";
|
|
6485
6763
|
import {
|
|
6486
6764
|
HeadingFiveIcon,
|
|
6487
6765
|
HeadingFourIcon,
|
|
@@ -6582,7 +6860,7 @@ var HeadingButton = ({
|
|
|
6582
6860
|
ref,
|
|
6583
6861
|
...buttonProps
|
|
6584
6862
|
}) => {
|
|
6585
|
-
const { editor } =
|
|
6863
|
+
const { editor } = useTiptapEditor14(providedEditor);
|
|
6586
6864
|
const {
|
|
6587
6865
|
headingInSchema,
|
|
6588
6866
|
isDisabled,
|
|
@@ -6646,7 +6924,7 @@ function HeadingDropdownMenu({
|
|
|
6646
6924
|
}) {
|
|
6647
6925
|
var _a;
|
|
6648
6926
|
const [isOpen, setIsOpen] = React19.useState(false);
|
|
6649
|
-
const { editor } =
|
|
6927
|
+
const { editor } = useTiptapEditor15(providedEditor);
|
|
6650
6928
|
const headingInSchema = isNodeInSchema6("heading", editor);
|
|
6651
6929
|
const handleOnOpenChange = React19.useCallback(
|
|
6652
6930
|
(open) => {
|
|
@@ -6722,17 +7000,17 @@ function HeadingDropdownMenu({
|
|
|
6722
7000
|
// src/ui/list-dropdown-menu/index.tsx
|
|
6723
7001
|
import { Button as Button10 } from "@kopexa/button";
|
|
6724
7002
|
import { DropdownMenu as DropdownMenu2 } from "@kopexa/dropdown-menu";
|
|
6725
|
-
import { isNodeInSchema as isNodeInSchema8 } from "@kopexa/editor-utils";
|
|
7003
|
+
import { isNodeInSchema as isNodeInSchema8, useTiptapEditor as useTiptapEditor17 } from "@kopexa/editor-utils";
|
|
6726
7004
|
import { ChevronDownIcon as ChevronDownIcon2, ListIcon as ListIcon4 } from "@kopexa/icons";
|
|
6727
7005
|
import { isNodeSelection as isNodeSelection8 } from "@tiptap/react";
|
|
6728
|
-
import { useCallback as useCallback30, useMemo as
|
|
7006
|
+
import { useCallback as useCallback30, useMemo as useMemo20, useState as useState26 } from "react";
|
|
6729
7007
|
|
|
6730
7008
|
// src/ui/list-button/index.tsx
|
|
6731
7009
|
import { Button as Button9 } from "@kopexa/button";
|
|
6732
|
-
import { isNodeInSchema as isNodeInSchema7 } from "@kopexa/editor-utils";
|
|
7010
|
+
import { isNodeInSchema as isNodeInSchema7, useTiptapEditor as useTiptapEditor16 } from "@kopexa/editor-utils";
|
|
6733
7011
|
import { ListIcon as ListIcon3, ListOrderedIcon as ListOrderedIcon2, ListTodoIcon as ListTodoIcon2 } from "@kopexa/icons";
|
|
6734
7012
|
import { isNodeSelection as isNodeSelection7 } from "@tiptap/react";
|
|
6735
|
-
import { useCallback as useCallback29, useMemo as
|
|
7013
|
+
import { useCallback as useCallback29, useMemo as useMemo19 } from "react";
|
|
6736
7014
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6737
7015
|
var listOptions = [
|
|
6738
7016
|
{
|
|
@@ -6836,7 +7114,7 @@ var ListButton = ({
|
|
|
6836
7114
|
ref,
|
|
6837
7115
|
...buttonProps
|
|
6838
7116
|
}) => {
|
|
6839
|
-
const { editor } =
|
|
7117
|
+
const { editor } = useTiptapEditor16(providedEditor);
|
|
6840
7118
|
const { listInSchema, listOption, isActive, shortcutKey } = useListState(
|
|
6841
7119
|
editor,
|
|
6842
7120
|
type
|
|
@@ -6851,7 +7129,7 @@ var ListButton = ({
|
|
|
6851
7129
|
},
|
|
6852
7130
|
[onClick, editor, type]
|
|
6853
7131
|
);
|
|
6854
|
-
const show =
|
|
7132
|
+
const show = useMemo19(() => {
|
|
6855
7133
|
return shouldShowListButton({
|
|
6856
7134
|
editor,
|
|
6857
7135
|
type,
|
|
@@ -6916,7 +7194,7 @@ function useListDropdownState(editor, availableTypes) {
|
|
|
6916
7194
|
const listInSchema = availableTypes.some(
|
|
6917
7195
|
(type) => isNodeInSchema8(type, editor)
|
|
6918
7196
|
);
|
|
6919
|
-
const filteredLists =
|
|
7197
|
+
const filteredLists = useMemo20(
|
|
6920
7198
|
() => getFilteredListOptions(availableTypes),
|
|
6921
7199
|
[availableTypes]
|
|
6922
7200
|
);
|
|
@@ -6954,7 +7232,7 @@ function ListDropdownMenu({
|
|
|
6954
7232
|
onOpenChange,
|
|
6955
7233
|
...props
|
|
6956
7234
|
}) {
|
|
6957
|
-
const { editor } =
|
|
7235
|
+
const { editor } = useTiptapEditor17(providedEditor);
|
|
6958
7236
|
const {
|
|
6959
7237
|
isOpen,
|
|
6960
7238
|
listInSchema,
|
|
@@ -6964,7 +7242,7 @@ function ListDropdownMenu({
|
|
|
6964
7242
|
handleOpenChange
|
|
6965
7243
|
} = useListDropdownState(editor, types);
|
|
6966
7244
|
const getActiveIcon = useActiveListIcon(editor, filteredLists);
|
|
6967
|
-
const show =
|
|
7245
|
+
const show = useMemo20(() => {
|
|
6968
7246
|
return shouldShowListDropdown({
|
|
6969
7247
|
editor,
|
|
6970
7248
|
listTypes: types,
|
|
@@ -7012,6 +7290,7 @@ function ListDropdownMenu({
|
|
|
7012
7290
|
}
|
|
7013
7291
|
|
|
7014
7292
|
// src/ui/table-button/index.tsx
|
|
7293
|
+
import { useTiptapEditor as useTiptapEditor18 } from "@kopexa/editor-utils";
|
|
7015
7294
|
import { ToolbarButton as ToolbarButton6 } from "@kopexa/toolbar";
|
|
7016
7295
|
import { useCallback as useCallback31 } from "react";
|
|
7017
7296
|
import { Fragment as Fragment6, jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -7024,7 +7303,7 @@ var TableButton = ({
|
|
|
7024
7303
|
children,
|
|
7025
7304
|
...buttonProps
|
|
7026
7305
|
}) => {
|
|
7027
|
-
const { editor } =
|
|
7306
|
+
const { editor } = useTiptapEditor18(providedEditor);
|
|
7028
7307
|
const {
|
|
7029
7308
|
isVisible,
|
|
7030
7309
|
canToggle: canToggle3,
|
|
@@ -7075,10 +7354,15 @@ var TableButton = ({
|
|
|
7075
7354
|
|
|
7076
7355
|
// src/ui/text-align-button/text-align-button.tsx
|
|
7077
7356
|
import { IconButton as IconButton9 } from "@kopexa/button";
|
|
7357
|
+
import { useTiptapEditor as useTiptapEditor20 } from "@kopexa/editor-utils";
|
|
7078
7358
|
import { useCallback as useCallback33 } from "react";
|
|
7079
7359
|
|
|
7080
7360
|
// src/ui/text-align-button/use-text-align.ts
|
|
7081
|
-
import {
|
|
7361
|
+
import {
|
|
7362
|
+
isExtensionAvailable as isExtensionAvailable2,
|
|
7363
|
+
isNodeTypeSelected as isNodeTypeSelected6,
|
|
7364
|
+
useTiptapEditor as useTiptapEditor19
|
|
7365
|
+
} from "@kopexa/editor-utils";
|
|
7082
7366
|
import {
|
|
7083
7367
|
AlignCenterIcon,
|
|
7084
7368
|
AlignJustifyIcon,
|
|
@@ -7142,7 +7426,7 @@ function useTextAlign(config) {
|
|
|
7142
7426
|
hideWhenUnavailable = false,
|
|
7143
7427
|
onAligned
|
|
7144
7428
|
} = config;
|
|
7145
|
-
const { editor } =
|
|
7429
|
+
const { editor } = useTiptapEditor19(providedEditor);
|
|
7146
7430
|
const [isVisible, setIsVisible] = useState27(true);
|
|
7147
7431
|
const canAlign = canSetTextAlign(editor, align);
|
|
7148
7432
|
const isActive = isTextAlignActive(editor, align);
|
|
@@ -7189,7 +7473,7 @@ var TextAlignButton = ({
|
|
|
7189
7473
|
children,
|
|
7190
7474
|
...buttonProps
|
|
7191
7475
|
}) => {
|
|
7192
|
-
const { editor } =
|
|
7476
|
+
const { editor } = useTiptapEditor20(providedEditor);
|
|
7193
7477
|
const {
|
|
7194
7478
|
isVisible,
|
|
7195
7479
|
handleTextAlign,
|
|
@@ -7237,11 +7521,12 @@ var TextAlignButton = ({
|
|
|
7237
7521
|
};
|
|
7238
7522
|
|
|
7239
7523
|
// src/ui/undo-redo-button/undo-redo-button.tsx
|
|
7524
|
+
import { useTiptapEditor as useTiptapEditor22 } from "@kopexa/editor-utils";
|
|
7240
7525
|
import { ToolbarButton as ToolbarButton7 } from "@kopexa/toolbar";
|
|
7241
7526
|
import { useCallback as useCallback35 } from "react";
|
|
7242
7527
|
|
|
7243
7528
|
// src/ui/undo-redo-button/use-undo-redo.ts
|
|
7244
|
-
import { isNodeTypeSelected as isNodeTypeSelected7 } from "@kopexa/editor-utils";
|
|
7529
|
+
import { isNodeTypeSelected as isNodeTypeSelected7, useTiptapEditor as useTiptapEditor21 } from "@kopexa/editor-utils";
|
|
7245
7530
|
import { RedoIcon, UndoIcon } from "@kopexa/icons";
|
|
7246
7531
|
import { useCallback as useCallback34, useEffect as useEffect28, useState as useState28 } from "react";
|
|
7247
7532
|
var UNDO_REDO_SHORTCUT_KEYS = {
|
|
@@ -7282,7 +7567,7 @@ function useUndoRedo(config) {
|
|
|
7282
7567
|
hideWhenUnavailable = false,
|
|
7283
7568
|
onExecuted
|
|
7284
7569
|
} = config;
|
|
7285
|
-
const { editor } =
|
|
7570
|
+
const { editor } = useTiptapEditor21(providedEditor);
|
|
7286
7571
|
const [isVisible, setIsVisible] = useState28(true);
|
|
7287
7572
|
const canExecute = canExecuteUndoRedoAction(editor, action);
|
|
7288
7573
|
useEffect28(() => {
|
|
@@ -7327,7 +7612,7 @@ var UndoRedoButton = ({
|
|
|
7327
7612
|
children,
|
|
7328
7613
|
...buttonProps
|
|
7329
7614
|
}) => {
|
|
7330
|
-
const { editor } =
|
|
7615
|
+
const { editor } = useTiptapEditor22(providedEditor);
|
|
7331
7616
|
const { isVisible, handleAction, label, canExecute, Icon, shortcutKeys } = useUndoRedo({
|
|
7332
7617
|
editor,
|
|
7333
7618
|
action,
|
|
@@ -7372,7 +7657,7 @@ var EditorHeader = ({
|
|
|
7372
7657
|
variant
|
|
7373
7658
|
}) => {
|
|
7374
7659
|
var _a, _b;
|
|
7375
|
-
const { editor } =
|
|
7660
|
+
const { editor } = useTiptapEditor23(providedEditor);
|
|
7376
7661
|
const isMobile = useIsMobile2();
|
|
7377
7662
|
const windowSize = useWindowSize();
|
|
7378
7663
|
const { styles } = useEditorUIContext();
|
|
@@ -7449,7 +7734,7 @@ function MoreOptions({
|
|
|
7449
7734
|
hideWhenUnavailable = false,
|
|
7450
7735
|
...props
|
|
7451
7736
|
}) {
|
|
7452
|
-
const { editor } =
|
|
7737
|
+
const { editor } = useTiptapEditor23(providedEditor);
|
|
7453
7738
|
const [show, setShow] = useState29(false);
|
|
7454
7739
|
useEffect29(() => {
|
|
7455
7740
|
if (!editor) return;
|
|
@@ -7542,7 +7827,7 @@ function shouldShowMoreOptions(params) {
|
|
|
7542
7827
|
}
|
|
7543
7828
|
|
|
7544
7829
|
// src/presets/basic/index.tsx
|
|
7545
|
-
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7830
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7546
7831
|
var BasicEditor = ({
|
|
7547
7832
|
variant,
|
|
7548
7833
|
bordered,
|
|
@@ -7655,7 +7940,23 @@ var EditorContentArea = ({
|
|
|
7655
7940
|
}
|
|
7656
7941
|
),
|
|
7657
7942
|
isEditable && /* @__PURE__ */ jsx33(BubbleMenu, { editor }),
|
|
7658
|
-
isEditable && /* @__PURE__ */ jsx33(LinkBubble, { editor })
|
|
7943
|
+
isEditable && /* @__PURE__ */ jsx33(LinkBubble, { editor }),
|
|
7944
|
+
isEditable && /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
7945
|
+
/* @__PURE__ */ jsx33(TableHandle, { editor }),
|
|
7946
|
+
/* @__PURE__ */ jsx33(
|
|
7947
|
+
TableSelectionOverlay,
|
|
7948
|
+
{
|
|
7949
|
+
showResizeHandles: true,
|
|
7950
|
+
cellMenu: (props) => /* @__PURE__ */ jsx33(
|
|
7951
|
+
TableCellHandleMenu,
|
|
7952
|
+
{
|
|
7953
|
+
editor: props.editor,
|
|
7954
|
+
onOpenChange: props.onOpenChange
|
|
7955
|
+
}
|
|
7956
|
+
)
|
|
7957
|
+
}
|
|
7958
|
+
)
|
|
7959
|
+
] })
|
|
7659
7960
|
] })
|
|
7660
7961
|
);
|
|
7661
7962
|
};
|