@harbour-enterprises/superdoc 0.13.0-next.6 → 0.13.2-rev10
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/{eventemitter3-DfVviFzP.cjs → eventemitter3-CHxWXmuK.cjs} +1 -1
- package/dist/chunks/{eventemitter3-BrspJk8q.es.js → eventemitter3-KKY27oz-.es.js} +1 -1
- package/dist/chunks/{index-Hr3Um-Bg.es.js → index-BqLFjUHn.es.js} +2 -2
- package/dist/chunks/{index-B4J7wgs6.cjs → index-CweAXNfB.cjs} +2 -2
- package/dist/chunks/{index-Diu6UKHt.es.js → index-DS3W0eVB.es.js} +4 -4
- package/dist/chunks/{index-Cdsq63Xq.cjs → index-kOMfCfBT.cjs} +4 -4
- package/dist/chunks/{jszip-BTAcmbVg.cjs → jszip-9bCX1h2W.cjs} +1 -1
- package/dist/chunks/{jszip-DckFs3A7.es.js → jszip-Cl3s9njw.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BSS_LTA0.cjs → super-editor.es-Bdu65rjC.cjs} +1096 -819
- package/dist/chunks/{super-editor.es-CU8V5_XY.es.js → super-editor.es-BwWbNxcS.es.js} +1096 -819
- package/dist/chunks/{url-BIzg4y2i.cjs → url-B8LY3nwf.cjs} +2 -2
- package/dist/chunks/{url-CHayXMZH.es.js → url-Bq00tGvm.es.js} +2 -2
- package/dist/chunks/{vue-Bi1uWinj.es.js → vue-BBJVqxjL.es.js} +10 -3
- package/dist/chunks/{vue-HIY1g7dm.cjs → vue-BBjMeYfo.cjs} +10 -3
- package/dist/chunks/{xml-js-CfClL-1b.es.js → xml-js-1F0lia4t.es.js} +81 -102
- package/dist/chunks/{xml-js-BjqmFOSP.cjs → xml-js-BuAdLsHD.cjs} +81 -102
- package/dist/style.css +4 -3
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Bns3BtmW.js → converter-lPrQA7b1.js} +637 -55
- package/dist/super-editor/chunks/{docx-zipper-qf0kgh0l.js → docx-zipper-HvG9XskR.js} +1 -1
- package/dist/super-editor/chunks/{editor-hIfvfc-Y.js → editor-DbkiH8Up.js} +387 -685
- package/dist/super-editor/chunks/{toolbar-BC9mPZ43.js → toolbar-JdrfUR1G.js} +2 -3
- package/dist/super-editor/converter.es.js +2 -2
- package/dist/super-editor/core/Editor.d.ts +7 -0
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/InputRule.d.ts +7 -0
- package/dist/super-editor/core/InputRule.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/annotator.d.ts +4 -0
- package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/setImageNodeSelection.d.ts +2 -0
- package/dist/super-editor/core/helpers/setImageNodeSelection.d.ts.map +1 -0
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +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/extensions/field-annotation/field-annotation.d.ts.map +1 -1
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findRemovedFieldAnnotations.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/imageHelpers/startImageUpload.d.ts.map +1 -1
- package/dist/super-editor/extensions/line-break/line-break.d.ts.map +1 -1
- package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts.map +1 -1
- package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +6 -1
- package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
- package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
- package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +4 -3
- package/dist/super-editor/super-editor.es.js +7 -7
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts +3 -0
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts.map +1 -0
- package/dist/super-editor/tests/e2e/test-app/vite.config.d.ts +1 -1
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +8 -9
- package/dist/superdoc.es.js +9 -10
- package/dist/superdoc.umd.js +1107 -824
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-
|
|
1
|
+
import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-BBJVqxjL.es.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
4
4
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -10941,7 +10941,7 @@ class NodeRange {
|
|
|
10941
10941
|
}
|
|
10942
10942
|
}
|
|
10943
10943
|
const emptyAttrs = /* @__PURE__ */ Object.create(null);
|
|
10944
|
-
let Node$
|
|
10944
|
+
let Node$1$1 = class Node2 {
|
|
10945
10945
|
/**
|
|
10946
10946
|
@internal
|
|
10947
10947
|
*/
|
|
@@ -11342,8 +11342,8 @@ let Node$2 = class Node2 {
|
|
|
11342
11342
|
return node2;
|
|
11343
11343
|
}
|
|
11344
11344
|
};
|
|
11345
|
-
Node$
|
|
11346
|
-
class TextNode extends Node$
|
|
11345
|
+
Node$1$1.prototype.text = void 0;
|
|
11346
|
+
class TextNode extends Node$1$1 {
|
|
11347
11347
|
/**
|
|
11348
11348
|
@internal
|
|
11349
11349
|
*/
|
|
@@ -11930,7 +11930,7 @@ let NodeType$1 = class NodeType {
|
|
|
11930
11930
|
create(attrs = null, content, marks) {
|
|
11931
11931
|
if (this.isText)
|
|
11932
11932
|
throw new Error("NodeType.create can't construct text nodes");
|
|
11933
|
-
return new Node$
|
|
11933
|
+
return new Node$1$1(this, this.computeAttrs(attrs), Fragment.from(content), Mark$1.setFrom(marks));
|
|
11934
11934
|
}
|
|
11935
11935
|
/**
|
|
11936
11936
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -11940,7 +11940,7 @@ let NodeType$1 = class NodeType {
|
|
|
11940
11940
|
createChecked(attrs = null, content, marks) {
|
|
11941
11941
|
content = Fragment.from(content);
|
|
11942
11942
|
this.checkContent(content);
|
|
11943
|
-
return new Node$
|
|
11943
|
+
return new Node$1$1(this, this.computeAttrs(attrs), content, Mark$1.setFrom(marks));
|
|
11944
11944
|
}
|
|
11945
11945
|
/**
|
|
11946
11946
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -11963,7 +11963,7 @@ let NodeType$1 = class NodeType {
|
|
|
11963
11963
|
let after = matched && matched.fillBefore(Fragment.empty, true);
|
|
11964
11964
|
if (!after)
|
|
11965
11965
|
return null;
|
|
11966
|
-
return new Node$
|
|
11966
|
+
return new Node$1$1(this, attrs, content.append(after), Mark$1.setFrom(marks));
|
|
11967
11967
|
}
|
|
11968
11968
|
/**
|
|
11969
11969
|
Returns true if the given fragment is valid content for this node
|
|
@@ -12200,7 +12200,7 @@ let Schema$1 = class Schema {
|
|
|
12200
12200
|
bound.
|
|
12201
12201
|
*/
|
|
12202
12202
|
nodeFromJSON(json) {
|
|
12203
|
-
return Node$
|
|
12203
|
+
return Node$1$1.fromJSON(this, json);
|
|
12204
12204
|
}
|
|
12205
12205
|
/**
|
|
12206
12206
|
Deserialize a mark from its JSON representation. This method is
|
|
@@ -13726,7 +13726,7 @@ class ReplaceStep extends Step {
|
|
|
13726
13726
|
}
|
|
13727
13727
|
}
|
|
13728
13728
|
Step.jsonID("replace", ReplaceStep);
|
|
13729
|
-
|
|
13729
|
+
let ReplaceAroundStep$1 = class ReplaceAroundStep2 extends Step {
|
|
13730
13730
|
/**
|
|
13731
13731
|
Create a replace-around step with the given range and gap.
|
|
13732
13732
|
`insert` should be the point in the slice into which the content
|
|
@@ -13766,7 +13766,7 @@ class ReplaceAroundStep extends Step {
|
|
|
13766
13766
|
}
|
|
13767
13767
|
invert(doc2) {
|
|
13768
13768
|
let gap = this.gapTo - this.gapFrom;
|
|
13769
|
-
return new
|
|
13769
|
+
return new ReplaceAroundStep2(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc2.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
13770
13770
|
}
|
|
13771
13771
|
map(mapping) {
|
|
13772
13772
|
let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
@@ -13774,7 +13774,7 @@ class ReplaceAroundStep extends Step {
|
|
|
13774
13774
|
let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
13775
13775
|
if (from2.deletedAcross && to.deletedAcross || gapFrom < from2.pos || gapTo > to.pos)
|
|
13776
13776
|
return null;
|
|
13777
|
-
return new
|
|
13777
|
+
return new ReplaceAroundStep2(from2.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
13778
13778
|
}
|
|
13779
13779
|
toJSON() {
|
|
13780
13780
|
let json = {
|
|
@@ -13797,10 +13797,10 @@ class ReplaceAroundStep extends Step {
|
|
|
13797
13797
|
static fromJSON(schema, json) {
|
|
13798
13798
|
if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
|
|
13799
13799
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
13800
|
-
return new
|
|
13800
|
+
return new ReplaceAroundStep2(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
|
|
13801
13801
|
}
|
|
13802
|
-
}
|
|
13803
|
-
Step.jsonID("replaceAround", ReplaceAroundStep);
|
|
13802
|
+
};
|
|
13803
|
+
Step.jsonID("replaceAround", ReplaceAroundStep$1);
|
|
13804
13804
|
function contentBetween(doc2, from2, to) {
|
|
13805
13805
|
let $from = doc2.resolve(from2), dist2 = to - from2, depth = $from.depth;
|
|
13806
13806
|
while (dist2 > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
|
|
@@ -13953,7 +13953,7 @@ function lift(tr, range2, target) {
|
|
|
13953
13953
|
} else {
|
|
13954
13954
|
end2++;
|
|
13955
13955
|
}
|
|
13956
|
-
tr.step(new ReplaceAroundStep(start2, end2, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
|
|
13956
|
+
tr.step(new ReplaceAroundStep$1(start2, end2, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
|
|
13957
13957
|
}
|
|
13958
13958
|
function findWrapping(range2, nodeType, attrs = null, innerRange = range2) {
|
|
13959
13959
|
let around = findWrappingOutside(range2, nodeType);
|
|
@@ -13998,7 +13998,7 @@ function wrap(tr, range2, wrappers) {
|
|
|
13998
13998
|
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
13999
13999
|
}
|
|
14000
14000
|
let start2 = range2.start, end2 = range2.end;
|
|
14001
|
-
tr.step(new ReplaceAroundStep(start2, end2, start2, end2, new Slice(content, 0, 0), wrappers.length, true));
|
|
14001
|
+
tr.step(new ReplaceAroundStep$1(start2, end2, start2, end2, new Slice(content, 0, 0), wrappers.length, true));
|
|
14002
14002
|
}
|
|
14003
14003
|
function setBlockType$1(tr, from2, to, type2, attrs) {
|
|
14004
14004
|
if (!type2.isTextblock)
|
|
@@ -14020,7 +14020,7 @@ function setBlockType$1(tr, from2, to, type2, attrs) {
|
|
|
14020
14020
|
clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type2, void 0, convertNewlines === null);
|
|
14021
14021
|
let mapping = tr.mapping.slice(mapFrom);
|
|
14022
14022
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node2.nodeSize, 1);
|
|
14023
|
-
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type2.create(attrsHere, null, node2.marks)), 0, 0), 1, true));
|
|
14023
|
+
tr.step(new ReplaceAroundStep$1(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type2.create(attrsHere, null, node2.marks)), 0, 0), 1, true));
|
|
14024
14024
|
if (convertNewlines === true)
|
|
14025
14025
|
replaceNewlines(tr, node2, pos, mapFrom);
|
|
14026
14026
|
return false;
|
|
@@ -14061,7 +14061,7 @@ function setNodeMarkup(tr, pos, type2, attrs, marks) {
|
|
|
14061
14061
|
return tr.replaceWith(pos, pos + node2.nodeSize, newNode);
|
|
14062
14062
|
if (!type2.validContent(node2.content))
|
|
14063
14063
|
throw new RangeError("Invalid content for node type " + type2.name);
|
|
14064
|
-
tr.step(new ReplaceAroundStep(pos, pos + node2.nodeSize, pos + 1, pos + node2.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
|
|
14064
|
+
tr.step(new ReplaceAroundStep$1(pos, pos + node2.nodeSize, pos + 1, pos + node2.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
|
|
14065
14065
|
}
|
|
14066
14066
|
function canSplit(doc2, pos, depth = 1, typesAfter) {
|
|
14067
14067
|
let $pos = doc2.resolve(pos), base2 = $pos.depth - depth;
|
|
@@ -14262,7 +14262,7 @@ class Fitter {
|
|
|
14262
14262
|
}
|
|
14263
14263
|
let slice2 = new Slice(content, openStart, openEnd);
|
|
14264
14264
|
if (moveInline > -1)
|
|
14265
|
-
return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
|
|
14265
|
+
return new ReplaceAroundStep$1($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
|
|
14266
14266
|
if (slice2.size || $from.pos != this.$to.pos)
|
|
14267
14267
|
return new ReplaceStep($from.pos, $to.pos, slice2);
|
|
14268
14268
|
return null;
|
|
@@ -15345,7 +15345,7 @@ function selectionToInsertionEnd$1(tr, startLen, bias) {
|
|
|
15345
15345
|
if (last < startLen)
|
|
15346
15346
|
return;
|
|
15347
15347
|
let step = tr.steps[last];
|
|
15348
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
|
|
15348
|
+
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1))
|
|
15349
15349
|
return;
|
|
15350
15350
|
let map3 = tr.mapping.maps[last], end2;
|
|
15351
15351
|
map3.forEach((_from, _to, _newFrom, newTo) => {
|
|
@@ -15760,7 +15760,7 @@ class EditorState {
|
|
|
15760
15760
|
let instance = new EditorState($config);
|
|
15761
15761
|
$config.fields.forEach((field) => {
|
|
15762
15762
|
if (field.name == "doc") {
|
|
15763
|
-
instance.doc = Node$
|
|
15763
|
+
instance.doc = Node$1$1.fromJSON(config.schema, json.doc);
|
|
15764
15764
|
} else if (field.name == "selection") {
|
|
15765
15765
|
instance.selection = Selection.fromJSON(instance.doc, json.selection);
|
|
15766
15766
|
} else if (field.name == "storedMarks") {
|
|
@@ -18821,6 +18821,583 @@ const createColGroup = (node2, cellMinWidth, overrideCol, overrideValue) => {
|
|
|
18821
18821
|
colgroupValues
|
|
18822
18822
|
};
|
|
18823
18823
|
};
|
|
18824
|
+
function chainableEditorState(transaction, state2) {
|
|
18825
|
+
let { selection, doc: doc2, storedMarks } = transaction;
|
|
18826
|
+
return {
|
|
18827
|
+
...state2,
|
|
18828
|
+
apply: state2.apply.bind(state2),
|
|
18829
|
+
applyTransaction: state2.applyTransaction.bind(state2),
|
|
18830
|
+
plugins: state2.plugins,
|
|
18831
|
+
schema: state2.schema,
|
|
18832
|
+
reconfigure: state2.reconfigure.bind(state2),
|
|
18833
|
+
toJSON: state2.toJSON.bind(state2),
|
|
18834
|
+
get storedMarks() {
|
|
18835
|
+
return storedMarks;
|
|
18836
|
+
},
|
|
18837
|
+
get selection() {
|
|
18838
|
+
return selection;
|
|
18839
|
+
},
|
|
18840
|
+
get doc() {
|
|
18841
|
+
return doc2;
|
|
18842
|
+
},
|
|
18843
|
+
get tr() {
|
|
18844
|
+
selection = transaction.selection;
|
|
18845
|
+
doc2 = transaction.doc;
|
|
18846
|
+
storedMarks = transaction.storedMarks;
|
|
18847
|
+
return transaction;
|
|
18848
|
+
}
|
|
18849
|
+
};
|
|
18850
|
+
}
|
|
18851
|
+
class CommandService {
|
|
18852
|
+
constructor(props) {
|
|
18853
|
+
__publicField$2(this, "editor");
|
|
18854
|
+
__publicField$2(this, "rawCommands");
|
|
18855
|
+
this.editor = props.editor;
|
|
18856
|
+
this.rawCommands = this.editor.extensionService.commands;
|
|
18857
|
+
}
|
|
18858
|
+
/**
|
|
18859
|
+
* Static method for creating a service.
|
|
18860
|
+
* @param args Arguments for the constructor.
|
|
18861
|
+
*/
|
|
18862
|
+
static create(...args) {
|
|
18863
|
+
return new CommandService(...args);
|
|
18864
|
+
}
|
|
18865
|
+
/**
|
|
18866
|
+
* Get editor state.
|
|
18867
|
+
*/
|
|
18868
|
+
get state() {
|
|
18869
|
+
return this.editor.state;
|
|
18870
|
+
}
|
|
18871
|
+
/**
|
|
18872
|
+
* Get all commands with wrapped command method.
|
|
18873
|
+
*/
|
|
18874
|
+
get commands() {
|
|
18875
|
+
const { editor, state: state2 } = this;
|
|
18876
|
+
const { view } = editor;
|
|
18877
|
+
const { tr } = state2;
|
|
18878
|
+
const props = this.createProps(tr);
|
|
18879
|
+
const entries = Object.entries(this.rawCommands).map(([name, command2]) => {
|
|
18880
|
+
const method = (...args) => {
|
|
18881
|
+
const fn2 = command2(...args)(props);
|
|
18882
|
+
if (!tr.getMeta("preventDispatch")) {
|
|
18883
|
+
view.dispatch(tr);
|
|
18884
|
+
}
|
|
18885
|
+
return fn2;
|
|
18886
|
+
};
|
|
18887
|
+
return [name, method];
|
|
18888
|
+
});
|
|
18889
|
+
return Object.fromEntries(entries);
|
|
18890
|
+
}
|
|
18891
|
+
/**
|
|
18892
|
+
* Create a chain of commands to call multiple commands at once.
|
|
18893
|
+
*/
|
|
18894
|
+
get chain() {
|
|
18895
|
+
return () => this.createChain();
|
|
18896
|
+
}
|
|
18897
|
+
/**
|
|
18898
|
+
* Check if a command or a chain of commands can be executed. Without executing it.
|
|
18899
|
+
*/
|
|
18900
|
+
get can() {
|
|
18901
|
+
return () => this.createCan();
|
|
18902
|
+
}
|
|
18903
|
+
/**
|
|
18904
|
+
* Creates a chain of commands.
|
|
18905
|
+
* @param startTr Start transaction.
|
|
18906
|
+
* @param shouldDispatch Should dispatch or not.
|
|
18907
|
+
*/
|
|
18908
|
+
createChain(startTr, shouldDispatch = true) {
|
|
18909
|
+
const { editor, state: state2, rawCommands } = this;
|
|
18910
|
+
const { view } = editor;
|
|
18911
|
+
const callbacks2 = [];
|
|
18912
|
+
const hasStartTr = !!startTr;
|
|
18913
|
+
const tr = startTr || state2.tr;
|
|
18914
|
+
const run2 = () => {
|
|
18915
|
+
if (!hasStartTr && shouldDispatch && !tr.getMeta("preventDispatch")) {
|
|
18916
|
+
view.dispatch(tr);
|
|
18917
|
+
}
|
|
18918
|
+
return callbacks2.every((cb) => cb === true);
|
|
18919
|
+
};
|
|
18920
|
+
const entries = Object.entries(rawCommands).map(([name, command2]) => {
|
|
18921
|
+
const chainedCommand = (...args) => {
|
|
18922
|
+
const props = this.createProps(tr, shouldDispatch);
|
|
18923
|
+
const callback = command2(...args)(props);
|
|
18924
|
+
callbacks2.push(callback);
|
|
18925
|
+
return chain;
|
|
18926
|
+
};
|
|
18927
|
+
return [name, chainedCommand];
|
|
18928
|
+
});
|
|
18929
|
+
const chain = {
|
|
18930
|
+
...Object.fromEntries(entries),
|
|
18931
|
+
run: run2
|
|
18932
|
+
};
|
|
18933
|
+
return chain;
|
|
18934
|
+
}
|
|
18935
|
+
/**
|
|
18936
|
+
* Creates a can check for commands.
|
|
18937
|
+
* @param startTr Start transaction.
|
|
18938
|
+
*/
|
|
18939
|
+
createCan(startTr) {
|
|
18940
|
+
const { rawCommands, state: state2 } = this;
|
|
18941
|
+
const dispatch = false;
|
|
18942
|
+
const tr = startTr || state2.tr;
|
|
18943
|
+
const props = this.createProps(tr, dispatch);
|
|
18944
|
+
const commands2 = Object.fromEntries(
|
|
18945
|
+
Object.entries(rawCommands).map(([name, command2]) => {
|
|
18946
|
+
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
18947
|
+
})
|
|
18948
|
+
);
|
|
18949
|
+
return {
|
|
18950
|
+
...commands2,
|
|
18951
|
+
chain: () => this.createChain(tr, dispatch)
|
|
18952
|
+
};
|
|
18953
|
+
}
|
|
18954
|
+
/**
|
|
18955
|
+
* Creates default props for the command method.
|
|
18956
|
+
* @param {*} tr Transaction.
|
|
18957
|
+
* @param {*} shouldDispatch Check if should dispatch.
|
|
18958
|
+
* @returns Object with props.
|
|
18959
|
+
*/
|
|
18960
|
+
createProps(tr, shouldDispatch = true) {
|
|
18961
|
+
const { editor, state: state2, rawCommands } = this;
|
|
18962
|
+
const { view } = editor;
|
|
18963
|
+
const props = {
|
|
18964
|
+
tr,
|
|
18965
|
+
editor,
|
|
18966
|
+
view,
|
|
18967
|
+
state: chainableEditorState(tr, state2),
|
|
18968
|
+
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
18969
|
+
chain: () => this.createChain(tr, shouldDispatch),
|
|
18970
|
+
can: () => this.createCan(tr),
|
|
18971
|
+
get commands() {
|
|
18972
|
+
return Object.fromEntries(
|
|
18973
|
+
Object.entries(rawCommands).map(([name, command2]) => {
|
|
18974
|
+
return [name, (...args) => command2(...args)(props)];
|
|
18975
|
+
})
|
|
18976
|
+
);
|
|
18977
|
+
}
|
|
18978
|
+
};
|
|
18979
|
+
return props;
|
|
18980
|
+
}
|
|
18981
|
+
}
|
|
18982
|
+
function getHTMLFromFragment(fragment, schema) {
|
|
18983
|
+
const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);
|
|
18984
|
+
const temporaryDocument = document.implementation.createHTMLDocument();
|
|
18985
|
+
const container = temporaryDocument.createElement("div");
|
|
18986
|
+
container.appendChild(documentFragment);
|
|
18987
|
+
return container.innerHTML;
|
|
18988
|
+
}
|
|
18989
|
+
const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
18990
|
+
let textBefore = "";
|
|
18991
|
+
const sliceEndPos = $from.parentOffset;
|
|
18992
|
+
$from.parent.nodesBetween(
|
|
18993
|
+
Math.max(0, sliceEndPos - maxMatch),
|
|
18994
|
+
sliceEndPos,
|
|
18995
|
+
(node2, pos, parent, index2) => {
|
|
18996
|
+
const chunk = node2.type.spec.toText?.({
|
|
18997
|
+
node: node2,
|
|
18998
|
+
pos,
|
|
18999
|
+
parent,
|
|
19000
|
+
index: index2
|
|
19001
|
+
}) || node2.textContent || "%leaf%";
|
|
19002
|
+
textBefore += node2.isAtom && !node2.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
19003
|
+
}
|
|
19004
|
+
);
|
|
19005
|
+
return textBefore;
|
|
19006
|
+
};
|
|
19007
|
+
const handleDocxPaste = (html, editor, view, plugin2) => {
|
|
19008
|
+
const { converter } = editor;
|
|
19009
|
+
if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor, view, plugin2);
|
|
19010
|
+
let cleanedHtml = convertEmToPt(html);
|
|
19011
|
+
cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
|
|
19012
|
+
const tempDiv = document.createElement("div");
|
|
19013
|
+
tempDiv.innerHTML = cleanedHtml;
|
|
19014
|
+
const paragraphs = tempDiv.querySelectorAll("p");
|
|
19015
|
+
paragraphs.forEach((p) => {
|
|
19016
|
+
const innerHTML3 = p.innerHTML;
|
|
19017
|
+
if (!innerHTML3.includes("<!--[if !supportLists]")) return;
|
|
19018
|
+
const styleAttr = p.getAttribute("style") || "";
|
|
19019
|
+
const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)/);
|
|
19020
|
+
if (msoListMatch) {
|
|
19021
|
+
const [, abstractId, level] = msoListMatch;
|
|
19022
|
+
const listNumId = getListNumIdFromAbstract(abstractId, editor);
|
|
19023
|
+
if (!listNumId) return;
|
|
19024
|
+
const abstractDefinition = getListAbstractDefinition(abstractId, editor);
|
|
19025
|
+
const { lvlText, start: start2, numFmt } = getLevelDefinition(abstractDefinition, level - 1);
|
|
19026
|
+
p.setAttribute("data-num-id", listNumId);
|
|
19027
|
+
p.setAttribute("data-list-level", level - 1);
|
|
19028
|
+
p.setAttribute("data-start", start2);
|
|
19029
|
+
p.setAttribute("data-lvl-text", lvlText);
|
|
19030
|
+
p.setAttribute("data-num-fmt", numFmt);
|
|
19031
|
+
}
|
|
19032
|
+
extractAndRemoveConditionalPrefix(p);
|
|
19033
|
+
});
|
|
19034
|
+
transformWordLists(tempDiv);
|
|
19035
|
+
const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
|
|
19036
|
+
tempDiv.remove();
|
|
19037
|
+
const { dispatch } = editor.view;
|
|
19038
|
+
if (!dispatch) return false;
|
|
19039
|
+
dispatch(view.state.tr.replaceSelectionWith(doc2, true));
|
|
19040
|
+
return true;
|
|
19041
|
+
};
|
|
19042
|
+
const getLevelDefinition = (abstractDefinition, level) => {
|
|
19043
|
+
if (!abstractDefinition || !abstractDefinition.elements) return null;
|
|
19044
|
+
const levelElement = abstractDefinition.elements.find((el) => {
|
|
19045
|
+
return el.name === "w:lvl" && el.attributes?.["w:ilvl"] == level;
|
|
19046
|
+
});
|
|
19047
|
+
if (!levelElement) return null;
|
|
19048
|
+
const { elements } = levelElement;
|
|
19049
|
+
const lvlText = elements.find((el) => el.name === "w:lvlText")?.attributes?.["w:val"];
|
|
19050
|
+
const start2 = elements.find((el) => el.name === "w:start")?.attributes?.["w:val"];
|
|
19051
|
+
const numFmt = elements.find((el) => el.name === "w:numFmt")?.attributes?.["w:val"];
|
|
19052
|
+
return { lvlText, start: start2, numFmt, elements };
|
|
19053
|
+
};
|
|
19054
|
+
const getListNumIdFromAbstract = (abstractId, editor) => {
|
|
19055
|
+
const { definitions } = editor?.converter?.numbering;
|
|
19056
|
+
if (!definitions) return null;
|
|
19057
|
+
const matchedDefinition = Object.values(definitions).find((def) => {
|
|
19058
|
+
return def.elements.some((el) => el.name === "w:abstractNumId" && el.attributes?.["w:val"] == abstractId);
|
|
19059
|
+
});
|
|
19060
|
+
return matchedDefinition?.attributes?.["w:numId"];
|
|
19061
|
+
};
|
|
19062
|
+
const getListAbstractDefinition = (abstractId, editor) => {
|
|
19063
|
+
const { abstracts = {} } = editor?.converter?.numbering;
|
|
19064
|
+
return abstracts[abstractId] || null;
|
|
19065
|
+
};
|
|
19066
|
+
const transformWordLists = (container) => {
|
|
19067
|
+
const paragraphs = Array.from(container.querySelectorAll("p[data-num-id]"));
|
|
19068
|
+
const listMap = /* @__PURE__ */ new Map();
|
|
19069
|
+
const listLevels = {};
|
|
19070
|
+
for (const p of paragraphs) {
|
|
19071
|
+
const listId = p.getAttribute("data-num-id");
|
|
19072
|
+
const level = parseInt(p.getAttribute("data-list-level"));
|
|
19073
|
+
const numFmt = p.getAttribute("data-num-fmt");
|
|
19074
|
+
const start2 = p.getAttribute("data-start");
|
|
19075
|
+
const lvlText = p.getAttribute("data-lvl-text");
|
|
19076
|
+
if (!listMap.has(listId)) listMap.set(listId, []);
|
|
19077
|
+
listMap.get(listId).push({ p, level, numFmt, start: start2, lvlText });
|
|
19078
|
+
}
|
|
19079
|
+
for (const [id, items] of listMap.entries()) {
|
|
19080
|
+
if (!listLevels[id]) {
|
|
19081
|
+
listLevels[id] = {
|
|
19082
|
+
stack: [],
|
|
19083
|
+
counts: {},
|
|
19084
|
+
prevLevel: null
|
|
19085
|
+
};
|
|
19086
|
+
}
|
|
19087
|
+
const parentStack = [];
|
|
19088
|
+
items.forEach(({ p, level, numFmt, start: start2, lvlText }, index2) => {
|
|
19089
|
+
const listLevel = generateListNestingPath(listLevels, id, level);
|
|
19090
|
+
const li = document.createElement("li");
|
|
19091
|
+
li.innerHTML = p.innerHTML;
|
|
19092
|
+
li.setAttribute("data-list-level", JSON.stringify(listLevel));
|
|
19093
|
+
li.setAttribute("data-num-id", id);
|
|
19094
|
+
li.setAttribute("data-lvl-text", lvlText);
|
|
19095
|
+
li.setAttribute("data-num-fmt", numFmt);
|
|
19096
|
+
if (p.hasAttribute("data-font-family")) {
|
|
19097
|
+
li.setAttribute("data-font-family", p.getAttribute("data-font-family"));
|
|
19098
|
+
}
|
|
19099
|
+
if (p.hasAttribute("data-font-size")) {
|
|
19100
|
+
li.setAttribute("data-font-size", p.getAttribute("data-font-size"));
|
|
19101
|
+
}
|
|
19102
|
+
const parentNode2 = p.parentNode;
|
|
19103
|
+
let listForLevel = parentStack[level];
|
|
19104
|
+
if (!listForLevel) {
|
|
19105
|
+
const newList = document.createElement("ol");
|
|
19106
|
+
newList.setAttribute("data-list-id", id);
|
|
19107
|
+
newList.level = level;
|
|
19108
|
+
if (level > 0) {
|
|
19109
|
+
const parentLi = parentStack[level - 1]?.querySelector("li:last-child");
|
|
19110
|
+
if (parentLi) parentLi.appendChild(newList);
|
|
19111
|
+
} else {
|
|
19112
|
+
parentNode2.insertBefore(newList, p);
|
|
19113
|
+
}
|
|
19114
|
+
parentStack[level] = newList;
|
|
19115
|
+
parentStack.length = level + 1;
|
|
19116
|
+
listForLevel = newList;
|
|
19117
|
+
}
|
|
19118
|
+
listForLevel.appendChild(li);
|
|
19119
|
+
p.remove();
|
|
19120
|
+
});
|
|
19121
|
+
}
|
|
19122
|
+
};
|
|
19123
|
+
function generateListNestingPath(listLevels, listId, currentLevel) {
|
|
19124
|
+
const levelState = listLevels[listId];
|
|
19125
|
+
if (!levelState.stack) levelState.stack = [];
|
|
19126
|
+
if (levelState.prevLevel === void 0) levelState.prevLevel = null;
|
|
19127
|
+
if (levelState.prevLevel === null) {
|
|
19128
|
+
levelState.stack = Array(currentLevel).fill(1).concat(1);
|
|
19129
|
+
} else {
|
|
19130
|
+
if (currentLevel > levelState.prevLevel) {
|
|
19131
|
+
levelState.stack.push(1);
|
|
19132
|
+
} else if (currentLevel === levelState.prevLevel) {
|
|
19133
|
+
levelState.stack[levelState.stack.length - 1]++;
|
|
19134
|
+
} else {
|
|
19135
|
+
levelState.stack = levelState.stack.slice(0, currentLevel + 1);
|
|
19136
|
+
levelState.stack[currentLevel] = (levelState.stack[currentLevel] || 1) + 1;
|
|
19137
|
+
}
|
|
19138
|
+
}
|
|
19139
|
+
levelState.prevLevel = currentLevel;
|
|
19140
|
+
return [...levelState.stack];
|
|
19141
|
+
}
|
|
19142
|
+
function extractAndRemoveConditionalPrefix(p) {
|
|
19143
|
+
const nodes = Array.from(p.childNodes);
|
|
19144
|
+
let fontFamily2 = null;
|
|
19145
|
+
let fontSize2 = null;
|
|
19146
|
+
let start2 = -1, end2 = -1;
|
|
19147
|
+
nodes.forEach((node2, index2) => {
|
|
19148
|
+
if (node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[if !supportLists]")) {
|
|
19149
|
+
start2 = index2;
|
|
19150
|
+
}
|
|
19151
|
+
if (start2 !== -1 && node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[endif]")) {
|
|
19152
|
+
end2 = index2;
|
|
19153
|
+
}
|
|
19154
|
+
});
|
|
19155
|
+
if (start2 !== -1 && end2 !== -1) {
|
|
19156
|
+
for (let i = start2 + 1; i < end2; i++) {
|
|
19157
|
+
const node2 = nodes[i];
|
|
19158
|
+
if (node2.nodeType === Node.ELEMENT_NODE && node2.style) {
|
|
19159
|
+
fontFamily2 = fontFamily2 || node2.style.fontFamily;
|
|
19160
|
+
fontSize2 = fontSize2 || node2.style.fontSize;
|
|
19161
|
+
}
|
|
19162
|
+
}
|
|
19163
|
+
for (let i = end2; i >= start2; i--) {
|
|
19164
|
+
p.removeChild(p.childNodes[i]);
|
|
19165
|
+
}
|
|
19166
|
+
if (fontFamily2) p.setAttribute("data-font-family", fontFamily2);
|
|
19167
|
+
if (fontSize2) p.setAttribute("data-font-size", fontSize2);
|
|
19168
|
+
}
|
|
19169
|
+
}
|
|
19170
|
+
class InputRule {
|
|
19171
|
+
constructor(config) {
|
|
19172
|
+
__publicField$2(this, "match");
|
|
19173
|
+
__publicField$2(this, "handler");
|
|
19174
|
+
this.match = config.match;
|
|
19175
|
+
this.handler = config.handler;
|
|
19176
|
+
}
|
|
19177
|
+
}
|
|
19178
|
+
const inputRuleMatcherHandler = (text, match) => {
|
|
19179
|
+
if (isRegExp(match)) {
|
|
19180
|
+
return match.exec(text);
|
|
19181
|
+
}
|
|
19182
|
+
const inputRuleMatch = match(text);
|
|
19183
|
+
if (!inputRuleMatch) {
|
|
19184
|
+
return null;
|
|
19185
|
+
}
|
|
19186
|
+
const result = [inputRuleMatch.text];
|
|
19187
|
+
result.index = inputRuleMatch.index;
|
|
19188
|
+
result.input = text;
|
|
19189
|
+
result.data = inputRuleMatch.data;
|
|
19190
|
+
if (inputRuleMatch.replaceWith) {
|
|
19191
|
+
if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {
|
|
19192
|
+
console.warn(
|
|
19193
|
+
'[super-editor warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
|
|
19194
|
+
);
|
|
19195
|
+
}
|
|
19196
|
+
result.push(inputRuleMatch.replaceWith);
|
|
19197
|
+
}
|
|
19198
|
+
return result;
|
|
19199
|
+
};
|
|
19200
|
+
const run = (config) => {
|
|
19201
|
+
const {
|
|
19202
|
+
editor,
|
|
19203
|
+
from: from2,
|
|
19204
|
+
to,
|
|
19205
|
+
text,
|
|
19206
|
+
rules,
|
|
19207
|
+
plugin: plugin2
|
|
19208
|
+
} = config;
|
|
19209
|
+
const { view } = editor;
|
|
19210
|
+
if (view.composing) {
|
|
19211
|
+
return false;
|
|
19212
|
+
}
|
|
19213
|
+
const $from = view.state.doc.resolve(from2);
|
|
19214
|
+
if ($from.parent.type.spec.code || !!($from.nodeBefore || $from.nodeAfter)?.marks.find((mark) => mark.type.spec.code)) {
|
|
19215
|
+
return false;
|
|
19216
|
+
}
|
|
19217
|
+
let matched = false;
|
|
19218
|
+
const textBefore = getTextContentFromNodes($from) + text;
|
|
19219
|
+
rules.forEach((rule) => {
|
|
19220
|
+
if (matched) {
|
|
19221
|
+
return;
|
|
19222
|
+
}
|
|
19223
|
+
const match = inputRuleMatcherHandler(textBefore, rule.match);
|
|
19224
|
+
if (!match) {
|
|
19225
|
+
return;
|
|
19226
|
+
}
|
|
19227
|
+
const tr = view.state.tr;
|
|
19228
|
+
const state2 = chainableEditorState(tr, view.state);
|
|
19229
|
+
const range2 = {
|
|
19230
|
+
from: from2 - (match[0].length - text.length),
|
|
19231
|
+
to
|
|
19232
|
+
};
|
|
19233
|
+
const { commands: commands2, chain, can } = new CommandService({
|
|
19234
|
+
editor,
|
|
19235
|
+
state: state2
|
|
19236
|
+
});
|
|
19237
|
+
const handler = rule.handler({
|
|
19238
|
+
state: state2,
|
|
19239
|
+
range: range2,
|
|
19240
|
+
match,
|
|
19241
|
+
commands: commands2,
|
|
19242
|
+
chain,
|
|
19243
|
+
can
|
|
19244
|
+
});
|
|
19245
|
+
if (handler === null || !tr.steps.length) {
|
|
19246
|
+
return;
|
|
19247
|
+
}
|
|
19248
|
+
tr.setMeta(plugin2, {
|
|
19249
|
+
transform: tr,
|
|
19250
|
+
from: from2,
|
|
19251
|
+
to,
|
|
19252
|
+
text
|
|
19253
|
+
});
|
|
19254
|
+
view.dispatch(tr);
|
|
19255
|
+
matched = true;
|
|
19256
|
+
});
|
|
19257
|
+
return matched;
|
|
19258
|
+
};
|
|
19259
|
+
const inputRulesPlugin = ({ editor, rules }) => {
|
|
19260
|
+
const plugin2 = new Plugin({
|
|
19261
|
+
key: new PluginKey("inputRulesPlugin"),
|
|
19262
|
+
state: {
|
|
19263
|
+
init() {
|
|
19264
|
+
return null;
|
|
19265
|
+
},
|
|
19266
|
+
apply(tr, prev, state2) {
|
|
19267
|
+
const stored = tr.getMeta(plugin2);
|
|
19268
|
+
if (stored) {
|
|
19269
|
+
return stored;
|
|
19270
|
+
}
|
|
19271
|
+
const simulatedInputMeta = tr.getMeta("applyInputRules");
|
|
19272
|
+
const isSimulatedInput = !!simulatedInputMeta;
|
|
19273
|
+
if (isSimulatedInput) {
|
|
19274
|
+
setTimeout(() => {
|
|
19275
|
+
let { text } = simulatedInputMeta;
|
|
19276
|
+
if (typeof text !== "string") {
|
|
19277
|
+
text = getHTMLFromFragment(Fragment.from(text), state2.schema);
|
|
19278
|
+
}
|
|
19279
|
+
const { from: from2 } = simulatedInputMeta;
|
|
19280
|
+
const to = from2 + text.length;
|
|
19281
|
+
run({
|
|
19282
|
+
editor,
|
|
19283
|
+
from: from2,
|
|
19284
|
+
to,
|
|
19285
|
+
text,
|
|
19286
|
+
rules,
|
|
19287
|
+
plugin: plugin2
|
|
19288
|
+
});
|
|
19289
|
+
});
|
|
19290
|
+
}
|
|
19291
|
+
return tr.selectionSet || tr.docChanged ? null : prev;
|
|
19292
|
+
}
|
|
19293
|
+
},
|
|
19294
|
+
props: {
|
|
19295
|
+
handleTextInput(view, from2, to, text) {
|
|
19296
|
+
return run({
|
|
19297
|
+
editor,
|
|
19298
|
+
from: from2,
|
|
19299
|
+
to,
|
|
19300
|
+
text,
|
|
19301
|
+
rules,
|
|
19302
|
+
plugin: plugin2
|
|
19303
|
+
});
|
|
19304
|
+
},
|
|
19305
|
+
// add support for input rules to trigger on enter
|
|
19306
|
+
// this is useful for example for code blocks
|
|
19307
|
+
handleKeyDown(view, event) {
|
|
19308
|
+
if (event.key !== "Enter") {
|
|
19309
|
+
return false;
|
|
19310
|
+
}
|
|
19311
|
+
const { $cursor } = view.state.selection;
|
|
19312
|
+
if ($cursor) {
|
|
19313
|
+
return run({
|
|
19314
|
+
editor,
|
|
19315
|
+
from: $cursor.pos,
|
|
19316
|
+
to: $cursor.pos,
|
|
19317
|
+
text: "\n",
|
|
19318
|
+
rules,
|
|
19319
|
+
plugin: plugin2
|
|
19320
|
+
});
|
|
19321
|
+
}
|
|
19322
|
+
return false;
|
|
19323
|
+
},
|
|
19324
|
+
// Paste handler
|
|
19325
|
+
handlePaste(view, event, slice2) {
|
|
19326
|
+
const clipboard = event.clipboardData;
|
|
19327
|
+
const html = clipboard.getData("text/html");
|
|
19328
|
+
clipboard.getData("text/plain");
|
|
19329
|
+
const fieldAnnotationContent = slice2.content.content.filter((item) => item.type.name === "fieldAnnotation");
|
|
19330
|
+
if (fieldAnnotationContent.length) {
|
|
19331
|
+
return false;
|
|
19332
|
+
}
|
|
19333
|
+
let source;
|
|
19334
|
+
if (!html) {
|
|
19335
|
+
source = "plain-text";
|
|
19336
|
+
} else if (isWordHtml(html)) {
|
|
19337
|
+
source = "word-html";
|
|
19338
|
+
} else {
|
|
19339
|
+
source = "browser-html";
|
|
19340
|
+
}
|
|
19341
|
+
switch (source) {
|
|
19342
|
+
case "plain-text":
|
|
19343
|
+
break;
|
|
19344
|
+
case "word-html":
|
|
19345
|
+
if (editor.options.mode === "docx") {
|
|
19346
|
+
return handleDocxPaste(html, editor, view, plugin2);
|
|
19347
|
+
}
|
|
19348
|
+
case "browser-html":
|
|
19349
|
+
return handleHtmlPaste$1(html, editor);
|
|
19350
|
+
}
|
|
19351
|
+
return false;
|
|
19352
|
+
}
|
|
19353
|
+
},
|
|
19354
|
+
isInputRules: true
|
|
19355
|
+
});
|
|
19356
|
+
return plugin2;
|
|
19357
|
+
};
|
|
19358
|
+
function isWordHtml(html) {
|
|
19359
|
+
return /class=["']?Mso|xmlns:o=["']?urn:schemas-microsoft-com|<!--\[if gte mso|<meta[^>]+name=["']?Generator["']?[^>]+Word/i.test(html);
|
|
19360
|
+
}
|
|
19361
|
+
const handleHtmlPaste$1 = (html, editor, plugin2) => {
|
|
19362
|
+
const htmlWithPtSizing = convertEmToPt(html);
|
|
19363
|
+
const cleanedHtml = sanitizeHtml(htmlWithPtSizing);
|
|
19364
|
+
const doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
|
|
19365
|
+
const { dispatch } = editor.view;
|
|
19366
|
+
if (!dispatch) return false;
|
|
19367
|
+
dispatch(editor.view.state.tr.replaceSelectionWith(doc2, true));
|
|
19368
|
+
return true;
|
|
19369
|
+
};
|
|
19370
|
+
const convertEmToPt = (html) => {
|
|
19371
|
+
return html.replace(
|
|
19372
|
+
/font-size\s*:\s*([\d.]+)em/gi,
|
|
19373
|
+
(_, emValue) => {
|
|
19374
|
+
const em = parseFloat(emValue);
|
|
19375
|
+
const pt = Math.round(em * 12 * 100) / 100;
|
|
19376
|
+
return `font-size: ${pt}pt`;
|
|
19377
|
+
}
|
|
19378
|
+
);
|
|
19379
|
+
};
|
|
19380
|
+
function cleanHtmlUnnecessaryTags(html) {
|
|
19381
|
+
return html.replace(/<o:p>.*?<\/o:p>/gi, "").replace(/ /gi, " ").replace(/<span[^>]*>\s*<\/span>/gi, "").replace(/<p[^>]*>\s*<\/p>/gi, "").trim();
|
|
19382
|
+
}
|
|
19383
|
+
function sanitizeHtml(html, forbiddenTags = ["meta", "svg", "script", "style", "button"]) {
|
|
19384
|
+
const container = document.createElement("div");
|
|
19385
|
+
container.innerHTML = html;
|
|
19386
|
+
const walkAndClean = (node2) => {
|
|
19387
|
+
for (const child of [...node2.children]) {
|
|
19388
|
+
if (forbiddenTags.includes(child.tagName.toLowerCase())) {
|
|
19389
|
+
child.remove();
|
|
19390
|
+
continue;
|
|
19391
|
+
}
|
|
19392
|
+
if (child.hasAttribute("linebreaktype")) {
|
|
19393
|
+
child.removeAttribute("linebreaktype");
|
|
19394
|
+
}
|
|
19395
|
+
walkAndClean(child);
|
|
19396
|
+
}
|
|
19397
|
+
};
|
|
19398
|
+
walkAndClean(container);
|
|
19399
|
+
return container;
|
|
19400
|
+
}
|
|
18824
19401
|
function exportSchemaToJson(params2) {
|
|
18825
19402
|
const { type: type2 } = params2.node || {};
|
|
18826
19403
|
const router = {
|
|
@@ -18858,13 +19435,13 @@ function exportSchemaToJson(params2) {
|
|
|
18858
19435
|
function translateBodyNode(params2) {
|
|
18859
19436
|
let sectPr = params2.bodyNode?.elements.find((n) => n.name === "w:sectPr") || {};
|
|
18860
19437
|
if (params2.converter) {
|
|
18861
|
-
const hasHeader = sectPr
|
|
19438
|
+
const hasHeader = sectPr?.elements?.some((n) => n.name === "w:headerReference");
|
|
18862
19439
|
const hasDefaultHeader = params2.converter.headerIds?.default;
|
|
18863
19440
|
if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter) {
|
|
18864
19441
|
const defaultHeader = generateDefaultHeaderFooter("header", params2.converter.headerIds?.default);
|
|
18865
19442
|
sectPr.elements.push(defaultHeader);
|
|
18866
19443
|
}
|
|
18867
|
-
const hasFooter = sectPr
|
|
19444
|
+
const hasFooter = sectPr?.elements?.some((n) => n.name === "w:footerReference");
|
|
18868
19445
|
const hasDefaultFooter = params2.converter.footerIds?.default;
|
|
18869
19446
|
if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter) {
|
|
18870
19447
|
const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
|
|
@@ -20164,12 +20741,11 @@ function prepareHtmlAnnotation(params2) {
|
|
|
20164
20741
|
node: { attrs = {}, marks = [] },
|
|
20165
20742
|
editorSchema
|
|
20166
20743
|
} = params2;
|
|
20167
|
-
const
|
|
20168
|
-
const paragraphHtml = parser.parseFromString(attrs.rawHtml || attrs.displayLabel, "text/html");
|
|
20744
|
+
const paragraphHtmlContainer = sanitizeHtml(attrs.rawHtml);
|
|
20169
20745
|
const marksFromAttrs = translateFieldAttrsToMarks(attrs);
|
|
20170
20746
|
const allMarks = [...marks, ...marksFromAttrs];
|
|
20171
20747
|
let state2 = EditorState.create({
|
|
20172
|
-
doc: DOMParser$1.fromSchema(editorSchema).parse(
|
|
20748
|
+
doc: DOMParser$1.fromSchema(editorSchema).parse(paragraphHtmlContainer)
|
|
20173
20749
|
});
|
|
20174
20750
|
if (allMarks.length) {
|
|
20175
20751
|
state2 = applyMarksToHtmlAnnotation(state2, allMarks);
|
|
@@ -23224,7 +23800,7 @@ function addDefaultStylesIfMissing(styles) {
|
|
|
23224
23800
|
});
|
|
23225
23801
|
return updatedStyles;
|
|
23226
23802
|
}
|
|
23227
|
-
const importHeadersFooters = (docx, converter,
|
|
23803
|
+
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
23228
23804
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
23229
23805
|
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
23230
23806
|
const { elements } = relationships;
|
|
@@ -23234,6 +23810,9 @@ const importHeadersFooters = (docx, converter, editor) => {
|
|
|
23234
23810
|
const footers = elements.filter((el) => el.attributes["Type"] === footerType);
|
|
23235
23811
|
const sectPr = findSectPr(docx["word/document.xml"]) || [];
|
|
23236
23812
|
const allSectPrElements = sectPr.flatMap((el) => el.elements);
|
|
23813
|
+
if (!mainEditor) return;
|
|
23814
|
+
const editor = { ...mainEditor };
|
|
23815
|
+
editor.options.annotations = true;
|
|
23237
23816
|
headers.forEach((header) => {
|
|
23238
23817
|
const { rId, referenceFile, currentFileName } = getHeaderFooterSectionData(header, docx);
|
|
23239
23818
|
const sectPrHeader = allSectPrElements.find((el) => el.name === "w:headerReference" && el.attributes["r:id"] === rId);
|
|
@@ -23393,7 +23972,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
23393
23972
|
return;
|
|
23394
23973
|
}
|
|
23395
23974
|
}
|
|
23396
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.
|
|
23975
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-rev10") {
|
|
23397
23976
|
const customLocation = "docProps/custom.xml";
|
|
23398
23977
|
if (!docx[customLocation]) {
|
|
23399
23978
|
docx[customLocation] = generateCustomXml();
|
|
@@ -23860,7 +24439,7 @@ function storeSuperdocVersion(docx) {
|
|
|
23860
24439
|
function generateCustomXml() {
|
|
23861
24440
|
return DEFAULT_CUSTOM_XML;
|
|
23862
24441
|
}
|
|
23863
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.13.
|
|
24442
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.13.2-rev10") {
|
|
23864
24443
|
return {
|
|
23865
24444
|
type: "element",
|
|
23866
24445
|
name: "property",
|
|
@@ -26393,7 +26972,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
26393
26972
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
26394
26973
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
26395
26974
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
26396
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
26975
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
26397
26976
|
function getMarksFromSelection(state2) {
|
|
26398
26977
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
26399
26978
|
const marks = [];
|
|
@@ -27582,164 +28161,6 @@ createMarksSchema_fn = function(markExtensions, attributes, editor) {
|
|
|
27582
28161
|
};
|
|
27583
28162
|
__privateAdd$1(_Schema, _Schema_static);
|
|
27584
28163
|
let Schema2 = _Schema;
|
|
27585
|
-
function chainableEditorState(transaction, state2) {
|
|
27586
|
-
let { selection, doc: doc2, storedMarks } = transaction;
|
|
27587
|
-
return {
|
|
27588
|
-
...state2,
|
|
27589
|
-
apply: state2.apply.bind(state2),
|
|
27590
|
-
applyTransaction: state2.applyTransaction.bind(state2),
|
|
27591
|
-
plugins: state2.plugins,
|
|
27592
|
-
schema: state2.schema,
|
|
27593
|
-
reconfigure: state2.reconfigure.bind(state2),
|
|
27594
|
-
toJSON: state2.toJSON.bind(state2),
|
|
27595
|
-
get storedMarks() {
|
|
27596
|
-
return storedMarks;
|
|
27597
|
-
},
|
|
27598
|
-
get selection() {
|
|
27599
|
-
return selection;
|
|
27600
|
-
},
|
|
27601
|
-
get doc() {
|
|
27602
|
-
return doc2;
|
|
27603
|
-
},
|
|
27604
|
-
get tr() {
|
|
27605
|
-
selection = transaction.selection;
|
|
27606
|
-
doc2 = transaction.doc;
|
|
27607
|
-
storedMarks = transaction.storedMarks;
|
|
27608
|
-
return transaction;
|
|
27609
|
-
}
|
|
27610
|
-
};
|
|
27611
|
-
}
|
|
27612
|
-
class CommandService {
|
|
27613
|
-
constructor(props) {
|
|
27614
|
-
__publicField$1(this, "editor");
|
|
27615
|
-
__publicField$1(this, "rawCommands");
|
|
27616
|
-
this.editor = props.editor;
|
|
27617
|
-
this.rawCommands = this.editor.extensionService.commands;
|
|
27618
|
-
}
|
|
27619
|
-
/**
|
|
27620
|
-
* Static method for creating a service.
|
|
27621
|
-
* @param args Arguments for the constructor.
|
|
27622
|
-
*/
|
|
27623
|
-
static create(...args) {
|
|
27624
|
-
return new CommandService(...args);
|
|
27625
|
-
}
|
|
27626
|
-
/**
|
|
27627
|
-
* Get editor state.
|
|
27628
|
-
*/
|
|
27629
|
-
get state() {
|
|
27630
|
-
return this.editor.state;
|
|
27631
|
-
}
|
|
27632
|
-
/**
|
|
27633
|
-
* Get all commands with wrapped command method.
|
|
27634
|
-
*/
|
|
27635
|
-
get commands() {
|
|
27636
|
-
const { editor, state: state2 } = this;
|
|
27637
|
-
const { view } = editor;
|
|
27638
|
-
const { tr } = state2;
|
|
27639
|
-
const props = this.createProps(tr);
|
|
27640
|
-
const entries = Object.entries(this.rawCommands).map(([name, command2]) => {
|
|
27641
|
-
const method = (...args) => {
|
|
27642
|
-
const fn2 = command2(...args)(props);
|
|
27643
|
-
if (!tr.getMeta("preventDispatch")) {
|
|
27644
|
-
view.dispatch(tr);
|
|
27645
|
-
}
|
|
27646
|
-
return fn2;
|
|
27647
|
-
};
|
|
27648
|
-
return [name, method];
|
|
27649
|
-
});
|
|
27650
|
-
return Object.fromEntries(entries);
|
|
27651
|
-
}
|
|
27652
|
-
/**
|
|
27653
|
-
* Create a chain of commands to call multiple commands at once.
|
|
27654
|
-
*/
|
|
27655
|
-
get chain() {
|
|
27656
|
-
return () => this.createChain();
|
|
27657
|
-
}
|
|
27658
|
-
/**
|
|
27659
|
-
* Check if a command or a chain of commands can be executed. Without executing it.
|
|
27660
|
-
*/
|
|
27661
|
-
get can() {
|
|
27662
|
-
return () => this.createCan();
|
|
27663
|
-
}
|
|
27664
|
-
/**
|
|
27665
|
-
* Creates a chain of commands.
|
|
27666
|
-
* @param startTr Start transaction.
|
|
27667
|
-
* @param shouldDispatch Should dispatch or not.
|
|
27668
|
-
*/
|
|
27669
|
-
createChain(startTr, shouldDispatch = true) {
|
|
27670
|
-
const { editor, state: state2, rawCommands } = this;
|
|
27671
|
-
const { view } = editor;
|
|
27672
|
-
const callbacks2 = [];
|
|
27673
|
-
const hasStartTr = !!startTr;
|
|
27674
|
-
const tr = startTr || state2.tr;
|
|
27675
|
-
const run2 = () => {
|
|
27676
|
-
if (!hasStartTr && shouldDispatch && !tr.getMeta("preventDispatch")) {
|
|
27677
|
-
view.dispatch(tr);
|
|
27678
|
-
}
|
|
27679
|
-
return callbacks2.every((cb) => cb === true);
|
|
27680
|
-
};
|
|
27681
|
-
const entries = Object.entries(rawCommands).map(([name, command2]) => {
|
|
27682
|
-
const chainedCommand = (...args) => {
|
|
27683
|
-
const props = this.createProps(tr, shouldDispatch);
|
|
27684
|
-
const callback = command2(...args)(props);
|
|
27685
|
-
callbacks2.push(callback);
|
|
27686
|
-
return chain;
|
|
27687
|
-
};
|
|
27688
|
-
return [name, chainedCommand];
|
|
27689
|
-
});
|
|
27690
|
-
const chain = {
|
|
27691
|
-
...Object.fromEntries(entries),
|
|
27692
|
-
run: run2
|
|
27693
|
-
};
|
|
27694
|
-
return chain;
|
|
27695
|
-
}
|
|
27696
|
-
/**
|
|
27697
|
-
* Creates a can check for commands.
|
|
27698
|
-
* @param startTr Start transaction.
|
|
27699
|
-
*/
|
|
27700
|
-
createCan(startTr) {
|
|
27701
|
-
const { rawCommands, state: state2 } = this;
|
|
27702
|
-
const dispatch = false;
|
|
27703
|
-
const tr = startTr || state2.tr;
|
|
27704
|
-
const props = this.createProps(tr, dispatch);
|
|
27705
|
-
const commands2 = Object.fromEntries(
|
|
27706
|
-
Object.entries(rawCommands).map(([name, command2]) => {
|
|
27707
|
-
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
27708
|
-
})
|
|
27709
|
-
);
|
|
27710
|
-
return {
|
|
27711
|
-
...commands2,
|
|
27712
|
-
chain: () => this.createChain(tr, dispatch)
|
|
27713
|
-
};
|
|
27714
|
-
}
|
|
27715
|
-
/**
|
|
27716
|
-
* Creates default props for the command method.
|
|
27717
|
-
* @param {*} tr Transaction.
|
|
27718
|
-
* @param {*} shouldDispatch Check if should dispatch.
|
|
27719
|
-
* @returns Object with props.
|
|
27720
|
-
*/
|
|
27721
|
-
createProps(tr, shouldDispatch = true) {
|
|
27722
|
-
const { editor, state: state2, rawCommands } = this;
|
|
27723
|
-
const { view } = editor;
|
|
27724
|
-
const props = {
|
|
27725
|
-
tr,
|
|
27726
|
-
editor,
|
|
27727
|
-
view,
|
|
27728
|
-
state: chainableEditorState(tr, state2),
|
|
27729
|
-
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
27730
|
-
chain: () => this.createChain(tr, shouldDispatch),
|
|
27731
|
-
can: () => this.createCan(tr),
|
|
27732
|
-
get commands() {
|
|
27733
|
-
return Object.fromEntries(
|
|
27734
|
-
Object.entries(rawCommands).map(([name, command2]) => {
|
|
27735
|
-
return [name, (...args) => command2(...args)(props)];
|
|
27736
|
-
})
|
|
27737
|
-
);
|
|
27738
|
-
}
|
|
27739
|
-
};
|
|
27740
|
-
return props;
|
|
27741
|
-
}
|
|
27742
|
-
}
|
|
27743
28164
|
const first = (commands2) => (props) => {
|
|
27744
28165
|
const items = typeof commands2 === "function" ? commands2(props) : commands2;
|
|
27745
28166
|
for (let i = 0; i < items.length; i += 1) {
|
|
@@ -28101,7 +28522,7 @@ function deleteBarrier(state2, $cut, dispatch, dir) {
|
|
|
28101
28522
|
for (let i = conn.length - 1; i >= 0; i--)
|
|
28102
28523
|
wrap2 = Fragment.from(conn[i].create(null, wrap2));
|
|
28103
28524
|
wrap2 = Fragment.from(before.copy(wrap2));
|
|
28104
|
-
let tr = state2.tr.step(new ReplaceAroundStep($cut.pos - 1, end2, $cut.pos, end2, new Slice(wrap2, 1, 0), conn.length, true));
|
|
28525
|
+
let tr = state2.tr.step(new ReplaceAroundStep$1($cut.pos - 1, end2, $cut.pos, end2, new Slice(wrap2, 1, 0), conn.length, true));
|
|
28105
28526
|
let $joinAt = tr.doc.resolve(end2 + 2 * conn.length);
|
|
28106
28527
|
if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos))
|
|
28107
28528
|
tr.join($joinAt.pos);
|
|
@@ -28132,7 +28553,7 @@ function deleteBarrier(state2, $cut, dispatch, dir) {
|
|
|
28132
28553
|
let end2 = Fragment.empty;
|
|
28133
28554
|
for (let i = wrap2.length - 1; i >= 0; i--)
|
|
28134
28555
|
end2 = Fragment.from(wrap2[i].copy(end2));
|
|
28135
|
-
let tr = state2.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end2, wrap2.length, 0), 0, true));
|
|
28556
|
+
let tr = state2.tr.step(new ReplaceAroundStep$1($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end2, wrap2.length, 0), 0, true));
|
|
28136
28557
|
dispatch(tr.scrollIntoView());
|
|
28137
28558
|
}
|
|
28138
28559
|
return true;
|
|
@@ -28705,7 +29126,7 @@ function selectionToInsertionEnd(tr, startLen, bias) {
|
|
|
28705
29126
|
return;
|
|
28706
29127
|
}
|
|
28707
29128
|
const step = tr.steps[last];
|
|
28708
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {
|
|
29129
|
+
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
|
|
28709
29130
|
return;
|
|
28710
29131
|
}
|
|
28711
29132
|
const map22 = tr.mapping.maps[last];
|
|
@@ -28851,7 +29272,7 @@ function doWrapInList(tr, range2, wrappers, joinBefore, listType) {
|
|
|
28851
29272
|
let content = Fragment.empty;
|
|
28852
29273
|
for (let i = wrappers.length - 1; i >= 0; i--)
|
|
28853
29274
|
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
28854
|
-
tr.step(new ReplaceAroundStep(range2.start - (joinBefore ? 2 : 0), range2.end, range2.start, range2.end, new Slice(content, 0, 0), wrappers.length, true));
|
|
29275
|
+
tr.step(new ReplaceAroundStep$1(range2.start - (joinBefore ? 2 : 0), range2.end, range2.start, range2.end, new Slice(content, 0, 0), wrappers.length, true));
|
|
28855
29276
|
let found2 = 0;
|
|
28856
29277
|
for (let i = 0; i < wrappers.length; i++)
|
|
28857
29278
|
if (wrappers[i].type == listType)
|
|
@@ -28884,7 +29305,7 @@ function liftListItem$1(itemType) {
|
|
|
28884
29305
|
function liftToOuterList(state2, dispatch, itemType, range2) {
|
|
28885
29306
|
let tr = state2.tr, end2 = range2.end, endOfList = range2.$to.end(range2.depth);
|
|
28886
29307
|
if (end2 < endOfList) {
|
|
28887
|
-
tr.step(new ReplaceAroundStep(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range2.parent.copy())), 1, 0), 1, true));
|
|
29308
|
+
tr.step(new ReplaceAroundStep$1(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range2.parent.copy())), 1, 0), 1, true));
|
|
28888
29309
|
range2 = new NodeRange(tr.doc.resolve(range2.$from.pos), tr.doc.resolve(endOfList), range2.depth);
|
|
28889
29310
|
}
|
|
28890
29311
|
const target = liftTarget(range2);
|
|
@@ -28911,7 +29332,7 @@ function liftOutOfList(state2, dispatch, range2) {
|
|
|
28911
29332
|
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
|
|
28912
29333
|
return false;
|
|
28913
29334
|
let start2 = $start.pos, end2 = start2 + item.nodeSize;
|
|
28914
|
-
tr.step(new ReplaceAroundStep(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
29335
|
+
tr.step(new ReplaceAroundStep$1(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
28915
29336
|
dispatch(tr.scrollIntoView());
|
|
28916
29337
|
return true;
|
|
28917
29338
|
}
|
|
@@ -28932,7 +29353,7 @@ function sinkListItem$1(itemType) {
|
|
|
28932
29353
|
let inner = Fragment.from(nestedBefore ? itemType.create() : null);
|
|
28933
29354
|
let slice2 = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
|
|
28934
29355
|
let before = range2.start, after = range2.end;
|
|
28935
|
-
dispatch(state2.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
|
|
29356
|
+
dispatch(state2.tr.step(new ReplaceAroundStep$1(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
|
|
28936
29357
|
}
|
|
28937
29358
|
return true;
|
|
28938
29359
|
};
|
|
@@ -36525,7 +36946,8 @@ const restoreRelativeSelection = (tr, relSel, binding) => {
|
|
|
36525
36946
|
binding.mapping
|
|
36526
36947
|
);
|
|
36527
36948
|
if (anchor !== null && head !== null) {
|
|
36528
|
-
|
|
36949
|
+
const sel = TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head));
|
|
36950
|
+
tr.setSelection(sel);
|
|
36529
36951
|
}
|
|
36530
36952
|
}
|
|
36531
36953
|
}
|
|
@@ -37306,7 +37728,7 @@ const setMeta = (view, key, value) => {
|
|
|
37306
37728
|
};
|
|
37307
37729
|
const absolutePositionToRelativePosition = (pos, type2, mapping) => {
|
|
37308
37730
|
if (pos === 0) {
|
|
37309
|
-
return Y.createRelativePositionFromTypeIndex(type2, 0, -1);
|
|
37731
|
+
return Y.createRelativePositionFromTypeIndex(type2, 0, type2.length === 0 ? -1 : 0);
|
|
37310
37732
|
}
|
|
37311
37733
|
let n = type2._first === null ? null : (
|
|
37312
37734
|
/** @type {Y.ContentType} */
|
|
@@ -37315,7 +37737,7 @@ const absolutePositionToRelativePosition = (pos, type2, mapping) => {
|
|
|
37315
37737
|
while (n !== null && type2 !== n) {
|
|
37316
37738
|
if (n instanceof Y.XmlText) {
|
|
37317
37739
|
if (n._length >= pos) {
|
|
37318
|
-
return Y.createRelativePositionFromTypeIndex(n, pos, -1);
|
|
37740
|
+
return Y.createRelativePositionFromTypeIndex(n, pos, type2.length === 0 ? -1 : 0);
|
|
37319
37741
|
} else {
|
|
37320
37742
|
pos -= n._length;
|
|
37321
37743
|
}
|
|
@@ -37379,7 +37801,7 @@ const absolutePositionToRelativePosition = (pos, type2, mapping) => {
|
|
|
37379
37801
|
return createRelativePosition(n._item.parent, n._item);
|
|
37380
37802
|
}
|
|
37381
37803
|
}
|
|
37382
|
-
return Y.createRelativePositionFromTypeIndex(type2, type2._length, -1);
|
|
37804
|
+
return Y.createRelativePositionFromTypeIndex(type2, type2._length, type2.length === 0 ? -1 : 0);
|
|
37383
37805
|
};
|
|
37384
37806
|
const createRelativePosition = (type2, item) => {
|
|
37385
37807
|
let typeid = null;
|
|
@@ -37861,523 +38283,120 @@ var shift = {
|
|
|
37861
38283
|
186: ":",
|
|
37862
38284
|
187: "+",
|
|
37863
38285
|
188: "<",
|
|
37864
|
-
189: "_",
|
|
37865
|
-
190: ">",
|
|
37866
|
-
191: "?",
|
|
37867
|
-
192: "~",
|
|
37868
|
-
219: "{",
|
|
37869
|
-
220: "|",
|
|
37870
|
-
221: "}",
|
|
37871
|
-
222: '"'
|
|
37872
|
-
};
|
|
37873
|
-
var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
|
|
37874
|
-
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
37875
|
-
for (var i = 0; i < 10; i++) base$1[48 + i] = base$1[96 + i] = String(i);
|
|
37876
|
-
for (var i = 1; i <= 24; i++) base$1[i + 111] = "F" + i;
|
|
37877
|
-
for (var i = 65; i <= 90; i++) {
|
|
37878
|
-
base$1[i] = String.fromCharCode(i + 32);
|
|
37879
|
-
shift[i] = String.fromCharCode(i);
|
|
37880
|
-
}
|
|
37881
|
-
for (var code in base$1) if (!shift.hasOwnProperty(code)) shift[code] = base$1[code];
|
|
37882
|
-
function keyName(event) {
|
|
37883
|
-
var ignoreKey = mac$1 && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified";
|
|
37884
|
-
var name = !ignoreKey && event.key || (event.shiftKey ? shift : base$1)[event.keyCode] || event.key || "Unidentified";
|
|
37885
|
-
if (name == "Esc") name = "Escape";
|
|
37886
|
-
if (name == "Del") name = "Delete";
|
|
37887
|
-
if (name == "Left") name = "ArrowLeft";
|
|
37888
|
-
if (name == "Up") name = "ArrowUp";
|
|
37889
|
-
if (name == "Right") name = "ArrowRight";
|
|
37890
|
-
if (name == "Down") name = "ArrowDown";
|
|
37891
|
-
return name;
|
|
37892
|
-
}
|
|
37893
|
-
const mac = typeof navigator != "undefined" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
|
|
37894
|
-
const windows = typeof navigator != "undefined" && /Win/.test(navigator.platform);
|
|
37895
|
-
function normalizeKeyName(name) {
|
|
37896
|
-
let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];
|
|
37897
|
-
if (result == "Space")
|
|
37898
|
-
result = " ";
|
|
37899
|
-
let alt, ctrl, shift2, meta;
|
|
37900
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
37901
|
-
let mod = parts[i];
|
|
37902
|
-
if (/^(cmd|meta|m)$/i.test(mod))
|
|
37903
|
-
meta = true;
|
|
37904
|
-
else if (/^a(lt)?$/i.test(mod))
|
|
37905
|
-
alt = true;
|
|
37906
|
-
else if (/^(c|ctrl|control)$/i.test(mod))
|
|
37907
|
-
ctrl = true;
|
|
37908
|
-
else if (/^s(hift)?$/i.test(mod))
|
|
37909
|
-
shift2 = true;
|
|
37910
|
-
else if (/^mod$/i.test(mod)) {
|
|
37911
|
-
if (mac)
|
|
37912
|
-
meta = true;
|
|
37913
|
-
else
|
|
37914
|
-
ctrl = true;
|
|
37915
|
-
} else
|
|
37916
|
-
throw new Error("Unrecognized modifier name: " + mod);
|
|
37917
|
-
}
|
|
37918
|
-
if (alt)
|
|
37919
|
-
result = "Alt-" + result;
|
|
37920
|
-
if (ctrl)
|
|
37921
|
-
result = "Ctrl-" + result;
|
|
37922
|
-
if (meta)
|
|
37923
|
-
result = "Meta-" + result;
|
|
37924
|
-
if (shift2)
|
|
37925
|
-
result = "Shift-" + result;
|
|
37926
|
-
return result;
|
|
37927
|
-
}
|
|
37928
|
-
function normalize(map22) {
|
|
37929
|
-
let copy2 = /* @__PURE__ */ Object.create(null);
|
|
37930
|
-
for (let prop in map22)
|
|
37931
|
-
copy2[normalizeKeyName(prop)] = map22[prop];
|
|
37932
|
-
return copy2;
|
|
37933
|
-
}
|
|
37934
|
-
function modifiers(name, event, shift2 = true) {
|
|
37935
|
-
if (event.altKey)
|
|
37936
|
-
name = "Alt-" + name;
|
|
37937
|
-
if (event.ctrlKey)
|
|
37938
|
-
name = "Ctrl-" + name;
|
|
37939
|
-
if (event.metaKey)
|
|
37940
|
-
name = "Meta-" + name;
|
|
37941
|
-
if (shift2 && event.shiftKey)
|
|
37942
|
-
name = "Shift-" + name;
|
|
37943
|
-
return name;
|
|
37944
|
-
}
|
|
37945
|
-
function keymap(bindings) {
|
|
37946
|
-
return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
|
|
37947
|
-
}
|
|
37948
|
-
function keydownHandler(bindings) {
|
|
37949
|
-
let map22 = normalize(bindings);
|
|
37950
|
-
return function(view, event) {
|
|
37951
|
-
let name = keyName(event), baseName, direct = map22[modifiers(name, event)];
|
|
37952
|
-
if (direct && direct(view.state, view.dispatch, view))
|
|
37953
|
-
return true;
|
|
37954
|
-
if (name.length == 1 && name != " ") {
|
|
37955
|
-
if (event.shiftKey) {
|
|
37956
|
-
let noShift = map22[modifiers(name, event, false)];
|
|
37957
|
-
if (noShift && noShift(view.state, view.dispatch, view))
|
|
37958
|
-
return true;
|
|
37959
|
-
}
|
|
37960
|
-
if ((event.altKey || event.metaKey || event.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
|
|
37961
|
-
!(windows && event.ctrlKey && event.altKey) && (baseName = base$1[event.keyCode]) && baseName != name) {
|
|
37962
|
-
let fromCode = map22[modifiers(baseName, event)];
|
|
37963
|
-
if (fromCode && fromCode(view.state, view.dispatch, view))
|
|
37964
|
-
return true;
|
|
37965
|
-
}
|
|
37966
|
-
}
|
|
37967
|
-
return false;
|
|
37968
|
-
};
|
|
37969
|
-
}
|
|
37970
|
-
function isExtensionRulesEnabled(extension, enabled) {
|
|
37971
|
-
if (Array.isArray(enabled)) {
|
|
37972
|
-
return enabled.some((enabledExtension) => {
|
|
37973
|
-
const name = typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name;
|
|
37974
|
-
return name === extension.name;
|
|
37975
|
-
});
|
|
37976
|
-
}
|
|
37977
|
-
return enabled;
|
|
37978
|
-
}
|
|
37979
|
-
function getHTMLFromFragment(fragment, schema) {
|
|
37980
|
-
const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);
|
|
37981
|
-
const temporaryDocument = document.implementation.createHTMLDocument();
|
|
37982
|
-
const container = temporaryDocument.createElement("div");
|
|
37983
|
-
container.appendChild(documentFragment);
|
|
37984
|
-
return container.innerHTML;
|
|
37985
|
-
}
|
|
37986
|
-
const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
37987
|
-
let textBefore = "";
|
|
37988
|
-
const sliceEndPos = $from.parentOffset;
|
|
37989
|
-
$from.parent.nodesBetween(
|
|
37990
|
-
Math.max(0, sliceEndPos - maxMatch),
|
|
37991
|
-
sliceEndPos,
|
|
37992
|
-
(node2, pos, parent, index2) => {
|
|
37993
|
-
const chunk = node2.type.spec.toText?.({
|
|
37994
|
-
node: node2,
|
|
37995
|
-
pos,
|
|
37996
|
-
parent,
|
|
37997
|
-
index: index2
|
|
37998
|
-
}) || node2.textContent || "%leaf%";
|
|
37999
|
-
textBefore += node2.isAtom && !node2.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
38000
|
-
}
|
|
38001
|
-
);
|
|
38002
|
-
return textBefore;
|
|
38003
|
-
};
|
|
38004
|
-
const handleDocxPaste = (html, editor, view, plugin2) => {
|
|
38005
|
-
const { converter } = editor;
|
|
38006
|
-
if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor, view, plugin2);
|
|
38007
|
-
let cleanedHtml = convertEmToPt(html);
|
|
38008
|
-
cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
|
|
38009
|
-
const tempDiv = document.createElement("div");
|
|
38010
|
-
tempDiv.innerHTML = cleanedHtml;
|
|
38011
|
-
const paragraphs = tempDiv.querySelectorAll("p");
|
|
38012
|
-
paragraphs.forEach((p) => {
|
|
38013
|
-
const innerHTML3 = p.innerHTML;
|
|
38014
|
-
if (!innerHTML3.includes("<!--[if !supportLists]")) return;
|
|
38015
|
-
const styleAttr = p.getAttribute("style") || "";
|
|
38016
|
-
const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)/);
|
|
38017
|
-
if (msoListMatch) {
|
|
38018
|
-
const [, abstractId, level] = msoListMatch;
|
|
38019
|
-
const listNumId = getListNumIdFromAbstract(abstractId, editor);
|
|
38020
|
-
if (!listNumId) return;
|
|
38021
|
-
const abstractDefinition = getListAbstractDefinition(abstractId, editor);
|
|
38022
|
-
const { lvlText, start: start2, numFmt } = getLevelDefinition(abstractDefinition, level - 1);
|
|
38023
|
-
p.setAttribute("data-num-id", listNumId);
|
|
38024
|
-
p.setAttribute("data-list-level", level - 1);
|
|
38025
|
-
p.setAttribute("data-start", start2);
|
|
38026
|
-
p.setAttribute("data-lvl-text", lvlText);
|
|
38027
|
-
p.setAttribute("data-num-fmt", numFmt);
|
|
38028
|
-
}
|
|
38029
|
-
extractAndRemoveConditionalPrefix(p);
|
|
38030
|
-
});
|
|
38031
|
-
transformWordLists(tempDiv);
|
|
38032
|
-
const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
|
|
38033
|
-
tempDiv.remove();
|
|
38034
|
-
const { dispatch } = editor.view;
|
|
38035
|
-
if (!dispatch) return false;
|
|
38036
|
-
dispatch(view.state.tr.replaceSelectionWith(doc2, true));
|
|
38037
|
-
return true;
|
|
38038
|
-
};
|
|
38039
|
-
const getLevelDefinition = (abstractDefinition, level) => {
|
|
38040
|
-
if (!abstractDefinition || !abstractDefinition.elements) return null;
|
|
38041
|
-
const levelElement = abstractDefinition.elements.find((el) => {
|
|
38042
|
-
return el.name === "w:lvl" && el.attributes?.["w:ilvl"] == level;
|
|
38043
|
-
});
|
|
38044
|
-
if (!levelElement) return null;
|
|
38045
|
-
const { elements } = levelElement;
|
|
38046
|
-
const lvlText = elements.find((el) => el.name === "w:lvlText")?.attributes?.["w:val"];
|
|
38047
|
-
const start2 = elements.find((el) => el.name === "w:start")?.attributes?.["w:val"];
|
|
38048
|
-
const numFmt = elements.find((el) => el.name === "w:numFmt")?.attributes?.["w:val"];
|
|
38049
|
-
return { lvlText, start: start2, numFmt, elements };
|
|
38050
|
-
};
|
|
38051
|
-
const getListNumIdFromAbstract = (abstractId, editor) => {
|
|
38052
|
-
const { definitions } = editor?.converter?.numbering;
|
|
38053
|
-
if (!definitions) return null;
|
|
38054
|
-
const matchedDefinition = Object.values(definitions).find((def) => {
|
|
38055
|
-
return def.elements.some((el) => el.name === "w:abstractNumId" && el.attributes?.["w:val"] == abstractId);
|
|
38056
|
-
});
|
|
38057
|
-
return matchedDefinition?.attributes?.["w:numId"];
|
|
38058
|
-
};
|
|
38059
|
-
const getListAbstractDefinition = (abstractId, editor) => {
|
|
38060
|
-
const { abstracts = {} } = editor?.converter?.numbering;
|
|
38061
|
-
return abstracts[abstractId] || null;
|
|
38062
|
-
};
|
|
38063
|
-
const transformWordLists = (container) => {
|
|
38064
|
-
const paragraphs = Array.from(container.querySelectorAll("p[data-num-id]"));
|
|
38065
|
-
const listMap = /* @__PURE__ */ new Map();
|
|
38066
|
-
const listLevels = {};
|
|
38067
|
-
for (const p of paragraphs) {
|
|
38068
|
-
const listId = p.getAttribute("data-num-id");
|
|
38069
|
-
const level = parseInt(p.getAttribute("data-list-level"));
|
|
38070
|
-
const numFmt = p.getAttribute("data-num-fmt");
|
|
38071
|
-
const start2 = p.getAttribute("data-start");
|
|
38072
|
-
const lvlText = p.getAttribute("data-lvl-text");
|
|
38073
|
-
if (!listMap.has(listId)) listMap.set(listId, []);
|
|
38074
|
-
listMap.get(listId).push({ p, level, numFmt, start: start2, lvlText });
|
|
38075
|
-
}
|
|
38076
|
-
for (const [id, items] of listMap.entries()) {
|
|
38077
|
-
if (!listLevels[id]) {
|
|
38078
|
-
listLevels[id] = {
|
|
38079
|
-
stack: [],
|
|
38080
|
-
counts: {},
|
|
38081
|
-
prevLevel: null
|
|
38082
|
-
};
|
|
38083
|
-
}
|
|
38084
|
-
const parentStack = [];
|
|
38085
|
-
items.forEach(({ p, level, numFmt, start: start2, lvlText }, index2) => {
|
|
38086
|
-
const listLevel = generateListNestingPath(listLevels, id, level);
|
|
38087
|
-
const li = document.createElement("li");
|
|
38088
|
-
li.innerHTML = p.innerHTML;
|
|
38089
|
-
li.setAttribute("data-list-level", JSON.stringify(listLevel));
|
|
38090
|
-
li.setAttribute("data-num-id", id);
|
|
38091
|
-
li.setAttribute("data-lvl-text", lvlText);
|
|
38092
|
-
li.setAttribute("data-num-fmt", numFmt);
|
|
38093
|
-
if (p.hasAttribute("data-font-family")) {
|
|
38094
|
-
li.setAttribute("data-font-family", p.getAttribute("data-font-family"));
|
|
38095
|
-
}
|
|
38096
|
-
if (p.hasAttribute("data-font-size")) {
|
|
38097
|
-
li.setAttribute("data-font-size", p.getAttribute("data-font-size"));
|
|
38098
|
-
}
|
|
38099
|
-
const parentNode2 = p.parentNode;
|
|
38100
|
-
let listForLevel = parentStack[level];
|
|
38101
|
-
if (!listForLevel) {
|
|
38102
|
-
const newList = document.createElement("ol");
|
|
38103
|
-
newList.setAttribute("data-list-id", id);
|
|
38104
|
-
newList.level = level;
|
|
38105
|
-
if (level > 0) {
|
|
38106
|
-
const parentLi = parentStack[level - 1]?.querySelector("li:last-child");
|
|
38107
|
-
if (parentLi) parentLi.appendChild(newList);
|
|
38108
|
-
} else {
|
|
38109
|
-
parentNode2.insertBefore(newList, p);
|
|
38110
|
-
}
|
|
38111
|
-
parentStack[level] = newList;
|
|
38112
|
-
parentStack.length = level + 1;
|
|
38113
|
-
listForLevel = newList;
|
|
38114
|
-
}
|
|
38115
|
-
listForLevel.appendChild(li);
|
|
38116
|
-
p.remove();
|
|
38117
|
-
});
|
|
38118
|
-
}
|
|
38286
|
+
189: "_",
|
|
38287
|
+
190: ">",
|
|
38288
|
+
191: "?",
|
|
38289
|
+
192: "~",
|
|
38290
|
+
219: "{",
|
|
38291
|
+
220: "|",
|
|
38292
|
+
221: "}",
|
|
38293
|
+
222: '"'
|
|
38119
38294
|
};
|
|
38120
|
-
|
|
38121
|
-
|
|
38122
|
-
|
|
38123
|
-
|
|
38124
|
-
|
|
38125
|
-
|
|
38126
|
-
|
|
38127
|
-
if (currentLevel > levelState.prevLevel) {
|
|
38128
|
-
levelState.stack.push(1);
|
|
38129
|
-
} else if (currentLevel === levelState.prevLevel) {
|
|
38130
|
-
levelState.stack[levelState.stack.length - 1]++;
|
|
38131
|
-
} else {
|
|
38132
|
-
levelState.stack = levelState.stack.slice(0, currentLevel + 1);
|
|
38133
|
-
levelState.stack[currentLevel] = (levelState.stack[currentLevel] || 1) + 1;
|
|
38134
|
-
}
|
|
38135
|
-
}
|
|
38136
|
-
levelState.prevLevel = currentLevel;
|
|
38137
|
-
return [...levelState.stack];
|
|
38138
|
-
}
|
|
38139
|
-
function extractAndRemoveConditionalPrefix(p) {
|
|
38140
|
-
const nodes = Array.from(p.childNodes);
|
|
38141
|
-
let fontFamily2 = null;
|
|
38142
|
-
let fontSize2 = null;
|
|
38143
|
-
let start2 = -1, end2 = -1;
|
|
38144
|
-
nodes.forEach((node2, index2) => {
|
|
38145
|
-
if (node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[if !supportLists]")) {
|
|
38146
|
-
start2 = index2;
|
|
38147
|
-
}
|
|
38148
|
-
if (start2 !== -1 && node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[endif]")) {
|
|
38149
|
-
end2 = index2;
|
|
38150
|
-
}
|
|
38151
|
-
});
|
|
38152
|
-
if (start2 !== -1 && end2 !== -1) {
|
|
38153
|
-
for (let i = start2 + 1; i < end2; i++) {
|
|
38154
|
-
const node2 = nodes[i];
|
|
38155
|
-
if (node2.nodeType === Node.ELEMENT_NODE && node2.style) {
|
|
38156
|
-
fontFamily2 = fontFamily2 || node2.style.fontFamily;
|
|
38157
|
-
fontSize2 = fontSize2 || node2.style.fontSize;
|
|
38158
|
-
}
|
|
38159
|
-
}
|
|
38160
|
-
for (let i = end2; i >= start2; i--) {
|
|
38161
|
-
p.removeChild(p.childNodes[i]);
|
|
38162
|
-
}
|
|
38163
|
-
if (fontFamily2) p.setAttribute("data-font-family", fontFamily2);
|
|
38164
|
-
if (fontSize2) p.setAttribute("data-font-size", fontSize2);
|
|
38165
|
-
}
|
|
38295
|
+
var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
|
|
38296
|
+
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
38297
|
+
for (var i = 0; i < 10; i++) base$1[48 + i] = base$1[96 + i] = String(i);
|
|
38298
|
+
for (var i = 1; i <= 24; i++) base$1[i + 111] = "F" + i;
|
|
38299
|
+
for (var i = 65; i <= 90; i++) {
|
|
38300
|
+
base$1[i] = String.fromCharCode(i + 32);
|
|
38301
|
+
shift[i] = String.fromCharCode(i);
|
|
38166
38302
|
}
|
|
38167
|
-
|
|
38168
|
-
|
|
38169
|
-
|
|
38170
|
-
|
|
38171
|
-
|
|
38172
|
-
|
|
38173
|
-
|
|
38303
|
+
for (var code in base$1) if (!shift.hasOwnProperty(code)) shift[code] = base$1[code];
|
|
38304
|
+
function keyName(event) {
|
|
38305
|
+
var ignoreKey = mac$1 && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified";
|
|
38306
|
+
var name = !ignoreKey && event.key || (event.shiftKey ? shift : base$1)[event.keyCode] || event.key || "Unidentified";
|
|
38307
|
+
if (name == "Esc") name = "Escape";
|
|
38308
|
+
if (name == "Del") name = "Delete";
|
|
38309
|
+
if (name == "Left") name = "ArrowLeft";
|
|
38310
|
+
if (name == "Up") name = "ArrowUp";
|
|
38311
|
+
if (name == "Right") name = "ArrowRight";
|
|
38312
|
+
if (name == "Down") name = "ArrowDown";
|
|
38313
|
+
return name;
|
|
38174
38314
|
}
|
|
38175
|
-
const
|
|
38176
|
-
|
|
38177
|
-
|
|
38178
|
-
|
|
38179
|
-
|
|
38180
|
-
|
|
38181
|
-
|
|
38182
|
-
|
|
38183
|
-
|
|
38184
|
-
|
|
38185
|
-
|
|
38186
|
-
|
|
38187
|
-
|
|
38188
|
-
if (
|
|
38189
|
-
|
|
38190
|
-
|
|
38191
|
-
|
|
38192
|
-
|
|
38193
|
-
|
|
38315
|
+
const mac = typeof navigator != "undefined" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
|
|
38316
|
+
const windows = typeof navigator != "undefined" && /Win/.test(navigator.platform);
|
|
38317
|
+
function normalizeKeyName(name) {
|
|
38318
|
+
let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];
|
|
38319
|
+
if (result == "Space")
|
|
38320
|
+
result = " ";
|
|
38321
|
+
let alt, ctrl, shift2, meta;
|
|
38322
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
38323
|
+
let mod = parts[i];
|
|
38324
|
+
if (/^(cmd|meta|m)$/i.test(mod))
|
|
38325
|
+
meta = true;
|
|
38326
|
+
else if (/^a(lt)?$/i.test(mod))
|
|
38327
|
+
alt = true;
|
|
38328
|
+
else if (/^(c|ctrl|control)$/i.test(mod))
|
|
38329
|
+
ctrl = true;
|
|
38330
|
+
else if (/^s(hift)?$/i.test(mod))
|
|
38331
|
+
shift2 = true;
|
|
38332
|
+
else if (/^mod$/i.test(mod)) {
|
|
38333
|
+
if (mac)
|
|
38334
|
+
meta = true;
|
|
38335
|
+
else
|
|
38336
|
+
ctrl = true;
|
|
38337
|
+
} else
|
|
38338
|
+
throw new Error("Unrecognized modifier name: " + mod);
|
|
38194
38339
|
}
|
|
38340
|
+
if (alt)
|
|
38341
|
+
result = "Alt-" + result;
|
|
38342
|
+
if (ctrl)
|
|
38343
|
+
result = "Ctrl-" + result;
|
|
38344
|
+
if (meta)
|
|
38345
|
+
result = "Meta-" + result;
|
|
38346
|
+
if (shift2)
|
|
38347
|
+
result = "Shift-" + result;
|
|
38195
38348
|
return result;
|
|
38196
|
-
}
|
|
38197
|
-
|
|
38198
|
-
|
|
38199
|
-
|
|
38200
|
-
|
|
38201
|
-
|
|
38202
|
-
|
|
38203
|
-
|
|
38204
|
-
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
|
|
38213
|
-
|
|
38214
|
-
|
|
38215
|
-
|
|
38216
|
-
|
|
38217
|
-
|
|
38218
|
-
|
|
38219
|
-
|
|
38220
|
-
|
|
38221
|
-
if (
|
|
38222
|
-
return;
|
|
38223
|
-
|
|
38224
|
-
|
|
38225
|
-
|
|
38226
|
-
|
|
38227
|
-
|
|
38228
|
-
to
|
|
38229
|
-
};
|
|
38230
|
-
const { commands: commands2, chain, can } = new CommandService({
|
|
38231
|
-
editor,
|
|
38232
|
-
state: state2
|
|
38233
|
-
});
|
|
38234
|
-
const handler = rule.handler({
|
|
38235
|
-
state: state2,
|
|
38236
|
-
range: range2,
|
|
38237
|
-
match,
|
|
38238
|
-
commands: commands2,
|
|
38239
|
-
chain,
|
|
38240
|
-
can
|
|
38241
|
-
});
|
|
38242
|
-
if (handler === null || !tr.steps.length) {
|
|
38243
|
-
return;
|
|
38244
|
-
}
|
|
38245
|
-
tr.setMeta(plugin2, {
|
|
38246
|
-
transform: tr,
|
|
38247
|
-
from: from2,
|
|
38248
|
-
to,
|
|
38249
|
-
text
|
|
38250
|
-
});
|
|
38251
|
-
view.dispatch(tr);
|
|
38252
|
-
matched = true;
|
|
38253
|
-
});
|
|
38254
|
-
return matched;
|
|
38255
|
-
};
|
|
38256
|
-
const inputRulesPlugin = ({ editor, rules }) => {
|
|
38257
|
-
const plugin2 = new Plugin({
|
|
38258
|
-
key: new PluginKey("inputRulesPlugin"),
|
|
38259
|
-
state: {
|
|
38260
|
-
init() {
|
|
38261
|
-
return null;
|
|
38262
|
-
},
|
|
38263
|
-
apply(tr, prev, state2) {
|
|
38264
|
-
const stored = tr.getMeta(plugin2);
|
|
38265
|
-
if (stored) {
|
|
38266
|
-
return stored;
|
|
38267
|
-
}
|
|
38268
|
-
const simulatedInputMeta = tr.getMeta("applyInputRules");
|
|
38269
|
-
const isSimulatedInput = !!simulatedInputMeta;
|
|
38270
|
-
if (isSimulatedInput) {
|
|
38271
|
-
setTimeout(() => {
|
|
38272
|
-
let { text } = simulatedInputMeta;
|
|
38273
|
-
if (typeof text !== "string") {
|
|
38274
|
-
text = getHTMLFromFragment(Fragment.from(text), state2.schema);
|
|
38275
|
-
}
|
|
38276
|
-
const { from: from2 } = simulatedInputMeta;
|
|
38277
|
-
const to = from2 + text.length;
|
|
38278
|
-
run({
|
|
38279
|
-
editor,
|
|
38280
|
-
from: from2,
|
|
38281
|
-
to,
|
|
38282
|
-
text,
|
|
38283
|
-
rules,
|
|
38284
|
-
plugin: plugin2
|
|
38285
|
-
});
|
|
38286
|
-
});
|
|
38287
|
-
}
|
|
38288
|
-
return tr.selectionSet || tr.docChanged ? null : prev;
|
|
38349
|
+
}
|
|
38350
|
+
function normalize(map22) {
|
|
38351
|
+
let copy2 = /* @__PURE__ */ Object.create(null);
|
|
38352
|
+
for (let prop in map22)
|
|
38353
|
+
copy2[normalizeKeyName(prop)] = map22[prop];
|
|
38354
|
+
return copy2;
|
|
38355
|
+
}
|
|
38356
|
+
function modifiers(name, event, shift2 = true) {
|
|
38357
|
+
if (event.altKey)
|
|
38358
|
+
name = "Alt-" + name;
|
|
38359
|
+
if (event.ctrlKey)
|
|
38360
|
+
name = "Ctrl-" + name;
|
|
38361
|
+
if (event.metaKey)
|
|
38362
|
+
name = "Meta-" + name;
|
|
38363
|
+
if (shift2 && event.shiftKey)
|
|
38364
|
+
name = "Shift-" + name;
|
|
38365
|
+
return name;
|
|
38366
|
+
}
|
|
38367
|
+
function keymap(bindings) {
|
|
38368
|
+
return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
|
|
38369
|
+
}
|
|
38370
|
+
function keydownHandler(bindings) {
|
|
38371
|
+
let map22 = normalize(bindings);
|
|
38372
|
+
return function(view, event) {
|
|
38373
|
+
let name = keyName(event), baseName, direct = map22[modifiers(name, event)];
|
|
38374
|
+
if (direct && direct(view.state, view.dispatch, view))
|
|
38375
|
+
return true;
|
|
38376
|
+
if (name.length == 1 && name != " ") {
|
|
38377
|
+
if (event.shiftKey) {
|
|
38378
|
+
let noShift = map22[modifiers(name, event, false)];
|
|
38379
|
+
if (noShift && noShift(view.state, view.dispatch, view))
|
|
38380
|
+
return true;
|
|
38289
38381
|
}
|
|
38290
|
-
|
|
38291
|
-
|
|
38292
|
-
|
|
38293
|
-
|
|
38294
|
-
|
|
38295
|
-
from: from2,
|
|
38296
|
-
to,
|
|
38297
|
-
text,
|
|
38298
|
-
rules,
|
|
38299
|
-
plugin: plugin2
|
|
38300
|
-
});
|
|
38301
|
-
},
|
|
38302
|
-
// add support for input rules to trigger on enter
|
|
38303
|
-
// this is useful for example for code blocks
|
|
38304
|
-
handleKeyDown(view, event) {
|
|
38305
|
-
if (event.key !== "Enter") {
|
|
38306
|
-
return false;
|
|
38307
|
-
}
|
|
38308
|
-
const { $cursor } = view.state.selection;
|
|
38309
|
-
if ($cursor) {
|
|
38310
|
-
return run({
|
|
38311
|
-
editor,
|
|
38312
|
-
from: $cursor.pos,
|
|
38313
|
-
to: $cursor.pos,
|
|
38314
|
-
text: "\n",
|
|
38315
|
-
rules,
|
|
38316
|
-
plugin: plugin2
|
|
38317
|
-
});
|
|
38318
|
-
}
|
|
38319
|
-
return false;
|
|
38320
|
-
},
|
|
38321
|
-
// Paste handler
|
|
38322
|
-
handlePaste(view, event, slice2) {
|
|
38323
|
-
const clipboard = event.clipboardData;
|
|
38324
|
-
const html = clipboard.getData("text/html");
|
|
38325
|
-
clipboard.getData("text/plain");
|
|
38326
|
-
const fieldAnnotationContent = slice2.content.content.filter((item) => item.type.name === "fieldAnnotation");
|
|
38327
|
-
if (fieldAnnotationContent.length) {
|
|
38328
|
-
return false;
|
|
38329
|
-
}
|
|
38330
|
-
let source;
|
|
38331
|
-
if (!html) {
|
|
38332
|
-
source = "plain-text";
|
|
38333
|
-
} else if (isWordHtml(html)) {
|
|
38334
|
-
source = "word-html";
|
|
38335
|
-
} else {
|
|
38336
|
-
source = "browser-html";
|
|
38337
|
-
}
|
|
38338
|
-
switch (source) {
|
|
38339
|
-
case "plain-text":
|
|
38340
|
-
break;
|
|
38341
|
-
case "word-html":
|
|
38342
|
-
if (editor.options.mode === "docx") {
|
|
38343
|
-
return handleDocxPaste(html, editor, view, plugin2);
|
|
38344
|
-
}
|
|
38345
|
-
case "browser-html":
|
|
38346
|
-
return handleHtmlPaste$1(html, editor);
|
|
38347
|
-
}
|
|
38348
|
-
return false;
|
|
38382
|
+
if ((event.altKey || event.metaKey || event.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
|
|
38383
|
+
!(windows && event.ctrlKey && event.altKey) && (baseName = base$1[event.keyCode]) && baseName != name) {
|
|
38384
|
+
let fromCode = map22[modifiers(baseName, event)];
|
|
38385
|
+
if (fromCode && fromCode(view.state, view.dispatch, view))
|
|
38386
|
+
return true;
|
|
38349
38387
|
}
|
|
38350
|
-
},
|
|
38351
|
-
isInputRules: true
|
|
38352
|
-
});
|
|
38353
|
-
return plugin2;
|
|
38354
|
-
};
|
|
38355
|
-
function isWordHtml(html) {
|
|
38356
|
-
return /class=["']?Mso|xmlns:o=["']?urn:schemas-microsoft-com|<!--\[if gte mso|<meta[^>]+name=["']?Generator["']?[^>]+Word/i.test(html);
|
|
38357
|
-
}
|
|
38358
|
-
const handleHtmlPaste$1 = (html, editor, plugin2) => {
|
|
38359
|
-
const cleanedHtml = convertEmToPt(html);
|
|
38360
|
-
const tempDiv = document.createElement("div");
|
|
38361
|
-
tempDiv.innerHTML = cleanedHtml;
|
|
38362
|
-
const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
|
|
38363
|
-
tempDiv.remove();
|
|
38364
|
-
const { dispatch } = editor.view;
|
|
38365
|
-
if (!dispatch) return false;
|
|
38366
|
-
dispatch(editor.view.state.tr.replaceSelectionWith(doc2, true));
|
|
38367
|
-
return true;
|
|
38368
|
-
};
|
|
38369
|
-
const convertEmToPt = (html) => {
|
|
38370
|
-
return html.replace(
|
|
38371
|
-
/font-size\s*:\s*([\d.]+)em/gi,
|
|
38372
|
-
(_, emValue) => {
|
|
38373
|
-
const em = parseFloat(emValue);
|
|
38374
|
-
const pt = Math.round(em * 12 * 100) / 100;
|
|
38375
|
-
return `font-size: ${pt}pt`;
|
|
38376
38388
|
}
|
|
38377
|
-
|
|
38378
|
-
};
|
|
38379
|
-
|
|
38380
|
-
|
|
38389
|
+
return false;
|
|
38390
|
+
};
|
|
38391
|
+
}
|
|
38392
|
+
function isExtensionRulesEnabled(extension, enabled) {
|
|
38393
|
+
if (Array.isArray(enabled)) {
|
|
38394
|
+
return enabled.some((enabledExtension) => {
|
|
38395
|
+
const name = typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name;
|
|
38396
|
+
return name === extension.name;
|
|
38397
|
+
});
|
|
38398
|
+
}
|
|
38399
|
+
return enabled;
|
|
38381
38400
|
}
|
|
38382
38401
|
const _ExtensionService = class _ExtensionService2 {
|
|
38383
38402
|
constructor(extensions, userExtensions, editor) {
|
|
@@ -39217,6 +39236,7 @@ const createHeaderFooterEditor = ({
|
|
|
39217
39236
|
mediaFiles: editor.storage.image.media,
|
|
39218
39237
|
fonts: editor.options.fonts,
|
|
39219
39238
|
isHeaderOrFooter: true,
|
|
39239
|
+
isHeadless: editor.options.isHeadless,
|
|
39220
39240
|
annotations: true,
|
|
39221
39241
|
currentPageNumber,
|
|
39222
39242
|
parentEditor: editor,
|
|
@@ -39224,13 +39244,15 @@ const createHeaderFooterEditor = ({
|
|
|
39224
39244
|
onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type2)
|
|
39225
39245
|
});
|
|
39226
39246
|
const pm = editorContainer.querySelector(".ProseMirror");
|
|
39227
|
-
pm
|
|
39228
|
-
|
|
39229
|
-
|
|
39230
|
-
|
|
39231
|
-
|
|
39232
|
-
|
|
39233
|
-
|
|
39247
|
+
if (pm) {
|
|
39248
|
+
pm.style.maxHeight = "100%";
|
|
39249
|
+
pm.style.minHeight = "100%";
|
|
39250
|
+
pm.style.outline = "none";
|
|
39251
|
+
pm.style.border = "none";
|
|
39252
|
+
pm.setAttribute("role", "textbox");
|
|
39253
|
+
pm.setAttribute("aria-multiline", true);
|
|
39254
|
+
pm.setAttribute("aria-label", `${type2} content area. Double click to start typing.`);
|
|
39255
|
+
}
|
|
39234
39256
|
return headerFooterEditor;
|
|
39235
39257
|
};
|
|
39236
39258
|
const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
@@ -39249,14 +39271,16 @@ const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
|
39249
39271
|
});
|
|
39250
39272
|
});
|
|
39251
39273
|
};
|
|
39252
|
-
const toggleHeaderFooterEditMode = (editor, focusedSectionEditor, isEditMode) => {
|
|
39274
|
+
const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode, documentMode }) => {
|
|
39253
39275
|
editor.converter.headerEditors.forEach((item) => {
|
|
39254
39276
|
item.editor.setEditable(isEditMode, false);
|
|
39255
39277
|
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
39278
|
+
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
39256
39279
|
});
|
|
39257
39280
|
editor.converter.footerEditors.forEach((item) => {
|
|
39258
39281
|
item.editor.setEditable(isEditMode, false);
|
|
39259
39282
|
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
39283
|
+
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
39260
39284
|
});
|
|
39261
39285
|
if (isEditMode) {
|
|
39262
39286
|
const pm = document.querySelector(".ProseMirror");
|
|
@@ -40337,6 +40361,19 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
|
|
|
40337
40361
|
);
|
|
40338
40362
|
});
|
|
40339
40363
|
};
|
|
40364
|
+
const resetHeaderFooterFieldAnnotations = ({ editor }) => {
|
|
40365
|
+
if (!editor) return;
|
|
40366
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
40367
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
|
|
40368
|
+
sectionEditor.commands.resetFieldAnnotations();
|
|
40369
|
+
onHeaderFooterDataUpdate(
|
|
40370
|
+
{ editor: sectionEditor },
|
|
40371
|
+
editor,
|
|
40372
|
+
sectionId,
|
|
40373
|
+
type2
|
|
40374
|
+
);
|
|
40375
|
+
});
|
|
40376
|
+
};
|
|
40340
40377
|
const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
|
|
40341
40378
|
if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
|
|
40342
40379
|
const { doc: doc2 } = editor.state;
|
|
@@ -40407,6 +40444,7 @@ const AnnotatorHelpers = {
|
|
|
40407
40444
|
getAllHeaderFooterEditors,
|
|
40408
40445
|
updateHeaderFooterFieldAnnotations,
|
|
40409
40446
|
deleteHeaderFooterFieldAnnotations,
|
|
40447
|
+
resetHeaderFooterFieldAnnotations,
|
|
40410
40448
|
cleanUpListsWithAnnotations
|
|
40411
40449
|
};
|
|
40412
40450
|
const CollaborationPluginKey = new PluginKey("collaboration");
|
|
@@ -40586,6 +40624,16 @@ const setWordSelection = (view, pos) => {
|
|
|
40586
40624
|
const tr = state2.tr.setSelection(TextSelection.create(state2.doc, word.from, word.to));
|
|
40587
40625
|
dispatch(tr);
|
|
40588
40626
|
};
|
|
40627
|
+
const setImageNodeSelection = (view, pos) => {
|
|
40628
|
+
const { doc: doc2 } = view.state;
|
|
40629
|
+
const node2 = doc2.nodeAt(pos);
|
|
40630
|
+
if (node2 && node2.type.name === "image") {
|
|
40631
|
+
const tr = view.state.tr.setSelection(NodeSelection.create(doc2, pos));
|
|
40632
|
+
view.dispatch(tr);
|
|
40633
|
+
return true;
|
|
40634
|
+
}
|
|
40635
|
+
return false;
|
|
40636
|
+
};
|
|
40589
40637
|
const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
40590
40638
|
/**
|
|
40591
40639
|
* Create a new Editor instance
|
|
@@ -40684,6 +40732,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40684
40732
|
this.setHighContrastMode = setHighContrastMode;
|
|
40685
40733
|
initMode();
|
|
40686
40734
|
}
|
|
40735
|
+
mount(el) {
|
|
40736
|
+
__privateMethod$1(this, _Editor_instances, createView_fn).call(this, el);
|
|
40737
|
+
window.setTimeout(() => {
|
|
40738
|
+
if (this.isDestroyed) return;
|
|
40739
|
+
this.emit("create", { editor: this });
|
|
40740
|
+
}, 0);
|
|
40741
|
+
}
|
|
40742
|
+
unmount() {
|
|
40743
|
+
if (this.view) {
|
|
40744
|
+
this.view.destroy();
|
|
40745
|
+
}
|
|
40746
|
+
this.view = null;
|
|
40747
|
+
}
|
|
40687
40748
|
/**
|
|
40688
40749
|
* Set the toolbar for this editor
|
|
40689
40750
|
* @param {Object} toolbar - The toolbar instance
|
|
@@ -40732,7 +40793,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40732
40793
|
* @returns {boolean}
|
|
40733
40794
|
*/
|
|
40734
40795
|
get isDestroyed() {
|
|
40735
|
-
return this.view
|
|
40796
|
+
return this.view?.isDestroyed ?? true;
|
|
40736
40797
|
}
|
|
40737
40798
|
/**
|
|
40738
40799
|
* Get the editor element
|
|
@@ -40775,7 +40836,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40775
40836
|
this.commands.toggleTrackChangesShowOriginal();
|
|
40776
40837
|
this.setEditable(false, false);
|
|
40777
40838
|
this.setOptions({ documentMode: "viewing" });
|
|
40778
|
-
toggleHeaderFooterEditMode(
|
|
40839
|
+
toggleHeaderFooterEditMode({
|
|
40840
|
+
editor: this,
|
|
40841
|
+
focusedSectionEditor: null,
|
|
40842
|
+
isEditMode: false,
|
|
40843
|
+
documentMode: cleanedMode
|
|
40844
|
+
});
|
|
40779
40845
|
} else if (cleanedMode === "suggesting") {
|
|
40780
40846
|
__privateMethod$1(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
|
|
40781
40847
|
this.commands.disableTrackChangesShowOriginal();
|
|
@@ -40788,7 +40854,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40788
40854
|
this.commands.disableTrackChanges();
|
|
40789
40855
|
this.setEditable(true, false);
|
|
40790
40856
|
this.setOptions({ documentMode: "editing" });
|
|
40791
|
-
toggleHeaderFooterEditMode(
|
|
40857
|
+
toggleHeaderFooterEditMode({
|
|
40858
|
+
editor: this,
|
|
40859
|
+
focusedSectionEditor: null,
|
|
40860
|
+
isEditMode: false,
|
|
40861
|
+
documentMode: cleanedMode
|
|
40862
|
+
});
|
|
40792
40863
|
}
|
|
40793
40864
|
}
|
|
40794
40865
|
/**
|
|
@@ -40965,29 +41036,26 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40965
41036
|
};
|
|
40966
41037
|
}
|
|
40967
41038
|
/**
|
|
40968
|
-
|
|
40969
|
-
|
|
40970
|
-
|
|
40971
|
-
*
|
|
40972
|
-
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
40973
|
-
* @returns {void}
|
|
40974
|
-
*/
|
|
40975
|
-
initDefaultStyles(element = this.element) {
|
|
40976
|
-
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
40977
|
-
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41039
|
+
* Attach styles and attributes to the editor element
|
|
41040
|
+
*/
|
|
41041
|
+
updateEditorStyles(element, proseMirror) {
|
|
40978
41042
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
40979
|
-
if (!proseMirror || !
|
|
41043
|
+
if (!proseMirror || !element) {
|
|
40980
41044
|
return;
|
|
40981
41045
|
}
|
|
40982
41046
|
proseMirror.setAttribute("role", "document");
|
|
40983
41047
|
proseMirror.setAttribute("aria-multiline", true);
|
|
40984
41048
|
proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
|
|
40985
41049
|
proseMirror.setAttribute("aria-description", "");
|
|
40986
|
-
|
|
40987
|
-
|
|
40988
|
-
|
|
40989
|
-
|
|
40990
|
-
|
|
41050
|
+
if (pageSize) {
|
|
41051
|
+
element.style.width = pageSize.width + "in";
|
|
41052
|
+
element.style.minWidth = pageSize.width + "in";
|
|
41053
|
+
element.style.minHeight = pageSize.height + "in";
|
|
41054
|
+
}
|
|
41055
|
+
if (pageMargins) {
|
|
41056
|
+
element.style.paddingLeft = pageMargins.left + "in";
|
|
41057
|
+
element.style.paddingRight = pageMargins.right + "in";
|
|
41058
|
+
}
|
|
40991
41059
|
element.style.boxSizing = "border-box";
|
|
40992
41060
|
element.style.isolation = "isolate";
|
|
40993
41061
|
proseMirror.style.outline = "none";
|
|
@@ -41008,6 +41076,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41008
41076
|
proseMirror.style.paddingTop = "1in";
|
|
41009
41077
|
proseMirror.style.paddingBottom = "1in";
|
|
41010
41078
|
}
|
|
41079
|
+
}
|
|
41080
|
+
/**
|
|
41081
|
+
* Initialize default styles for the editor container and ProseMirror.
|
|
41082
|
+
* Get page size and margins from the converter.
|
|
41083
|
+
* Set document default font and font size.
|
|
41084
|
+
*
|
|
41085
|
+
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41086
|
+
* @returns {void}
|
|
41087
|
+
*/
|
|
41088
|
+
initDefaultStyles(element = this.element) {
|
|
41089
|
+
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41090
|
+
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41091
|
+
this.updateEditorStyles(element, proseMirror);
|
|
41011
41092
|
this.initMobileStyles(element);
|
|
41012
41093
|
}
|
|
41013
41094
|
/**
|
|
@@ -41219,10 +41300,25 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41219
41300
|
*/
|
|
41220
41301
|
destroy() {
|
|
41221
41302
|
this.emit("destroy");
|
|
41222
|
-
|
|
41303
|
+
this.unmount();
|
|
41304
|
+
this.destroyHeaderFooterEditors();
|
|
41223
41305
|
__privateMethod$1(this, _Editor_instances, endCollaboration_fn).call(this);
|
|
41224
41306
|
this.removeAllListeners();
|
|
41225
41307
|
}
|
|
41308
|
+
destroyHeaderFooterEditors() {
|
|
41309
|
+
try {
|
|
41310
|
+
const editors = [
|
|
41311
|
+
...this.converter.headerEditors,
|
|
41312
|
+
...this.converter.footerEditors
|
|
41313
|
+
];
|
|
41314
|
+
for (let editorData of editors) {
|
|
41315
|
+
editorData.editor.destroy();
|
|
41316
|
+
}
|
|
41317
|
+
this.converter.headerEditors.length = 0;
|
|
41318
|
+
this.converter.footerEditors.length = 0;
|
|
41319
|
+
} catch (error) {
|
|
41320
|
+
}
|
|
41321
|
+
}
|
|
41226
41322
|
/**
|
|
41227
41323
|
* Check if migrations are needed for the data
|
|
41228
41324
|
* @static
|
|
@@ -41240,7 +41336,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41240
41336
|
* @returns {Object | void} Migration results
|
|
41241
41337
|
*/
|
|
41242
41338
|
processCollaborationMigrations() {
|
|
41243
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.
|
|
41339
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev10");
|
|
41244
41340
|
if (!this.options.ydoc) return;
|
|
41245
41341
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41246
41342
|
let docVersion = metaMap.get("version");
|
|
@@ -41284,6 +41380,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41284
41380
|
__privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
|
|
41285
41381
|
this.initDefaultStyles();
|
|
41286
41382
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
41383
|
+
updateYdocDocxData(this);
|
|
41287
41384
|
this.initializeCollaborationData(true);
|
|
41288
41385
|
} else {
|
|
41289
41386
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
@@ -41435,7 +41532,7 @@ init_fn = function(options2) {
|
|
|
41435
41532
|
this.emit("beforeCreate", { editor: this });
|
|
41436
41533
|
this.on("contentError", this.options.onContentError);
|
|
41437
41534
|
this.on("exception", this.options.onException);
|
|
41438
|
-
|
|
41535
|
+
this.mount(this.options.element);
|
|
41439
41536
|
this.initDefaultStyles();
|
|
41440
41537
|
this.setDocumentMode(options2.documentMode);
|
|
41441
41538
|
if (this.options.isHeadless) return;
|
|
@@ -41459,10 +41556,6 @@ init_fn = function(options2) {
|
|
|
41459
41556
|
__privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
|
|
41460
41557
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
41461
41558
|
}
|
|
41462
|
-
window.setTimeout(() => {
|
|
41463
|
-
if (this.isDestroyed) return;
|
|
41464
|
-
this.emit("create", { editor: this });
|
|
41465
|
-
}, 0);
|
|
41466
41559
|
};
|
|
41467
41560
|
initRichText_fn = function(options2) {
|
|
41468
41561
|
if (!options2.extensions || !options2.extensions.length) {
|
|
@@ -41474,7 +41567,7 @@ initRichText_fn = function(options2) {
|
|
|
41474
41567
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
41475
41568
|
this.emit("beforeCreate", { editor: this });
|
|
41476
41569
|
this.on("contentError", this.options.onContentError);
|
|
41477
|
-
|
|
41570
|
+
this.mount(this.options.element);
|
|
41478
41571
|
this.on("create", this.options.onCreate);
|
|
41479
41572
|
this.on("update", this.options.onUpdate);
|
|
41480
41573
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
@@ -41485,10 +41578,6 @@ initRichText_fn = function(options2) {
|
|
|
41485
41578
|
this.on("commentsLoaded", this.options.onCommentsLoaded);
|
|
41486
41579
|
this.on("commentClick", this.options.onCommentClicked);
|
|
41487
41580
|
this.on("locked", this.options.onDocumentLocked);
|
|
41488
|
-
window.setTimeout(() => {
|
|
41489
|
-
if (this.isDestroyed) return;
|
|
41490
|
-
this.emit("create", { editor: this });
|
|
41491
|
-
}, 0);
|
|
41492
41581
|
};
|
|
41493
41582
|
onFocus_fn = function({ editor, event }) {
|
|
41494
41583
|
this.toolbar?.setActiveEditor(editor);
|
|
@@ -41609,14 +41698,15 @@ createDocFromHTML_fn = function(content) {
|
|
|
41609
41698
|
}
|
|
41610
41699
|
return DOMParser$1.fromSchema(this.schema).parse(parsedContent);
|
|
41611
41700
|
};
|
|
41612
|
-
createView_fn = function() {
|
|
41701
|
+
createView_fn = function(element) {
|
|
41613
41702
|
let doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
|
|
41614
41703
|
const state2 = { schema: this.schema };
|
|
41615
41704
|
if (!this.options.ydoc) state2.doc = doc2;
|
|
41616
|
-
this.view = new EditorView(
|
|
41705
|
+
this.view = new EditorView(element, {
|
|
41617
41706
|
...this.options.editorProps,
|
|
41618
41707
|
dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
|
|
41619
41708
|
state: EditorState.create(state2),
|
|
41709
|
+
handleClick: __privateMethod$1(this, _Editor_instances, handleNodeSelection_fn).bind(this),
|
|
41620
41710
|
handleDoubleClick: async (view, pos, event) => {
|
|
41621
41711
|
if (this.options.documentMode !== "editing") return;
|
|
41622
41712
|
const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
|
|
@@ -41630,7 +41720,12 @@ createView_fn = function() {
|
|
|
41630
41720
|
event.stopPropagation();
|
|
41631
41721
|
if (!this.options.editable) {
|
|
41632
41722
|
this.setEditable(true, false);
|
|
41633
|
-
toggleHeaderFooterEditMode(
|
|
41723
|
+
toggleHeaderFooterEditMode({
|
|
41724
|
+
editor: this,
|
|
41725
|
+
focusedSectionEditor: null,
|
|
41726
|
+
isEditMode: false,
|
|
41727
|
+
documentMode: this.options.documentMode
|
|
41728
|
+
});
|
|
41634
41729
|
const pm = document.querySelector(".ProseMirror");
|
|
41635
41730
|
pm.classList.remove("header-footer-edit");
|
|
41636
41731
|
pm.setAttribute("aria-readonly", false);
|
|
@@ -41643,8 +41738,6 @@ createView_fn = function() {
|
|
|
41643
41738
|
});
|
|
41644
41739
|
this.view.updateState(newState);
|
|
41645
41740
|
this.createNodeViews();
|
|
41646
|
-
const dom = this.view.dom;
|
|
41647
|
-
dom.editor = this;
|
|
41648
41741
|
this.options.telemetry?.sendReport();
|
|
41649
41742
|
};
|
|
41650
41743
|
onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
@@ -41671,7 +41764,9 @@ initComments_fn = function() {
|
|
|
41671
41764
|
}, 50);
|
|
41672
41765
|
};
|
|
41673
41766
|
initPagination_fn = async function() {
|
|
41674
|
-
if (this.options.isHeadless || !this.extensionService)
|
|
41767
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
41768
|
+
return;
|
|
41769
|
+
}
|
|
41675
41770
|
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
41676
41771
|
if (pagination && this.options.pagination) {
|
|
41677
41772
|
console.debug("🔗 [super-editor] Initializing pagination");
|
|
@@ -41683,7 +41778,7 @@ initPagination_fn = async function() {
|
|
|
41683
41778
|
}
|
|
41684
41779
|
};
|
|
41685
41780
|
dispatchTransaction_fn = function(transaction) {
|
|
41686
|
-
if (this.
|
|
41781
|
+
if (this.isDestroyed) return;
|
|
41687
41782
|
let state2;
|
|
41688
41783
|
try {
|
|
41689
41784
|
const trackChangesState = TrackChangesBasePluginKey.getState(this.view.state);
|
|
@@ -41735,6 +41830,11 @@ dispatchTransaction_fn = function(transaction) {
|
|
|
41735
41830
|
transaction
|
|
41736
41831
|
});
|
|
41737
41832
|
};
|
|
41833
|
+
handleNodeSelection_fn = function(view, pos) {
|
|
41834
|
+
if (this.options.isHeaderOrFooter) {
|
|
41835
|
+
return setImageNodeSelection(view, pos);
|
|
41836
|
+
}
|
|
41837
|
+
};
|
|
41738
41838
|
prepareDocumentForImport_fn = function(doc2) {
|
|
41739
41839
|
const newState = EditorState.create({
|
|
41740
41840
|
schema: this.schema,
|
|
@@ -44077,7 +44177,7 @@ const Paragraph = Node$1.create({
|
|
|
44077
44177
|
},
|
|
44078
44178
|
addPmPlugins() {
|
|
44079
44179
|
const { view } = this.editor;
|
|
44080
|
-
|
|
44180
|
+
new Plugin({
|
|
44081
44181
|
name: "dropcapPlugin",
|
|
44082
44182
|
key: new PluginKey("dropcapPlugin"),
|
|
44083
44183
|
state: {
|
|
@@ -44097,7 +44197,7 @@ const Paragraph = Node$1.create({
|
|
|
44097
44197
|
}
|
|
44098
44198
|
}
|
|
44099
44199
|
});
|
|
44100
|
-
return [
|
|
44200
|
+
return [];
|
|
44101
44201
|
}
|
|
44102
44202
|
});
|
|
44103
44203
|
const getDropcapDecorations = (state2, view) => {
|
|
@@ -44450,7 +44550,16 @@ const HardBreak = Node$1.create({
|
|
|
44450
44550
|
};
|
|
44451
44551
|
},
|
|
44452
44552
|
parseDOM() {
|
|
44453
|
-
return [{
|
|
44553
|
+
return [{
|
|
44554
|
+
tag: 'span[linebreaktype="page"]',
|
|
44555
|
+
getAttrs: (dom) => {
|
|
44556
|
+
if (!(dom instanceof HTMLElement)) return false;
|
|
44557
|
+
return {
|
|
44558
|
+
pageBreakSource: dom.getAttribute("pagebreaksource") || null,
|
|
44559
|
+
pageBreakType: dom.getAttribute("linebreaktype") || null
|
|
44560
|
+
};
|
|
44561
|
+
}
|
|
44562
|
+
}];
|
|
44454
44563
|
},
|
|
44455
44564
|
renderDOM({ htmlAttributes }) {
|
|
44456
44565
|
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
@@ -47447,6 +47556,8 @@ function findRemovedFieldAnnotations(tr) {
|
|
|
47447
47556
|
if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
|
|
47448
47557
|
return removedNodes;
|
|
47449
47558
|
}
|
|
47559
|
+
const hasDeletion = transactionDeletedAnything(tr);
|
|
47560
|
+
if (!hasDeletion) return removedNodes;
|
|
47450
47561
|
tr.steps.forEach((step, stepIndex) => {
|
|
47451
47562
|
if (step instanceof ReplaceStep && step.from !== step.to) {
|
|
47452
47563
|
let mapping = tr.mapping.maps[stepIndex];
|
|
@@ -47463,6 +47574,14 @@ function findRemovedFieldAnnotations(tr) {
|
|
|
47463
47574
|
});
|
|
47464
47575
|
return removedNodes;
|
|
47465
47576
|
}
|
|
47577
|
+
function transactionDeletedAnything(tr) {
|
|
47578
|
+
return tr.steps.some((step) => {
|
|
47579
|
+
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep) {
|
|
47580
|
+
return step.from !== step.to;
|
|
47581
|
+
}
|
|
47582
|
+
return false;
|
|
47583
|
+
});
|
|
47584
|
+
}
|
|
47466
47585
|
function trackFieldAnnotationsDeletion(editor, tr) {
|
|
47467
47586
|
let removedAnnotations = [];
|
|
47468
47587
|
try {
|
|
@@ -47858,8 +47977,18 @@ const FieldAnnotation = Node$1.create({
|
|
|
47858
47977
|
};
|
|
47859
47978
|
}
|
|
47860
47979
|
},
|
|
47980
|
+
defaultDisplayLabel: {
|
|
47981
|
+
default: "",
|
|
47982
|
+
parseDOM: (elem) => elem.getAttribute("data-default-display-label"),
|
|
47983
|
+
renderDOM: (attrs) => {
|
|
47984
|
+
if (!attrs.defaultDisplayLabel) return {};
|
|
47985
|
+
return {
|
|
47986
|
+
"data-default-display-label": attrs.defaultDisplayLabel
|
|
47987
|
+
};
|
|
47988
|
+
}
|
|
47989
|
+
},
|
|
47861
47990
|
displayLabel: {
|
|
47862
|
-
default: "
|
|
47991
|
+
default: "",
|
|
47863
47992
|
parseDOM: (elem) => elem.getAttribute("data-display-label"),
|
|
47864
47993
|
renderDOM: (attrs) => {
|
|
47865
47994
|
if (!attrs.displayLabel) return {};
|
|
@@ -48175,6 +48304,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
48175
48304
|
return renderer();
|
|
48176
48305
|
},
|
|
48177
48306
|
addCommands() {
|
|
48307
|
+
const annotationTypes = this.options.types;
|
|
48178
48308
|
return {
|
|
48179
48309
|
/**
|
|
48180
48310
|
* Add field annotation.
|
|
@@ -48196,7 +48326,12 @@ const FieldAnnotation = Node$1.create({
|
|
|
48196
48326
|
let currentMarks = $pos.marks();
|
|
48197
48327
|
currentMarks = currentMarks.length ? [...currentMarks] : null;
|
|
48198
48328
|
let formatAttrs = getFormatAttrsFromMarks(currentMarks);
|
|
48199
|
-
let
|
|
48329
|
+
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
48330
|
+
let node2 = schema.nodes[this.name].create({
|
|
48331
|
+
...attrs,
|
|
48332
|
+
...formatAttrs,
|
|
48333
|
+
defaultDisplayLabel
|
|
48334
|
+
}, null, null);
|
|
48200
48335
|
state2.tr.insert(newPos, node2).setSelection(Selection.near(tr.doc.resolve(newPos + node2.nodeSize)));
|
|
48201
48336
|
if (editorFocus) {
|
|
48202
48337
|
this.editor.view.focus();
|
|
@@ -48204,9 +48339,9 @@ const FieldAnnotation = Node$1.create({
|
|
|
48204
48339
|
}
|
|
48205
48340
|
return true;
|
|
48206
48341
|
},
|
|
48207
|
-
addFieldAnnotationAtSelection: (attrs = {}, editorFocus = false) => ({
|
|
48342
|
+
addFieldAnnotationAtSelection: (attrs = {}, editorFocus = false) => ({ state: state2, commands: commands2 }) => {
|
|
48208
48343
|
const { from: from2 } = state2.selection;
|
|
48209
|
-
commands2.addFieldAnnotation(from2, attrs, editorFocus);
|
|
48344
|
+
return commands2.addFieldAnnotation(from2, attrs, editorFocus);
|
|
48210
48345
|
},
|
|
48211
48346
|
/**
|
|
48212
48347
|
* Replace field annotation.
|
|
@@ -48216,24 +48351,113 @@ const FieldAnnotation = Node$1.create({
|
|
|
48216
48351
|
* from: 20,
|
|
48217
48352
|
* to: 45,
|
|
48218
48353
|
* attrs: {
|
|
48219
|
-
*
|
|
48220
|
-
*
|
|
48354
|
+
* fieldType: 'TEXTINPUT'
|
|
48355
|
+
* fieldColor: '#980043'
|
|
48221
48356
|
* }
|
|
48222
48357
|
* ])
|
|
48223
48358
|
*/
|
|
48224
|
-
replaceWithFieldAnnotation: (fieldsArray) => ({ editor, dispatch,
|
|
48359
|
+
replaceWithFieldAnnotation: (fieldsArray) => ({ editor, dispatch, tr }) => {
|
|
48225
48360
|
if (!dispatch) return true;
|
|
48226
|
-
tr.setMeta("fieldAnnotationReplace", true);
|
|
48227
48361
|
fieldsArray.forEach((annotation) => {
|
|
48228
48362
|
let { from: from2, to, attrs } = annotation;
|
|
48229
48363
|
let { schema } = editor;
|
|
48230
48364
|
let newPosFrom = tr.mapping.map(from2);
|
|
48231
48365
|
let newPosTo = tr.mapping.map(to);
|
|
48232
|
-
let
|
|
48366
|
+
let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
|
|
48367
|
+
let node2 = schema.nodes[this.name].create({
|
|
48368
|
+
...attrs,
|
|
48369
|
+
defaultDisplayLabel
|
|
48370
|
+
}, null, null);
|
|
48233
48371
|
tr.replaceWith(newPosFrom, newPosTo, node2);
|
|
48234
48372
|
});
|
|
48235
48373
|
return true;
|
|
48236
48374
|
},
|
|
48375
|
+
/**
|
|
48376
|
+
* Replace annotations with a label (as text node) in selection.
|
|
48377
|
+
* @param options Additional options.
|
|
48378
|
+
* @example
|
|
48379
|
+
* editor.commands.replaceFieldAnnotationsWithLabelInSelection()
|
|
48380
|
+
*/
|
|
48381
|
+
replaceFieldAnnotationsWithLabelInSelection: (options2 = {}) => ({ commands: commands2 }) => {
|
|
48382
|
+
return commands2.replaceFieldAnnotationsWithLabel(null, {
|
|
48383
|
+
...options2,
|
|
48384
|
+
isInSelection: true
|
|
48385
|
+
});
|
|
48386
|
+
},
|
|
48387
|
+
/**
|
|
48388
|
+
* Replace annotations with a label (as text node).
|
|
48389
|
+
* @param fieldIdOrArray The field ID or array of field IDs.
|
|
48390
|
+
* @param options.isInSelection Find in selection instead of field IDs.
|
|
48391
|
+
* @param options.addToHistory Add to history or not.
|
|
48392
|
+
* @param options.types Annotation types to replace.
|
|
48393
|
+
* @example
|
|
48394
|
+
* editor.commands.replaceFieldAnnotationsWithLabel(['1', '2'])
|
|
48395
|
+
*/
|
|
48396
|
+
replaceFieldAnnotationsWithLabel: (fieldIdOrArray, {
|
|
48397
|
+
isInSelection = false,
|
|
48398
|
+
addToHistory = false,
|
|
48399
|
+
types: types2 = annotationTypes
|
|
48400
|
+
} = {}) => ({ dispatch, state: state2, tr }) => {
|
|
48401
|
+
let { from: from2, to } = state2.selection;
|
|
48402
|
+
let annotations = isInSelection ? findFieldAnnotationsBetween(from2, to, state2.doc) : findFieldAnnotationsByFieldId(fieldIdOrArray, state2);
|
|
48403
|
+
annotations = types2.length ? annotations.filter(({ node: node2 }) => types2.includes(node2.attrs.type)) : annotations;
|
|
48404
|
+
if (!annotations.length) {
|
|
48405
|
+
return true;
|
|
48406
|
+
}
|
|
48407
|
+
if (!addToHistory) {
|
|
48408
|
+
tr.setMeta("addToHistory", false);
|
|
48409
|
+
}
|
|
48410
|
+
if (dispatch) {
|
|
48411
|
+
annotations.forEach((annotation) => {
|
|
48412
|
+
let { pos, node: node2 } = annotation;
|
|
48413
|
+
let newPosFrom = tr.mapping.map(pos);
|
|
48414
|
+
let newPosTo = tr.mapping.map(pos + node2.nodeSize);
|
|
48415
|
+
let currentNode = tr.doc.nodeAt(newPosFrom);
|
|
48416
|
+
let nodeEqual = node2.attrs.fieldId === currentNode?.attrs?.fieldId;
|
|
48417
|
+
let $newPosFrom = tr.doc.resolve(newPosFrom);
|
|
48418
|
+
let currentMarks = $newPosFrom.marks();
|
|
48419
|
+
currentMarks = currentMarks.length ? [...currentMarks] : null;
|
|
48420
|
+
if (nodeEqual) {
|
|
48421
|
+
let label = node2.attrs.displayLabel || " ";
|
|
48422
|
+
let textNode = state2.schema.text(label, currentMarks);
|
|
48423
|
+
tr.replaceWith(newPosFrom, newPosTo, textNode);
|
|
48424
|
+
}
|
|
48425
|
+
});
|
|
48426
|
+
}
|
|
48427
|
+
return true;
|
|
48428
|
+
},
|
|
48429
|
+
/**
|
|
48430
|
+
* Resets all annotations to default values.
|
|
48431
|
+
* @example
|
|
48432
|
+
* editor.commands.resetFieldAnnotations()
|
|
48433
|
+
*/
|
|
48434
|
+
resetFieldAnnotations: () => ({ dispatch, state: state2, tr }) => {
|
|
48435
|
+
let annotations = getAllFieldAnnotations(state2);
|
|
48436
|
+
if (!annotations.length) {
|
|
48437
|
+
return true;
|
|
48438
|
+
}
|
|
48439
|
+
tr.setMeta("fieldAnnotationUpdate", true);
|
|
48440
|
+
if (dispatch) {
|
|
48441
|
+
annotations.forEach(({ pos, node: node2 }) => {
|
|
48442
|
+
let newPos = tr.mapping.map(pos);
|
|
48443
|
+
let currentNode = tr.doc.nodeAt(newPos);
|
|
48444
|
+
let nodeEqual = node2.attrs.fieldId === currentNode?.attrs?.fieldId;
|
|
48445
|
+
if (nodeEqual) {
|
|
48446
|
+
let displayLabel = node2.attrs.defaultDisplayLabel || node2.attrs.displayLabel || "";
|
|
48447
|
+
tr.setNodeMarkup(newPos, void 0, {
|
|
48448
|
+
...node2.attrs,
|
|
48449
|
+
// reset displayLabel to default.
|
|
48450
|
+
displayLabel,
|
|
48451
|
+
// reset attrs for specific types.
|
|
48452
|
+
imageSrc: null,
|
|
48453
|
+
rawHtml: null,
|
|
48454
|
+
linkUrl: null
|
|
48455
|
+
});
|
|
48456
|
+
}
|
|
48457
|
+
});
|
|
48458
|
+
}
|
|
48459
|
+
return true;
|
|
48460
|
+
},
|
|
48237
48461
|
/**
|
|
48238
48462
|
* Update annotations associated with a field.
|
|
48239
48463
|
* @param fieldIdOrArray The field ID or array of field IDs.
|
|
@@ -48988,12 +49212,16 @@ const startImageUpload = async ({ editor, view, file }) => {
|
|
|
48988
49212
|
}
|
|
48989
49213
|
let id = {};
|
|
48990
49214
|
let { tr, schema } = view.state;
|
|
48991
|
-
|
|
49215
|
+
let { selection } = tr;
|
|
49216
|
+
if (editor.options.isHeaderOrFooter) {
|
|
49217
|
+
selection = editor.options.lastSelection;
|
|
49218
|
+
}
|
|
49219
|
+
if (!selection.empty && !editor.options.isHeaderOrFooter) {
|
|
48992
49220
|
tr.deleteSelection();
|
|
48993
49221
|
}
|
|
48994
49222
|
let imageMeta = {
|
|
48995
49223
|
type: "add",
|
|
48996
|
-
pos:
|
|
49224
|
+
pos: selection.from,
|
|
48997
49225
|
id
|
|
48998
49226
|
};
|
|
48999
49227
|
tr.setMeta(ImagePlaceholderPluginKey, imageMeta);
|
|
@@ -54242,7 +54470,8 @@ const Pagination = Extension.create({
|
|
|
54242
54470
|
addStorage() {
|
|
54243
54471
|
return {
|
|
54244
54472
|
height: 0,
|
|
54245
|
-
sectionData: null
|
|
54473
|
+
sectionData: null,
|
|
54474
|
+
headerFooterEditors: /* @__PURE__ */ new Map()
|
|
54246
54475
|
};
|
|
54247
54476
|
},
|
|
54248
54477
|
addCommands() {
|
|
@@ -54285,13 +54514,14 @@ const Pagination = Extension.create({
|
|
|
54285
54514
|
shouldUpdate = true;
|
|
54286
54515
|
shouldInitialize = meta.isReadyToInit;
|
|
54287
54516
|
}
|
|
54517
|
+
const syncMeta = tr.getMeta("y-sync$");
|
|
54518
|
+
if (syncMeta && syncMeta.isChangeOrigin) {
|
|
54519
|
+
return { ...oldState };
|
|
54520
|
+
}
|
|
54288
54521
|
const imagePluginTransaction = tr.getMeta(ImagePlaceholderPluginKey);
|
|
54289
54522
|
if (imagePluginTransaction) {
|
|
54290
54523
|
if (imagePluginTransaction.type === "remove") {
|
|
54291
|
-
|
|
54292
|
-
const domImage = editor.view.domAtPos(imagePos).node.querySelector("img");
|
|
54293
|
-
if (domImage.complete) onImageLoad(editor);
|
|
54294
|
-
else domImage.onload = () => onImageLoad(editor);
|
|
54524
|
+
onImageLoad(editor);
|
|
54295
54525
|
}
|
|
54296
54526
|
return { ...oldState };
|
|
54297
54527
|
}
|
|
@@ -54318,6 +54548,7 @@ const Pagination = Extension.create({
|
|
|
54318
54548
|
if (isForceUpdate) shouldUpdate = true;
|
|
54319
54549
|
return {
|
|
54320
54550
|
...oldState,
|
|
54551
|
+
decorations: meta?.decorations?.map(tr.mapping, tr.doc) || DecorationSet.empty,
|
|
54321
54552
|
isReadyToInit: shouldInitialize
|
|
54322
54553
|
};
|
|
54323
54554
|
}
|
|
@@ -54346,6 +54577,10 @@ const Pagination = Extension.create({
|
|
|
54346
54577
|
},
|
|
54347
54578
|
onDestroy() {
|
|
54348
54579
|
cleanupFloatingSeparators();
|
|
54580
|
+
const { headerFooterEditors } = this.editor.storage.pagination;
|
|
54581
|
+
if (headerFooterEditors) {
|
|
54582
|
+
headerFooterEditors.clear();
|
|
54583
|
+
}
|
|
54349
54584
|
}
|
|
54350
54585
|
});
|
|
54351
54586
|
const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
|
|
@@ -54406,6 +54641,7 @@ const performUpdate = (editor, view, previousDecorations) => {
|
|
|
54406
54641
|
const calculatePageBreaks = (view, editor, sectionData) => {
|
|
54407
54642
|
if (!editor.converter) return DecorationSet.empty;
|
|
54408
54643
|
const pageSize = editor.converter.pageStyles?.pageSize;
|
|
54644
|
+
if (!pageSize) return DecorationSet.empty;
|
|
54409
54645
|
const { width, height } = pageSize;
|
|
54410
54646
|
if (!width || !height) return DecorationSet.empty;
|
|
54411
54647
|
const ignorePlugins = [CollaborationPluginKey, PaginationPluginKey];
|
|
@@ -54444,11 +54680,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54444
54680
|
let pageHeightThreshold = pageHeight;
|
|
54445
54681
|
let footer = null, header = null;
|
|
54446
54682
|
const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
54447
|
-
const
|
|
54683
|
+
const isFirstHeader = true;
|
|
54684
|
+
const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber, isFirstHeader);
|
|
54448
54685
|
const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
|
|
54449
54686
|
decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
|
|
54450
54687
|
const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
|
|
54451
|
-
const
|
|
54688
|
+
const isLastFooter = true;
|
|
54689
|
+
const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber, isLastFooter);
|
|
54452
54690
|
pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
|
|
54453
54691
|
let coords = view?.coordsAtPos(doc2.content.size);
|
|
54454
54692
|
if (!coords) return [];
|
|
@@ -54467,7 +54705,8 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54467
54705
|
if (currentPageNumber === 1) {
|
|
54468
54706
|
const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
|
|
54469
54707
|
decorations.pop();
|
|
54470
|
-
const
|
|
54708
|
+
const isFirstHeader2 = true;
|
|
54709
|
+
const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber, isFirstHeader2);
|
|
54471
54710
|
const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
|
|
54472
54711
|
decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
|
|
54473
54712
|
}
|
|
@@ -54541,15 +54780,15 @@ function createFinalPagePadding(bufferHeight) {
|
|
|
54541
54780
|
div2.style.height = bufferHeight + "px";
|
|
54542
54781
|
return { nodeHeight: bufferHeight, node: div2 };
|
|
54543
54782
|
}
|
|
54544
|
-
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
|
|
54545
|
-
const headerDef = sectionData
|
|
54783
|
+
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber, isFirstHeader = false) {
|
|
54784
|
+
const headerDef = sectionData?.headers?.[headerId];
|
|
54546
54785
|
const minHeaderHeight = pageMargins.top * 96;
|
|
54547
54786
|
const headerMargin = pageMargins.header * 96;
|
|
54548
54787
|
const hasHeaderOffset = headerDef?.height > minHeaderHeight - headerMargin;
|
|
54549
54788
|
const headerOffset = hasHeaderOffset ? headerMargin : 0;
|
|
54550
54789
|
const headerHeight = Math.max(headerDef?.height || 0, minHeaderHeight) + headerOffset;
|
|
54551
54790
|
const availableHeight = headerHeight - headerMargin;
|
|
54552
|
-
|
|
54791
|
+
let editorContainer = document.createElement("div");
|
|
54553
54792
|
if (!headerId && !editor?.converter?.headerIds?.["default"]) {
|
|
54554
54793
|
headerId = "rId" + generateDocxRandomId();
|
|
54555
54794
|
editor.converter.headerIds["default"] = headerId;
|
|
@@ -54561,23 +54800,31 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54561
54800
|
};
|
|
54562
54801
|
}
|
|
54563
54802
|
const data = editor.converter.headers[headerId];
|
|
54564
|
-
const
|
|
54565
|
-
|
|
54566
|
-
|
|
54567
|
-
|
|
54568
|
-
|
|
54569
|
-
|
|
54570
|
-
|
|
54571
|
-
|
|
54572
|
-
|
|
54573
|
-
|
|
54574
|
-
|
|
54575
|
-
|
|
54576
|
-
|
|
54577
|
-
|
|
54803
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54804
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isHeader: true, isFirstHeader });
|
|
54805
|
+
let editorSection = null;
|
|
54806
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54807
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.headerEditors[pageNumberIndex]) {
|
|
54808
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54809
|
+
editorSection = editorData.editor;
|
|
54810
|
+
editorContainer = editorSection.element;
|
|
54811
|
+
} else {
|
|
54812
|
+
editorSection = createHeaderFooterEditor({
|
|
54813
|
+
editor,
|
|
54814
|
+
data,
|
|
54815
|
+
editorContainer,
|
|
54816
|
+
appendToBody: false,
|
|
54817
|
+
sectionId: headerId,
|
|
54818
|
+
type: "header",
|
|
54819
|
+
availableHeight,
|
|
54820
|
+
currentPageNumber
|
|
54821
|
+
});
|
|
54822
|
+
editor.converter.headerEditors.push({ id: headerId, editor: editorSection });
|
|
54823
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54824
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54825
|
+
}
|
|
54578
54826
|
editorSection.setEditable(false, false);
|
|
54579
|
-
|
|
54580
|
-
editorContainer.className = "pagination-section-header";
|
|
54827
|
+
editorContainer.classList.add("pagination-section-header");
|
|
54581
54828
|
editorContainer.style.paddingTop = headerMargin + "px";
|
|
54582
54829
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
54583
54830
|
editorContainer.style.paddingRight = pageMargins.right * 96 + "px";
|
|
@@ -54590,12 +54837,12 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54590
54837
|
headerHeight
|
|
54591
54838
|
};
|
|
54592
54839
|
}
|
|
54593
|
-
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber) {
|
|
54594
|
-
const footerDef = sectionData
|
|
54840
|
+
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber, isLastFooter = false) {
|
|
54841
|
+
const footerDef = sectionData?.footers?.[footerId];
|
|
54595
54842
|
const minFooterHeight = pageMargins.bottom * 96;
|
|
54596
54843
|
const footerPaddingFromEdge = pageMargins.footer * 96;
|
|
54597
54844
|
const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
|
|
54598
|
-
|
|
54845
|
+
let editorContainer = document.createElement("div");
|
|
54599
54846
|
if (!footerId && !editor.converter.footerIds["default"]) {
|
|
54600
54847
|
footerId = "rId" + generateDocxRandomId();
|
|
54601
54848
|
editor.converter.footerIds["default"] = footerId;
|
|
@@ -54607,23 +54854,31 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54607
54854
|
};
|
|
54608
54855
|
}
|
|
54609
54856
|
const data = editor.converter.footers[footerId];
|
|
54610
|
-
const
|
|
54611
|
-
|
|
54612
|
-
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54623
|
-
|
|
54857
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54858
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isFooter: true, isLastFooter });
|
|
54859
|
+
let editorSection = null;
|
|
54860
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54861
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.footerEditors[pageNumberIndex]) {
|
|
54862
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54863
|
+
editorSection = editorData.editor;
|
|
54864
|
+
editorContainer = editorSection.element;
|
|
54865
|
+
} else {
|
|
54866
|
+
editorSection = createHeaderFooterEditor({
|
|
54867
|
+
editor,
|
|
54868
|
+
data,
|
|
54869
|
+
editorContainer,
|
|
54870
|
+
appendToBody: false,
|
|
54871
|
+
sectionId: footerId,
|
|
54872
|
+
type: "footer",
|
|
54873
|
+
availableHeight: footerHeight,
|
|
54874
|
+
currentPageNumber
|
|
54875
|
+
});
|
|
54876
|
+
editor.converter.footerEditors.push({ id: footerId, editor: editorSection });
|
|
54877
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54878
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54879
|
+
}
|
|
54624
54880
|
editorSection.setEditable(false, false);
|
|
54625
|
-
|
|
54626
|
-
editorContainer.className = "pagination-section-footer";
|
|
54881
|
+
editorContainer.classList.add("pagination-section-footer");
|
|
54627
54882
|
editorContainer.style.height = footerHeight + "px";
|
|
54628
54883
|
editorContainer.style.marginBottom = footerPaddingFromEdge + "px";
|
|
54629
54884
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
@@ -54636,10 +54891,28 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54636
54891
|
footerHeight: footerHeight + footerPaddingFromEdge
|
|
54637
54892
|
};
|
|
54638
54893
|
}
|
|
54894
|
+
const getHeaderFooterEditorKey = ({
|
|
54895
|
+
pageNumber,
|
|
54896
|
+
isHeader,
|
|
54897
|
+
isFooter,
|
|
54898
|
+
isFirstHeader = false,
|
|
54899
|
+
isLastFooter = false
|
|
54900
|
+
}) => {
|
|
54901
|
+
if (isFirstHeader) return `first-header-${pageNumber}`;
|
|
54902
|
+
if (isLastFooter) return `last-footer-${pageNumber}`;
|
|
54903
|
+
if (isHeader) return `header-${pageNumber}`;
|
|
54904
|
+
if (isFooter) return `footer-${pageNumber}`;
|
|
54905
|
+
return void 0;
|
|
54906
|
+
};
|
|
54639
54907
|
const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
|
|
54640
54908
|
if (editor.options.documentMode !== "editing") return;
|
|
54641
54909
|
editor.setEditable(false, false);
|
|
54642
|
-
toggleHeaderFooterEditMode(
|
|
54910
|
+
toggleHeaderFooterEditMode({
|
|
54911
|
+
editor,
|
|
54912
|
+
focusedSectionEditor: currentFocusedSectionEditor,
|
|
54913
|
+
isEditMode: true,
|
|
54914
|
+
documentMode: editor.options.documentMode
|
|
54915
|
+
});
|
|
54643
54916
|
};
|
|
54644
54917
|
function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
|
|
54645
54918
|
const { pageSize, pageMargins } = editor.converter.pageStyles;
|
|
@@ -55194,7 +55467,7 @@ const Search = Extension.create({
|
|
|
55194
55467
|
}
|
|
55195
55468
|
});
|
|
55196
55469
|
const NodeResizerKey = new PluginKey("node-resizer");
|
|
55197
|
-
const nodeResizer = (nodeNames = ["image"]) => {
|
|
55470
|
+
const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
55198
55471
|
let resizeState = {
|
|
55199
55472
|
dragging: false,
|
|
55200
55473
|
startX: 0,
|
|
@@ -55219,8 +55492,13 @@ const nodeResizer = (nodeNames = ["image"]) => {
|
|
|
55219
55492
|
if (tr.getMeta(NodeResizerKey)) {
|
|
55220
55493
|
return oldState;
|
|
55221
55494
|
}
|
|
55222
|
-
|
|
55495
|
+
if (typeof document === "undefined" || editor.options.isHeadless) return oldState;
|
|
55223
55496
|
const { selection } = newState;
|
|
55497
|
+
const node2 = selection.node;
|
|
55498
|
+
if (!node2 || !nodeNames.includes(node2.type.name)) {
|
|
55499
|
+
return DecorationSet.empty;
|
|
55500
|
+
}
|
|
55501
|
+
const decorations = [];
|
|
55224
55502
|
if (nodeNames.includes(selection.node?.type.name)) {
|
|
55225
55503
|
decorations.push(
|
|
55226
55504
|
Decoration.node(selection.from, selection.to, {
|
|
@@ -55423,7 +55701,7 @@ const nodeResizer = (nodeNames = ["image"]) => {
|
|
|
55423
55701
|
const NodeResizer = Extension.create({
|
|
55424
55702
|
name: "nodeResizer",
|
|
55425
55703
|
addPmPlugins() {
|
|
55426
|
-
return [nodeResizer(["image"])];
|
|
55704
|
+
return [nodeResizer(["image"], this.editor)];
|
|
55427
55705
|
}
|
|
55428
55706
|
});
|
|
55429
55707
|
const getRichTextExtensions = () => {
|
|
@@ -64099,7 +64377,6 @@ const style$2 = cB("icon", `
|
|
|
64099
64377
|
display: inline-block;
|
|
64100
64378
|
position: relative;
|
|
64101
64379
|
fill: currentColor;
|
|
64102
|
-
transform: translateZ(0);
|
|
64103
64380
|
`, [cM("color-transition", {
|
|
64104
64381
|
transition: "color .3s var(--n-bezier)"
|
|
64105
64382
|
}), cM("depth", {
|