@harbour-enterprises/superdoc 0.24.0-next.3 → 0.24.0-next.5
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/{PdfViewer-skWUtg2N.cjs → PdfViewer-D6AmuQ3v.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DEWI6Uts.es.js → PdfViewer-XhwjWR8o.es.js} +1 -1
- package/dist/chunks/blank-docx-ABm6XYAA.es.js +4 -0
- package/dist/chunks/blank-docx-DfW3Eeh2.cjs +3 -0
- package/dist/chunks/{index-2QL0aZ2S.cjs → index-DAdhqIN8.cjs} +76 -12
- package/dist/chunks/{index-C_AMhrHP.es.js → index-OjiyjDUm.es.js} +76 -12
- package/dist/chunks/{super-editor.es-CfK_qBM9.cjs → super-editor.es-BPK2gF1W.cjs} +1489 -986
- package/dist/chunks/{super-editor.es-iMAoOYOw.es.js → super-editor.es-bHlpz8m_.es.js} +1489 -986
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/helpers/export.d.ts +1 -1
- package/dist/core/helpers/export.d.ts.map +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +37 -27
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BueCftlx.js → converter-D-9mYZ83.js} +1247 -967
- package/dist/super-editor/chunks/{docx-zipper-C9jmfWYZ.js → docx-zipper-C1p3F7Ok.js} +1 -1
- package/dist/super-editor/chunks/{editor-BsuNqVvp.js → editor-lJoa5ADp.js} +292 -47
- package/dist/super-editor/chunks/{toolbar-DxhfgAoa.js → toolbar-B5-QnQ4l.js} +2 -2
- package/dist/super-editor/converter.es.js +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/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +10 -0
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +11 -0
- package/dist/super-editor/super-editor/src/core/helpers/canRenderFont.d.ts +12 -0
- package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts +6 -1
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +5 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +4 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +9 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/gridSpan-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/header-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/hideMark-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/noWrap-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/shd/shd-translator.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/translate-table-cell.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/tcBorders-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/tcFitText-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/tcMar-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/tcPr-translator.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/tcW-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/textDirection-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/tl2br-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-helpers.d.ts +16 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/tr2bl-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/vAlign-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/vMerge-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +112 -0
- package/dist/super-editor/super-editor.es.js +91 -76
- 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 +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +1563 -996
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/blank-docx-CPqX9RF5.cjs +0 -3
- package/dist/chunks/blank-docx-iwdyG9RH.es.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1,
|
|
1
|
+
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-D-9mYZ83.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -9,12 +9,12 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
12
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFontsWithLocalFonts_fn, determineUnsupportedFontsWithCanvas_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-D-9mYZ83.js";
|
|
16
16
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
17
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
17
|
+
import { D as DocxZipper } from "./docx-zipper-C1p3F7Ok.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -13101,6 +13101,29 @@ const setImageNodeSelection = (view, pos) => {
|
|
|
13101
13101
|
}
|
|
13102
13102
|
return false;
|
|
13103
13103
|
};
|
|
13104
|
+
function canRenderFont(fontName, fallbackFont = "sans-serif") {
|
|
13105
|
+
const _canRenderFont = (fontName2, fallbackFont2) => {
|
|
13106
|
+
const canvas = document.createElement("canvas");
|
|
13107
|
+
const ctx = canvas.getContext("2d");
|
|
13108
|
+
ctx.textBaseline = "top";
|
|
13109
|
+
const text = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
13110
|
+
ctx.font = `72px ${fallbackFont2}`;
|
|
13111
|
+
const initialTextMeasurement = ctx.measureText(text);
|
|
13112
|
+
const fallbackWidth = initialTextMeasurement.width;
|
|
13113
|
+
const fallbackHeight = initialTextMeasurement.actualBoundingBoxDescent;
|
|
13114
|
+
ctx.font = `72px "${fontName2}", ${fallbackFont2}`;
|
|
13115
|
+
const customTextMeasurement = ctx.measureText(text);
|
|
13116
|
+
const customFontWidth = customTextMeasurement.width;
|
|
13117
|
+
const customFontHeight = customTextMeasurement.actualBoundingBoxDescent;
|
|
13118
|
+
const isAvailable = customFontWidth !== fallbackWidth || customFontHeight !== fallbackHeight;
|
|
13119
|
+
return isAvailable;
|
|
13120
|
+
};
|
|
13121
|
+
if (_canRenderFont(fontName, fallbackFont)) {
|
|
13122
|
+
return true;
|
|
13123
|
+
}
|
|
13124
|
+
const oppositeFallbackFont = fallbackFont === "sans-serif" ? "serif" : "sans-serif";
|
|
13125
|
+
return _canRenderFont(fontName, oppositeFallbackFont);
|
|
13126
|
+
}
|
|
13104
13127
|
const { findChildren: findChildren$3 } = helpers;
|
|
13105
13128
|
function getAllFieldAnnotations(state) {
|
|
13106
13129
|
let fieldAnnotations = findChildren$3(state.doc, (node) => node.type.name === "fieldAnnotation");
|
|
@@ -14193,6 +14216,11 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14193
14216
|
* @type {boolean}
|
|
14194
14217
|
*/
|
|
14195
14218
|
__publicField(this, "isFocused", false);
|
|
14219
|
+
/**
|
|
14220
|
+
* All the embedded fonts that were imported by the Editor
|
|
14221
|
+
* @type {string[]}
|
|
14222
|
+
*/
|
|
14223
|
+
__publicField(this, "fontsImported", []);
|
|
14196
14224
|
__publicField(this, "options", {
|
|
14197
14225
|
element: null,
|
|
14198
14226
|
selector: null,
|
|
@@ -14253,6 +14281,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14253
14281
|
onPaginationUpdate: () => null,
|
|
14254
14282
|
onException: () => null,
|
|
14255
14283
|
onListDefinitionsChange: () => null,
|
|
14284
|
+
onFontsResolved: null,
|
|
14256
14285
|
// async (file) => url;
|
|
14257
14286
|
handleImageUpload: null,
|
|
14258
14287
|
// telemetry
|
|
@@ -15238,6 +15267,9 @@ init_fn = function() {
|
|
|
15238
15267
|
this.emit("beforeCreate", { editor: this });
|
|
15239
15268
|
this.on("contentError", this.options.onContentError);
|
|
15240
15269
|
this.mount(this.options.element);
|
|
15270
|
+
if (!this.options.isHeadless) {
|
|
15271
|
+
__privateMethod(this, _Editor_instances, checkFonts_fn).call(this);
|
|
15272
|
+
}
|
|
15241
15273
|
this.on("create", this.options.onCreate);
|
|
15242
15274
|
this.on("update", this.options.onUpdate);
|
|
15243
15275
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
@@ -15438,13 +15470,90 @@ initMedia_fn = function() {
|
|
|
15438
15470
|
* @returns {void}
|
|
15439
15471
|
*/
|
|
15440
15472
|
initFonts_fn = function() {
|
|
15441
|
-
const
|
|
15442
|
-
if (styleString?.length) {
|
|
15473
|
+
const results = this.converter.getFontFaceImportString();
|
|
15474
|
+
if (results?.styleString?.length) {
|
|
15443
15475
|
const style = document.createElement("style");
|
|
15444
|
-
style.textContent = styleString;
|
|
15476
|
+
style.textContent = results.styleString;
|
|
15445
15477
|
document.head.appendChild(style);
|
|
15478
|
+
this.fontsImported = results.fontsImported;
|
|
15479
|
+
}
|
|
15480
|
+
};
|
|
15481
|
+
checkFonts_fn = async function() {
|
|
15482
|
+
if (!this.options.onFontsResolved || typeof this.options.onFontsResolved !== "function") {
|
|
15483
|
+
return;
|
|
15484
|
+
}
|
|
15485
|
+
if (this.options.isHeadless) {
|
|
15486
|
+
return;
|
|
15487
|
+
}
|
|
15488
|
+
const fontsUsedInDocument = this.converter.getDocumentFonts();
|
|
15489
|
+
if (!("queryLocalFonts" in window)) {
|
|
15490
|
+
console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
|
|
15491
|
+
const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
15492
|
+
this.options.onFontsResolved({
|
|
15493
|
+
documentFonts: fontsUsedInDocument,
|
|
15494
|
+
unsupportedFonts
|
|
15495
|
+
});
|
|
15496
|
+
return;
|
|
15497
|
+
}
|
|
15498
|
+
const localFontAccess = await navigator.permissions.query({ name: "local-fonts" });
|
|
15499
|
+
if (localFontAccess.state === "denied") {
|
|
15500
|
+
console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
|
|
15501
|
+
const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
15502
|
+
this.options.onFontsResolved({
|
|
15503
|
+
documentFonts: fontsUsedInDocument,
|
|
15504
|
+
unsupportedFonts
|
|
15505
|
+
});
|
|
15506
|
+
return;
|
|
15507
|
+
}
|
|
15508
|
+
try {
|
|
15509
|
+
const localFonts = await window.queryLocalFonts();
|
|
15510
|
+
const uniqueLocalFonts = [...new Set(localFonts.map((font) => font.family))];
|
|
15511
|
+
const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithLocalFonts_fn).call(this, fontsUsedInDocument, uniqueLocalFonts);
|
|
15512
|
+
this.options.onFontsResolved({
|
|
15513
|
+
documentFonts: fontsUsedInDocument,
|
|
15514
|
+
unsupportedFonts
|
|
15515
|
+
});
|
|
15516
|
+
} catch {
|
|
15517
|
+
console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
|
|
15518
|
+
const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
15519
|
+
this.options.onFontsResolved({
|
|
15520
|
+
documentFonts: fontsUsedInDocument,
|
|
15521
|
+
unsupportedFonts
|
|
15522
|
+
});
|
|
15446
15523
|
}
|
|
15447
15524
|
};
|
|
15525
|
+
/**
|
|
15526
|
+
* Determines which fonts used in the document are not available locally nor imported.
|
|
15527
|
+
*
|
|
15528
|
+
* @param {string[]} fonts - Array of font family names used in the document.
|
|
15529
|
+
* @param {string[]} localFonts - Array of local font family names available on the system.
|
|
15530
|
+
* @returns {string[]} Array of font names that are unsupported.
|
|
15531
|
+
*/
|
|
15532
|
+
determineUnsupportedFontsWithLocalFonts_fn = function(fonts, localFonts) {
|
|
15533
|
+
const unsupportedFonts = fonts.filter((font) => {
|
|
15534
|
+
const isLocalFont = localFonts.includes(font);
|
|
15535
|
+
const isFontImported = this.fontsImported.includes(font);
|
|
15536
|
+
return !isLocalFont && !isFontImported;
|
|
15537
|
+
});
|
|
15538
|
+
return unsupportedFonts;
|
|
15539
|
+
};
|
|
15540
|
+
/**
|
|
15541
|
+
* Determines which fonts used in the document are not supported
|
|
15542
|
+
* by attempting to render them on a canvas.
|
|
15543
|
+
* Fonts are considered unsupported if they cannot be rendered
|
|
15544
|
+
* and are not already imported in the document via @font-face.
|
|
15545
|
+
*
|
|
15546
|
+
* @param {string[]} fonts - Array of font family names used in the document.
|
|
15547
|
+
* @returns {string[]} Array of unsupported font family names.
|
|
15548
|
+
*/
|
|
15549
|
+
determineUnsupportedFontsWithCanvas_fn = function(fonts) {
|
|
15550
|
+
const unsupportedFonts = fonts.filter((font) => {
|
|
15551
|
+
const canRender = canRenderFont(font);
|
|
15552
|
+
const isFontImported = this.fontsImported.includes(font);
|
|
15553
|
+
return !canRender && !isFontImported;
|
|
15554
|
+
});
|
|
15555
|
+
return unsupportedFonts;
|
|
15556
|
+
};
|
|
15448
15557
|
/**
|
|
15449
15558
|
* Creates document PM schema.
|
|
15450
15559
|
* @returns {void}
|
|
@@ -21014,8 +21123,11 @@ const HardBreak = Node$1.create({
|
|
|
21014
21123
|
}
|
|
21015
21124
|
});
|
|
21016
21125
|
const getColStyleDeclaration = (minWidth, width) => {
|
|
21017
|
-
if (width) {
|
|
21018
|
-
|
|
21126
|
+
if (width != null) {
|
|
21127
|
+
const numericWidth = Number(width);
|
|
21128
|
+
if (Number.isFinite(numericWidth) && numericWidth >= 0) {
|
|
21129
|
+
return ["width", `${numericWidth}px`];
|
|
21130
|
+
}
|
|
21019
21131
|
}
|
|
21020
21132
|
return ["min-width", `${minWidth}px`];
|
|
21021
21133
|
};
|
|
@@ -21037,7 +21149,7 @@ const createTableView = ({ editor }) => {
|
|
|
21037
21149
|
this.table = this.dom.appendChild(document.createElement("table"));
|
|
21038
21150
|
this.colgroup = this.table.appendChild(document.createElement("colgroup"));
|
|
21039
21151
|
updateTable(this.editor, this.node, this.table);
|
|
21040
|
-
updateColumns(node, this.colgroup, this.table, cellMinWidth);
|
|
21152
|
+
updateColumns(node, this.colgroup, this.table, cellMinWidth, void 0, void 0, this.editor);
|
|
21041
21153
|
this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
21042
21154
|
setTimeout(() => {
|
|
21043
21155
|
updateTableWrapper(this.dom, this.table);
|
|
@@ -21049,7 +21161,7 @@ const createTableView = ({ editor }) => {
|
|
|
21049
21161
|
}
|
|
21050
21162
|
this.node = node;
|
|
21051
21163
|
updateTable(this.editor, node, this.table);
|
|
21052
|
-
updateColumns(node, this.colgroup, this.table, this.cellMinWidth);
|
|
21164
|
+
updateColumns(node, this.colgroup, this.table, this.cellMinWidth, void 0, void 0, this.editor);
|
|
21053
21165
|
updateTableWrapper(this.dom, this.table);
|
|
21054
21166
|
return true;
|
|
21055
21167
|
}
|
|
@@ -21062,46 +21174,105 @@ const createTableView = ({ editor }) => {
|
|
|
21062
21174
|
}
|
|
21063
21175
|
};
|
|
21064
21176
|
};
|
|
21065
|
-
function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21177
|
+
function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue, editor) {
|
|
21178
|
+
const gridColumns = Array.isArray(node.attrs?.grid) && node.attrs.grid.length ? node.attrs.grid.map((col) => twipsToPixels(col.col)) : null;
|
|
21179
|
+
const totalColumns = gridColumns?.length ?? null;
|
|
21180
|
+
const pageBody = table.closest(".page__body");
|
|
21181
|
+
const wrapper = table.parentElement;
|
|
21182
|
+
let availableWidth = pageBody?.getBoundingClientRect?.().width;
|
|
21183
|
+
if (!availableWidth && wrapper) {
|
|
21184
|
+
availableWidth = wrapper.getBoundingClientRect().width;
|
|
21185
|
+
}
|
|
21186
|
+
if (typeof availableWidth === "number" && !Number.isNaN(availableWidth)) {
|
|
21187
|
+
availableWidth = Math.max(availableWidth - 2, 0);
|
|
21188
|
+
} else {
|
|
21189
|
+
availableWidth = null;
|
|
21190
|
+
}
|
|
21191
|
+
const pageStyles = editor?.converter?.pageStyles;
|
|
21192
|
+
if (pageStyles?.pageSize?.width) {
|
|
21193
|
+
const toNumber = (v) => typeof v === "number" ? v : parseFloat(v) || 0;
|
|
21194
|
+
const pageWidth = toNumber(pageStyles.pageSize.width);
|
|
21195
|
+
const marginLeft = toNumber(pageStyles.pageMargins?.left);
|
|
21196
|
+
const marginRight = toNumber(pageStyles.pageMargins?.right);
|
|
21197
|
+
const pageAvailableWidthPx = Math.max((pageWidth - marginLeft - marginRight) * PIXELS_PER_INCH, 0);
|
|
21198
|
+
if (pageAvailableWidthPx > 0) {
|
|
21199
|
+
availableWidth = availableWidth ? Math.min(availableWidth, pageAvailableWidthPx) : pageAvailableWidthPx;
|
|
21200
|
+
}
|
|
21201
|
+
}
|
|
21202
|
+
const resolveColumnWidth = (colIndex2, colwidthValue) => {
|
|
21203
|
+
if (overrideCol === colIndex2) return overrideValue;
|
|
21204
|
+
if (colwidthValue != null) return colwidthValue;
|
|
21205
|
+
if (gridColumns && gridColumns[colIndex2] != null) return gridColumns[colIndex2];
|
|
21206
|
+
return null;
|
|
21207
|
+
};
|
|
21208
|
+
const widths = [];
|
|
21069
21209
|
const row = node.firstChild;
|
|
21210
|
+
let colIndex = 0;
|
|
21070
21211
|
if (row !== null) {
|
|
21071
|
-
for (let i = 0
|
|
21072
|
-
const
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
totalWidth += hasWidth || cellMinWidth;
|
|
21077
|
-
if (!hasWidth) fixedWidth = false;
|
|
21078
|
-
if (!nextDOM) {
|
|
21079
|
-
const col2 = document.createElement("col");
|
|
21080
|
-
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth, hasWidth);
|
|
21081
|
-
col2.style.setProperty(propKey, propVal);
|
|
21082
|
-
colgroup.appendChild(col2);
|
|
21083
|
-
} else {
|
|
21084
|
-
if (nextDOM.style.width !== cssWidth) {
|
|
21085
|
-
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth, hasWidth);
|
|
21086
|
-
nextDOM.style.setProperty(propKey, propVal);
|
|
21087
|
-
}
|
|
21088
|
-
nextDOM = nextDOM.nextSibling;
|
|
21089
|
-
}
|
|
21212
|
+
for (let i = 0; i < row.childCount; i++) {
|
|
21213
|
+
const child = row.child(i);
|
|
21214
|
+
const { colspan, colwidth } = child.attrs;
|
|
21215
|
+
for (let span = 0; span < colspan; span += 1, colIndex += 1) {
|
|
21216
|
+
widths.push(resolveColumnWidth(colIndex, colwidth && colwidth[span]));
|
|
21090
21217
|
}
|
|
21091
21218
|
}
|
|
21092
21219
|
}
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21220
|
+
if (totalColumns != null && colIndex < totalColumns) {
|
|
21221
|
+
for (let col = colIndex; col < totalColumns; col += 1) {
|
|
21222
|
+
widths.push(resolveColumnWidth(col));
|
|
21223
|
+
}
|
|
21097
21224
|
}
|
|
21098
|
-
|
|
21099
|
-
|
|
21225
|
+
const normalizedWidths = widths.map((widthPx) => {
|
|
21226
|
+
const numericWidth = Number(widthPx);
|
|
21227
|
+
if (!Number.isFinite(numericWidth)) return null;
|
|
21228
|
+
if (numericWidth < 0) return null;
|
|
21229
|
+
if (numericWidth === 0) return 0;
|
|
21230
|
+
if (numericWidth < 1) return 0;
|
|
21231
|
+
return numericWidth;
|
|
21232
|
+
});
|
|
21233
|
+
const rawTotalWidth = normalizedWidths.reduce((sum, width) => sum + (width != null ? width : cellMinWidth), 0);
|
|
21234
|
+
let scale = 1;
|
|
21235
|
+
if (availableWidth && rawTotalWidth > 0 && rawTotalWidth > availableWidth) {
|
|
21236
|
+
scale = availableWidth / rawTotalWidth;
|
|
21237
|
+
}
|
|
21238
|
+
let totalWidth = 0;
|
|
21239
|
+
let hasUndefinedWidth = false;
|
|
21240
|
+
let dom = colgroup.firstChild;
|
|
21241
|
+
normalizedWidths.forEach((width) => {
|
|
21242
|
+
let scaledWidth = width;
|
|
21243
|
+
if (scaledWidth != null) {
|
|
21244
|
+
scaledWidth = scaledWidth * scale;
|
|
21245
|
+
}
|
|
21246
|
+
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth, scaledWidth);
|
|
21247
|
+
if (scaledWidth == null) {
|
|
21248
|
+
totalWidth += cellMinWidth;
|
|
21249
|
+
hasUndefinedWidth = true;
|
|
21250
|
+
} else {
|
|
21251
|
+
totalWidth += scaledWidth;
|
|
21252
|
+
}
|
|
21253
|
+
if (!dom) {
|
|
21254
|
+
const colElement = document.createElement("col");
|
|
21255
|
+
colElement.style.setProperty(propKey, propVal);
|
|
21256
|
+
colgroup.appendChild(colElement);
|
|
21257
|
+
} else {
|
|
21258
|
+
dom.style.setProperty(propKey, propVal);
|
|
21259
|
+
dom = dom.nextSibling;
|
|
21260
|
+
}
|
|
21261
|
+
});
|
|
21262
|
+
while (dom) {
|
|
21263
|
+
const next = dom.nextSibling;
|
|
21264
|
+
dom.parentNode?.removeChild(dom);
|
|
21265
|
+
dom = next;
|
|
21266
|
+
}
|
|
21267
|
+
if (scale < 1 || !hasUndefinedWidth) {
|
|
21268
|
+
const clampedWidth = Math.min(totalWidth, availableWidth || totalWidth);
|
|
21269
|
+
table.style.width = `${clampedWidth}px`;
|
|
21100
21270
|
table.style.minWidth = "";
|
|
21101
21271
|
} else {
|
|
21102
21272
|
table.style.width = "";
|
|
21103
21273
|
table.style.minWidth = `${totalWidth}px`;
|
|
21104
21274
|
}
|
|
21275
|
+
table.style.maxWidth = "100%";
|
|
21105
21276
|
}
|
|
21106
21277
|
function updateTable(editor, node, table) {
|
|
21107
21278
|
const allExtensionsAttrs = editor.extensionService.attributes;
|
|
@@ -21179,22 +21350,61 @@ const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent =
|
|
|
21179
21350
|
const tableBorders = createTableBorders();
|
|
21180
21351
|
return types.table.createChecked({ borders: tableBorders }, rows);
|
|
21181
21352
|
};
|
|
21353
|
+
const MIN_MEANINGFUL_WIDTH_PX = 1;
|
|
21182
21354
|
const createColGroup = (node, cellMinWidth, overrideCol, overrideValue) => {
|
|
21183
21355
|
let totalWidth = 0;
|
|
21184
21356
|
let fixedWidth = true;
|
|
21185
21357
|
const cols = [];
|
|
21186
21358
|
const colsValues = [];
|
|
21187
21359
|
const row = node.firstChild;
|
|
21360
|
+
const gridColumns = Array.isArray(node.attrs?.grid) && node.attrs.grid.length ? node.attrs.grid.map((col) => twipsToPixels(col.col)) : null;
|
|
21188
21361
|
if (!row) return {};
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21362
|
+
const totalColumns = gridColumns?.length;
|
|
21363
|
+
const resolveColumnWidth = (colIndex2, colwidthValue) => {
|
|
21364
|
+
if (overrideCol === colIndex2) return overrideValue;
|
|
21365
|
+
if (colwidthValue != null) return colwidthValue;
|
|
21366
|
+
if (gridColumns && gridColumns[colIndex2] != null) return gridColumns[colIndex2];
|
|
21367
|
+
return null;
|
|
21368
|
+
};
|
|
21369
|
+
let colIndex = 0;
|
|
21370
|
+
for (let i = 0; i < row.childCount; i++) {
|
|
21371
|
+
const child = row.child(i);
|
|
21372
|
+
const { colspan, colwidth } = child.attrs;
|
|
21373
|
+
for (let j = 0; j < colspan; j++, colIndex++) {
|
|
21374
|
+
const candidateWidth = resolveColumnWidth(colIndex, colwidth && colwidth[j]);
|
|
21375
|
+
const numericWidth = Number(candidateWidth);
|
|
21376
|
+
let effectiveWidth = Number.isFinite(numericWidth) && numericWidth > 0 ? numericWidth : null;
|
|
21377
|
+
if (effectiveWidth != null && effectiveWidth < MIN_MEANINGFUL_WIDTH_PX) {
|
|
21378
|
+
effectiveWidth = 0;
|
|
21379
|
+
}
|
|
21380
|
+
if (effectiveWidth == null) {
|
|
21381
|
+
totalWidth += cellMinWidth;
|
|
21382
|
+
fixedWidth = false;
|
|
21383
|
+
} else {
|
|
21384
|
+
totalWidth += effectiveWidth;
|
|
21385
|
+
}
|
|
21386
|
+
const [prop, value] = getColStyleDeclaration(cellMinWidth, effectiveWidth);
|
|
21387
|
+
cols.push(["col", { style: `${prop}: ${value}` }]);
|
|
21388
|
+
colsValues.push(parseFloat(value));
|
|
21389
|
+
}
|
|
21390
|
+
}
|
|
21391
|
+
if (totalColumns != null) {
|
|
21392
|
+
for (let col = colIndex; col < totalColumns; col++) {
|
|
21393
|
+
const candidateWidth = resolveColumnWidth(col);
|
|
21394
|
+
const numericWidth = Number(candidateWidth);
|
|
21395
|
+
let effectiveWidth = Number.isFinite(numericWidth) && numericWidth > 0 ? numericWidth : null;
|
|
21396
|
+
if (effectiveWidth != null && effectiveWidth < MIN_MEANINGFUL_WIDTH_PX) {
|
|
21397
|
+
effectiveWidth = 0;
|
|
21398
|
+
}
|
|
21399
|
+
if (effectiveWidth == null) {
|
|
21400
|
+
totalWidth += cellMinWidth;
|
|
21401
|
+
fixedWidth = false;
|
|
21402
|
+
} else {
|
|
21403
|
+
totalWidth += effectiveWidth;
|
|
21404
|
+
}
|
|
21405
|
+
const [prop, value] = getColStyleDeclaration(cellMinWidth, effectiveWidth);
|
|
21196
21406
|
cols.push(["col", { style: `${prop}: ${value}` }]);
|
|
21197
|
-
colsValues.push(
|
|
21407
|
+
colsValues.push(parseFloat(value));
|
|
21198
21408
|
}
|
|
21199
21409
|
}
|
|
21200
21410
|
const tableWidth = fixedWidth ? `${totalWidth}px` : "";
|
|
@@ -24097,6 +24307,19 @@ const TableHeader = Node$1.create({
|
|
|
24097
24307
|
"data-colwidth": attrs.colwidth.join(",")
|
|
24098
24308
|
};
|
|
24099
24309
|
}
|
|
24310
|
+
},
|
|
24311
|
+
__placeholder: {
|
|
24312
|
+
default: null,
|
|
24313
|
+
parseDOM: (element) => {
|
|
24314
|
+
const value = element.getAttribute("data-placeholder");
|
|
24315
|
+
return value || null;
|
|
24316
|
+
},
|
|
24317
|
+
renderDOM({ __placeholder }) {
|
|
24318
|
+
if (!__placeholder) return {};
|
|
24319
|
+
return {
|
|
24320
|
+
"data-placeholder": __placeholder
|
|
24321
|
+
};
|
|
24322
|
+
}
|
|
24100
24323
|
}
|
|
24101
24324
|
};
|
|
24102
24325
|
},
|
|
@@ -24256,6 +24479,28 @@ const TableCell = Node$1.create({
|
|
|
24256
24479
|
widthUnit: {
|
|
24257
24480
|
default: "px",
|
|
24258
24481
|
rendered: false
|
|
24482
|
+
},
|
|
24483
|
+
__placeholder: {
|
|
24484
|
+
default: null,
|
|
24485
|
+
parseDOM: (element) => {
|
|
24486
|
+
const value = element.getAttribute("data-placeholder");
|
|
24487
|
+
return value || null;
|
|
24488
|
+
},
|
|
24489
|
+
renderDOM({ __placeholder }) {
|
|
24490
|
+
if (!__placeholder) return {};
|
|
24491
|
+
return {
|
|
24492
|
+
"data-placeholder": __placeholder
|
|
24493
|
+
};
|
|
24494
|
+
}
|
|
24495
|
+
},
|
|
24496
|
+
/**
|
|
24497
|
+
* @category Attribute
|
|
24498
|
+
* @param {TableCellProperties} tableCellProperties - Properties for the table cell.
|
|
24499
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 463
|
|
24500
|
+
*/
|
|
24501
|
+
tableCellProperties: {
|
|
24502
|
+
default: null,
|
|
24503
|
+
rendered: false
|
|
24259
24504
|
}
|
|
24260
24505
|
};
|
|
24261
24506
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-D-9mYZ83.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-lJoa5ADp.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E } from "./chunks/editor-
|
|
2
|
-
import "./chunks/converter-
|
|
3
|
-
import "./chunks/docx-zipper-
|
|
1
|
+
import { E } from "./chunks/editor-lJoa5ADp.js";
|
|
2
|
+
import "./chunks/converter-D-9mYZ83.js";
|
|
3
|
+
import "./chunks/docx-zipper-C1p3F7Ok.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -592,6 +592,16 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
592
592
|
box-sizing: border-box;
|
|
593
593
|
overflow-wrap: anywhere;
|
|
594
594
|
}
|
|
595
|
+
.ProseMirror td[data-placeholder],
|
|
596
|
+
.ProseMirror th[data-placeholder] {
|
|
597
|
+
padding: 0 !important;
|
|
598
|
+
border: 0 !important;
|
|
599
|
+
background: transparent !important;
|
|
600
|
+
}
|
|
601
|
+
.ProseMirror td[data-placeholder] > *,
|
|
602
|
+
.ProseMirror th[data-placeholder] > * {
|
|
603
|
+
display: none !important;
|
|
604
|
+
}
|
|
595
605
|
.ProseMirror th {
|
|
596
606
|
font-weight: bold;
|
|
597
607
|
text-align: left;
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
* @property {Function} [onPaginationUpdate] - Called when pagination updates
|
|
83
83
|
* @property {Function} [onException] - Called when an exception occurs
|
|
84
84
|
* @property {Function} [onListDefinitionsChange] - Called when list definitions change
|
|
85
|
+
* @property {Function} [onFontsResolved] - Called when all fonts used in the document are determined
|
|
85
86
|
* @property {Function} [handleImageUpload] - Handler for image uploads
|
|
86
87
|
* @property {Object} [telemetry] - Telemetry configuration
|
|
87
88
|
* @property {boolean} [suppressDefaultDocxStyles] - Prevent default styles from being applied in docx mode
|
|
@@ -173,6 +174,11 @@ export class Editor extends EventEmitter {
|
|
|
173
174
|
* @type {boolean}
|
|
174
175
|
*/
|
|
175
176
|
isFocused: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* All the embedded fonts that were imported by the Editor
|
|
179
|
+
* @type {string[]}
|
|
180
|
+
*/
|
|
181
|
+
fontsImported: string[];
|
|
176
182
|
options: {
|
|
177
183
|
element: any;
|
|
178
184
|
selector: any;
|
|
@@ -232,6 +238,7 @@ export class Editor extends EventEmitter {
|
|
|
232
238
|
onPaginationUpdate: () => any;
|
|
233
239
|
onException: () => any;
|
|
234
240
|
onListDefinitionsChange: () => any;
|
|
241
|
+
onFontsResolved: any;
|
|
235
242
|
handleImageUpload: any;
|
|
236
243
|
telemetry: any;
|
|
237
244
|
customUpdatedFiles: {};
|
|
@@ -850,6 +857,10 @@ export type EditorOptions = {
|
|
|
850
857
|
* - Called when list definitions change
|
|
851
858
|
*/
|
|
852
859
|
onListDefinitionsChange?: Function;
|
|
860
|
+
/**
|
|
861
|
+
* - Called when all fonts used in the document are determined
|
|
862
|
+
*/
|
|
863
|
+
onFontsResolved?: Function;
|
|
853
864
|
/**
|
|
854
865
|
* - Handler for image uploads
|
|
855
866
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given font can be rendered on the browser
|
|
3
|
+
*
|
|
4
|
+
* @param {string} fontName - The name of the font to check for availability.
|
|
5
|
+
* @returns {boolean} True if the font can be rendered, false otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* if (canRenderFont('Arial')) {
|
|
9
|
+
* // Use Arial font
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export function canRenderFont(fontName: string, fallbackFont?: string): boolean;
|
|
@@ -89,6 +89,7 @@ export class SuperConverter {
|
|
|
89
89
|
fonts: any;
|
|
90
90
|
addedMedia: {};
|
|
91
91
|
comments: any[];
|
|
92
|
+
inlineDocumentFonts: any[];
|
|
92
93
|
docHiglightColors: Set<any>;
|
|
93
94
|
xml: any;
|
|
94
95
|
numbering: {};
|
|
@@ -155,7 +156,11 @@ export class SuperConverter {
|
|
|
155
156
|
*/
|
|
156
157
|
promoteToGuid(): any;
|
|
157
158
|
getDocumentDefaultStyles(): {};
|
|
158
|
-
getDocumentFonts():
|
|
159
|
+
getDocumentFonts(): any[];
|
|
160
|
+
getFontFaceImportString(): {
|
|
161
|
+
styleString: string;
|
|
162
|
+
fontsImported: any[];
|
|
163
|
+
};
|
|
159
164
|
getDocumentInternalId(): void;
|
|
160
165
|
createDocumentIdElement(): {
|
|
161
166
|
type: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const PIXELS_PER_INCH: 96;
|
|
1
2
|
export function inchesToTwips(inches: any): number;
|
|
2
3
|
export function twipsToInches(twips: any): number;
|
|
3
4
|
export function twipsToPixels(twips: any): number;
|
|
@@ -11,7 +12,7 @@ export function emuToPixels(emu: any): number;
|
|
|
11
12
|
export function pixelsToEmu(px: any): number;
|
|
12
13
|
export function pixelsToHalfPoints(pixels: any): number;
|
|
13
14
|
export function halfPointToPoints(halfPoints: any): number;
|
|
14
|
-
export function
|
|
15
|
+
export function eighthPointsToPixels(eighthPoints: any): number;
|
|
15
16
|
export function pixelsToEightPoints(pixels: any): number;
|
|
16
17
|
export function rotToDegrees(rot: any): number;
|
|
17
18
|
export function degreesToRot(degrees: any): number;
|
package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function createDocumentJson(docx: ParsedDocx, converter: SuperConverter,
|
|
|
29
29
|
pageStyles: any;
|
|
30
30
|
} | null;
|
|
31
31
|
export function defaultNodeListHandler(): {
|
|
32
|
-
handler: ({ nodes: elements, docx, insideTrackChange, converter, editor, filename, parentStyleId, lists, path, }: {
|
|
32
|
+
handler: ({ nodes: elements, docx, insideTrackChange, converter, editor, filename, parentStyleId, lists, inlineDocumentFonts, path, }: {
|
|
33
33
|
nodes: any;
|
|
34
34
|
docx: any;
|
|
35
35
|
insideTrackChange: any;
|
|
@@ -38,6 +38,7 @@ export function defaultNodeListHandler(): {
|
|
|
38
38
|
filename: any;
|
|
39
39
|
parentStyleId: any;
|
|
40
40
|
lists: any;
|
|
41
|
+
inlineDocumentFonts: any;
|
|
41
42
|
path?: any[];
|
|
42
43
|
}) => any[];
|
|
43
44
|
handlerEntities: any[];
|
package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* @param tblStyleTag
|
|
4
4
|
* @param {ParsedDocx} docx
|
|
5
5
|
* @param {NodeListHandler} nodeListHandler
|
|
6
|
-
* @returns {{
|
|
6
|
+
* @returns {{borders: {}, name: *, rowBorders: {}, fonts: *, justification: *, cellMargins: {}, fontSize: *}|null}
|
|
7
7
|
*/
|
|
8
8
|
export function getReferencedTableStyles(tblStyleTag: any, docx: ParsedDocx): {
|
|
9
|
-
uiPriotity: any;
|
|
10
9
|
borders: {};
|
|
11
10
|
name: any;
|
|
12
11
|
rowBorders: {};
|
|
13
|
-
|
|
12
|
+
fonts: any;
|
|
13
|
+
justification: any;
|
|
14
|
+
cellMargins: {};
|
|
15
|
+
fontSize: any;
|
|
14
16
|
} | null;
|
|
15
17
|
/**
|
|
16
18
|
* @type {import("docxImporter").NodeHandlerEntry}
|