@harbour-enterprises/superdoc 0.23.0-next.25 → 0.23.0-next.27
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/chunks/{PdfViewer-D5j64OT4.es.js → PdfViewer-C8baB1bn.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CYMwWMP6.cjs → PdfViewer-DJ7UGyBT.cjs} +1 -1
- package/dist/chunks/{index-CIz8zQ3h.cjs → index-BjwQD_um.cjs} +2 -2
- package/dist/chunks/{index-ePxDRT3A.es.js → index-DScOqhcx.es.js} +2 -2
- package/dist/chunks/{super-editor.es-BhyobyII.es.js → super-editor.es-D0-dqxm2.es.js} +328 -133
- package/dist/chunks/{super-editor.es-DZWnc89F.cjs → super-editor.es-DpCRbxmi.cjs} +328 -133
- package/dist/style.css +6 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CL8NqbzP.js → converter-B2Y-pDXk.js} +120 -24
- package/dist/super-editor/chunks/{docx-zipper-Ab__pf6Y.js → docx-zipper-bhLh8OB6.js} +1 -1
- package/dist/super-editor/chunks/{editor-DDXA7n3I.js → editor-GN9xFFdh.js} +2 -2
- package/dist/super-editor/chunks/{toolbar-BkZURoPS.js → toolbar-Bq8miKER.js} +14 -12
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +6 -1
- package/dist/super-editor/super-editor/src/components/slash-menu/constants.d.ts +4 -0
- package/dist/super-editor/super-editor/src/components/slash-menu/menuItems.d.ts +4 -36
- package/dist/super-editor/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +5 -12
- package/dist/super-editor/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +1 -3
- package/dist/super-editor/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +1 -3
- package/dist/super-editor/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +1 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pict/helpers/handle-shape-textbox-import.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pict/helpers/handle-v-rect-import.d.ts +1 -1
- package/dist/super-editor/super-editor.es.js +212 -113
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +328 -133
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
11
|
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
-
import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, at as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as runPropertyTranslators, aG as commentRangeEndTranslator, aH as commentRangeStartTranslator, aI as translator, aJ as translator$1, aK as translator$2, aL as translator$3, aM as translator$4, aN as translator$5, aO as translator$6, aP as translator$7, aQ as translator$8, aR as translator$9, aS as translator$a, aT as translator$b, aU as translator$c, aV as translator$d, aW as translator$e, aX as translator$f, aY as translator$g, aZ as translator$h, a_ as translator$i, a$ as translator$j, b0 as translator$k, b1 as translator$l, b2 as translator$m, b3 as translator$n, b4 as translator$o, b5 as translator$p, b6 as translator$q, b7 as translator$r, b8 as translator$s, b9 as translator$t, ba as translator$u, bb as translator$v, bc as translator$w, bd as translator$x, be as translator$y, bf as translator$z, bg as translator$A, bh as translator$B, bi as translator$C, bj as translator$D, bk as translator$E, bl as translator$F, bm as translator$G, bn as translator$H, bo as translator$I, bp as translator$J, bq as translator$K, br as translator$L, bs as translator$M, bt as translator$N, bu as translator$O, bv as translator$P, bw as translator$Q, bx as translator$R, by as translator$S, bz as translator$T, bA as translator$U, bB as translator$V, bC as translator$W, bD as translator$X, bE as translator$Y, bF as translator$Z, bG as translator$_, bH as translator$$, bI as translator$10, bJ as translator$11, bK as translator$12, a as Plugin } from "./chunks/converter-
|
|
13
|
-
import { bL, a5, i, a2 } from "./chunks/converter-
|
|
14
|
-
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-
|
|
15
|
-
import { n, C, o, T, l, p, m } from "./chunks/editor-
|
|
12
|
+
import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, at as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as runPropertyTranslators, aG as commentRangeEndTranslator, aH as commentRangeStartTranslator, aI as translator, aJ as translator$1, aK as translator$2, aL as translator$3, aM as translator$4, aN as translator$5, aO as translator$6, aP as translator$7, aQ as translator$8, aR as translator$9, aS as translator$a, aT as translator$b, aU as translator$c, aV as translator$d, aW as translator$e, aX as translator$f, aY as translator$g, aZ as translator$h, a_ as translator$i, a$ as translator$j, b0 as translator$k, b1 as translator$l, b2 as translator$m, b3 as translator$n, b4 as translator$o, b5 as translator$p, b6 as translator$q, b7 as translator$r, b8 as translator$s, b9 as translator$t, ba as translator$u, bb as translator$v, bc as translator$w, bd as translator$x, be as translator$y, bf as translator$z, bg as translator$A, bh as translator$B, bi as translator$C, bj as translator$D, bk as translator$E, bl as translator$F, bm as translator$G, bn as translator$H, bo as translator$I, bp as translator$J, bq as translator$K, br as translator$L, bs as translator$M, bt as translator$N, bu as translator$O, bv as translator$P, bw as translator$Q, bx as translator$R, by as translator$S, bz as translator$T, bA as translator$U, bB as translator$V, bC as translator$W, bD as translator$X, bE as translator$Y, bF as translator$Z, bG as translator$_, bH as translator$$, bI as translator$10, bJ as translator$11, bK as translator$12, a as Plugin } from "./chunks/converter-B2Y-pDXk.js";
|
|
13
|
+
import { bL, a5, i, a2 } from "./chunks/converter-B2Y-pDXk.js";
|
|
14
|
+
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-GN9xFFdh.js";
|
|
15
|
+
import { n, C, o, T, l, p, m } from "./chunks/editor-GN9xFFdh.js";
|
|
16
16
|
import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
|
|
17
|
-
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar,
|
|
17
|
+
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-Bq8miKER.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-bhLh8OB6.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
var hasRequiredEventemitter3;
|
|
@@ -3349,7 +3349,9 @@ const ICONS = {
|
|
|
3349
3349
|
copy: copyIconSvg,
|
|
3350
3350
|
paste: pasteIconSvg,
|
|
3351
3351
|
addDocumentSection: plusIconSvg,
|
|
3352
|
-
removeDocumentSection: trashIconSvg
|
|
3352
|
+
removeDocumentSection: trashIconSvg,
|
|
3353
|
+
trackChangesAccept: checkIconSvg$1,
|
|
3354
|
+
trackChangesReject: xMarkIconSvg
|
|
3353
3355
|
};
|
|
3354
3356
|
const TEXTS = {
|
|
3355
3357
|
addRowBefore: "Insert row above",
|
|
@@ -3372,7 +3374,9 @@ const TEXTS = {
|
|
|
3372
3374
|
copy: "Copy",
|
|
3373
3375
|
paste: "Paste",
|
|
3374
3376
|
removeDocumentSection: "Remove section",
|
|
3375
|
-
createDocumentSection: "Create section"
|
|
3377
|
+
createDocumentSection: "Create section",
|
|
3378
|
+
trackChangesAccept: "Accept change",
|
|
3379
|
+
trackChangesReject: "Reject change"
|
|
3376
3380
|
};
|
|
3377
3381
|
const tableActionsOptions = [
|
|
3378
3382
|
{
|
|
@@ -3576,34 +3580,37 @@ async function getEditorContext(editor, event) {
|
|
|
3576
3580
|
const isInSectionNode = structureFromResolvedPos?.isInSectionNode ?? selectionHasNodeOrMark(state, "documentSection", { requireEnds: true });
|
|
3577
3581
|
const currentNodeType = node?.type?.name || null;
|
|
3578
3582
|
const activeMarks = [];
|
|
3583
|
+
let trackedChangeId = null;
|
|
3579
3584
|
if (event && pos !== null) {
|
|
3580
3585
|
const $pos = state.doc.resolve(pos);
|
|
3581
|
-
|
|
3582
|
-
|
|
3586
|
+
const processMark = (mark) => {
|
|
3587
|
+
if (!activeMarks.includes(mark.type.name)) {
|
|
3588
|
+
activeMarks.push(mark.type.name);
|
|
3589
|
+
}
|
|
3590
|
+
if (!trackedChangeId && (mark.type.name === "trackInsert" || mark.type.name === "trackDelete" || mark.type.name === "trackFormat")) {
|
|
3591
|
+
trackedChangeId = mark.attrs.id;
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
3594
|
+
for (let depth = 0; depth <= $pos.depth; depth++) {
|
|
3595
|
+
const nodeAtDepth = $pos.node(depth);
|
|
3596
|
+
if (nodeAtDepth && nodeAtDepth.marks) {
|
|
3597
|
+
nodeAtDepth.marks.forEach(processMark);
|
|
3598
|
+
}
|
|
3583
3599
|
}
|
|
3584
|
-
if (
|
|
3585
|
-
|
|
3600
|
+
if (state.storedMarks) {
|
|
3601
|
+
state.storedMarks.forEach(processMark);
|
|
3586
3602
|
}
|
|
3587
3603
|
} else {
|
|
3588
3604
|
state.storedMarks?.forEach((mark) => activeMarks.push(mark.type.name));
|
|
3589
3605
|
state.selection.$head.marks().forEach((mark) => activeMarks.push(mark.type.name));
|
|
3590
3606
|
}
|
|
3591
|
-
const isTrackedChange = activeMarks.includes("trackInsert") || activeMarks.includes("trackDelete");
|
|
3592
|
-
let trackedChangeId = null;
|
|
3593
|
-
if (isTrackedChange && event && pos !== null) {
|
|
3594
|
-
const $pos = state.doc.resolve(pos);
|
|
3595
|
-
const marksAtPos = $pos.marks();
|
|
3596
|
-
const trackedMark = marksAtPos.find((mark) => mark.type.name === "trackInsert" || mark.type.name === "trackDelete");
|
|
3597
|
-
if (trackedMark) {
|
|
3598
|
-
trackedChangeId = trackedMark.attrs.id;
|
|
3599
|
-
}
|
|
3600
|
-
}
|
|
3607
|
+
const isTrackedChange = activeMarks.includes("trackInsert") || activeMarks.includes("trackDelete") || activeMarks.includes("trackFormat");
|
|
3601
3608
|
const cursorCoords = pos ? view.coordsAtPos(pos) : null;
|
|
3602
3609
|
const cursorPosition = cursorCoords ? {
|
|
3603
3610
|
x: cursorCoords.left,
|
|
3604
3611
|
y: cursorCoords.top
|
|
3605
3612
|
} : null;
|
|
3606
|
-
|
|
3613
|
+
const context = {
|
|
3607
3614
|
// Selection info
|
|
3608
3615
|
selectedText,
|
|
3609
3616
|
hasSelection: !empty,
|
|
@@ -3629,9 +3636,11 @@ async function getEditorContext(editor, event) {
|
|
|
3629
3636
|
pos,
|
|
3630
3637
|
node,
|
|
3631
3638
|
event,
|
|
3639
|
+
trigger: event ? "click" : "slash",
|
|
3632
3640
|
// Editor reference for advanced use cases
|
|
3633
3641
|
editor
|
|
3634
3642
|
};
|
|
3643
|
+
return context;
|
|
3635
3644
|
}
|
|
3636
3645
|
function computeCanUndo(editor, state) {
|
|
3637
3646
|
if (typeof editor?.can === "function") {
|
|
@@ -3712,160 +3721,209 @@ const isModuleEnabled = (editorOptions, moduleName) => {
|
|
|
3712
3721
|
switch (moduleName) {
|
|
3713
3722
|
case "ai":
|
|
3714
3723
|
return !!editorOptions?.isAiEnabled;
|
|
3715
|
-
// Example for future use cases
|
|
3716
|
-
// case 'comments':
|
|
3717
|
-
// return !!editorOptions?.isCommentsEnabled;
|
|
3718
3724
|
default:
|
|
3719
3725
|
return true;
|
|
3720
3726
|
}
|
|
3721
3727
|
};
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
const slashMenuConfig = editor.options?.slashMenuConfig;
|
|
3725
|
-
if (!slashMenuConfig) {
|
|
3726
|
-
return defaultSections;
|
|
3727
|
-
}
|
|
3728
|
-
let sections = [];
|
|
3729
|
-
if (slashMenuConfig.includeDefaultItems !== false) {
|
|
3730
|
-
sections = [...defaultSections];
|
|
3731
|
-
}
|
|
3732
|
-
if (slashMenuConfig.customItems && Array.isArray(slashMenuConfig.customItems)) {
|
|
3733
|
-
sections = [...sections, ...slashMenuConfig.customItems];
|
|
3734
|
-
}
|
|
3735
|
-
if (typeof slashMenuConfig.menuProvider === "function") {
|
|
3728
|
+
const shouldShowItem = (item, context) => {
|
|
3729
|
+
if (typeof item.showWhen === "function") {
|
|
3736
3730
|
try {
|
|
3737
|
-
|
|
3731
|
+
return item.showWhen(context);
|
|
3738
3732
|
} catch (error) {
|
|
3739
|
-
console.warn("[SlashMenu]
|
|
3733
|
+
console.warn("[SlashMenu] showWhen error for item", item.id, ":", error);
|
|
3734
|
+
return false;
|
|
3740
3735
|
}
|
|
3741
3736
|
}
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
items: filteredItems
|
|
3760
|
-
};
|
|
3761
|
-
}).filter((section) => section.items.length > 0);
|
|
3762
|
-
}
|
|
3763
|
-
function getItems(context) {
|
|
3764
|
-
const { editor, selectedText, trigger, clipboardContent } = context;
|
|
3765
|
-
const clipboardHasContent = Boolean(
|
|
3766
|
-
clipboardContent?.hasContent || clipboardContent?.html || clipboardContent?.text || typeof clipboardContent?.size === "number" && clipboardContent.size > 0 || clipboardContent && typeof clipboardContent?.content?.size === "number" && clipboardContent.content.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw.size === "number" && clipboardContent.raw.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw?.content?.size === "number" && clipboardContent.raw.content.size > 0
|
|
3767
|
-
);
|
|
3768
|
-
const isInTable2 = selectionHasNodeOrMark(editor.view.state, "table", { requireEnds: true });
|
|
3769
|
-
const isInSectionNode = selectionHasNodeOrMark(editor.view.state, "documentSection", { requireEnds: true });
|
|
3770
|
-
const sections = [
|
|
3737
|
+
};
|
|
3738
|
+
function getItems(context, customItems = [], includeDefaultItems = true) {
|
|
3739
|
+
const { selectedText, editor } = context;
|
|
3740
|
+
if (arguments.length === 1 && editor?.options?.slashMenuConfig) {
|
|
3741
|
+
customItems = editor.options.slashMenuConfig.items || editor.options.slashMenuConfig.customItems || [];
|
|
3742
|
+
includeDefaultItems = editor.options.slashMenuConfig.includeDefaultItems !== false;
|
|
3743
|
+
}
|
|
3744
|
+
const enhancedContext = {
|
|
3745
|
+
...context,
|
|
3746
|
+
isInTable: context.isInTable ?? false,
|
|
3747
|
+
isInSectionNode: context.isInSectionNode ?? false,
|
|
3748
|
+
isTrackedChange: context.isTrackedChange ?? false,
|
|
3749
|
+
clipboardContent: context.clipboardContent ?? { hasContent: false },
|
|
3750
|
+
selectedText: context.selectedText ?? "",
|
|
3751
|
+
hasSelection: context.hasSelection ?? Boolean(context.selectedText)
|
|
3752
|
+
};
|
|
3753
|
+
const defaultSections = [
|
|
3771
3754
|
{
|
|
3772
3755
|
id: "ai-content",
|
|
3756
|
+
isDefault: true,
|
|
3773
3757
|
items: [
|
|
3774
3758
|
{
|
|
3775
3759
|
id: "insert-text",
|
|
3776
3760
|
label: selectedText ? TEXTS.replaceText : TEXTS.insertText,
|
|
3777
3761
|
icon: ICONS.ai,
|
|
3778
3762
|
component: AIWriter,
|
|
3763
|
+
isDefault: true,
|
|
3779
3764
|
action: (editor2) => {
|
|
3780
3765
|
if (editor2?.commands && typeof editor2.commands?.insertAiMark === "function") {
|
|
3781
3766
|
editor2.commands.insertAiMark();
|
|
3782
3767
|
}
|
|
3783
3768
|
},
|
|
3784
|
-
|
|
3785
|
-
|
|
3769
|
+
showWhen: (context2) => {
|
|
3770
|
+
const { trigger } = context2;
|
|
3771
|
+
const allowedTriggers = [TRIGGERS.slash, TRIGGERS.click];
|
|
3772
|
+
return allowedTriggers.includes(trigger) && isModuleEnabled(context2.editor?.options, "ai");
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
]
|
|
3776
|
+
},
|
|
3777
|
+
{
|
|
3778
|
+
id: "track-changes",
|
|
3779
|
+
isDefault: true,
|
|
3780
|
+
items: [
|
|
3781
|
+
{
|
|
3782
|
+
id: "track-changes-accept",
|
|
3783
|
+
icon: ICONS.trackChangesAccept,
|
|
3784
|
+
label: TEXTS.trackChangesAccept,
|
|
3785
|
+
isDefault: true,
|
|
3786
|
+
action: (editor2, context2) => {
|
|
3787
|
+
if (context2?.trackedChangeId) {
|
|
3788
|
+
editor2.commands.acceptTrackedChangeById(context2.trackedChangeId);
|
|
3789
|
+
} else {
|
|
3790
|
+
editor2.commands.acceptTrackedChangeBySelection();
|
|
3791
|
+
}
|
|
3792
|
+
},
|
|
3793
|
+
showWhen: (context2) => {
|
|
3794
|
+
const { trigger, isTrackedChange } = context2;
|
|
3795
|
+
return trigger === TRIGGERS.click && isTrackedChange;
|
|
3796
|
+
}
|
|
3797
|
+
},
|
|
3798
|
+
{
|
|
3799
|
+
id: "track-changes-reject",
|
|
3800
|
+
label: TEXTS.trackChangesReject,
|
|
3801
|
+
icon: ICONS.trackChangesReject,
|
|
3802
|
+
isDefault: true,
|
|
3803
|
+
action: (editor2, context2) => {
|
|
3804
|
+
if (context2?.trackedChangeId) {
|
|
3805
|
+
editor2.commands.rejectTrackedChangeById(context2.trackedChangeId);
|
|
3806
|
+
} else {
|
|
3807
|
+
editor2.commands.rejectTrackedChangeOnSelection();
|
|
3808
|
+
}
|
|
3809
|
+
},
|
|
3810
|
+
showWhen: (context2) => {
|
|
3811
|
+
const { trigger, isTrackedChange } = context2;
|
|
3812
|
+
return trigger === TRIGGERS.click && isTrackedChange;
|
|
3813
|
+
}
|
|
3786
3814
|
}
|
|
3787
3815
|
]
|
|
3788
3816
|
},
|
|
3789
3817
|
{
|
|
3790
3818
|
id: "document-sections",
|
|
3819
|
+
isDefault: true,
|
|
3791
3820
|
items: [
|
|
3792
3821
|
{
|
|
3793
3822
|
id: "insert-document-section",
|
|
3794
3823
|
label: TEXTS.createDocumentSection,
|
|
3795
3824
|
icon: ICONS.addDocumentSection,
|
|
3825
|
+
isDefault: true,
|
|
3796
3826
|
action: (editor2) => {
|
|
3797
3827
|
editor2.commands.createDocumentSection();
|
|
3798
3828
|
},
|
|
3799
|
-
|
|
3829
|
+
showWhen: (context2) => {
|
|
3830
|
+
const { trigger } = context2;
|
|
3831
|
+
return trigger === TRIGGERS.click;
|
|
3832
|
+
}
|
|
3800
3833
|
},
|
|
3801
3834
|
{
|
|
3802
3835
|
id: "remove-section",
|
|
3803
3836
|
label: TEXTS.removeDocumentSection,
|
|
3804
3837
|
icon: ICONS.removeDocumentSection,
|
|
3838
|
+
isDefault: true,
|
|
3805
3839
|
action: (editor2) => {
|
|
3806
3840
|
editor2.commands.removeSectionAtSelection();
|
|
3807
3841
|
},
|
|
3808
|
-
|
|
3809
|
-
|
|
3842
|
+
showWhen: (context2) => {
|
|
3843
|
+
const { trigger, isInSectionNode } = context2;
|
|
3844
|
+
return trigger === TRIGGERS.click && isInSectionNode;
|
|
3845
|
+
}
|
|
3810
3846
|
}
|
|
3811
3847
|
]
|
|
3812
3848
|
},
|
|
3813
3849
|
{
|
|
3814
3850
|
id: "general",
|
|
3851
|
+
isDefault: true,
|
|
3815
3852
|
items: [
|
|
3816
3853
|
{
|
|
3817
3854
|
id: "insert-link",
|
|
3818
3855
|
label: TEXTS.insertLink,
|
|
3819
3856
|
icon: ICONS.link,
|
|
3820
3857
|
component: LinkInput,
|
|
3821
|
-
|
|
3858
|
+
isDefault: true,
|
|
3859
|
+
showWhen: (context2) => {
|
|
3860
|
+
const { trigger } = context2;
|
|
3861
|
+
return trigger === TRIGGERS.click;
|
|
3862
|
+
}
|
|
3822
3863
|
},
|
|
3823
3864
|
{
|
|
3824
3865
|
id: "insert-table",
|
|
3825
3866
|
label: TEXTS.insertTable,
|
|
3826
3867
|
icon: ICONS.table,
|
|
3827
3868
|
component: TableGrid,
|
|
3828
|
-
|
|
3869
|
+
isDefault: true,
|
|
3870
|
+
showWhen: (context2) => {
|
|
3871
|
+
const { trigger, isInTable: isInTable2 } = context2;
|
|
3872
|
+
const allowedTriggers = [TRIGGERS.slash, TRIGGERS.click];
|
|
3873
|
+
return allowedTriggers.includes(trigger) && !isInTable2;
|
|
3874
|
+
}
|
|
3829
3875
|
},
|
|
3830
3876
|
{
|
|
3831
3877
|
id: "edit-table",
|
|
3832
3878
|
label: TEXTS.editTable,
|
|
3833
3879
|
icon: ICONS.table,
|
|
3834
3880
|
component: TableActions,
|
|
3835
|
-
|
|
3836
|
-
|
|
3881
|
+
isDefault: true,
|
|
3882
|
+
showWhen: (context2) => {
|
|
3883
|
+
const { trigger, isInTable: isInTable2 } = context2;
|
|
3884
|
+
const allowedTriggers = [TRIGGERS.slash, TRIGGERS.click];
|
|
3885
|
+
return allowedTriggers.includes(trigger) && isInTable2;
|
|
3886
|
+
}
|
|
3837
3887
|
}
|
|
3838
3888
|
]
|
|
3839
3889
|
},
|
|
3840
3890
|
{
|
|
3841
3891
|
id: "clipboard",
|
|
3892
|
+
isDefault: true,
|
|
3842
3893
|
items: [
|
|
3843
3894
|
{
|
|
3844
3895
|
id: "cut",
|
|
3845
3896
|
label: TEXTS.cut,
|
|
3846
3897
|
icon: ICONS.cut,
|
|
3898
|
+
isDefault: true,
|
|
3847
3899
|
action: (editor2) => {
|
|
3848
3900
|
editor2.view.focus();
|
|
3849
3901
|
document.execCommand("cut");
|
|
3850
3902
|
},
|
|
3851
|
-
|
|
3852
|
-
|
|
3903
|
+
showWhen: (context2) => {
|
|
3904
|
+
const { trigger, selectedText: selectedText2 } = context2;
|
|
3905
|
+
return trigger === TRIGGERS.click && selectedText2;
|
|
3906
|
+
}
|
|
3853
3907
|
},
|
|
3854
3908
|
{
|
|
3855
3909
|
id: "copy",
|
|
3856
3910
|
label: TEXTS.copy,
|
|
3857
3911
|
icon: ICONS.copy,
|
|
3912
|
+
isDefault: true,
|
|
3858
3913
|
action: (editor2) => {
|
|
3859
3914
|
editor2.view.focus();
|
|
3860
3915
|
document.execCommand("copy");
|
|
3861
3916
|
},
|
|
3862
|
-
|
|
3863
|
-
|
|
3917
|
+
showWhen: (context2) => {
|
|
3918
|
+
const { trigger, selectedText: selectedText2 } = context2;
|
|
3919
|
+
return trigger === TRIGGERS.click && selectedText2;
|
|
3920
|
+
}
|
|
3864
3921
|
},
|
|
3865
3922
|
{
|
|
3866
3923
|
id: "paste",
|
|
3867
3924
|
label: TEXTS.paste,
|
|
3868
3925
|
icon: ICONS.paste,
|
|
3926
|
+
isDefault: true,
|
|
3869
3927
|
action: async (editor2) => {
|
|
3870
3928
|
try {
|
|
3871
3929
|
const clipboardItems = await navigator.clipboard.read();
|
|
@@ -3879,7 +3937,7 @@ function getItems(context) {
|
|
|
3879
3937
|
text = await (await item.getType("text/plain")).text();
|
|
3880
3938
|
}
|
|
3881
3939
|
}
|
|
3882
|
-
const handled = handleClipboardPaste({ editor: editor2, view: editor2.view }, html
|
|
3940
|
+
const handled = handleClipboardPaste({ editor: editor2, view: editor2.view }, html);
|
|
3883
3941
|
if (!handled) {
|
|
3884
3942
|
const dataTransfer = new DataTransfer();
|
|
3885
3943
|
if (html) dataTransfer.setData("text/html", html);
|
|
@@ -3895,30 +3953,52 @@ function getItems(context) {
|
|
|
3895
3953
|
console.warn("Failed to paste:", error);
|
|
3896
3954
|
}
|
|
3897
3955
|
},
|
|
3898
|
-
|
|
3899
|
-
|
|
3956
|
+
showWhen: (context2) => {
|
|
3957
|
+
const { trigger, clipboardContent } = context2;
|
|
3958
|
+
const allowedTriggers = [TRIGGERS.click, TRIGGERS.slash];
|
|
3959
|
+
const hasContent = clipboardContent?.hasContent || clipboardContent?.size > 0 || clipboardContent?.content?.size > 0;
|
|
3960
|
+
return allowedTriggers.includes(trigger) && hasContent;
|
|
3961
|
+
}
|
|
3900
3962
|
}
|
|
3901
3963
|
]
|
|
3902
3964
|
}
|
|
3903
3965
|
];
|
|
3904
|
-
let allSections =
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
if (
|
|
3912
|
-
|
|
3913
|
-
|
|
3966
|
+
let allSections = [];
|
|
3967
|
+
if (includeDefaultItems) {
|
|
3968
|
+
allSections = [...defaultSections];
|
|
3969
|
+
}
|
|
3970
|
+
if (customItems.length > 0) {
|
|
3971
|
+
customItems.forEach((customSection) => {
|
|
3972
|
+
const existingSectionIndex = allSections.findIndex((section) => section.id === customSection.id);
|
|
3973
|
+
if (existingSectionIndex !== -1) {
|
|
3974
|
+
allSections[existingSectionIndex].items = [
|
|
3975
|
+
...allSections[existingSectionIndex].items,
|
|
3976
|
+
...customSection.items.map((item) => ({ ...item, isDefault: false }))
|
|
3977
|
+
];
|
|
3978
|
+
} else {
|
|
3979
|
+
allSections.push({
|
|
3980
|
+
...customSection,
|
|
3981
|
+
isDefault: false,
|
|
3982
|
+
items: customSection.items.map((item) => ({ ...item, isDefault: false }))
|
|
3983
|
+
});
|
|
3984
|
+
}
|
|
3914
3985
|
});
|
|
3986
|
+
}
|
|
3987
|
+
if (editor?.options?.slashMenuConfig?.menuProvider) {
|
|
3988
|
+
try {
|
|
3989
|
+
allSections = editor.options.slashMenuConfig.menuProvider(enhancedContext, allSections) || allSections;
|
|
3990
|
+
} catch (error) {
|
|
3991
|
+
console.warn("[SlashMenu] menuProvider error:", error);
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
const filteredSections = allSections.map((section) => {
|
|
3995
|
+
const filteredItems = section.items.filter((item) => shouldShowItem(item, enhancedContext));
|
|
3915
3996
|
return {
|
|
3916
3997
|
...section,
|
|
3917
3998
|
items: filteredItems
|
|
3918
3999
|
};
|
|
3919
4000
|
}).filter((section) => section.items.length > 0);
|
|
3920
|
-
|
|
3921
|
-
return finalSections;
|
|
4001
|
+
return filteredSections;
|
|
3922
4002
|
}
|
|
3923
4003
|
const _hoisted_1$3 = { class: "slash-menu-items" };
|
|
3924
4004
|
const _hoisted_2$1 = {
|
|
@@ -4001,13 +4081,28 @@ const _sfc_main$4 = {
|
|
|
4001
4081
|
});
|
|
4002
4082
|
const customItemRefs = /* @__PURE__ */ new Map();
|
|
4003
4083
|
const setCustomItemRef = (el, item) => {
|
|
4004
|
-
if (el
|
|
4084
|
+
if (el) {
|
|
4005
4085
|
customItemRefs.set(item.id, { element: el, item });
|
|
4006
4086
|
nextTick(() => {
|
|
4007
4087
|
renderCustomItem(item.id);
|
|
4008
4088
|
});
|
|
4009
4089
|
}
|
|
4010
4090
|
};
|
|
4091
|
+
const defaultRender = (context) => {
|
|
4092
|
+
const item = context.item || context.currentItem;
|
|
4093
|
+
const container = document.createElement("div");
|
|
4094
|
+
container.className = "slash-menu-default-content";
|
|
4095
|
+
if (item.icon) {
|
|
4096
|
+
const iconSpan = document.createElement("span");
|
|
4097
|
+
iconSpan.className = "slash-menu-item-icon";
|
|
4098
|
+
iconSpan.innerHTML = item.icon;
|
|
4099
|
+
container.appendChild(iconSpan);
|
|
4100
|
+
}
|
|
4101
|
+
const labelSpan = document.createElement("span");
|
|
4102
|
+
labelSpan.textContent = item.label;
|
|
4103
|
+
container.appendChild(labelSpan);
|
|
4104
|
+
return container;
|
|
4105
|
+
};
|
|
4011
4106
|
const renderCustomItem = async (itemId) => {
|
|
4012
4107
|
const refData = customItemRefs.get(itemId);
|
|
4013
4108
|
if (!refData || refData.element.hasCustomContent) return;
|
|
@@ -4016,8 +4111,9 @@ const _sfc_main$4 = {
|
|
|
4016
4111
|
if (!currentContext.value) {
|
|
4017
4112
|
currentContext.value = await getEditorContext(props.editor);
|
|
4018
4113
|
}
|
|
4019
|
-
const
|
|
4020
|
-
const
|
|
4114
|
+
const contextWithItem = { ...currentContext.value, currentItem: item };
|
|
4115
|
+
const renderFunction = item.render || defaultRender;
|
|
4116
|
+
const customElement = renderFunction(contextWithItem);
|
|
4021
4117
|
if (customElement instanceof HTMLElement) {
|
|
4022
4118
|
element.innerHTML = "";
|
|
4023
4119
|
element.appendChild(customElement);
|
|
@@ -4025,7 +4121,9 @@ const _sfc_main$4 = {
|
|
|
4025
4121
|
}
|
|
4026
4122
|
} catch (error) {
|
|
4027
4123
|
console.warn(`[SlashMenu] Error rendering custom item ${itemId}:`, error);
|
|
4028
|
-
|
|
4124
|
+
const fallbackElement = defaultRender({ ...currentContext.value || {}, currentItem: item });
|
|
4125
|
+
element.innerHTML = "";
|
|
4126
|
+
element.appendChild(fallbackElement);
|
|
4029
4127
|
element.hasCustomContent = true;
|
|
4030
4128
|
}
|
|
4031
4129
|
};
|
|
@@ -4220,19 +4318,20 @@ const _sfc_main$4 = {
|
|
|
4220
4318
|
class: normalizeClass(["slash-menu-item", { "is-selected": item.id === selectedId.value }]),
|
|
4221
4319
|
onClick: ($event) => executeCommand(item)
|
|
4222
4320
|
}, [
|
|
4223
|
-
|
|
4224
|
-
key: 0,
|
|
4321
|
+
createElementVNode("div", {
|
|
4225
4322
|
ref_for: true,
|
|
4226
4323
|
ref: (el) => setCustomItemRef(el, item),
|
|
4227
4324
|
class: "slash-menu-custom-item"
|
|
4228
|
-
},
|
|
4229
|
-
item.
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4325
|
+
}, [
|
|
4326
|
+
!item.render ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4327
|
+
item.icon ? (openBlock(), createElementBlock("span", {
|
|
4328
|
+
key: 0,
|
|
4329
|
+
class: "slash-menu-item-icon",
|
|
4330
|
+
innerHTML: item.icon
|
|
4331
|
+
}, null, 8, _hoisted_4)) : createCommentVNode("", true),
|
|
4332
|
+
createElementVNode("span", null, toDisplayString(item.label), 1)
|
|
4333
|
+
], 64)) : createCommentVNode("", true)
|
|
4334
|
+
], 512)
|
|
4236
4335
|
], 10, _hoisted_3$1);
|
|
4237
4336
|
}), 128))
|
|
4238
4337
|
], 64);
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-DpCRbxmi.cjs");
|
|
4
4
|
require("./chunks/vue-DKMj1I9B.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
package/dist/super-editor.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-
|
|
1
|
+
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-D0-dqxm2.es.js";
|
|
2
2
|
import "./chunks/vue-ZWZLQtoU.es.js";
|
|
3
3
|
export {
|
|
4
4
|
A as AIWriter,
|
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
4
|
-
const superdoc = require("./chunks/index-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-DpCRbxmi.cjs");
|
|
4
|
+
const superdoc = require("./chunks/index-BjwQD_um.cjs");
|
|
5
5
|
require("./chunks/vue-DKMj1I9B.cjs");
|
|
6
6
|
const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
|
|
7
7
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-
|
|
2
|
-
import { D, H, P, S as S2, m, l } from "./chunks/index-
|
|
1
|
+
import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-D0-dqxm2.es.js";
|
|
2
|
+
import { D, H, P, S as S2, m, l } from "./chunks/index-DScOqhcx.es.js";
|
|
3
3
|
import "./chunks/vue-ZWZLQtoU.es.js";
|
|
4
4
|
import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
|
|
5
5
|
export {
|