@harbour-enterprises/superdoc 0.13.2-rev4 → 0.13.2-rev6
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/{index-BtEUM3Lh.cjs → index-B0t3i_io.cjs} +1 -1
- package/dist/chunks/{index-CfHNUf7T.cjs → index-Bk160jQ2.cjs} +2 -2
- package/dist/chunks/{index-C9qTXaOd.es.js → index-D_HUrFWV.es.js} +2 -2
- package/dist/chunks/{index-B7eoQe4X.es.js → index-KzH9VKHh.es.js} +1 -1
- package/dist/chunks/{super-editor.es-Dfr_PiLc.cjs → super-editor.es-BTxObl3D.cjs} +187 -91
- package/dist/chunks/{super-editor.es-CkSR59Ak.es.js → super-editor.es-Dc89JIQn.es.js} +187 -91
- package/dist/chunks/{url-DDjZQLix.cjs → url-CWyTQ-Xy.cjs} +1 -1
- package/dist/chunks/{url-NHyWLplx.es.js → url-DsBQArCl.es.js} +1 -1
- package/dist/chunks/{xml-js-CioRgccm.cjs → xml-js-Bu1ZZzmb.cjs} +202 -258
- package/dist/chunks/{xml-js-DpXPtkG0.es.js → xml-js-CdiD26MJ.es.js} +202 -258
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-sprojffz.js → converter-DZFBaVFd.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-COiwQT0E.js → docx-zipper-dbI_Pbue.js} +1 -1
- package/dist/super-editor/chunks/{editor-C1UvzGZr.js → editor-Bz5BbOEe.js} +186 -91
- package/dist/super-editor/chunks/{toolbar-C3s7KmIv.js → toolbar-C07jc7pa.js} +3 -2
- package/dist/super-editor/converter.es.js +1 -1
- 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/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- 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/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +6 -5
- package/dist/superdoc.es.js +7 -6
- package/dist/superdoc.umd.js +189 -92
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-BTAcmbVg.cjs");
|
|
3
3
|
const vue = require("./vue-HIY1g7dm.cjs");
|
|
4
|
-
const xmlJs = require("./xml-js-
|
|
5
|
-
const url = require("./url-
|
|
4
|
+
const xmlJs = require("./xml-js-Bu1ZZzmb.cjs");
|
|
5
|
+
const url = require("./url-CWyTQ-Xy.cjs");
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
for (var i = 0; i < m.length; i++) {
|
|
8
8
|
const e = m[i];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-DckFs3A7.es.js";
|
|
2
2
|
import { p as process$1 } from "./vue-Bi1uWinj.es.js";
|
|
3
|
-
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-
|
|
4
|
-
import { u as url } from "./url-
|
|
3
|
+
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-CdiD26MJ.es.js";
|
|
4
|
+
import { u as url } from "./url-DsBQArCl.es.js";
|
|
5
5
|
function _mergeNamespaces(n, m) {
|
|
6
6
|
for (var i = 0; i < m.length; i++) {
|
|
7
7
|
const e = m[i];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./jszip-DckFs3A7.es.js";
|
|
2
|
-
import { s as streamHttp, r as require$$1 } from "./index-
|
|
2
|
+
import { s as streamHttp, r as require$$1 } from "./index-D_HUrFWV.es.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
for (var i = 0; i < m.length; i++) {
|
|
5
5
|
const e = m[i];
|
|
@@ -23989,7 +23989,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
23989
23989
|
return;
|
|
23990
23990
|
}
|
|
23991
23991
|
}
|
|
23992
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-
|
|
23992
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-rev6") {
|
|
23993
23993
|
const customLocation = "docProps/custom.xml";
|
|
23994
23994
|
if (!docx[customLocation]) {
|
|
23995
23995
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24456,7 +24456,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24456
24456
|
function generateCustomXml() {
|
|
24457
24457
|
return DEFAULT_CUSTOM_XML;
|
|
24458
24458
|
}
|
|
24459
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.13.2-
|
|
24459
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.13.2-rev6") {
|
|
24460
24460
|
return {
|
|
24461
24461
|
type: "element",
|
|
24462
24462
|
name: "property",
|
|
@@ -39252,6 +39252,7 @@ const createHeaderFooterEditor = ({
|
|
|
39252
39252
|
mediaFiles: editor.storage.image.media,
|
|
39253
39253
|
fonts: editor.options.fonts,
|
|
39254
39254
|
isHeaderOrFooter: true,
|
|
39255
|
+
isHeadless: editor.options.isHeadless,
|
|
39255
39256
|
annotations: true,
|
|
39256
39257
|
currentPageNumber,
|
|
39257
39258
|
parentEditor: editor,
|
|
@@ -39259,13 +39260,15 @@ const createHeaderFooterEditor = ({
|
|
|
39259
39260
|
onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type2)
|
|
39260
39261
|
});
|
|
39261
39262
|
const pm = editorContainer.querySelector(".ProseMirror");
|
|
39262
|
-
pm
|
|
39263
|
-
|
|
39264
|
-
|
|
39265
|
-
|
|
39266
|
-
|
|
39267
|
-
|
|
39268
|
-
|
|
39263
|
+
if (pm) {
|
|
39264
|
+
pm.style.maxHeight = "100%";
|
|
39265
|
+
pm.style.minHeight = "100%";
|
|
39266
|
+
pm.style.outline = "none";
|
|
39267
|
+
pm.style.border = "none";
|
|
39268
|
+
pm.setAttribute("role", "textbox");
|
|
39269
|
+
pm.setAttribute("aria-multiline", true);
|
|
39270
|
+
pm.setAttribute("aria-label", `${type2} content area. Double click to start typing.`);
|
|
39271
|
+
}
|
|
39269
39272
|
return headerFooterEditor;
|
|
39270
39273
|
};
|
|
39271
39274
|
const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
@@ -39284,14 +39287,16 @@ const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
|
39284
39287
|
});
|
|
39285
39288
|
});
|
|
39286
39289
|
};
|
|
39287
|
-
const toggleHeaderFooterEditMode = (editor, focusedSectionEditor, isEditMode) => {
|
|
39290
|
+
const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode, documentMode }) => {
|
|
39288
39291
|
editor.converter.headerEditors.forEach((item) => {
|
|
39289
39292
|
item.editor.setEditable(isEditMode, false);
|
|
39290
39293
|
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
39294
|
+
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
39291
39295
|
});
|
|
39292
39296
|
editor.converter.footerEditors.forEach((item) => {
|
|
39293
39297
|
item.editor.setEditable(isEditMode, false);
|
|
39294
39298
|
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
39299
|
+
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
39295
39300
|
});
|
|
39296
39301
|
if (isEditMode) {
|
|
39297
39302
|
const pm = document.querySelector(".ProseMirror");
|
|
@@ -40719,6 +40724,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40719
40724
|
this.setHighContrastMode = setHighContrastMode;
|
|
40720
40725
|
initMode();
|
|
40721
40726
|
}
|
|
40727
|
+
mount(el) {
|
|
40728
|
+
__privateMethod$1(this, _Editor_instances, createView_fn).call(this, el);
|
|
40729
|
+
window.setTimeout(() => {
|
|
40730
|
+
if (this.isDestroyed) return;
|
|
40731
|
+
this.emit("create", { editor: this });
|
|
40732
|
+
}, 0);
|
|
40733
|
+
}
|
|
40734
|
+
unmount() {
|
|
40735
|
+
if (this.view) {
|
|
40736
|
+
this.view.destroy();
|
|
40737
|
+
}
|
|
40738
|
+
this.view = null;
|
|
40739
|
+
}
|
|
40722
40740
|
/**
|
|
40723
40741
|
* Set the toolbar for this editor
|
|
40724
40742
|
* @param {Object} toolbar - The toolbar instance
|
|
@@ -40767,7 +40785,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40767
40785
|
* @returns {boolean}
|
|
40768
40786
|
*/
|
|
40769
40787
|
get isDestroyed() {
|
|
40770
|
-
return this.view
|
|
40788
|
+
return this.view?.isDestroyed ?? true;
|
|
40771
40789
|
}
|
|
40772
40790
|
/**
|
|
40773
40791
|
* Get the editor element
|
|
@@ -40810,7 +40828,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40810
40828
|
this.commands.toggleTrackChangesShowOriginal();
|
|
40811
40829
|
this.setEditable(false, false);
|
|
40812
40830
|
this.setOptions({ documentMode: "viewing" });
|
|
40813
|
-
toggleHeaderFooterEditMode(
|
|
40831
|
+
toggleHeaderFooterEditMode({
|
|
40832
|
+
editor: this,
|
|
40833
|
+
focusedSectionEditor: null,
|
|
40834
|
+
isEditMode: false,
|
|
40835
|
+
documentMode: cleanedMode
|
|
40836
|
+
});
|
|
40814
40837
|
} else if (cleanedMode === "suggesting") {
|
|
40815
40838
|
__privateMethod$1(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
|
|
40816
40839
|
this.commands.disableTrackChangesShowOriginal();
|
|
@@ -40823,7 +40846,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40823
40846
|
this.commands.disableTrackChanges();
|
|
40824
40847
|
this.setEditable(true, false);
|
|
40825
40848
|
this.setOptions({ documentMode: "editing" });
|
|
40826
|
-
toggleHeaderFooterEditMode(
|
|
40849
|
+
toggleHeaderFooterEditMode({
|
|
40850
|
+
editor: this,
|
|
40851
|
+
focusedSectionEditor: null,
|
|
40852
|
+
isEditMode: false,
|
|
40853
|
+
documentMode: cleanedMode
|
|
40854
|
+
});
|
|
40827
40855
|
}
|
|
40828
40856
|
}
|
|
40829
40857
|
/**
|
|
@@ -41000,29 +41028,26 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41000
41028
|
};
|
|
41001
41029
|
}
|
|
41002
41030
|
/**
|
|
41003
|
-
|
|
41004
|
-
|
|
41005
|
-
|
|
41006
|
-
*
|
|
41007
|
-
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41008
|
-
* @returns {void}
|
|
41009
|
-
*/
|
|
41010
|
-
initDefaultStyles(element = this.element) {
|
|
41011
|
-
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41012
|
-
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41031
|
+
* Attach styles and attributes to the editor element
|
|
41032
|
+
*/
|
|
41033
|
+
updateEditorStyles(element, proseMirror) {
|
|
41013
41034
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
41014
|
-
if (!proseMirror || !
|
|
41035
|
+
if (!proseMirror || !element) {
|
|
41015
41036
|
return;
|
|
41016
41037
|
}
|
|
41017
41038
|
proseMirror.setAttribute("role", "document");
|
|
41018
41039
|
proseMirror.setAttribute("aria-multiline", true);
|
|
41019
41040
|
proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
|
|
41020
41041
|
proseMirror.setAttribute("aria-description", "");
|
|
41021
|
-
|
|
41022
|
-
|
|
41023
|
-
|
|
41024
|
-
|
|
41025
|
-
|
|
41042
|
+
if (pageSize) {
|
|
41043
|
+
element.style.width = pageSize.width + "in";
|
|
41044
|
+
element.style.minWidth = pageSize.width + "in";
|
|
41045
|
+
element.style.minHeight = pageSize.height + "in";
|
|
41046
|
+
}
|
|
41047
|
+
if (pageMargins) {
|
|
41048
|
+
element.style.paddingLeft = pageMargins.left + "in";
|
|
41049
|
+
element.style.paddingRight = pageMargins.right + "in";
|
|
41050
|
+
}
|
|
41026
41051
|
element.style.boxSizing = "border-box";
|
|
41027
41052
|
element.style.isolation = "isolate";
|
|
41028
41053
|
proseMirror.style.outline = "none";
|
|
@@ -41043,6 +41068,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41043
41068
|
proseMirror.style.paddingTop = "1in";
|
|
41044
41069
|
proseMirror.style.paddingBottom = "1in";
|
|
41045
41070
|
}
|
|
41071
|
+
}
|
|
41072
|
+
/**
|
|
41073
|
+
* Initialize default styles for the editor container and ProseMirror.
|
|
41074
|
+
* Get page size and margins from the converter.
|
|
41075
|
+
* Set document default font and font size.
|
|
41076
|
+
*
|
|
41077
|
+
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41078
|
+
* @returns {void}
|
|
41079
|
+
*/
|
|
41080
|
+
initDefaultStyles(element = this.element) {
|
|
41081
|
+
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41082
|
+
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41083
|
+
this.updateEditorStyles(element, proseMirror);
|
|
41046
41084
|
this.initMobileStyles(element);
|
|
41047
41085
|
}
|
|
41048
41086
|
/**
|
|
@@ -41254,10 +41292,22 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41254
41292
|
*/
|
|
41255
41293
|
destroy() {
|
|
41256
41294
|
this.emit("destroy");
|
|
41257
|
-
|
|
41295
|
+
this.unmount();
|
|
41296
|
+
this.destroyHeaderFooterEditors();
|
|
41258
41297
|
__privateMethod$1(this, _Editor_instances, endCollaboration_fn).call(this);
|
|
41259
41298
|
this.removeAllListeners();
|
|
41260
41299
|
}
|
|
41300
|
+
destroyHeaderFooterEditors() {
|
|
41301
|
+
const editors = [
|
|
41302
|
+
...this.converter.headerEditors,
|
|
41303
|
+
...this.converter.footerEditors
|
|
41304
|
+
];
|
|
41305
|
+
for (let editorData of editors) {
|
|
41306
|
+
editorData.editor.destroy();
|
|
41307
|
+
}
|
|
41308
|
+
this.converter.headerEditors.length = 0;
|
|
41309
|
+
this.converter.footerEditors.length = 0;
|
|
41310
|
+
}
|
|
41261
41311
|
/**
|
|
41262
41312
|
* Check if migrations are needed for the data
|
|
41263
41313
|
* @static
|
|
@@ -41275,7 +41325,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41275
41325
|
* @returns {Object | void} Migration results
|
|
41276
41326
|
*/
|
|
41277
41327
|
processCollaborationMigrations() {
|
|
41278
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-
|
|
41328
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev6");
|
|
41279
41329
|
if (!this.options.ydoc) return;
|
|
41280
41330
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41281
41331
|
let docVersion = metaMap.get("version");
|
|
@@ -41471,7 +41521,7 @@ init_fn = function(options2) {
|
|
|
41471
41521
|
this.emit("beforeCreate", { editor: this });
|
|
41472
41522
|
this.on("contentError", this.options.onContentError);
|
|
41473
41523
|
this.on("exception", this.options.onException);
|
|
41474
|
-
|
|
41524
|
+
this.mount(this.options.element);
|
|
41475
41525
|
this.initDefaultStyles();
|
|
41476
41526
|
this.setDocumentMode(options2.documentMode);
|
|
41477
41527
|
if (this.options.isHeadless) return;
|
|
@@ -41495,10 +41545,6 @@ init_fn = function(options2) {
|
|
|
41495
41545
|
__privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
|
|
41496
41546
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
41497
41547
|
}
|
|
41498
|
-
window.setTimeout(() => {
|
|
41499
|
-
if (this.isDestroyed) return;
|
|
41500
|
-
this.emit("create", { editor: this });
|
|
41501
|
-
}, 0);
|
|
41502
41548
|
};
|
|
41503
41549
|
initRichText_fn = function(options2) {
|
|
41504
41550
|
if (!options2.extensions || !options2.extensions.length) {
|
|
@@ -41510,7 +41556,7 @@ initRichText_fn = function(options2) {
|
|
|
41510
41556
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
41511
41557
|
this.emit("beforeCreate", { editor: this });
|
|
41512
41558
|
this.on("contentError", this.options.onContentError);
|
|
41513
|
-
|
|
41559
|
+
this.mount(this.options.element);
|
|
41514
41560
|
this.on("create", this.options.onCreate);
|
|
41515
41561
|
this.on("update", this.options.onUpdate);
|
|
41516
41562
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
@@ -41521,10 +41567,6 @@ initRichText_fn = function(options2) {
|
|
|
41521
41567
|
this.on("commentsLoaded", this.options.onCommentsLoaded);
|
|
41522
41568
|
this.on("commentClick", this.options.onCommentClicked);
|
|
41523
41569
|
this.on("locked", this.options.onDocumentLocked);
|
|
41524
|
-
window.setTimeout(() => {
|
|
41525
|
-
if (this.isDestroyed) return;
|
|
41526
|
-
this.emit("create", { editor: this });
|
|
41527
|
-
}, 0);
|
|
41528
41570
|
};
|
|
41529
41571
|
onFocus_fn = function({ editor, event }) {
|
|
41530
41572
|
this.toolbar?.setActiveEditor(editor);
|
|
@@ -41645,11 +41687,11 @@ createDocFromHTML_fn = function(content) {
|
|
|
41645
41687
|
}
|
|
41646
41688
|
return DOMParser$1.fromSchema(this.schema).parse(parsedContent);
|
|
41647
41689
|
};
|
|
41648
|
-
createView_fn = function() {
|
|
41690
|
+
createView_fn = function(element) {
|
|
41649
41691
|
let doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
|
|
41650
41692
|
const state2 = { schema: this.schema };
|
|
41651
41693
|
if (!this.options.ydoc) state2.doc = doc2;
|
|
41652
|
-
this.view = new EditorView(
|
|
41694
|
+
this.view = new EditorView(element, {
|
|
41653
41695
|
...this.options.editorProps,
|
|
41654
41696
|
dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
|
|
41655
41697
|
state: EditorState.create(state2),
|
|
@@ -41666,7 +41708,12 @@ createView_fn = function() {
|
|
|
41666
41708
|
event.stopPropagation();
|
|
41667
41709
|
if (!this.options.editable) {
|
|
41668
41710
|
this.setEditable(true, false);
|
|
41669
|
-
toggleHeaderFooterEditMode(
|
|
41711
|
+
toggleHeaderFooterEditMode({
|
|
41712
|
+
editor: this,
|
|
41713
|
+
focusedSectionEditor: null,
|
|
41714
|
+
isEditMode: false,
|
|
41715
|
+
documentMode: this.options.documentMode
|
|
41716
|
+
});
|
|
41670
41717
|
const pm = document.querySelector(".ProseMirror");
|
|
41671
41718
|
pm.classList.remove("header-footer-edit");
|
|
41672
41719
|
pm.setAttribute("aria-readonly", false);
|
|
@@ -41679,8 +41726,6 @@ createView_fn = function() {
|
|
|
41679
41726
|
});
|
|
41680
41727
|
this.view.updateState(newState);
|
|
41681
41728
|
this.createNodeViews();
|
|
41682
|
-
const dom = this.view.dom;
|
|
41683
|
-
dom.editor = this;
|
|
41684
41729
|
this.options.telemetry?.sendReport();
|
|
41685
41730
|
};
|
|
41686
41731
|
onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
@@ -41707,7 +41752,9 @@ initComments_fn = function() {
|
|
|
41707
41752
|
}, 50);
|
|
41708
41753
|
};
|
|
41709
41754
|
initPagination_fn = async function() {
|
|
41710
|
-
if (this.options.isHeadless || !this.extensionService)
|
|
41755
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
41756
|
+
return;
|
|
41757
|
+
}
|
|
41711
41758
|
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
41712
41759
|
if (pagination && this.options.pagination) {
|
|
41713
41760
|
console.debug("🔗 [super-editor] Initializing pagination");
|
|
@@ -41719,7 +41766,7 @@ initPagination_fn = async function() {
|
|
|
41719
41766
|
}
|
|
41720
41767
|
};
|
|
41721
41768
|
dispatchTransaction_fn = function(transaction) {
|
|
41722
|
-
if (this.
|
|
41769
|
+
if (this.isDestroyed) return;
|
|
41723
41770
|
let state2;
|
|
41724
41771
|
try {
|
|
41725
41772
|
const trackChangesState = TrackChangesBasePluginKey.getState(this.view.state);
|
|
@@ -54287,7 +54334,8 @@ const Pagination = Extension.create({
|
|
|
54287
54334
|
addStorage() {
|
|
54288
54335
|
return {
|
|
54289
54336
|
height: 0,
|
|
54290
|
-
sectionData: null
|
|
54337
|
+
sectionData: null,
|
|
54338
|
+
headerFooterEditors: /* @__PURE__ */ new Map()
|
|
54291
54339
|
};
|
|
54292
54340
|
},
|
|
54293
54341
|
addCommands() {
|
|
@@ -54330,6 +54378,10 @@ const Pagination = Extension.create({
|
|
|
54330
54378
|
shouldUpdate = true;
|
|
54331
54379
|
shouldInitialize = meta.isReadyToInit;
|
|
54332
54380
|
}
|
|
54381
|
+
const syncMeta = tr.getMeta("y-sync$");
|
|
54382
|
+
if (syncMeta && syncMeta.isChangeOrigin) {
|
|
54383
|
+
return { ...oldState };
|
|
54384
|
+
}
|
|
54333
54385
|
const imagePluginTransaction = tr.getMeta(ImagePlaceholderPluginKey);
|
|
54334
54386
|
if (imagePluginTransaction) {
|
|
54335
54387
|
if (imagePluginTransaction.type === "remove") {
|
|
@@ -54363,6 +54415,7 @@ const Pagination = Extension.create({
|
|
|
54363
54415
|
if (isForceUpdate) shouldUpdate = true;
|
|
54364
54416
|
return {
|
|
54365
54417
|
...oldState,
|
|
54418
|
+
decorations: meta?.decorations?.map(tr.mapping, tr.doc) || DecorationSet.empty,
|
|
54366
54419
|
isReadyToInit: shouldInitialize
|
|
54367
54420
|
};
|
|
54368
54421
|
}
|
|
@@ -54391,6 +54444,10 @@ const Pagination = Extension.create({
|
|
|
54391
54444
|
},
|
|
54392
54445
|
onDestroy() {
|
|
54393
54446
|
cleanupFloatingSeparators();
|
|
54447
|
+
const { headerFooterEditors } = this.editor.storage.pagination;
|
|
54448
|
+
if (headerFooterEditors) {
|
|
54449
|
+
headerFooterEditors.clear();
|
|
54450
|
+
}
|
|
54394
54451
|
}
|
|
54395
54452
|
});
|
|
54396
54453
|
const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
|
|
@@ -54451,6 +54508,7 @@ const performUpdate = (editor, view, previousDecorations) => {
|
|
|
54451
54508
|
const calculatePageBreaks = (view, editor, sectionData) => {
|
|
54452
54509
|
if (!editor.converter) return DecorationSet.empty;
|
|
54453
54510
|
const pageSize = editor.converter.pageStyles?.pageSize;
|
|
54511
|
+
if (!pageSize) return DecorationSet.empty;
|
|
54454
54512
|
const { width, height } = pageSize;
|
|
54455
54513
|
if (!width || !height) return DecorationSet.empty;
|
|
54456
54514
|
const ignorePlugins = [CollaborationPluginKey, PaginationPluginKey];
|
|
@@ -54489,11 +54547,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54489
54547
|
let pageHeightThreshold = pageHeight;
|
|
54490
54548
|
let footer = null, header = null;
|
|
54491
54549
|
const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
54492
|
-
const
|
|
54550
|
+
const isFirstHeader = true;
|
|
54551
|
+
const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber, isFirstHeader);
|
|
54493
54552
|
const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
|
|
54494
54553
|
decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
|
|
54495
54554
|
const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
|
|
54496
|
-
const
|
|
54555
|
+
const isLastFooter = true;
|
|
54556
|
+
const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber, isLastFooter);
|
|
54497
54557
|
pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
|
|
54498
54558
|
let coords = view?.coordsAtPos(doc2.content.size);
|
|
54499
54559
|
if (!coords) return [];
|
|
@@ -54512,7 +54572,8 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54512
54572
|
if (currentPageNumber === 1) {
|
|
54513
54573
|
const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
|
|
54514
54574
|
decorations.pop();
|
|
54515
|
-
const
|
|
54575
|
+
const isFirstHeader2 = true;
|
|
54576
|
+
const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber, isFirstHeader2);
|
|
54516
54577
|
const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
|
|
54517
54578
|
decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
|
|
54518
54579
|
}
|
|
@@ -54586,15 +54647,15 @@ function createFinalPagePadding(bufferHeight) {
|
|
|
54586
54647
|
div2.style.height = bufferHeight + "px";
|
|
54587
54648
|
return { nodeHeight: bufferHeight, node: div2 };
|
|
54588
54649
|
}
|
|
54589
|
-
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
|
|
54590
|
-
const headerDef = sectionData
|
|
54650
|
+
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber, isFirstHeader = false) {
|
|
54651
|
+
const headerDef = sectionData?.headers?.[headerId];
|
|
54591
54652
|
const minHeaderHeight = pageMargins.top * 96;
|
|
54592
54653
|
const headerMargin = pageMargins.header * 96;
|
|
54593
54654
|
const hasHeaderOffset = headerDef?.height > minHeaderHeight - headerMargin;
|
|
54594
54655
|
const headerOffset = hasHeaderOffset ? headerMargin : 0;
|
|
54595
54656
|
const headerHeight = Math.max(headerDef?.height || 0, minHeaderHeight) + headerOffset;
|
|
54596
54657
|
const availableHeight = headerHeight - headerMargin;
|
|
54597
|
-
|
|
54658
|
+
let editorContainer = document.createElement("div");
|
|
54598
54659
|
if (!headerId && !editor?.converter?.headerIds?.["default"]) {
|
|
54599
54660
|
headerId = "rId" + generateDocxRandomId();
|
|
54600
54661
|
editor.converter.headerIds["default"] = headerId;
|
|
@@ -54606,23 +54667,31 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54606
54667
|
};
|
|
54607
54668
|
}
|
|
54608
54669
|
const data = editor.converter.headers[headerId];
|
|
54609
|
-
const
|
|
54610
|
-
|
|
54611
|
-
|
|
54612
|
-
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54670
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54671
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isHeader: true, isFirstHeader });
|
|
54672
|
+
let editorSection = null;
|
|
54673
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54674
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.headerEditors[pageNumberIndex]) {
|
|
54675
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54676
|
+
editorSection = editorData.editor;
|
|
54677
|
+
editorContainer = editorSection.element;
|
|
54678
|
+
} else {
|
|
54679
|
+
editorSection = createHeaderFooterEditor({
|
|
54680
|
+
editor,
|
|
54681
|
+
data,
|
|
54682
|
+
editorContainer,
|
|
54683
|
+
appendToBody: false,
|
|
54684
|
+
sectionId: headerId,
|
|
54685
|
+
type: "header",
|
|
54686
|
+
availableHeight,
|
|
54687
|
+
currentPageNumber
|
|
54688
|
+
});
|
|
54689
|
+
editor.converter.headerEditors.push({ id: headerId, editor: editorSection });
|
|
54690
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54691
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54692
|
+
}
|
|
54623
54693
|
editorSection.setEditable(false, false);
|
|
54624
|
-
|
|
54625
|
-
editorContainer.className = "pagination-section-header";
|
|
54694
|
+
editorContainer.classList.add("pagination-section-header");
|
|
54626
54695
|
editorContainer.style.paddingTop = headerMargin + "px";
|
|
54627
54696
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
54628
54697
|
editorContainer.style.paddingRight = pageMargins.right * 96 + "px";
|
|
@@ -54635,12 +54704,12 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54635
54704
|
headerHeight
|
|
54636
54705
|
};
|
|
54637
54706
|
}
|
|
54638
|
-
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber) {
|
|
54639
|
-
const footerDef = sectionData
|
|
54707
|
+
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber, isLastFooter = false) {
|
|
54708
|
+
const footerDef = sectionData?.footers?.[footerId];
|
|
54640
54709
|
const minFooterHeight = pageMargins.bottom * 96;
|
|
54641
54710
|
const footerPaddingFromEdge = pageMargins.footer * 96;
|
|
54642
54711
|
const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
|
|
54643
|
-
|
|
54712
|
+
let editorContainer = document.createElement("div");
|
|
54644
54713
|
if (!footerId && !editor.converter.footerIds["default"]) {
|
|
54645
54714
|
footerId = "rId" + generateDocxRandomId();
|
|
54646
54715
|
editor.converter.footerIds["default"] = footerId;
|
|
@@ -54652,23 +54721,31 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54652
54721
|
};
|
|
54653
54722
|
}
|
|
54654
54723
|
const data = editor.converter.footers[footerId];
|
|
54655
|
-
const
|
|
54656
|
-
|
|
54657
|
-
|
|
54658
|
-
|
|
54659
|
-
|
|
54660
|
-
|
|
54661
|
-
|
|
54662
|
-
|
|
54663
|
-
|
|
54664
|
-
|
|
54665
|
-
|
|
54666
|
-
|
|
54667
|
-
|
|
54668
|
-
|
|
54724
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54725
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isFooter: true, isLastFooter });
|
|
54726
|
+
let editorSection = null;
|
|
54727
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54728
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.footerEditors[pageNumberIndex]) {
|
|
54729
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54730
|
+
editorSection = editorData.editor;
|
|
54731
|
+
editorContainer = editorSection.element;
|
|
54732
|
+
} else {
|
|
54733
|
+
editorSection = createHeaderFooterEditor({
|
|
54734
|
+
editor,
|
|
54735
|
+
data,
|
|
54736
|
+
editorContainer,
|
|
54737
|
+
appendToBody: false,
|
|
54738
|
+
sectionId: footerId,
|
|
54739
|
+
type: "footer",
|
|
54740
|
+
availableHeight: footerHeight,
|
|
54741
|
+
currentPageNumber
|
|
54742
|
+
});
|
|
54743
|
+
editor.converter.footerEditors.push({ id: footerId, editor: editorSection });
|
|
54744
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54745
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54746
|
+
}
|
|
54669
54747
|
editorSection.setEditable(false, false);
|
|
54670
|
-
|
|
54671
|
-
editorContainer.className = "pagination-section-footer";
|
|
54748
|
+
editorContainer.classList.add("pagination-section-footer");
|
|
54672
54749
|
editorContainer.style.height = footerHeight + "px";
|
|
54673
54750
|
editorContainer.style.marginBottom = footerPaddingFromEdge + "px";
|
|
54674
54751
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
@@ -54681,10 +54758,28 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54681
54758
|
footerHeight: footerHeight + footerPaddingFromEdge
|
|
54682
54759
|
};
|
|
54683
54760
|
}
|
|
54761
|
+
const getHeaderFooterEditorKey = ({
|
|
54762
|
+
pageNumber,
|
|
54763
|
+
isHeader,
|
|
54764
|
+
isFooter,
|
|
54765
|
+
isFirstHeader = false,
|
|
54766
|
+
isLastFooter = false
|
|
54767
|
+
}) => {
|
|
54768
|
+
if (isFirstHeader) return `first-header-${pageNumber}`;
|
|
54769
|
+
if (isLastFooter) return `last-footer-${pageNumber}`;
|
|
54770
|
+
if (isHeader) return `header-${pageNumber}`;
|
|
54771
|
+
if (isFooter) return `footer-${pageNumber}`;
|
|
54772
|
+
return void 0;
|
|
54773
|
+
};
|
|
54684
54774
|
const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
|
|
54685
54775
|
if (editor.options.documentMode !== "editing") return;
|
|
54686
54776
|
editor.setEditable(false, false);
|
|
54687
|
-
toggleHeaderFooterEditMode(
|
|
54777
|
+
toggleHeaderFooterEditMode({
|
|
54778
|
+
editor,
|
|
54779
|
+
focusedSectionEditor: currentFocusedSectionEditor,
|
|
54780
|
+
isEditMode: true,
|
|
54781
|
+
documentMode: editor.options.documentMode
|
|
54782
|
+
});
|
|
54688
54783
|
};
|
|
54689
54784
|
function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
|
|
54690
54785
|
const { pageSize, pageMargins } = editor.converter.pageStyles;
|
|
@@ -64144,6 +64239,7 @@ const style$2 = cB("icon", `
|
|
|
64144
64239
|
display: inline-block;
|
|
64145
64240
|
position: relative;
|
|
64146
64241
|
fill: currentColor;
|
|
64242
|
+
transform: translateZ(0);
|
|
64147
64243
|
`, [cM("color-transition", {
|
|
64148
64244
|
transition: "color .3s var(--n-bezier)"
|
|
64149
64245
|
}), cM("depth", {
|