@harbour-enterprises/superdoc 0.14.0-next.5 → 0.14.0-next.7
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-BABtK_9p.cjs → index-CE6UNfC5.cjs} +2 -2
- package/dist/chunks/{index-DRG7AiQg.es.js → index-CW9fKHgN.es.js} +2 -2
- package/dist/chunks/{index-BOOtEcgZ.cjs → index-DGsxwjB4.cjs} +1 -1
- package/dist/chunks/{index-ClYNVXDv.es.js → index-DHn8sl2L.es.js} +1 -1
- package/dist/chunks/{super-editor.es-CS08WNwP.es.js → super-editor.es-B1co-x-F.es.js} +69 -31
- package/dist/chunks/{super-editor.es-1V_Ac-SF.cjs → super-editor.es-BrUIfwuC.cjs} +69 -31
- package/dist/chunks/{url-BmSVZ-b1.cjs → url-CUv5CLO-.cjs} +1 -1
- package/dist/chunks/{url-DtyZlUvQ.es.js → url-CZOvt3H8.es.js} +1 -1
- package/dist/chunks/{xml-js-uhSaCX_L.es.js → xml-js-D5Licdr-.es.js} +158 -123
- package/dist/chunks/{xml-js-PTtx0UCg.cjs → xml-js-tHwLFq2w.cjs} +158 -123
- package/dist/core/SuperDoc.d.ts +5 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-3dVTYXnm.js → converter-Cq8A38P6.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-CAF6BgPQ.js → docx-zipper-DOtI6fZj.js} +1 -1
- package/dist/super-editor/chunks/{editor-NHY1ApZn.js → editor-DiMXpjJM.js} +69 -31
- package/dist/super-editor/chunks/{toolbar-Dr1wHywT.js → toolbar-CE2dEw2j.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +11 -4
- 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 +18 -5
- package/dist/superdoc.es.js +19 -6
- package/dist/superdoc.umd.js +83 -32
- 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-9bCX1h2W.cjs");
|
|
3
3
|
const vue = require("./vue-BBjMeYfo.cjs");
|
|
4
|
-
const xmlJs = require("./xml-js-
|
|
5
|
-
const url = require("./url-
|
|
4
|
+
const xmlJs = require("./xml-js-tHwLFq2w.cjs");
|
|
5
|
+
const url = require("./url-CUv5CLO-.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-Cl3s9njw.es.js";
|
|
2
2
|
import { p as process$1 } from "./vue-BBJVqxjL.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-D5Licdr-.es.js";
|
|
4
|
+
import { u as url } from "./url-CZOvt3H8.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-Cl3s9njw.es.js";
|
|
2
|
-
import { s as streamHttp, r as require$$1 } from "./index-
|
|
2
|
+
import { s as streamHttp, r as require$$1 } from "./index-CW9fKHgN.es.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
for (var i = 0; i < m.length; i++) {
|
|
5
5
|
const e = m[i];
|
|
@@ -24235,7 +24235,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
24235
24235
|
return;
|
|
24236
24236
|
}
|
|
24237
24237
|
}
|
|
24238
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.
|
|
24238
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.7") {
|
|
24239
24239
|
const customLocation = "docProps/custom.xml";
|
|
24240
24240
|
if (!docx[customLocation]) {
|
|
24241
24241
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24703,7 +24703,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24703
24703
|
function generateCustomXml() {
|
|
24704
24704
|
return DEFAULT_CUSTOM_XML;
|
|
24705
24705
|
}
|
|
24706
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.
|
|
24706
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.7") {
|
|
24707
24707
|
return {
|
|
24708
24708
|
type: "element",
|
|
24709
24709
|
name: "property",
|
|
@@ -27236,7 +27236,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
27236
27236
|
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);
|
|
27237
27237
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
27238
27238
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
27239
|
-
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,
|
|
27239
|
+
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, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
27240
27240
|
function getMarksFromSelection(state2) {
|
|
27241
27241
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
27242
27242
|
const marks = [];
|
|
@@ -39781,6 +39781,8 @@ const createHeaderFooterEditor = ({
|
|
|
39781
39781
|
});
|
|
39782
39782
|
if (appendToBody) document.body.appendChild(editorContainer);
|
|
39783
39783
|
const headerFooterEditor = new Editor({
|
|
39784
|
+
documentMode: editor.options.documentMode,
|
|
39785
|
+
role: editor.options.role,
|
|
39784
39786
|
loadFromSchema: true,
|
|
39785
39787
|
mode: "docx",
|
|
39786
39788
|
element: editorContainer,
|
|
@@ -41512,10 +41514,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41512
41514
|
}
|
|
41513
41515
|
/**
|
|
41514
41516
|
* Unregister a PM plugin
|
|
41515
|
-
* @param {string|Object}
|
|
41517
|
+
* @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
|
|
41516
41518
|
* @returns {void}
|
|
41517
41519
|
*/
|
|
41518
|
-
unregisterPlugin(
|
|
41520
|
+
unregisterPlugin(nameOrPluginKey) {
|
|
41519
41521
|
if (this.isDestroyed) return;
|
|
41520
41522
|
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
41521
41523
|
const state2 = this.state.reconfigure({
|
|
@@ -41593,7 +41595,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41593
41595
|
/**
|
|
41594
41596
|
* Attach styles and attributes to the editor element
|
|
41595
41597
|
*/
|
|
41596
|
-
updateEditorStyles(element, proseMirror) {
|
|
41598
|
+
updateEditorStyles(element, proseMirror, hasPaginationEnabled = true) {
|
|
41597
41599
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
41598
41600
|
if (!proseMirror || !element) {
|
|
41599
41601
|
return;
|
|
@@ -41627,9 +41629,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41627
41629
|
element.style.webkitOverflowScrolling = "touch";
|
|
41628
41630
|
const defaultLineHeight = 1.2;
|
|
41629
41631
|
proseMirror.style.lineHeight = defaultLineHeight;
|
|
41630
|
-
if (!
|
|
41632
|
+
if (!hasPaginationEnabled) {
|
|
41631
41633
|
proseMirror.style.paddingTop = "1in";
|
|
41632
41634
|
proseMirror.style.paddingBottom = "1in";
|
|
41635
|
+
} else {
|
|
41636
|
+
proseMirror.style.paddingTop = "0";
|
|
41637
|
+
proseMirror.style.paddingBottom = "0";
|
|
41633
41638
|
}
|
|
41634
41639
|
}
|
|
41635
41640
|
/**
|
|
@@ -41640,10 +41645,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41640
41645
|
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41641
41646
|
* @returns {void}
|
|
41642
41647
|
*/
|
|
41643
|
-
initDefaultStyles(element = this.element) {
|
|
41648
|
+
initDefaultStyles(element = this.element, isPaginationEnabled = true) {
|
|
41644
41649
|
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41645
41650
|
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41646
|
-
this.updateEditorStyles(element, proseMirror);
|
|
41651
|
+
this.updateEditorStyles(element, proseMirror, isPaginationEnabled);
|
|
41647
41652
|
this.initMobileStyles(element);
|
|
41648
41653
|
}
|
|
41649
41654
|
/**
|
|
@@ -41691,6 +41696,25 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41691
41696
|
}
|
|
41692
41697
|
window.addEventListener("resize", () => handleResize);
|
|
41693
41698
|
}
|
|
41699
|
+
/**
|
|
41700
|
+
* Initialize pagination, if the pagination extension is enabled.
|
|
41701
|
+
* @private
|
|
41702
|
+
* @async
|
|
41703
|
+
* @returns {Promise<void>}
|
|
41704
|
+
*/
|
|
41705
|
+
async initPagination() {
|
|
41706
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
41707
|
+
return;
|
|
41708
|
+
}
|
|
41709
|
+
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
41710
|
+
if (pagination && this.options.pagination) {
|
|
41711
|
+
const sectionData = await initPaginationData(this);
|
|
41712
|
+
this.storage.pagination.sectionData = sectionData;
|
|
41713
|
+
const { state: state2, dispatch } = this.view;
|
|
41714
|
+
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
41715
|
+
dispatch(tr);
|
|
41716
|
+
}
|
|
41717
|
+
}
|
|
41694
41718
|
/**
|
|
41695
41719
|
* Get attrs of the currently selected node or mark.
|
|
41696
41720
|
* @param {String} nameOrType
|
|
@@ -41900,7 +41924,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41900
41924
|
* @returns {Object | void} Migration results
|
|
41901
41925
|
*/
|
|
41902
41926
|
processCollaborationMigrations() {
|
|
41903
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.
|
|
41927
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.7");
|
|
41904
41928
|
if (!this.options.ydoc) return;
|
|
41905
41929
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41906
41930
|
let docVersion = metaMap.get("version");
|
|
@@ -41950,7 +41974,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41950
41974
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
41951
41975
|
}
|
|
41952
41976
|
if (!this.options.ydoc) {
|
|
41953
|
-
|
|
41977
|
+
this.initPagination();
|
|
41954
41978
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
41955
41979
|
}
|
|
41956
41980
|
}
|
|
@@ -42097,8 +42121,6 @@ init_fn = function(options2) {
|
|
|
42097
42121
|
this.on("contentError", this.options.onContentError);
|
|
42098
42122
|
this.on("exception", this.options.onException);
|
|
42099
42123
|
this.mount(this.options.element);
|
|
42100
|
-
this.initDefaultStyles();
|
|
42101
|
-
this.setDocumentMode(options2.documentMode);
|
|
42102
42124
|
if (this.options.isHeadless) return;
|
|
42103
42125
|
this.on("create", this.options.onCreate);
|
|
42104
42126
|
this.on("update", this.options.onUpdate);
|
|
@@ -42116,8 +42138,12 @@ init_fn = function(options2) {
|
|
|
42116
42138
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
42117
42139
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
42118
42140
|
this.initializeCollaborationData();
|
|
42141
|
+
this.initDefaultStyles();
|
|
42142
|
+
setTimeout(() => {
|
|
42143
|
+
this.setDocumentMode(this.options.documentMode);
|
|
42144
|
+
}, 50);
|
|
42119
42145
|
if (!this.options.ydoc) {
|
|
42120
|
-
|
|
42146
|
+
this.initPagination();
|
|
42121
42147
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42122
42148
|
}
|
|
42123
42149
|
};
|
|
@@ -42164,7 +42190,7 @@ insertNewFileData_fn = function() {
|
|
|
42164
42190
|
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
|
|
42165
42191
|
this.view.dispatch(tr);
|
|
42166
42192
|
setTimeout(() => {
|
|
42167
|
-
|
|
42193
|
+
this.initPagination();
|
|
42168
42194
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42169
42195
|
}, 50);
|
|
42170
42196
|
};
|
|
@@ -42310,7 +42336,7 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
|
42310
42336
|
this.options.onCollaborationReady({ editor, ydoc });
|
|
42311
42337
|
this.options.collaborationIsReady = true;
|
|
42312
42338
|
if (!this.options.isNewFile) {
|
|
42313
|
-
|
|
42339
|
+
this.initPagination();
|
|
42314
42340
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42315
42341
|
}
|
|
42316
42342
|
};
|
|
@@ -42327,19 +42353,6 @@ initComments_fn = function() {
|
|
|
42327
42353
|
dispatch(tr);
|
|
42328
42354
|
}, 50);
|
|
42329
42355
|
};
|
|
42330
|
-
initPagination_fn = async function() {
|
|
42331
|
-
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
42332
|
-
return;
|
|
42333
|
-
}
|
|
42334
|
-
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
42335
|
-
if (pagination && this.options.pagination) {
|
|
42336
|
-
const sectionData = await initPaginationData(this);
|
|
42337
|
-
this.storage.pagination.sectionData = sectionData;
|
|
42338
|
-
const { state: state2, dispatch } = this.view;
|
|
42339
|
-
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
42340
|
-
dispatch(tr);
|
|
42341
|
-
}
|
|
42342
|
-
};
|
|
42343
42356
|
dispatchTransaction_fn = function(transaction) {
|
|
42344
42357
|
if (this.isDestroyed) return;
|
|
42345
42358
|
let state2;
|
|
@@ -54963,6 +54976,19 @@ const Pagination = Extension.create({
|
|
|
54963
54976
|
return commands2.insertContent({
|
|
54964
54977
|
type: "hardBreak"
|
|
54965
54978
|
});
|
|
54979
|
+
},
|
|
54980
|
+
/**
|
|
54981
|
+
* Toggle pagination on/off
|
|
54982
|
+
* @returns {void}
|
|
54983
|
+
*/
|
|
54984
|
+
togglePagination: () => ({ tr, state: state2, dispatch, editor }) => {
|
|
54985
|
+
const isEnabled = PaginationPluginKey.getState(state2)?.isEnabled;
|
|
54986
|
+
tr.setMeta(PaginationPluginKey, { isEnabled: !isEnabled });
|
|
54987
|
+
if (dispatch) {
|
|
54988
|
+
dispatch(tr);
|
|
54989
|
+
editor.initDefaultStyles(editor.element, !isEnabled);
|
|
54990
|
+
return true;
|
|
54991
|
+
}
|
|
54966
54992
|
}
|
|
54967
54993
|
};
|
|
54968
54994
|
},
|
|
@@ -54988,11 +55014,21 @@ const Pagination = Extension.create({
|
|
|
54988
55014
|
return {
|
|
54989
55015
|
isReadyToInit: false,
|
|
54990
55016
|
decorations: DecorationSet.empty,
|
|
54991
|
-
isDebugging
|
|
55017
|
+
isDebugging,
|
|
55018
|
+
isEnabled: editor.options.pagination
|
|
54992
55019
|
};
|
|
54993
55020
|
},
|
|
54994
55021
|
apply(tr, oldState, prevEditorState, newEditorState) {
|
|
54995
55022
|
const meta = tr.getMeta(PaginationPluginKey);
|
|
55023
|
+
if (meta && "isEnabled" in meta) {
|
|
55024
|
+
const newEnabled = meta.isEnabled;
|
|
55025
|
+
if (newEnabled) shouldUpdate = true;
|
|
55026
|
+
return {
|
|
55027
|
+
...oldState,
|
|
55028
|
+
decorations: newEnabled ? oldState.decorations : DecorationSet.empty,
|
|
55029
|
+
isEnabled: newEnabled
|
|
55030
|
+
};
|
|
55031
|
+
}
|
|
54996
55032
|
if (meta && meta.isReadyToInit) {
|
|
54997
55033
|
shouldUpdate = true;
|
|
54998
55034
|
shouldInitialize = meta.isReadyToInit;
|
|
@@ -55042,6 +55078,7 @@ const Pagination = Extension.create({
|
|
|
55042
55078
|
let previousDecorations = DecorationSet.empty;
|
|
55043
55079
|
return {
|
|
55044
55080
|
update: (view2, prevState) => {
|
|
55081
|
+
if (!PaginationPluginKey.getState(view2.state)?.isEnabled) return;
|
|
55045
55082
|
if (!shouldUpdate || isUpdating) return;
|
|
55046
55083
|
isUpdating = true;
|
|
55047
55084
|
hasInitialized = true;
|
|
@@ -55053,7 +55090,8 @@ const Pagination = Extension.create({
|
|
|
55053
55090
|
},
|
|
55054
55091
|
props: {
|
|
55055
55092
|
decorations(state2) {
|
|
55056
|
-
|
|
55093
|
+
const pluginState = PaginationPluginKey.getState(state2);
|
|
55094
|
+
return pluginState.isEnabled ? pluginState.decorations : DecorationSet.empty;
|
|
55057
55095
|
}
|
|
55058
55096
|
}
|
|
55059
55097
|
});
|
|
@@ -24252,7 +24252,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
24252
24252
|
return;
|
|
24253
24253
|
}
|
|
24254
24254
|
}
|
|
24255
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.
|
|
24255
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.7") {
|
|
24256
24256
|
const customLocation = "docProps/custom.xml";
|
|
24257
24257
|
if (!docx[customLocation]) {
|
|
24258
24258
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24720,7 +24720,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24720
24720
|
function generateCustomXml() {
|
|
24721
24721
|
return DEFAULT_CUSTOM_XML;
|
|
24722
24722
|
}
|
|
24723
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.
|
|
24723
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.7") {
|
|
24724
24724
|
return {
|
|
24725
24725
|
type: "element",
|
|
24726
24726
|
name: "property",
|
|
@@ -27253,7 +27253,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
27253
27253
|
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);
|
|
27254
27254
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
27255
27255
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
27256
|
-
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,
|
|
27256
|
+
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, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
27257
27257
|
function getMarksFromSelection(state2) {
|
|
27258
27258
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
27259
27259
|
const marks = [];
|
|
@@ -39798,6 +39798,8 @@ const createHeaderFooterEditor = ({
|
|
|
39798
39798
|
});
|
|
39799
39799
|
if (appendToBody) document.body.appendChild(editorContainer);
|
|
39800
39800
|
const headerFooterEditor = new Editor({
|
|
39801
|
+
documentMode: editor.options.documentMode,
|
|
39802
|
+
role: editor.options.role,
|
|
39801
39803
|
loadFromSchema: true,
|
|
39802
39804
|
mode: "docx",
|
|
39803
39805
|
element: editorContainer,
|
|
@@ -41529,10 +41531,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41529
41531
|
}
|
|
41530
41532
|
/**
|
|
41531
41533
|
* Unregister a PM plugin
|
|
41532
|
-
* @param {string|Object}
|
|
41534
|
+
* @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
|
|
41533
41535
|
* @returns {void}
|
|
41534
41536
|
*/
|
|
41535
|
-
unregisterPlugin(
|
|
41537
|
+
unregisterPlugin(nameOrPluginKey) {
|
|
41536
41538
|
if (this.isDestroyed) return;
|
|
41537
41539
|
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
41538
41540
|
const state2 = this.state.reconfigure({
|
|
@@ -41610,7 +41612,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41610
41612
|
/**
|
|
41611
41613
|
* Attach styles and attributes to the editor element
|
|
41612
41614
|
*/
|
|
41613
|
-
updateEditorStyles(element, proseMirror) {
|
|
41615
|
+
updateEditorStyles(element, proseMirror, hasPaginationEnabled = true) {
|
|
41614
41616
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
41615
41617
|
if (!proseMirror || !element) {
|
|
41616
41618
|
return;
|
|
@@ -41644,9 +41646,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41644
41646
|
element.style.webkitOverflowScrolling = "touch";
|
|
41645
41647
|
const defaultLineHeight = 1.2;
|
|
41646
41648
|
proseMirror.style.lineHeight = defaultLineHeight;
|
|
41647
|
-
if (!
|
|
41649
|
+
if (!hasPaginationEnabled) {
|
|
41648
41650
|
proseMirror.style.paddingTop = "1in";
|
|
41649
41651
|
proseMirror.style.paddingBottom = "1in";
|
|
41652
|
+
} else {
|
|
41653
|
+
proseMirror.style.paddingTop = "0";
|
|
41654
|
+
proseMirror.style.paddingBottom = "0";
|
|
41650
41655
|
}
|
|
41651
41656
|
}
|
|
41652
41657
|
/**
|
|
@@ -41657,10 +41662,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41657
41662
|
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
41658
41663
|
* @returns {void}
|
|
41659
41664
|
*/
|
|
41660
|
-
initDefaultStyles(element = this.element) {
|
|
41665
|
+
initDefaultStyles(element = this.element, isPaginationEnabled = true) {
|
|
41661
41666
|
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
41662
41667
|
const proseMirror = element?.querySelector(".ProseMirror");
|
|
41663
|
-
this.updateEditorStyles(element, proseMirror);
|
|
41668
|
+
this.updateEditorStyles(element, proseMirror, isPaginationEnabled);
|
|
41664
41669
|
this.initMobileStyles(element);
|
|
41665
41670
|
}
|
|
41666
41671
|
/**
|
|
@@ -41708,6 +41713,25 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41708
41713
|
}
|
|
41709
41714
|
window.addEventListener("resize", () => handleResize);
|
|
41710
41715
|
}
|
|
41716
|
+
/**
|
|
41717
|
+
* Initialize pagination, if the pagination extension is enabled.
|
|
41718
|
+
* @private
|
|
41719
|
+
* @async
|
|
41720
|
+
* @returns {Promise<void>}
|
|
41721
|
+
*/
|
|
41722
|
+
async initPagination() {
|
|
41723
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
41724
|
+
return;
|
|
41725
|
+
}
|
|
41726
|
+
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
41727
|
+
if (pagination && this.options.pagination) {
|
|
41728
|
+
const sectionData = await initPaginationData(this);
|
|
41729
|
+
this.storage.pagination.sectionData = sectionData;
|
|
41730
|
+
const { state: state2, dispatch } = this.view;
|
|
41731
|
+
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
41732
|
+
dispatch(tr);
|
|
41733
|
+
}
|
|
41734
|
+
}
|
|
41711
41735
|
/**
|
|
41712
41736
|
* Get attrs of the currently selected node or mark.
|
|
41713
41737
|
* @param {String} nameOrType
|
|
@@ -41917,7 +41941,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41917
41941
|
* @returns {Object | void} Migration results
|
|
41918
41942
|
*/
|
|
41919
41943
|
processCollaborationMigrations() {
|
|
41920
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.
|
|
41944
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.7");
|
|
41921
41945
|
if (!this.options.ydoc) return;
|
|
41922
41946
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41923
41947
|
let docVersion = metaMap.get("version");
|
|
@@ -41967,7 +41991,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41967
41991
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
41968
41992
|
}
|
|
41969
41993
|
if (!this.options.ydoc) {
|
|
41970
|
-
|
|
41994
|
+
this.initPagination();
|
|
41971
41995
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
41972
41996
|
}
|
|
41973
41997
|
}
|
|
@@ -42114,8 +42138,6 @@ init_fn = function(options2) {
|
|
|
42114
42138
|
this.on("contentError", this.options.onContentError);
|
|
42115
42139
|
this.on("exception", this.options.onException);
|
|
42116
42140
|
this.mount(this.options.element);
|
|
42117
|
-
this.initDefaultStyles();
|
|
42118
|
-
this.setDocumentMode(options2.documentMode);
|
|
42119
42141
|
if (this.options.isHeadless) return;
|
|
42120
42142
|
this.on("create", this.options.onCreate);
|
|
42121
42143
|
this.on("update", this.options.onUpdate);
|
|
@@ -42133,8 +42155,12 @@ init_fn = function(options2) {
|
|
|
42133
42155
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
42134
42156
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
42135
42157
|
this.initializeCollaborationData();
|
|
42158
|
+
this.initDefaultStyles();
|
|
42159
|
+
setTimeout(() => {
|
|
42160
|
+
this.setDocumentMode(this.options.documentMode);
|
|
42161
|
+
}, 50);
|
|
42136
42162
|
if (!this.options.ydoc) {
|
|
42137
|
-
|
|
42163
|
+
this.initPagination();
|
|
42138
42164
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42139
42165
|
}
|
|
42140
42166
|
};
|
|
@@ -42181,7 +42207,7 @@ insertNewFileData_fn = function() {
|
|
|
42181
42207
|
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
|
|
42182
42208
|
this.view.dispatch(tr);
|
|
42183
42209
|
setTimeout(() => {
|
|
42184
|
-
|
|
42210
|
+
this.initPagination();
|
|
42185
42211
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42186
42212
|
}, 50);
|
|
42187
42213
|
};
|
|
@@ -42327,7 +42353,7 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
|
42327
42353
|
this.options.onCollaborationReady({ editor, ydoc });
|
|
42328
42354
|
this.options.collaborationIsReady = true;
|
|
42329
42355
|
if (!this.options.isNewFile) {
|
|
42330
|
-
|
|
42356
|
+
this.initPagination();
|
|
42331
42357
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
42332
42358
|
}
|
|
42333
42359
|
};
|
|
@@ -42344,19 +42370,6 @@ initComments_fn = function() {
|
|
|
42344
42370
|
dispatch(tr);
|
|
42345
42371
|
}, 50);
|
|
42346
42372
|
};
|
|
42347
|
-
initPagination_fn = async function() {
|
|
42348
|
-
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
42349
|
-
return;
|
|
42350
|
-
}
|
|
42351
|
-
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
42352
|
-
if (pagination && this.options.pagination) {
|
|
42353
|
-
const sectionData = await initPaginationData(this);
|
|
42354
|
-
this.storage.pagination.sectionData = sectionData;
|
|
42355
|
-
const { state: state2, dispatch } = this.view;
|
|
42356
|
-
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
42357
|
-
dispatch(tr);
|
|
42358
|
-
}
|
|
42359
|
-
};
|
|
42360
42373
|
dispatchTransaction_fn = function(transaction) {
|
|
42361
42374
|
if (this.isDestroyed) return;
|
|
42362
42375
|
let state2;
|
|
@@ -54980,6 +54993,19 @@ const Pagination = Extension.create({
|
|
|
54980
54993
|
return commands2.insertContent({
|
|
54981
54994
|
type: "hardBreak"
|
|
54982
54995
|
});
|
|
54996
|
+
},
|
|
54997
|
+
/**
|
|
54998
|
+
* Toggle pagination on/off
|
|
54999
|
+
* @returns {void}
|
|
55000
|
+
*/
|
|
55001
|
+
togglePagination: () => ({ tr, state: state2, dispatch, editor }) => {
|
|
55002
|
+
const isEnabled = PaginationPluginKey.getState(state2)?.isEnabled;
|
|
55003
|
+
tr.setMeta(PaginationPluginKey, { isEnabled: !isEnabled });
|
|
55004
|
+
if (dispatch) {
|
|
55005
|
+
dispatch(tr);
|
|
55006
|
+
editor.initDefaultStyles(editor.element, !isEnabled);
|
|
55007
|
+
return true;
|
|
55008
|
+
}
|
|
54983
55009
|
}
|
|
54984
55010
|
};
|
|
54985
55011
|
},
|
|
@@ -55005,11 +55031,21 @@ const Pagination = Extension.create({
|
|
|
55005
55031
|
return {
|
|
55006
55032
|
isReadyToInit: false,
|
|
55007
55033
|
decorations: DecorationSet.empty,
|
|
55008
|
-
isDebugging
|
|
55034
|
+
isDebugging,
|
|
55035
|
+
isEnabled: editor.options.pagination
|
|
55009
55036
|
};
|
|
55010
55037
|
},
|
|
55011
55038
|
apply(tr, oldState, prevEditorState, newEditorState) {
|
|
55012
55039
|
const meta = tr.getMeta(PaginationPluginKey);
|
|
55040
|
+
if (meta && "isEnabled" in meta) {
|
|
55041
|
+
const newEnabled = meta.isEnabled;
|
|
55042
|
+
if (newEnabled) shouldUpdate = true;
|
|
55043
|
+
return {
|
|
55044
|
+
...oldState,
|
|
55045
|
+
decorations: newEnabled ? oldState.decorations : DecorationSet.empty,
|
|
55046
|
+
isEnabled: newEnabled
|
|
55047
|
+
};
|
|
55048
|
+
}
|
|
55013
55049
|
if (meta && meta.isReadyToInit) {
|
|
55014
55050
|
shouldUpdate = true;
|
|
55015
55051
|
shouldInitialize = meta.isReadyToInit;
|
|
@@ -55059,6 +55095,7 @@ const Pagination = Extension.create({
|
|
|
55059
55095
|
let previousDecorations = DecorationSet.empty;
|
|
55060
55096
|
return {
|
|
55061
55097
|
update: (view2, prevState) => {
|
|
55098
|
+
if (!PaginationPluginKey.getState(view2.state)?.isEnabled) return;
|
|
55062
55099
|
if (!shouldUpdate || isUpdating) return;
|
|
55063
55100
|
isUpdating = true;
|
|
55064
55101
|
hasInitialized = true;
|
|
@@ -55070,7 +55107,8 @@ const Pagination = Extension.create({
|
|
|
55070
55107
|
},
|
|
55071
55108
|
props: {
|
|
55072
55109
|
decorations(state2) {
|
|
55073
|
-
|
|
55110
|
+
const pluginState = PaginationPluginKey.getState(state2);
|
|
55111
|
+
return pluginState.isEnabled ? pluginState.decorations : DecorationSet.empty;
|
|
55074
55112
|
}
|
|
55075
55113
|
}
|
|
55076
55114
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-9bCX1h2W.cjs");
|
|
3
|
-
const xmlJs = require("./xml-js-
|
|
3
|
+
const xmlJs = require("./xml-js-tHwLFq2w.cjs");
|
|
4
4
|
const __viteBrowserExternal = require("./__vite-browser-external-DWbQq7bv.cjs");
|
|
5
5
|
var punycode$1 = { exports: {} };
|
|
6
6
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-Cl3s9njw.es.js";
|
|
2
|
-
import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-
|
|
2
|
+
import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-D5Licdr-.es.js";
|
|
3
3
|
import { _ as __viteBrowserExternal } from "./__vite-browser-external-CURh0WXD.es.js";
|
|
4
4
|
var punycode$1 = { exports: {} };
|
|
5
5
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|