@harbour-enterprises/superdoc 0.13.2-rev4 → 0.13.2-rev5
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-B4J7wgs6.cjs} +1 -1
- package/dist/chunks/{index-CfHNUf7T.cjs → index-Cdsq63Xq.cjs} +2 -2
- package/dist/chunks/{index-C9qTXaOd.es.js → index-Diu6UKHt.es.js} +2 -2
- package/dist/chunks/{index-B7eoQe4X.es.js → index-Hr3Um-Bg.es.js} +1 -1
- package/dist/chunks/{super-editor.es-Dfr_PiLc.cjs → super-editor.es-8qHwmdQ6.cjs} +160 -86
- package/dist/chunks/{super-editor.es-CkSR59Ak.es.js → super-editor.es-Dz4VUz6_.es.js} +160 -86
- package/dist/chunks/{url-DDjZQLix.cjs → url-BIzg4y2i.cjs} +1 -1
- package/dist/chunks/{url-NHyWLplx.es.js → url-CHayXMZH.es.js} +1 -1
- package/dist/chunks/{xml-js-CioRgccm.cjs → xml-js-BjqmFOSP.cjs} +123 -158
- package/dist/chunks/{xml-js-DpXPtkG0.es.js → xml-js-CfClL-1b.es.js} +123 -158
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-sprojffz.js → converter-CtLZIbF7.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-COiwQT0E.js → docx-zipper-JbUHPfi1.js} +1 -1
- package/dist/super-editor/chunks/{editor-C1UvzGZr.js → editor-CNrlIkRQ.js} +159 -86
- package/dist/super-editor/chunks/{toolbar-C3s7KmIv.js → toolbar-BhoFnMH2.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.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 +162 -87
- 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-BjqmFOSP.cjs");
|
|
5
|
+
const url = require("./url-BIzg4y2i.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-CfClL-1b.es.js";
|
|
4
|
+
import { u as url } from "./url-CHayXMZH.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-Diu6UKHt.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-rev5") {
|
|
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-rev5") {
|
|
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) => {
|
|
@@ -40719,6 +40722,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40719
40722
|
this.setHighContrastMode = setHighContrastMode;
|
|
40720
40723
|
initMode();
|
|
40721
40724
|
}
|
|
40725
|
+
mount(el) {
|
|
40726
|
+
__privateMethod$1(this, _Editor_instances, createView_fn).call(this, el);
|
|
40727
|
+
window.setTimeout(() => {
|
|
40728
|
+
if (this.isDestroyed) return;
|
|
40729
|
+
this.emit("create", { editor: this });
|
|
40730
|
+
}, 0);
|
|
40731
|
+
}
|
|
40732
|
+
unmount() {
|
|
40733
|
+
if (this.view) {
|
|
40734
|
+
this.view.destroy();
|
|
40735
|
+
}
|
|
40736
|
+
this.view = null;
|
|
40737
|
+
}
|
|
40722
40738
|
/**
|
|
40723
40739
|
* Set the toolbar for this editor
|
|
40724
40740
|
* @param {Object} toolbar - The toolbar instance
|
|
@@ -40767,7 +40783,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40767
40783
|
* @returns {boolean}
|
|
40768
40784
|
*/
|
|
40769
40785
|
get isDestroyed() {
|
|
40770
|
-
return this.view
|
|
40786
|
+
return this.view?.isDestroyed ?? true;
|
|
40771
40787
|
}
|
|
40772
40788
|
/**
|
|
40773
40789
|
* Get the editor element
|
|
@@ -41000,29 +41016,26 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41000
41016
|
};
|
|
41001
41017
|
}
|
|
41002
41018
|
/**
|
|
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");
|
|
41019
|
+
* Attach styles and attributes to the editor element
|
|
41020
|
+
*/
|
|
41021
|
+
updateEditorStyles(element, proseMirror) {
|
|
41013
41022
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
41014
|
-
if (!proseMirror || !
|
|
41023
|
+
if (!proseMirror || !element) {
|
|
41015
41024
|
return;
|
|
41016
41025
|
}
|
|
41017
41026
|
proseMirror.setAttribute("role", "document");
|
|
41018
41027
|
proseMirror.setAttribute("aria-multiline", true);
|
|
41019
41028
|
proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
|
|
41020
41029
|
proseMirror.setAttribute("aria-description", "");
|
|
41021
|
-
|
|
41022
|
-
|
|
41023
|
-
|
|
41024
|
-
|
|
41025
|
-
|
|
41030
|
+
if (pageSize) {
|
|
41031
|
+
element.style.width = pageSize.width + "in";
|
|
41032
|
+
element.style.minWidth = pageSize.width + "in";
|
|
41033
|
+
element.style.minHeight = pageSize.height + "in";
|
|
41034
|
+
}
|
|
41035
|
+
if (pageMargins) {
|
|
41036
|
+
element.style.paddingLeft = pageMargins.left + "in";
|
|
41037
|
+
element.style.paddingRight = pageMargins.right + "in";
|
|
41038
|
+
}
|
|
41026
41039
|
element.style.boxSizing = "border-box";
|
|
41027
41040
|
element.style.isolation = "isolate";
|
|
41028
41041
|
proseMirror.style.outline = "none";
|
|
@@ -41043,6 +41056,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41043
41056
|
proseMirror.style.paddingTop = "1in";
|
|
41044
41057
|
proseMirror.style.paddingBottom = "1in";
|
|
41045
41058
|
}
|
|
41059
|
+
}
|
|
41060
|
+
/**
|
|
41061
|
+
* Initialize default styles for the editor container and ProseMirror.
|
|
41062
|
+
* Get page size and margins from the converter.
|
|
41063
|
+
* Set document default font and font size.
|
|
41064
|
+
*
|
|
41065
|
+
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41066
|
+
* @returns {void}
|
|
41067
|
+
*/
|
|
41068
|
+
initDefaultStyles(element = this.element) {
|
|
41069
|
+
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41070
|
+
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41071
|
+
this.updateEditorStyles(element, proseMirror);
|
|
41046
41072
|
this.initMobileStyles(element);
|
|
41047
41073
|
}
|
|
41048
41074
|
/**
|
|
@@ -41254,10 +41280,22 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41254
41280
|
*/
|
|
41255
41281
|
destroy() {
|
|
41256
41282
|
this.emit("destroy");
|
|
41257
|
-
|
|
41283
|
+
this.unmount();
|
|
41284
|
+
this.destroyHeaderFooterEditors();
|
|
41258
41285
|
__privateMethod$1(this, _Editor_instances, endCollaboration_fn).call(this);
|
|
41259
41286
|
this.removeAllListeners();
|
|
41260
41287
|
}
|
|
41288
|
+
destroyHeaderFooterEditors() {
|
|
41289
|
+
const editors = [
|
|
41290
|
+
...this.converter.headerEditors,
|
|
41291
|
+
...this.converter.footerEditors
|
|
41292
|
+
];
|
|
41293
|
+
for (let editorData of editors) {
|
|
41294
|
+
editorData.editor.destroy();
|
|
41295
|
+
}
|
|
41296
|
+
this.converter.headerEditors.length = 0;
|
|
41297
|
+
this.converter.footerEditors.length = 0;
|
|
41298
|
+
}
|
|
41261
41299
|
/**
|
|
41262
41300
|
* Check if migrations are needed for the data
|
|
41263
41301
|
* @static
|
|
@@ -41275,7 +41313,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41275
41313
|
* @returns {Object | void} Migration results
|
|
41276
41314
|
*/
|
|
41277
41315
|
processCollaborationMigrations() {
|
|
41278
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-
|
|
41316
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev5");
|
|
41279
41317
|
if (!this.options.ydoc) return;
|
|
41280
41318
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41281
41319
|
let docVersion = metaMap.get("version");
|
|
@@ -41471,7 +41509,7 @@ init_fn = function(options2) {
|
|
|
41471
41509
|
this.emit("beforeCreate", { editor: this });
|
|
41472
41510
|
this.on("contentError", this.options.onContentError);
|
|
41473
41511
|
this.on("exception", this.options.onException);
|
|
41474
|
-
|
|
41512
|
+
this.mount(this.options.element);
|
|
41475
41513
|
this.initDefaultStyles();
|
|
41476
41514
|
this.setDocumentMode(options2.documentMode);
|
|
41477
41515
|
if (this.options.isHeadless) return;
|
|
@@ -41495,10 +41533,6 @@ init_fn = function(options2) {
|
|
|
41495
41533
|
__privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
|
|
41496
41534
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
41497
41535
|
}
|
|
41498
|
-
window.setTimeout(() => {
|
|
41499
|
-
if (this.isDestroyed) return;
|
|
41500
|
-
this.emit("create", { editor: this });
|
|
41501
|
-
}, 0);
|
|
41502
41536
|
};
|
|
41503
41537
|
initRichText_fn = function(options2) {
|
|
41504
41538
|
if (!options2.extensions || !options2.extensions.length) {
|
|
@@ -41510,7 +41544,7 @@ initRichText_fn = function(options2) {
|
|
|
41510
41544
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
41511
41545
|
this.emit("beforeCreate", { editor: this });
|
|
41512
41546
|
this.on("contentError", this.options.onContentError);
|
|
41513
|
-
|
|
41547
|
+
this.mount(this.options.element);
|
|
41514
41548
|
this.on("create", this.options.onCreate);
|
|
41515
41549
|
this.on("update", this.options.onUpdate);
|
|
41516
41550
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
@@ -41521,10 +41555,6 @@ initRichText_fn = function(options2) {
|
|
|
41521
41555
|
this.on("commentsLoaded", this.options.onCommentsLoaded);
|
|
41522
41556
|
this.on("commentClick", this.options.onCommentClicked);
|
|
41523
41557
|
this.on("locked", this.options.onDocumentLocked);
|
|
41524
|
-
window.setTimeout(() => {
|
|
41525
|
-
if (this.isDestroyed) return;
|
|
41526
|
-
this.emit("create", { editor: this });
|
|
41527
|
-
}, 0);
|
|
41528
41558
|
};
|
|
41529
41559
|
onFocus_fn = function({ editor, event }) {
|
|
41530
41560
|
this.toolbar?.setActiveEditor(editor);
|
|
@@ -41645,11 +41675,11 @@ createDocFromHTML_fn = function(content) {
|
|
|
41645
41675
|
}
|
|
41646
41676
|
return DOMParser$1.fromSchema(this.schema).parse(parsedContent);
|
|
41647
41677
|
};
|
|
41648
|
-
createView_fn = function() {
|
|
41678
|
+
createView_fn = function(element) {
|
|
41649
41679
|
let doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
|
|
41650
41680
|
const state2 = { schema: this.schema };
|
|
41651
41681
|
if (!this.options.ydoc) state2.doc = doc2;
|
|
41652
|
-
this.view = new EditorView(
|
|
41682
|
+
this.view = new EditorView(element, {
|
|
41653
41683
|
...this.options.editorProps,
|
|
41654
41684
|
dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
|
|
41655
41685
|
state: EditorState.create(state2),
|
|
@@ -41679,8 +41709,6 @@ createView_fn = function() {
|
|
|
41679
41709
|
});
|
|
41680
41710
|
this.view.updateState(newState);
|
|
41681
41711
|
this.createNodeViews();
|
|
41682
|
-
const dom = this.view.dom;
|
|
41683
|
-
dom.editor = this;
|
|
41684
41712
|
this.options.telemetry?.sendReport();
|
|
41685
41713
|
};
|
|
41686
41714
|
onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
@@ -41707,7 +41735,9 @@ initComments_fn = function() {
|
|
|
41707
41735
|
}, 50);
|
|
41708
41736
|
};
|
|
41709
41737
|
initPagination_fn = async function() {
|
|
41710
|
-
if (this.options.isHeadless || !this.extensionService)
|
|
41738
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
41739
|
+
return;
|
|
41740
|
+
}
|
|
41711
41741
|
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
41712
41742
|
if (pagination && this.options.pagination) {
|
|
41713
41743
|
console.debug("🔗 [super-editor] Initializing pagination");
|
|
@@ -41719,7 +41749,7 @@ initPagination_fn = async function() {
|
|
|
41719
41749
|
}
|
|
41720
41750
|
};
|
|
41721
41751
|
dispatchTransaction_fn = function(transaction) {
|
|
41722
|
-
if (this.
|
|
41752
|
+
if (this.isDestroyed) return;
|
|
41723
41753
|
let state2;
|
|
41724
41754
|
try {
|
|
41725
41755
|
const trackChangesState = TrackChangesBasePluginKey.getState(this.view.state);
|
|
@@ -54287,7 +54317,8 @@ const Pagination = Extension.create({
|
|
|
54287
54317
|
addStorage() {
|
|
54288
54318
|
return {
|
|
54289
54319
|
height: 0,
|
|
54290
|
-
sectionData: null
|
|
54320
|
+
sectionData: null,
|
|
54321
|
+
headerFooterEditors: /* @__PURE__ */ new Map()
|
|
54291
54322
|
};
|
|
54292
54323
|
},
|
|
54293
54324
|
addCommands() {
|
|
@@ -54330,6 +54361,10 @@ const Pagination = Extension.create({
|
|
|
54330
54361
|
shouldUpdate = true;
|
|
54331
54362
|
shouldInitialize = meta.isReadyToInit;
|
|
54332
54363
|
}
|
|
54364
|
+
const syncMeta = tr.getMeta("y-sync$");
|
|
54365
|
+
if (syncMeta && syncMeta.isChangeOrigin) {
|
|
54366
|
+
return { ...oldState };
|
|
54367
|
+
}
|
|
54333
54368
|
const imagePluginTransaction = tr.getMeta(ImagePlaceholderPluginKey);
|
|
54334
54369
|
if (imagePluginTransaction) {
|
|
54335
54370
|
if (imagePluginTransaction.type === "remove") {
|
|
@@ -54363,6 +54398,7 @@ const Pagination = Extension.create({
|
|
|
54363
54398
|
if (isForceUpdate) shouldUpdate = true;
|
|
54364
54399
|
return {
|
|
54365
54400
|
...oldState,
|
|
54401
|
+
decorations: meta?.decorations?.map(tr.mapping, tr.doc) || DecorationSet.empty,
|
|
54366
54402
|
isReadyToInit: shouldInitialize
|
|
54367
54403
|
};
|
|
54368
54404
|
}
|
|
@@ -54391,6 +54427,10 @@ const Pagination = Extension.create({
|
|
|
54391
54427
|
},
|
|
54392
54428
|
onDestroy() {
|
|
54393
54429
|
cleanupFloatingSeparators();
|
|
54430
|
+
const { headerFooterEditors } = this.editor.storage.pagination;
|
|
54431
|
+
if (headerFooterEditors) {
|
|
54432
|
+
headerFooterEditors.clear();
|
|
54433
|
+
}
|
|
54394
54434
|
}
|
|
54395
54435
|
});
|
|
54396
54436
|
const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
|
|
@@ -54451,6 +54491,7 @@ const performUpdate = (editor, view, previousDecorations) => {
|
|
|
54451
54491
|
const calculatePageBreaks = (view, editor, sectionData) => {
|
|
54452
54492
|
if (!editor.converter) return DecorationSet.empty;
|
|
54453
54493
|
const pageSize = editor.converter.pageStyles?.pageSize;
|
|
54494
|
+
if (!pageSize) return DecorationSet.empty;
|
|
54454
54495
|
const { width, height } = pageSize;
|
|
54455
54496
|
if (!width || !height) return DecorationSet.empty;
|
|
54456
54497
|
const ignorePlugins = [CollaborationPluginKey, PaginationPluginKey];
|
|
@@ -54489,11 +54530,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54489
54530
|
let pageHeightThreshold = pageHeight;
|
|
54490
54531
|
let footer = null, header = null;
|
|
54491
54532
|
const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
54492
|
-
const
|
|
54533
|
+
const isFirstHeader = true;
|
|
54534
|
+
const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber, isFirstHeader);
|
|
54493
54535
|
const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
|
|
54494
54536
|
decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
|
|
54495
54537
|
const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
|
|
54496
|
-
const
|
|
54538
|
+
const isLastFooter = true;
|
|
54539
|
+
const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber, isLastFooter);
|
|
54497
54540
|
pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
|
|
54498
54541
|
let coords = view?.coordsAtPos(doc2.content.size);
|
|
54499
54542
|
if (!coords) return [];
|
|
@@ -54512,7 +54555,8 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
54512
54555
|
if (currentPageNumber === 1) {
|
|
54513
54556
|
const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
|
|
54514
54557
|
decorations.pop();
|
|
54515
|
-
const
|
|
54558
|
+
const isFirstHeader2 = true;
|
|
54559
|
+
const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber, isFirstHeader2);
|
|
54516
54560
|
const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
|
|
54517
54561
|
decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
|
|
54518
54562
|
}
|
|
@@ -54586,15 +54630,15 @@ function createFinalPagePadding(bufferHeight) {
|
|
|
54586
54630
|
div2.style.height = bufferHeight + "px";
|
|
54587
54631
|
return { nodeHeight: bufferHeight, node: div2 };
|
|
54588
54632
|
}
|
|
54589
|
-
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
|
|
54590
|
-
const headerDef = sectionData
|
|
54633
|
+
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber, isFirstHeader = false) {
|
|
54634
|
+
const headerDef = sectionData?.headers?.[headerId];
|
|
54591
54635
|
const minHeaderHeight = pageMargins.top * 96;
|
|
54592
54636
|
const headerMargin = pageMargins.header * 96;
|
|
54593
54637
|
const hasHeaderOffset = headerDef?.height > minHeaderHeight - headerMargin;
|
|
54594
54638
|
const headerOffset = hasHeaderOffset ? headerMargin : 0;
|
|
54595
54639
|
const headerHeight = Math.max(headerDef?.height || 0, minHeaderHeight) + headerOffset;
|
|
54596
54640
|
const availableHeight = headerHeight - headerMargin;
|
|
54597
|
-
|
|
54641
|
+
let editorContainer = document.createElement("div");
|
|
54598
54642
|
if (!headerId && !editor?.converter?.headerIds?.["default"]) {
|
|
54599
54643
|
headerId = "rId" + generateDocxRandomId();
|
|
54600
54644
|
editor.converter.headerIds["default"] = headerId;
|
|
@@ -54606,23 +54650,31 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54606
54650
|
};
|
|
54607
54651
|
}
|
|
54608
54652
|
const data = editor.converter.headers[headerId];
|
|
54609
|
-
const
|
|
54610
|
-
|
|
54611
|
-
|
|
54612
|
-
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54653
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54654
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isHeader: true, isFirstHeader });
|
|
54655
|
+
let editorSection = null;
|
|
54656
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54657
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.headerEditors[pageNumberIndex]) {
|
|
54658
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54659
|
+
editorSection = editorData.editor;
|
|
54660
|
+
editorContainer = editorSection.element;
|
|
54661
|
+
} else {
|
|
54662
|
+
editorSection = createHeaderFooterEditor({
|
|
54663
|
+
editor,
|
|
54664
|
+
data,
|
|
54665
|
+
editorContainer,
|
|
54666
|
+
appendToBody: false,
|
|
54667
|
+
sectionId: headerId,
|
|
54668
|
+
type: "header",
|
|
54669
|
+
availableHeight,
|
|
54670
|
+
currentPageNumber
|
|
54671
|
+
});
|
|
54672
|
+
editor.converter.headerEditors.push({ id: headerId, editor: editorSection });
|
|
54673
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54674
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54675
|
+
}
|
|
54623
54676
|
editorSection.setEditable(false, false);
|
|
54624
|
-
|
|
54625
|
-
editorContainer.className = "pagination-section-header";
|
|
54677
|
+
editorContainer.classList.add("pagination-section-header");
|
|
54626
54678
|
editorContainer.style.paddingTop = headerMargin + "px";
|
|
54627
54679
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
54628
54680
|
editorContainer.style.paddingRight = pageMargins.right * 96 + "px";
|
|
@@ -54635,12 +54687,12 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, curr
|
|
|
54635
54687
|
headerHeight
|
|
54636
54688
|
};
|
|
54637
54689
|
}
|
|
54638
|
-
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber) {
|
|
54639
|
-
const footerDef = sectionData
|
|
54690
|
+
function createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber, isLastFooter = false) {
|
|
54691
|
+
const footerDef = sectionData?.footers?.[footerId];
|
|
54640
54692
|
const minFooterHeight = pageMargins.bottom * 96;
|
|
54641
54693
|
const footerPaddingFromEdge = pageMargins.footer * 96;
|
|
54642
54694
|
const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
|
|
54643
|
-
|
|
54695
|
+
let editorContainer = document.createElement("div");
|
|
54644
54696
|
if (!footerId && !editor.converter.footerIds["default"]) {
|
|
54645
54697
|
footerId = "rId" + generateDocxRandomId();
|
|
54646
54698
|
editor.converter.footerIds["default"] = footerId;
|
|
@@ -54652,23 +54704,31 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54652
54704
|
};
|
|
54653
54705
|
}
|
|
54654
54706
|
const data = editor.converter.footers[footerId];
|
|
54655
|
-
const
|
|
54656
|
-
|
|
54657
|
-
|
|
54658
|
-
|
|
54659
|
-
|
|
54660
|
-
|
|
54661
|
-
|
|
54662
|
-
|
|
54663
|
-
|
|
54664
|
-
|
|
54665
|
-
|
|
54666
|
-
|
|
54667
|
-
|
|
54668
|
-
|
|
54707
|
+
const pageNumberIndex = currentPageNumber - 1;
|
|
54708
|
+
const editorKey = getHeaderFooterEditorKey({ pageNumber: pageNumberIndex, isFooter: true, isLastFooter });
|
|
54709
|
+
let editorSection = null;
|
|
54710
|
+
const { headerFooterEditors } = editor.storage.pagination;
|
|
54711
|
+
if (headerFooterEditors.has(editorKey) && editor.converter.footerEditors[pageNumberIndex]) {
|
|
54712
|
+
const editorData = headerFooterEditors.get(editorKey);
|
|
54713
|
+
editorSection = editorData.editor;
|
|
54714
|
+
editorContainer = editorSection.element;
|
|
54715
|
+
} else {
|
|
54716
|
+
editorSection = createHeaderFooterEditor({
|
|
54717
|
+
editor,
|
|
54718
|
+
data,
|
|
54719
|
+
editorContainer,
|
|
54720
|
+
appendToBody: false,
|
|
54721
|
+
sectionId: footerId,
|
|
54722
|
+
type: "footer",
|
|
54723
|
+
availableHeight: footerHeight,
|
|
54724
|
+
currentPageNumber
|
|
54725
|
+
});
|
|
54726
|
+
editor.converter.footerEditors.push({ id: footerId, editor: editorSection });
|
|
54727
|
+
headerFooterEditors.set(editorKey, { editor: editorSection });
|
|
54728
|
+
broadcastEditorEvents(editor, editorSection);
|
|
54729
|
+
}
|
|
54669
54730
|
editorSection.setEditable(false, false);
|
|
54670
|
-
|
|
54671
|
-
editorContainer.className = "pagination-section-footer";
|
|
54731
|
+
editorContainer.classList.add("pagination-section-footer");
|
|
54672
54732
|
editorContainer.style.height = footerHeight + "px";
|
|
54673
54733
|
editorContainer.style.marginBottom = footerPaddingFromEdge + "px";
|
|
54674
54734
|
editorContainer.style.paddingLeft = pageMargins.left * 96 + "px";
|
|
@@ -54681,6 +54741,19 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
54681
54741
|
footerHeight: footerHeight + footerPaddingFromEdge
|
|
54682
54742
|
};
|
|
54683
54743
|
}
|
|
54744
|
+
const getHeaderFooterEditorKey = ({
|
|
54745
|
+
pageNumber,
|
|
54746
|
+
isHeader,
|
|
54747
|
+
isFooter,
|
|
54748
|
+
isFirstHeader = false,
|
|
54749
|
+
isLastFooter = false
|
|
54750
|
+
}) => {
|
|
54751
|
+
if (isFirstHeader) return `first-header-${pageNumber}`;
|
|
54752
|
+
if (isLastFooter) return `last-footer-${pageNumber}`;
|
|
54753
|
+
if (isHeader) return `header-${pageNumber}`;
|
|
54754
|
+
if (isFooter) return `footer-${pageNumber}`;
|
|
54755
|
+
return void 0;
|
|
54756
|
+
};
|
|
54684
54757
|
const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
|
|
54685
54758
|
if (editor.options.documentMode !== "editing") return;
|
|
54686
54759
|
editor.setEditable(false, false);
|
|
@@ -64144,6 +64217,7 @@ const style$2 = cB("icon", `
|
|
|
64144
64217
|
display: inline-block;
|
|
64145
64218
|
position: relative;
|
|
64146
64219
|
fill: currentColor;
|
|
64220
|
+
transform: translateZ(0);
|
|
64147
64221
|
`, [cM("color-transition", {
|
|
64148
64222
|
transition: "color .3s var(--n-bezier)"
|
|
64149
64223
|
}), cM("depth", {
|