@harbour-enterprises/superdoc 0.13.2-rev10 → 0.13.2-rev12
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/{super-editor.es-Bdu65rjC.cjs → super-editor.es-BKgM1pcY.cjs} +68 -32
- package/dist/chunks/{super-editor.es-BwWbNxcS.es.js → super-editor.es-C_Nq6j7z.es.js} +68 -32
- package/dist/core/SuperDoc.d.ts +5 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +14 -10
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-lPrQA7b1.js → converter-BaxWFoHG.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-HvG9XskR.js → docx-zipper-DultQQrr.js} +1 -1
- package/dist/super-editor/chunks/{editor-DbkiH8Up.js → editor-ClD1k7gi.js} +68 -32
- package/dist/super-editor/chunks/{toolbar-JdrfUR1G.js → toolbar-BBZO5GG_.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/style.css +14 -10
- 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 +15 -2
- package/dist/superdoc.es.js +16 -3
- package/dist/superdoc.umd.js +82 -33
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -31356,7 +31356,7 @@
|
|
|
31356
31356
|
return;
|
|
31357
31357
|
}
|
|
31358
31358
|
}
|
|
31359
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-
|
|
31359
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-rev12") {
|
|
31360
31360
|
const customLocation = "docProps/custom.xml";
|
|
31361
31361
|
if (!docx[customLocation]) {
|
|
31362
31362
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31823,7 +31823,7 @@
|
|
|
31823
31823
|
function generateCustomXml() {
|
|
31824
31824
|
return DEFAULT_CUSTOM_XML;
|
|
31825
31825
|
}
|
|
31826
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.13.2-
|
|
31826
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.13.2-rev12") {
|
|
31827
31827
|
return {
|
|
31828
31828
|
type: "element",
|
|
31829
31829
|
name: "property",
|
|
@@ -34356,7 +34356,7 @@
|
|
|
34356
34356
|
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);
|
|
34357
34357
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
34358
34358
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
34359
|
-
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,
|
|
34359
|
+
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, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
34360
34360
|
function getMarksFromSelection(state2) {
|
|
34361
34361
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
34362
34362
|
const marks = [];
|
|
@@ -46610,6 +46610,8 @@
|
|
|
46610
46610
|
});
|
|
46611
46611
|
if (appendToBody) document.body.appendChild(editorContainer);
|
|
46612
46612
|
const headerFooterEditor = new Editor({
|
|
46613
|
+
documentMode: editor.options.documentMode,
|
|
46614
|
+
role: editor.options.role,
|
|
46613
46615
|
loadFromSchema: true,
|
|
46614
46616
|
mode: "docx",
|
|
46615
46617
|
element: editorContainer,
|
|
@@ -48341,10 +48343,10 @@
|
|
|
48341
48343
|
}
|
|
48342
48344
|
/**
|
|
48343
48345
|
* Unregister a PM plugin
|
|
48344
|
-
* @param {string|Object}
|
|
48346
|
+
* @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
|
|
48345
48347
|
* @returns {void}
|
|
48346
48348
|
*/
|
|
48347
|
-
unregisterPlugin(
|
|
48349
|
+
unregisterPlugin(nameOrPluginKey) {
|
|
48348
48350
|
if (this.isDestroyed) return;
|
|
48349
48351
|
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
48350
48352
|
const state2 = this.state.reconfigure({
|
|
@@ -48422,7 +48424,7 @@
|
|
|
48422
48424
|
/**
|
|
48423
48425
|
* Attach styles and attributes to the editor element
|
|
48424
48426
|
*/
|
|
48425
|
-
updateEditorStyles(element, proseMirror) {
|
|
48427
|
+
updateEditorStyles(element, proseMirror, hasPaginationEnabled = true) {
|
|
48426
48428
|
const { pageSize, pageMargins } = this.converter.pageStyles ?? {};
|
|
48427
48429
|
if (!proseMirror || !element) {
|
|
48428
48430
|
return;
|
|
@@ -48456,9 +48458,12 @@
|
|
|
48456
48458
|
element.style.webkitOverflowScrolling = "touch";
|
|
48457
48459
|
const defaultLineHeight = 1.2;
|
|
48458
48460
|
proseMirror.style.lineHeight = defaultLineHeight;
|
|
48459
|
-
if (!
|
|
48461
|
+
if (!hasPaginationEnabled) {
|
|
48460
48462
|
proseMirror.style.paddingTop = "1in";
|
|
48461
48463
|
proseMirror.style.paddingBottom = "1in";
|
|
48464
|
+
} else {
|
|
48465
|
+
proseMirror.style.paddingTop = "0";
|
|
48466
|
+
proseMirror.style.paddingBottom = "0";
|
|
48462
48467
|
}
|
|
48463
48468
|
}
|
|
48464
48469
|
/**
|
|
@@ -48469,10 +48474,10 @@
|
|
|
48469
48474
|
* @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
|
|
48470
48475
|
* @returns {void}
|
|
48471
48476
|
*/
|
|
48472
|
-
initDefaultStyles(element = this.element) {
|
|
48477
|
+
initDefaultStyles(element = this.element, isPaginationEnabled = true) {
|
|
48473
48478
|
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
48474
48479
|
const proseMirror = element?.querySelector(".ProseMirror");
|
|
48475
|
-
this.updateEditorStyles(element, proseMirror);
|
|
48480
|
+
this.updateEditorStyles(element, proseMirror, isPaginationEnabled);
|
|
48476
48481
|
this.initMobileStyles(element);
|
|
48477
48482
|
}
|
|
48478
48483
|
/**
|
|
@@ -48520,6 +48525,26 @@
|
|
|
48520
48525
|
}
|
|
48521
48526
|
window.addEventListener("resize", () => handleResize);
|
|
48522
48527
|
}
|
|
48528
|
+
/**
|
|
48529
|
+
* Initialize pagination, if the pagination extension is enabled.
|
|
48530
|
+
* @private
|
|
48531
|
+
* @async
|
|
48532
|
+
* @returns {Promise<void>}
|
|
48533
|
+
*/
|
|
48534
|
+
async initPagination() {
|
|
48535
|
+
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
48536
|
+
return;
|
|
48537
|
+
}
|
|
48538
|
+
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
48539
|
+
if (pagination && this.options.pagination) {
|
|
48540
|
+
console.debug("🔗 [super-editor] Initializing pagination");
|
|
48541
|
+
const sectionData = await initPaginationData(this);
|
|
48542
|
+
this.storage.pagination.sectionData = sectionData;
|
|
48543
|
+
const { state: state2, dispatch } = this.view;
|
|
48544
|
+
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
48545
|
+
dispatch(tr);
|
|
48546
|
+
}
|
|
48547
|
+
}
|
|
48523
48548
|
/**
|
|
48524
48549
|
* Get attrs of the currently selected node or mark.
|
|
48525
48550
|
* @param {String} nameOrType
|
|
@@ -48720,7 +48745,7 @@
|
|
|
48720
48745
|
* @returns {Object | void} Migration results
|
|
48721
48746
|
*/
|
|
48722
48747
|
processCollaborationMigrations() {
|
|
48723
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-
|
|
48748
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev12");
|
|
48724
48749
|
if (!this.options.ydoc) return;
|
|
48725
48750
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
48726
48751
|
let docVersion = metaMap.get("version");
|
|
@@ -48770,7 +48795,7 @@
|
|
|
48770
48795
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
48771
48796
|
}
|
|
48772
48797
|
if (!this.options.ydoc) {
|
|
48773
|
-
|
|
48798
|
+
this.initPagination();
|
|
48774
48799
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
48775
48800
|
}
|
|
48776
48801
|
}
|
|
@@ -48917,8 +48942,6 @@
|
|
|
48917
48942
|
this.on("contentError", this.options.onContentError);
|
|
48918
48943
|
this.on("exception", this.options.onException);
|
|
48919
48944
|
this.mount(this.options.element);
|
|
48920
|
-
this.initDefaultStyles();
|
|
48921
|
-
this.setDocumentMode(options2.documentMode);
|
|
48922
48945
|
if (this.options.isHeadless) return;
|
|
48923
48946
|
this.on("create", this.options.onCreate);
|
|
48924
48947
|
this.on("update", this.options.onUpdate);
|
|
@@ -48936,8 +48959,10 @@
|
|
|
48936
48959
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
48937
48960
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
48938
48961
|
this.initializeCollaborationData();
|
|
48962
|
+
this.initDefaultStyles();
|
|
48963
|
+
this.setDocumentMode(this.options.documentMode);
|
|
48939
48964
|
if (!this.options.ydoc) {
|
|
48940
|
-
|
|
48965
|
+
this.initPagination();
|
|
48941
48966
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
48942
48967
|
}
|
|
48943
48968
|
};
|
|
@@ -48984,7 +49009,7 @@
|
|
|
48984
49009
|
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
|
|
48985
49010
|
this.view.dispatch(tr);
|
|
48986
49011
|
setTimeout(() => {
|
|
48987
|
-
|
|
49012
|
+
this.initPagination();
|
|
48988
49013
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
48989
49014
|
}, 50);
|
|
48990
49015
|
};
|
|
@@ -49130,7 +49155,7 @@
|
|
|
49130
49155
|
this.options.onCollaborationReady({ editor, ydoc });
|
|
49131
49156
|
this.options.collaborationIsReady = true;
|
|
49132
49157
|
if (!this.options.isNewFile) {
|
|
49133
|
-
|
|
49158
|
+
this.initPagination();
|
|
49134
49159
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
49135
49160
|
}
|
|
49136
49161
|
};
|
|
@@ -49147,20 +49172,6 @@
|
|
|
49147
49172
|
dispatch(tr);
|
|
49148
49173
|
}, 50);
|
|
49149
49174
|
};
|
|
49150
|
-
initPagination_fn = async function() {
|
|
49151
|
-
if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
|
|
49152
|
-
return;
|
|
49153
|
-
}
|
|
49154
|
-
const pagination = this.options.extensions.find((e) => e.name === "pagination");
|
|
49155
|
-
if (pagination && this.options.pagination) {
|
|
49156
|
-
console.debug("🔗 [super-editor] Initializing pagination");
|
|
49157
|
-
const sectionData = await initPaginationData(this);
|
|
49158
|
-
this.storage.pagination.sectionData = sectionData;
|
|
49159
|
-
const { state: state2, dispatch } = this.view;
|
|
49160
|
-
const tr = state2.tr.setMeta(PaginationPluginKey, { isReadyToInit: true });
|
|
49161
|
-
dispatch(tr);
|
|
49162
|
-
}
|
|
49163
|
-
};
|
|
49164
49175
|
dispatchTransaction_fn = function(transaction) {
|
|
49165
49176
|
if (this.isDestroyed) return;
|
|
49166
49177
|
let state2;
|
|
@@ -61864,6 +61875,19 @@
|
|
|
61864
61875
|
return commands2.insertContent({
|
|
61865
61876
|
type: "hardBreak"
|
|
61866
61877
|
});
|
|
61878
|
+
},
|
|
61879
|
+
/**
|
|
61880
|
+
* Toggle pagination on/off
|
|
61881
|
+
* @returns {void}
|
|
61882
|
+
*/
|
|
61883
|
+
togglePagination: () => ({ tr, state: state2, dispatch, editor }) => {
|
|
61884
|
+
const isEnabled = PaginationPluginKey.getState(state2)?.isEnabled;
|
|
61885
|
+
tr.setMeta(PaginationPluginKey, { isEnabled: !isEnabled });
|
|
61886
|
+
if (dispatch) {
|
|
61887
|
+
dispatch(tr);
|
|
61888
|
+
editor.initDefaultStyles(editor.element, !isEnabled);
|
|
61889
|
+
return true;
|
|
61890
|
+
}
|
|
61867
61891
|
}
|
|
61868
61892
|
};
|
|
61869
61893
|
},
|
|
@@ -61889,11 +61913,21 @@
|
|
|
61889
61913
|
return {
|
|
61890
61914
|
isReadyToInit: false,
|
|
61891
61915
|
decorations: DecorationSet.empty,
|
|
61892
|
-
isDebugging
|
|
61916
|
+
isDebugging,
|
|
61917
|
+
isEnabled: editor.options.pagination
|
|
61893
61918
|
};
|
|
61894
61919
|
},
|
|
61895
61920
|
apply(tr, oldState, prevEditorState, newEditorState) {
|
|
61896
61921
|
const meta = tr.getMeta(PaginationPluginKey);
|
|
61922
|
+
if (meta && "isEnabled" in meta) {
|
|
61923
|
+
const newEnabled = meta.isEnabled;
|
|
61924
|
+
if (newEnabled) shouldUpdate = true;
|
|
61925
|
+
return {
|
|
61926
|
+
...oldState,
|
|
61927
|
+
decorations: newEnabled ? oldState.decorations : DecorationSet.empty,
|
|
61928
|
+
isEnabled: newEnabled
|
|
61929
|
+
};
|
|
61930
|
+
}
|
|
61897
61931
|
if (meta && meta.isReadyToInit) {
|
|
61898
61932
|
shouldUpdate = true;
|
|
61899
61933
|
shouldInitialize = meta.isReadyToInit;
|
|
@@ -61942,6 +61976,7 @@
|
|
|
61942
61976
|
let previousDecorations = DecorationSet.empty;
|
|
61943
61977
|
return {
|
|
61944
61978
|
update: (view2, prevState) => {
|
|
61979
|
+
if (!PaginationPluginKey.getState(view2.state)?.isEnabled) return;
|
|
61945
61980
|
if (!shouldUpdate || isUpdating) return;
|
|
61946
61981
|
isUpdating = true;
|
|
61947
61982
|
hasInitialized = true;
|
|
@@ -61953,7 +61988,8 @@
|
|
|
61953
61988
|
},
|
|
61954
61989
|
props: {
|
|
61955
61990
|
decorations(state2) {
|
|
61956
|
-
|
|
61991
|
+
const pluginState = PaginationPluginKey.getState(state2);
|
|
61992
|
+
return pluginState.isEnabled ? pluginState.decorations : DecorationSet.empty;
|
|
61957
61993
|
}
|
|
61958
61994
|
}
|
|
61959
61995
|
});
|
|
@@ -93599,7 +93635,7 @@ ${style2}
|
|
|
93599
93635
|
this.config.colors = shuffleArray(this.config.colors);
|
|
93600
93636
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
93601
93637
|
this.colorIndex = 0;
|
|
93602
|
-
this.version = "0.13.2-
|
|
93638
|
+
this.version = "0.13.2-rev12";
|
|
93603
93639
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
93604
93640
|
this.superdocId = config.superdocId || v4();
|
|
93605
93641
|
this.colors = this.config.colors;
|
|
@@ -93842,6 +93878,19 @@ ${style2}
|
|
|
93842
93878
|
doc2.rulers = this.config.rulers;
|
|
93843
93879
|
});
|
|
93844
93880
|
}
|
|
93881
|
+
/**
|
|
93882
|
+
* Toggle pagination for SuperEditors
|
|
93883
|
+
* @returns {void}
|
|
93884
|
+
*/
|
|
93885
|
+
togglePagination() {
|
|
93886
|
+
this.config.pagination = !this.config.pagination;
|
|
93887
|
+
this.superdocStore.documents.forEach((doc2) => {
|
|
93888
|
+
const editor = doc2.getEditor();
|
|
93889
|
+
if (editor) {
|
|
93890
|
+
editor.commands.togglePagination();
|
|
93891
|
+
}
|
|
93892
|
+
});
|
|
93893
|
+
}
|
|
93845
93894
|
#addToolbar() {
|
|
93846
93895
|
const moduleConfig = this.config.modules?.toolbar || {};
|
|
93847
93896
|
this.toolbarElement = this.config.modules?.toolbar?.selector || this.config.toolbar;
|