@harbour-enterprises/superdoc 0.24.0 → 0.25.0-next.1
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-BiHh3x6b.es.js → PdfViewer-BEbvklge.es.js} +1 -1
- package/dist/chunks/{PdfViewer-qk_hITc5.cjs → PdfViewer-CvksDDwi.cjs} +1 -1
- package/dist/chunks/{index-aMnFs35I.es.js → index-B9Ad3j3k.es.js} +166 -76
- package/dist/chunks/{index-Di6nG2sc.cjs → index-Bf3lSVG2.cjs} +166 -76
- package/dist/chunks/{super-editor.es-Dz7y81Yr.es.js → super-editor.es--RpCOiR4.es.js} +157 -15
- package/dist/chunks/{super-editor.es-BKZvTraR.cjs → super-editor.es-Bh07I_ue.cjs} +157 -15
- package/dist/core/SuperDoc.d.ts +20 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/collaboration/permissions.d.ts +7 -1
- package/dist/core/collaboration/permissions.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +23 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +55 -55
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CI3WqmGV.js → converter-gSy6s2VK.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-D4fk50d9.js → docx-zipper-CceGxV02.js} +1 -1
- package/dist/super-editor/chunks/{editor-DC6pZVp1.js → editor-CyBtLJFF.js} +116 -16
- package/dist/super-editor/chunks/{toolbar-DMobfM6u.js → toolbar-1Ejr8Exl.js} +2 -2
- 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/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +18 -0
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +110 -0
- package/dist/super-editor/super-editor.es.js +66 -21
- 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 +321 -89
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -90,6 +90,13 @@
|
|
|
90
90
|
* @property {string} [html] - HTML content to initialize the editor with
|
|
91
91
|
* @property {string} [markdown] - Markdown content to initialize the editor with
|
|
92
92
|
* @property {boolean} [isDebug=false] - Whether to enable debug mode
|
|
93
|
+
* @property {(params: {
|
|
94
|
+
* permission: string,
|
|
95
|
+
* role?: string,
|
|
96
|
+
* isInternal?: boolean,
|
|
97
|
+
* comment?: Object | null,
|
|
98
|
+
* trackedChange?: Object | null,
|
|
99
|
+
}) => boolean | undefined} [permissionResolver] - Host-provided permission hook
|
|
93
100
|
*/
|
|
94
101
|
/**
|
|
95
102
|
* Main editor class that manages document state, extensions, and user interactions
|
|
@@ -245,6 +252,7 @@ export class Editor extends EventEmitter {
|
|
|
245
252
|
isHeaderFooterChanged: boolean;
|
|
246
253
|
isCustomXmlChanged: boolean;
|
|
247
254
|
focusTarget: any;
|
|
255
|
+
permissionResolver: any;
|
|
248
256
|
};
|
|
249
257
|
setHighContrastMode: (value: any) => void;
|
|
250
258
|
/**
|
|
@@ -889,5 +897,15 @@ export type EditorOptions = {
|
|
|
889
897
|
* - Whether to enable debug mode
|
|
890
898
|
*/
|
|
891
899
|
isDebug?: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* - Host-provided permission hook
|
|
902
|
+
*/
|
|
903
|
+
permissionResolver?: (params: {
|
|
904
|
+
permission: string;
|
|
905
|
+
role?: string;
|
|
906
|
+
isInternal?: boolean;
|
|
907
|
+
comment?: any | null;
|
|
908
|
+
trackedChange?: any | null;
|
|
909
|
+
}) => boolean | undefined;
|
|
892
910
|
};
|
|
893
911
|
import { EventEmitter } from './EventEmitter.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export function collectTrackedChanges({ state, from, to }: {
|
|
2
|
+
state: import("prosemirror-state").EditorState;
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
}): Array<any>;
|
|
6
|
+
export function isTrackedChangeActionAllowed({ editor, action, trackedChanges }: {
|
|
7
|
+
editor: {
|
|
8
|
+
setHighContrastMode: (value: any) => void;
|
|
9
|
+
get docChanged(): boolean;
|
|
10
|
+
mount(el: any): void;
|
|
11
|
+
unmount(): void;
|
|
12
|
+
view: any;
|
|
13
|
+
setToolbar(toolbar: any): void;
|
|
14
|
+
toolbar: any;
|
|
15
|
+
focus(): void;
|
|
16
|
+
get state(): any;
|
|
17
|
+
get storage(): any;
|
|
18
|
+
readonly commands: any;
|
|
19
|
+
readonly helpers: EditorHelpers;
|
|
20
|
+
get isEditable(): boolean;
|
|
21
|
+
get isDestroyed(): boolean;
|
|
22
|
+
get element(): HTMLElement;
|
|
23
|
+
get users(): Array<User>;
|
|
24
|
+
chain(): any;
|
|
25
|
+
can(): any;
|
|
26
|
+
setDocumentMode(documentMode: string): void;
|
|
27
|
+
generateCollaborationUpdate(): Promise<Uint8Array>;
|
|
28
|
+
initializeCollaborationData(): void;
|
|
29
|
+
replaceContent(content: object): void;
|
|
30
|
+
setOptions(options?: EditorOptions): void;
|
|
31
|
+
options: any;
|
|
32
|
+
setEditable(editable?: boolean, emitUpdate?: boolean): void;
|
|
33
|
+
registerPlugin(plugin: any, handlePlugins: any): void;
|
|
34
|
+
unregisterPlugin(nameOrPluginKey: string | any): void;
|
|
35
|
+
createNodeViews(): void;
|
|
36
|
+
getMaxContentSize(): any;
|
|
37
|
+
updateEditorStyles(element: any, proseMirror: any, hasPaginationEnabled?: boolean): void;
|
|
38
|
+
initDefaultStyles(element?: HTMLElement, isPaginationEnabled?: boolean): void;
|
|
39
|
+
initMobileStyles(element: HTMLElement | void): void;
|
|
40
|
+
getDocumentIdentifier(): Promise<string>;
|
|
41
|
+
getDocumentGuid(): string | null;
|
|
42
|
+
isDocumentModified(): boolean;
|
|
43
|
+
getTelemetryData(): Promise<{
|
|
44
|
+
documentId: string;
|
|
45
|
+
isModified: boolean;
|
|
46
|
+
isPermanentId: boolean;
|
|
47
|
+
version: any;
|
|
48
|
+
}>;
|
|
49
|
+
getDocumentId(): string;
|
|
50
|
+
getAttributes(nameOrType: string): any;
|
|
51
|
+
isActive(nameOrAttributes: string | any, attributesOrUndefined?: any): boolean;
|
|
52
|
+
getJSON(): any;
|
|
53
|
+
getMetadata(): {
|
|
54
|
+
documentGuid: string | null;
|
|
55
|
+
isModified: boolean;
|
|
56
|
+
version: string | null;
|
|
57
|
+
};
|
|
58
|
+
getHTML({ unflattenLists }?: {
|
|
59
|
+
unflattenLists?: boolean;
|
|
60
|
+
}): string;
|
|
61
|
+
getDocumentVersion(): string | null;
|
|
62
|
+
createChildEditor(options: EditorOptions): {
|
|
63
|
+
new (options: EditorOptions): /*elided*/ any;
|
|
64
|
+
loadXmlData(fileSource: File | Blob | Buffer, isNode2?: boolean): Promise<any[]>;
|
|
65
|
+
getDocumentVersion(doc2: any): string;
|
|
66
|
+
setDocumentVersion(doc2: any, version2: any): string;
|
|
67
|
+
getDocumentGuid(doc2: any): string | null;
|
|
68
|
+
updateDocumentVersion(doc2: any, version2: any): string;
|
|
69
|
+
checkIfMigrationsNeeded(): boolean;
|
|
70
|
+
};
|
|
71
|
+
getPageStyles(): any;
|
|
72
|
+
updatePageStyle({ pageMargins }: {
|
|
73
|
+
pageMargins: any;
|
|
74
|
+
}): void;
|
|
75
|
+
migrateListsToV2(): any[];
|
|
76
|
+
getUpdatedJson(): any;
|
|
77
|
+
exportDocx({ isFinalDoc, commentsType, exportJsonOnly, exportXmlOnly, comments, getUpdatedDocs, fieldsHighlightColor }?: {
|
|
78
|
+
isFinalDoc?: boolean;
|
|
79
|
+
commentsType?: string;
|
|
80
|
+
comments?: any[];
|
|
81
|
+
getUpdatedDocs?: boolean;
|
|
82
|
+
}): Promise<Blob | ArrayBuffer | any>;
|
|
83
|
+
destroy(): void;
|
|
84
|
+
destroyHeaderFooterEditors(): void;
|
|
85
|
+
processCollaborationMigrations(): any | void;
|
|
86
|
+
replaceFile(newFile: any): Promise<void>;
|
|
87
|
+
getInternalXmlFile(name: string, type?: string): any | string;
|
|
88
|
+
updateInternalXmlFile(name: string, updatedContent: string): void;
|
|
89
|
+
getNodesOfType(type: string): any[];
|
|
90
|
+
replaceNodeWithHTML(targetNode: any, html: string): void;
|
|
91
|
+
prepareForAnnotations(annotationValues?: FieldValue[]): void;
|
|
92
|
+
migrateParagraphFields(annotationValues?: FieldValue[]): Promise<FieldValue[]>;
|
|
93
|
+
annotate(annotationValues?: FieldValue[], hiddenIds?: string[], removeEmptyFields?: boolean): void;
|
|
94
|
+
previewAnnotations(annotationValues?: any[], hiddenIds?: string[]): void;
|
|
95
|
+
originalState: any;
|
|
96
|
+
closePreview(): void;
|
|
97
|
+
on(name: string, fn2: any): void;
|
|
98
|
+
emit(name: string, ...args: any[]): void;
|
|
99
|
+
off(name: string, fn2: any): void;
|
|
100
|
+
once(name: string, fn2: any): void;
|
|
101
|
+
removeAllListeners(): void;
|
|
102
|
+
};
|
|
103
|
+
action: "accept" | "reject";
|
|
104
|
+
trackedChanges: Array<any>;
|
|
105
|
+
}): boolean;
|
|
106
|
+
export function collectTrackedChangesForContext({ state, pos, trackedChangeId }: {
|
|
107
|
+
state: import("prosemirror-state").EditorState;
|
|
108
|
+
pos: number | null;
|
|
109
|
+
trackedChangeId: string | null;
|
|
110
|
+
}): Array<any>;
|
|
@@ -8,15 +8,15 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
8
8
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
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
|
-
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
-
import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, a as Plugin } from "./chunks/converter-
|
|
13
|
-
import { c1, 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,
|
|
15
|
-
import {
|
|
11
|
+
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
+
import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, a as Plugin } from "./chunks/converter-gSy6s2VK.js";
|
|
13
|
+
import { c1, a5, i, a2 } from "./chunks/converter-gSy6s2VK.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, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, M as Mark, n as Extension, A as Attribute, N as Node } from "./chunks/editor-CyBtLJFF.js";
|
|
15
|
+
import { q, C, t, T, o, v, p } from "./chunks/editor-CyBtLJFF.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, 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-
|
|
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-1Ejr8Exl.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-CceGxV02.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
var hasRequiredEventemitter3;
|
|
@@ -69,7 +69,7 @@ function requireEventemitter3() {
|
|
|
69
69
|
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
70
70
|
if (!handlers) return [];
|
|
71
71
|
if (handlers.fn) return [handlers.fn];
|
|
72
|
-
for (var i2 = 0,
|
|
72
|
+
for (var i2 = 0, l = handlers.length, ee = new Array(l); i2 < l; i2++) {
|
|
73
73
|
ee[i2] = handlers[i2].fn;
|
|
74
74
|
}
|
|
75
75
|
return ee;
|
|
@@ -1225,18 +1225,18 @@ const _sfc_main$7 = {
|
|
|
1225
1225
|
}, [
|
|
1226
1226
|
(openBlock(), createElementBlock(Fragment, null, renderList(5, (i2) => {
|
|
1227
1227
|
return openBlock(), createElementBlock(Fragment, { key: i2 }, [
|
|
1228
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(5, (
|
|
1228
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(5, (n) => {
|
|
1229
1229
|
return createElementVNode("div", {
|
|
1230
1230
|
class: "toolbar-table-grid__item",
|
|
1231
|
-
key: `${i2}_${
|
|
1232
|
-
"data-cols":
|
|
1231
|
+
key: `${i2}_${n}`,
|
|
1232
|
+
"data-cols": n,
|
|
1233
1233
|
"data-rows": i2,
|
|
1234
1234
|
"data-item": "true",
|
|
1235
1235
|
ref_for: true,
|
|
1236
1236
|
ref_key: "tableGridItems",
|
|
1237
1237
|
ref: tableGridItems,
|
|
1238
|
-
onKeydown: withModifiers((event) => handleKeyDown(event,
|
|
1239
|
-
onClick: withModifiers(($event) => handleClick({ cols:
|
|
1238
|
+
onKeydown: withModifiers((event) => handleKeyDown(event, n, i2), ["prevent"]),
|
|
1239
|
+
onClick: withModifiers(($event) => handleClick({ cols: n, rows: i2 }), ["stop", "prevent"])
|
|
1240
1240
|
}, null, 40, _hoisted_1$6);
|
|
1241
1241
|
}), 64))
|
|
1242
1242
|
], 64);
|
|
@@ -2984,10 +2984,31 @@ class SuperToolbar extends EventEmitter {
|
|
|
2984
2984
|
__privateMethod(this, _SuperToolbar_instances, deactivateAll_fn).call(this);
|
|
2985
2985
|
return;
|
|
2986
2986
|
}
|
|
2987
|
+
const { state } = this.activeEditor;
|
|
2988
|
+
const selection = state.selection;
|
|
2989
|
+
const selectionTrackedChanges = __privateMethod(this, _SuperToolbar_instances, enrichTrackedChanges_fn).call(this, collectTrackedChanges({ state, from: selection.from, to: selection.to }));
|
|
2990
|
+
const hasTrackedChanges = selectionTrackedChanges.length > 0;
|
|
2991
|
+
const hasValidSelection = hasTrackedChanges;
|
|
2992
|
+
const canAcceptTrackedChanges = hasValidSelection && isTrackedChangeActionAllowed({
|
|
2993
|
+
editor: this.activeEditor,
|
|
2994
|
+
action: "accept",
|
|
2995
|
+
trackedChanges: selectionTrackedChanges
|
|
2996
|
+
});
|
|
2997
|
+
const canRejectTrackedChanges = hasValidSelection && isTrackedChangeActionAllowed({
|
|
2998
|
+
editor: this.activeEditor,
|
|
2999
|
+
action: "reject",
|
|
3000
|
+
trackedChanges: selectionTrackedChanges
|
|
3001
|
+
});
|
|
2987
3002
|
const marks = getActiveFormatting(this.activeEditor);
|
|
2988
3003
|
const inTable = isInTable(this.activeEditor.state);
|
|
2989
3004
|
this.toolbarItems.forEach((item) => {
|
|
2990
3005
|
item.resetDisabled();
|
|
3006
|
+
if (item.name.value === "acceptTrackedChangeBySelection") {
|
|
3007
|
+
item.setDisabled(!canAcceptTrackedChanges);
|
|
3008
|
+
}
|
|
3009
|
+
if (item.name.value === "rejectTrackedChangeOnSelection") {
|
|
3010
|
+
item.setDisabled(!canRejectTrackedChanges);
|
|
3011
|
+
}
|
|
2991
3012
|
if (item.name.value === "linkedStyles") {
|
|
2992
3013
|
if (this.activeEditor && !getQuickFormatList(this.activeEditor).length) {
|
|
2993
3014
|
return item.deactivate();
|
|
@@ -3195,6 +3216,19 @@ updateToolbarHistory_fn = function() {
|
|
|
3195
3216
|
this.redoDepth = redoDepth(this.activeEditor.state);
|
|
3196
3217
|
}
|
|
3197
3218
|
};
|
|
3219
|
+
enrichTrackedChanges_fn = function(trackedChanges = []) {
|
|
3220
|
+
if (!trackedChanges?.length) return trackedChanges;
|
|
3221
|
+
const store = this.superdoc?.commentsStore;
|
|
3222
|
+
if (!store?.getComment) return trackedChanges;
|
|
3223
|
+
return trackedChanges.map((change) => {
|
|
3224
|
+
const commentId = change.id;
|
|
3225
|
+
if (!commentId) return change;
|
|
3226
|
+
const storeComment = store.getComment(commentId);
|
|
3227
|
+
if (!storeComment) return change;
|
|
3228
|
+
const comment = typeof storeComment.getValues === "function" ? storeComment.getValues() : storeComment;
|
|
3229
|
+
return { ...change, comment };
|
|
3230
|
+
});
|
|
3231
|
+
};
|
|
3198
3232
|
/**
|
|
3199
3233
|
* Run a command that requires an argument
|
|
3200
3234
|
* @private
|
|
@@ -3609,6 +3643,7 @@ async function getEditorContext(editor, event) {
|
|
|
3609
3643
|
state.selection.$head.marks().forEach((mark) => activeMarks.push(mark.type.name));
|
|
3610
3644
|
}
|
|
3611
3645
|
const isTrackedChange = activeMarks.includes("trackInsert") || activeMarks.includes("trackDelete") || activeMarks.includes("trackFormat");
|
|
3646
|
+
const trackedChanges = event ? collectTrackedChangesForContext({ state, pos, trackedChangeId }) : collectTrackedChanges({ state, from, to });
|
|
3612
3647
|
const cursorCoords = pos ? view.coordsAtPos(pos) : null;
|
|
3613
3648
|
const cursorPosition = cursorCoords ? {
|
|
3614
3649
|
x: cursorCoords.left,
|
|
@@ -3642,7 +3677,9 @@ async function getEditorContext(editor, event) {
|
|
|
3642
3677
|
event,
|
|
3643
3678
|
trigger: event ? "click" : "slash",
|
|
3644
3679
|
// Editor reference for advanced use cases
|
|
3645
|
-
editor
|
|
3680
|
+
editor,
|
|
3681
|
+
// Tracked change metadata
|
|
3682
|
+
trackedChanges
|
|
3646
3683
|
};
|
|
3647
3684
|
return context;
|
|
3648
3685
|
}
|
|
@@ -3739,6 +3776,14 @@ const shouldShowItem = (item, context) => {
|
|
|
3739
3776
|
}
|
|
3740
3777
|
}
|
|
3741
3778
|
};
|
|
3779
|
+
const canPerformTrackedChange = (context, action) => {
|
|
3780
|
+
if (!context?.editor) return true;
|
|
3781
|
+
return isTrackedChangeActionAllowed({
|
|
3782
|
+
editor: context.editor,
|
|
3783
|
+
action,
|
|
3784
|
+
trackedChanges: context.trackedChanges ?? []
|
|
3785
|
+
});
|
|
3786
|
+
};
|
|
3742
3787
|
function getItems(context, customItems = [], includeDefaultItems = true) {
|
|
3743
3788
|
const { selectedText, editor } = context;
|
|
3744
3789
|
if (arguments.length === 1 && editor?.options?.slashMenuConfig) {
|
|
@@ -3796,7 +3841,7 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
|
|
|
3796
3841
|
},
|
|
3797
3842
|
showWhen: (context2) => {
|
|
3798
3843
|
const { trigger, isTrackedChange } = context2;
|
|
3799
|
-
return trigger === TRIGGERS.click && isTrackedChange;
|
|
3844
|
+
return trigger === TRIGGERS.click && isTrackedChange && canPerformTrackedChange(context2, "accept");
|
|
3800
3845
|
}
|
|
3801
3846
|
},
|
|
3802
3847
|
{
|
|
@@ -3813,7 +3858,7 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
|
|
|
3813
3858
|
},
|
|
3814
3859
|
showWhen: (context2) => {
|
|
3815
3860
|
const { trigger, isTrackedChange } = context2;
|
|
3816
|
-
return trigger === TRIGGERS.click && isTrackedChange;
|
|
3861
|
+
return trigger === TRIGGERS.click && isTrackedChange && canPerformTrackedChange(context2, "reject");
|
|
3817
3862
|
}
|
|
3818
3863
|
}
|
|
3819
3864
|
]
|
|
@@ -5130,13 +5175,13 @@ const Extensions = {
|
|
|
5130
5175
|
};
|
|
5131
5176
|
export {
|
|
5132
5177
|
AIWriter,
|
|
5133
|
-
|
|
5178
|
+
q as AnnotatorHelpers,
|
|
5134
5179
|
c1 as BasicUpload,
|
|
5135
5180
|
C as CommentsPluginKey,
|
|
5136
5181
|
D as DocxZipper,
|
|
5137
5182
|
Editor,
|
|
5138
5183
|
Extensions,
|
|
5139
|
-
|
|
5184
|
+
t as SectionHelpers,
|
|
5140
5185
|
_sfc_main$4 as SlashMenu,
|
|
5141
5186
|
a5 as SuperConverter,
|
|
5142
5187
|
SuperEditor,
|
|
@@ -5145,13 +5190,13 @@ export {
|
|
|
5145
5190
|
Toolbar,
|
|
5146
5191
|
T as TrackChangesBasePluginKey,
|
|
5147
5192
|
createZip,
|
|
5148
|
-
|
|
5193
|
+
o as fieldAnnotationHelpers,
|
|
5149
5194
|
getActiveFormatting,
|
|
5150
|
-
|
|
5195
|
+
v as getAllowedImageDimensions,
|
|
5151
5196
|
i as getMarksFromSelection,
|
|
5152
5197
|
getRichTextExtensions,
|
|
5153
5198
|
getStarterExtensions,
|
|
5154
5199
|
a2 as helpers,
|
|
5155
5200
|
registeredHandlers,
|
|
5156
|
-
|
|
5201
|
+
p as trackChangesHelpers
|
|
5157
5202
|
};
|
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-Bh07I_ue.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--RpCOiR4.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-Bh07I_ue.cjs");
|
|
4
|
+
const superdoc = require("./chunks/index-Bf3lSVG2.cjs");
|
|
5
5
|
require("./chunks/vue-DKMj1I9B.cjs");
|
|
6
6
|
const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.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--RpCOiR4.es.js";
|
|
2
|
+
import { D, H, P, S as S2, m, l } from "./chunks/index-B9Ad3j3k.es.js";
|
|
3
3
|
import "./chunks/vue-ZWZLQtoU.es.js";
|
|
4
4
|
import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
|
|
5
5
|
export {
|