@harbour-enterprises/superdoc 0.17.0 → 0.18.0-next.1
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-GP6I2zIW.cjs → PdfViewer-CNZTqGHw.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C9MkdsYe.es.js → PdfViewer-D5cujgSt.es.js} +1 -1
- package/dist/chunks/{index-DyzJFuXw.es.js → index-BDwD6Uex.es.js} +4 -3
- package/dist/chunks/{index-D__8AUF5.cjs → index-BDysJRQU.cjs} +4 -3
- package/dist/chunks/{super-editor.es-v-3xRSOD.es.js → super-editor.es-BoCmoEkp.es.js} +472 -257
- package/dist/chunks/{super-editor.es-JiSMNI00.cjs → super-editor.es-aOm7eWFU.cjs} +471 -256
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-WThahWt0.js → converter-DvdFP4MZ.js} +339 -146
- package/dist/super-editor/chunks/{docx-zipper-6iJv_uCL.js → docx-zipper-CxFpxZUz.js} +1 -1
- package/dist/super-editor/chunks/{editor-OX-YyKoc.js → editor-CeWNMKjc.js} +32 -4
- package/dist/super-editor/chunks/{toolbar-CUglet_U.js → toolbar-Di2oAvyr.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/src/core/super-converter/exporter.d.ts +17 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/lineBreakImporter.d.ts +3 -5
- package/dist/super-editor/src/core/super-converter/v2/importer/tabImporter.d.ts +2 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +75 -0
- package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-clear.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-line-break-type.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/br-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/index.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-leader.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-pos.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-size.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/tab-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +203 -0
- package/dist/super-editor/src/extensions/block-node/block-node.d.ts +0 -1
- package/dist/super-editor/src/index.d.ts +2 -1
- package/dist/super-editor/super-editor.es.js +12 -7
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -1
- package/dist/super-editor.es.js +2 -1
- package/dist/superdoc.cjs +3 -2
- package/dist/superdoc.es.js +3 -2
- package/dist/superdoc.umd.js +594 -378
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/core/super-converter/v2/handlers/index.d.ts +0 -1
- package/dist/super-editor/src/extensions/field-annotation/field-annotation-marks-impl.d.ts +0 -5
- /package/dist/super-editor/src/{extensions/document-attributes → core/super-converter/v3/handlers/types}/index.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as process$1, av as commonjsGlobal, I as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-
|
|
1
|
+
import { H as process$1, av as commonjsGlobal, I as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-DvdFP4MZ.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
|
}
|
|
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
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, 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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_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, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1,
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, o as Slice, F as Fragment, R as ReplaceAroundStep$1, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, L as ListHelpers, y as findParentNode, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as helpers, a2 as posToDOMRect, a3 as CommandService, a4 as SuperConverter, a5 as createDocument, a6 as createDocFromMarkdown, a7 as createDocFromHTML, a8 as EditorState, a9 as hasSomeParentWithClass, aa as isActive, ab as unflattenListsInHtml, ac as parseSizeUnit, ad as minMax, ae as getLineHeightValueString, af as InputRule, ag as kebabCase, ah as findParentNodeClosestToPos, ai as getListItemStyleDefinitions, aj as docxNumberigHelpers, ak as parseIndentElement, al as combineIndents, am as StepMap, an as getColStyleDeclaration, ao as SelectionRange, ap as Transform, aq as isInTable$1, ar as createColGroup, as as generateDocxRandomId, at as insertNewRelationship, au as htmlHandler } from "./converter-DvdFP4MZ.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-CxFpxZUz.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -14353,7 +14353,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14353
14353
|
* @returns {Object | void} Migration results
|
|
14354
14354
|
*/
|
|
14355
14355
|
processCollaborationMigrations() {
|
|
14356
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
14356
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.17.0");
|
|
14357
14357
|
if (!this.options.ydoc) return;
|
|
14358
14358
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14359
14359
|
let docVersion = metaMap.get("version");
|
|
@@ -18640,6 +18640,22 @@ const LineBreak = Node$1.create({
|
|
|
18640
18640
|
renderDOM() {
|
|
18641
18641
|
return ["br", {}];
|
|
18642
18642
|
},
|
|
18643
|
+
addAttributes() {
|
|
18644
|
+
return {
|
|
18645
|
+
/**
|
|
18646
|
+
* @private
|
|
18647
|
+
* @category Attribute
|
|
18648
|
+
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
18649
|
+
*/
|
|
18650
|
+
lineBreakType: { rendered: false },
|
|
18651
|
+
/**
|
|
18652
|
+
* @private
|
|
18653
|
+
* @category Attribute
|
|
18654
|
+
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
18655
|
+
*/
|
|
18656
|
+
clear: { rendered: false }
|
|
18657
|
+
};
|
|
18658
|
+
},
|
|
18643
18659
|
addCommands() {
|
|
18644
18660
|
return {
|
|
18645
18661
|
/**
|
|
@@ -18696,7 +18712,19 @@ const HardBreak = Node$1.create({
|
|
|
18696
18712
|
pageBreakType: {
|
|
18697
18713
|
default: null,
|
|
18698
18714
|
rendered: false
|
|
18699
|
-
}
|
|
18715
|
+
},
|
|
18716
|
+
/**
|
|
18717
|
+
* @private
|
|
18718
|
+
* @category Attribute
|
|
18719
|
+
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
18720
|
+
*/
|
|
18721
|
+
lineBreakType: { rendered: false },
|
|
18722
|
+
/**
|
|
18723
|
+
* @private
|
|
18724
|
+
* @category Attribute
|
|
18725
|
+
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
18726
|
+
*/
|
|
18727
|
+
clear: { rendered: false }
|
|
18700
18728
|
};
|
|
18701
18729
|
},
|
|
18702
18730
|
parseDOM() {
|
|
@@ -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 { H as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { H as process$1 } from "./converter-DvdFP4MZ.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CeWNMKjc.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-CeWNMKjc.js";
|
|
2
|
+
import "./chunks/converter-DvdFP4MZ.js";
|
|
3
|
+
import "./chunks/docx-zipper-CxFpxZUz.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -44,6 +44,23 @@ export function exportSchemaToJson(params: ExportParams): XmlReadyNode;
|
|
|
44
44
|
* @returns {XmlReadyNode} JSON of the XML-ready paragraph node
|
|
45
45
|
*/
|
|
46
46
|
export function translateParagraphNode(params: any): XmlReadyNode;
|
|
47
|
+
/**
|
|
48
|
+
* Generate a w:rPr node (run properties) from marks
|
|
49
|
+
*
|
|
50
|
+
* @param {Object[]} marks The marks to add to the run properties
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
export function generateRunProps(marks?: any[]): {
|
|
54
|
+
name: string;
|
|
55
|
+
elements: any[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Get all marks as a list of MarkType objects
|
|
59
|
+
*
|
|
60
|
+
* @param {MarkType[]} marks
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export function processOutputMarks(marks?: MarkType[]): any[];
|
|
47
64
|
/**
|
|
48
65
|
* Main translation function for a table row
|
|
49
66
|
*
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
export function handler(params: import("../../v3/node-translator").SCEncoderConfig): any;
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
export const handleLineBreakNode: any;
|
|
5
|
-
/**
|
|
6
|
-
* @type {import("docxImporter").NodeHandlerEntry}
|
|
3
|
+
* Line break node handler entity
|
|
4
|
+
* @type {Object} Handler entity
|
|
7
5
|
*/
|
|
8
6
|
export const lineBreakNodeHandlerEntity: any;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type NodeHandlerParams = {
|
|
2
|
+
/**
|
|
3
|
+
* - The array of nodes to process.
|
|
4
|
+
*/
|
|
5
|
+
nodes: any[];
|
|
6
|
+
/**
|
|
7
|
+
* - The parsed DOCX object.
|
|
8
|
+
*/
|
|
9
|
+
docx: any;
|
|
10
|
+
/**
|
|
11
|
+
* - Indicates if the processing is inside a track change.
|
|
12
|
+
*/
|
|
13
|
+
insideTrackChange: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* - The node list handler.
|
|
16
|
+
*/
|
|
17
|
+
nodeListHandler: NodeListHandler;
|
|
18
|
+
/**
|
|
19
|
+
* - The converter object.
|
|
20
|
+
*/
|
|
21
|
+
converter: any;
|
|
22
|
+
/**
|
|
23
|
+
* - The editor object.
|
|
24
|
+
*/
|
|
25
|
+
editor: import("../../../../Editor").Editor;
|
|
26
|
+
/**
|
|
27
|
+
* - The name of the file being processed.
|
|
28
|
+
*/
|
|
29
|
+
filename?: string;
|
|
30
|
+
/**
|
|
31
|
+
* - The ID of the parent style.
|
|
32
|
+
*/
|
|
33
|
+
parentStyleId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* - The imported lists object
|
|
36
|
+
*/
|
|
37
|
+
lists?: any;
|
|
38
|
+
/**
|
|
39
|
+
* - The context object.
|
|
40
|
+
*/
|
|
41
|
+
ctx?: NodeHandlerContext;
|
|
42
|
+
};
|
|
43
|
+
export type NodeHandlerContext = {
|
|
44
|
+
/**
|
|
45
|
+
* - The name of the parent node.
|
|
46
|
+
*/
|
|
47
|
+
parent?: XmlNode;
|
|
48
|
+
};
|
|
49
|
+
export type XmlNode = any;
|
|
50
|
+
export type PmNodeJson = {
|
|
51
|
+
type: string;
|
|
52
|
+
content: any;
|
|
53
|
+
attrs: {};
|
|
54
|
+
sdNodeOrKeyName: string;
|
|
55
|
+
};
|
|
56
|
+
export type PmMarkJson = {
|
|
57
|
+
type: string;
|
|
58
|
+
attrs: {};
|
|
59
|
+
};
|
|
60
|
+
export type ParsedDocx = any;
|
|
61
|
+
export type NodeListHandler = {
|
|
62
|
+
handler: NodeListHandlerFn;
|
|
63
|
+
handlerEntities: NodeHandlerEntry[];
|
|
64
|
+
};
|
|
65
|
+
export type NodeListHandlerFn = (params: NodeHandlerParams) => PmNodeJson[];
|
|
66
|
+
export type NodeHandler = (params: NodeHandlerParams) => {
|
|
67
|
+
nodes: PmNodeJson[];
|
|
68
|
+
consumed: number;
|
|
69
|
+
};
|
|
70
|
+
export type NodeHandlerEntry = {
|
|
71
|
+
handlerName: string;
|
|
72
|
+
handler: NodeHandler;
|
|
73
|
+
};
|
|
74
|
+
export type SuperConverter = any;
|
|
75
|
+
export type Editor = any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} RegisteredHandlers
|
|
3
|
+
*/
|
|
4
|
+
export const registeredHandlers: Readonly<{
|
|
5
|
+
'w:br': import("../node-translator/node-translator.js").NodeTranslator;
|
|
6
|
+
'w:tab': import("../node-translator/node-translator.js").NodeTranslator;
|
|
7
|
+
}>;
|
|
8
|
+
export type RegisteredHandlers = any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @type {import('@translator').NodeTranslatorConfig} */
|
|
2
|
+
export const config: import("@translator").NodeTranslatorConfig;
|
|
3
|
+
/**
|
|
4
|
+
* The NodeTranslator instance for the passthrough element.
|
|
5
|
+
* @type {import('@translator').NodeTranslator}
|
|
6
|
+
*/
|
|
7
|
+
export const translator: import("@translator").NodeTranslator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./br-translator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tab-translator.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @type {import('@translator').NodeTranslatorConfig} */
|
|
2
|
+
export const config: import("@translator").NodeTranslatorConfig;
|
|
3
|
+
/**
|
|
4
|
+
* The NodeTranslator instance for the <w:tab> element.
|
|
5
|
+
* @type {import('@translator').NodeTranslator}
|
|
6
|
+
*/
|
|
7
|
+
export const translator: import("@translator").NodeTranslator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./node-translator.js";
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
export type TranslatorTypes = string;
|
|
2
|
+
/**
|
|
3
|
+
* @enum {string}
|
|
4
|
+
*/
|
|
5
|
+
export const TranslatorTypes: Readonly<{
|
|
6
|
+
NODE: "node";
|
|
7
|
+
ATTRIBUTE: "attribute";
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {keyof typeof TranslatorTypes} TranslatorTypeKey
|
|
11
|
+
* @typedef {typeof TranslatorTypes[TranslatorTypeKey]} TranslatorType
|
|
12
|
+
* @typedef {string} XmlNodeName
|
|
13
|
+
* @typedef {string} SuperDocNodeOrKeyName
|
|
14
|
+
*/
|
|
15
|
+
/** @typedef {import('../../v2/importer/types').NodeHandlerParams} SCEncoderConfig */
|
|
16
|
+
/** @typedef {import('../../v2/types').SuperDocNode} SCEncoderResult */
|
|
17
|
+
/** @typedef {{ node: { attrs?: any, marks?: any[], type: string }, children?: any[] }} SCDecoderConfig */
|
|
18
|
+
/** @typedef {{ name: string, elements: any[] }} SCDecoderResult */
|
|
19
|
+
/**
|
|
20
|
+
* @callback NodeTranslatorEncodeFn
|
|
21
|
+
* @param {SCEncoderConfig} params
|
|
22
|
+
* @param {EncodedAttributes} [encodedAttrs]
|
|
23
|
+
* @returns {import('../../v2/types').SuperDocNode}
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @callback NodeTranslatorDecodeFn
|
|
27
|
+
* @param {SCDecoderConfig} params
|
|
28
|
+
* @param {DecodedAttributes} [decodedAttrs]
|
|
29
|
+
* @returns {import('../../v2/types').OpenXmlNode}
|
|
30
|
+
*/
|
|
31
|
+
/** @callback MatchesEncodeFn @param {any[]} nodes @param {any} [ctx] @returns {boolean} */
|
|
32
|
+
/** @callback MatchesDecodeFn @param {any} node @param {any} [ctx] @returns {boolean} */
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {Object} AttributesHandlerList
|
|
35
|
+
* @property {string} xmlName - The name of the attribute in OOXML
|
|
36
|
+
* @property {string} sdName - The name of the attribute in SuperDoc
|
|
37
|
+
* @property {Function} [encode] - Function to encode the attribute from OOXML to SuperDoc
|
|
38
|
+
* @property {Function} [decode] - Function to decode the attribute from SuperDoc to OOXML
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} EncodedAttributes
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} DecodedAttributes
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {Object} NodeTranslatorConfig
|
|
48
|
+
* @property {string} xmlName - The name of the node in OOXML
|
|
49
|
+
* @property {string} sdNodeOrKeyName - The name of the node in SuperDoc
|
|
50
|
+
* @property {TranslatorType} [type="node"] - The type of the translator.
|
|
51
|
+
* @property {NodeTranslatorEncodeFn} encode - The function to encode the data.
|
|
52
|
+
* @property {NodeTranslatorDecodeFn} [decode] - The function to decode the data.
|
|
53
|
+
* @property {number} [priority] - The priority of the handler.
|
|
54
|
+
* @property {AttributesHandlerList[]} [attributes] - Attribute handlers list.
|
|
55
|
+
* @property {MatchesEncodeFn} [matchesEncode] - The function to check if the handler can encode the data.
|
|
56
|
+
* @property {MatchesDecodeFn} [matchesDecode] - The function to check if the handler can decode the data.
|
|
57
|
+
*/
|
|
58
|
+
export class NodeTranslator {
|
|
59
|
+
/** @type {typeof TranslatorTypes} */
|
|
60
|
+
static translatorTypes: typeof TranslatorTypes;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new NodeTranslator instance from a configuration object.
|
|
63
|
+
* @param {NodeTranslatorConfig} config - The configuration object.
|
|
64
|
+
* @returns {NodeTranslator} The created NodeTranslator instance.
|
|
65
|
+
*/
|
|
66
|
+
static from(config: NodeTranslatorConfig): NodeTranslator;
|
|
67
|
+
/**
|
|
68
|
+
* @param {string} xmlName
|
|
69
|
+
* @param {string} sdNodeOrKeyName
|
|
70
|
+
* @param {NodeTranslatorEncodeFn} encode
|
|
71
|
+
* @param {NodeTranslatorDecodeFn} decode
|
|
72
|
+
* @param {number} [priority]
|
|
73
|
+
* @param {MatchesEncodeFn} [matchesEncode]
|
|
74
|
+
* @param {MatchesDecodeFn} [matchesDecode]
|
|
75
|
+
* @param {AttributesHandlerList[]} [attributes]
|
|
76
|
+
*/
|
|
77
|
+
constructor(xmlName: string, sdNodeOrKeyName: string, encode: NodeTranslatorEncodeFn, decode: NodeTranslatorDecodeFn, priority?: number, matchesEncode?: MatchesEncodeFn, matchesDecode?: MatchesDecodeFn, attributes?: AttributesHandlerList[]);
|
|
78
|
+
/** @type {string} */
|
|
79
|
+
xmlName: string;
|
|
80
|
+
/** @type {string} */
|
|
81
|
+
sdNodeOrKeyName: string;
|
|
82
|
+
/** @type {number} */
|
|
83
|
+
priority: number;
|
|
84
|
+
/** @type {NodeTranslatorEncodeFn} */
|
|
85
|
+
encodeFn: NodeTranslatorEncodeFn;
|
|
86
|
+
/** @type {NodeTranslatorDecodeFn} */
|
|
87
|
+
decodeFn: NodeTranslatorDecodeFn;
|
|
88
|
+
/** @type {MatchesEncodeFn} */
|
|
89
|
+
matchesEncode: MatchesEncodeFn;
|
|
90
|
+
/** @type {MatchesDecodeFn} */
|
|
91
|
+
matchesDecode: MatchesDecodeFn;
|
|
92
|
+
/** @type {AttributesHandlerList[]} */
|
|
93
|
+
attributes: AttributesHandlerList[];
|
|
94
|
+
/**
|
|
95
|
+
* Encode the attributes for the node.
|
|
96
|
+
* @param {SCEncoderConfig} params
|
|
97
|
+
* @returns {Object} Encoded attributes object.
|
|
98
|
+
*/
|
|
99
|
+
encodeAttributes(params: SCEncoderConfig): any;
|
|
100
|
+
/**
|
|
101
|
+
* Decode the attributes for the node.
|
|
102
|
+
* @param {SCDecoderConfig} params
|
|
103
|
+
* @returns {Object} Decoded attributes object.
|
|
104
|
+
*/
|
|
105
|
+
decodeAttributes(params: SCDecoderConfig): any;
|
|
106
|
+
/**
|
|
107
|
+
* Decode the attributes for the node.
|
|
108
|
+
* @param {SCDecoderConfig} params
|
|
109
|
+
* @returns {Object} Decoded attributes object.
|
|
110
|
+
*/
|
|
111
|
+
decode(params: SCDecoderConfig): any;
|
|
112
|
+
/**
|
|
113
|
+
* Encode the attributes for the node.
|
|
114
|
+
* @param {SCEncoderConfig} params
|
|
115
|
+
* @returns {Object} Encoded attributes object.
|
|
116
|
+
*/
|
|
117
|
+
encode(params: SCEncoderConfig): any;
|
|
118
|
+
/**
|
|
119
|
+
* Convert the NodeTranslator instance to a string representation.
|
|
120
|
+
* @returns {string} - The string representation of the NodeTranslator instance.
|
|
121
|
+
*/
|
|
122
|
+
toString(): string;
|
|
123
|
+
}
|
|
124
|
+
export type TranslatorTypeKey = keyof typeof TranslatorTypes;
|
|
125
|
+
export type TranslatorType = (typeof TranslatorTypes)[TranslatorTypeKey];
|
|
126
|
+
export type XmlNodeName = string;
|
|
127
|
+
export type SuperDocNodeOrKeyName = string;
|
|
128
|
+
export type SCEncoderConfig = import("../../v2/importer/types").NodeHandlerParams;
|
|
129
|
+
export type SCEncoderResult = import("../../v2/types").SuperDocNode;
|
|
130
|
+
export type SCDecoderConfig = {
|
|
131
|
+
node: {
|
|
132
|
+
attrs?: any;
|
|
133
|
+
marks?: any[];
|
|
134
|
+
type: string;
|
|
135
|
+
};
|
|
136
|
+
children?: any[];
|
|
137
|
+
};
|
|
138
|
+
export type SCDecoderResult = {
|
|
139
|
+
name: string;
|
|
140
|
+
elements: any[];
|
|
141
|
+
};
|
|
142
|
+
export type NodeTranslatorEncodeFn = (params: SCEncoderConfig, encodedAttrs?: EncodedAttributes) => import("../../v2/types").SuperDocNode;
|
|
143
|
+
export type NodeTranslatorDecodeFn = (params: SCDecoderConfig, decodedAttrs?: DecodedAttributes) => import("../../v2/types").OpenXmlNode;
|
|
144
|
+
export type MatchesEncodeFn = (nodes: any[], ctx?: any) => boolean;
|
|
145
|
+
export type MatchesDecodeFn = (node: any, ctx?: any) => boolean;
|
|
146
|
+
export type AttributesHandlerList = {
|
|
147
|
+
/**
|
|
148
|
+
* - The name of the attribute in OOXML
|
|
149
|
+
*/
|
|
150
|
+
xmlName: string;
|
|
151
|
+
/**
|
|
152
|
+
* - The name of the attribute in SuperDoc
|
|
153
|
+
*/
|
|
154
|
+
sdName: string;
|
|
155
|
+
/**
|
|
156
|
+
* - Function to encode the attribute from OOXML to SuperDoc
|
|
157
|
+
*/
|
|
158
|
+
encode?: Function;
|
|
159
|
+
/**
|
|
160
|
+
* - Function to decode the attribute from SuperDoc to OOXML
|
|
161
|
+
*/
|
|
162
|
+
decode?: Function;
|
|
163
|
+
};
|
|
164
|
+
export type EncodedAttributes = any;
|
|
165
|
+
export type DecodedAttributes = any;
|
|
166
|
+
export type NodeTranslatorConfig = {
|
|
167
|
+
/**
|
|
168
|
+
* - The name of the node in OOXML
|
|
169
|
+
*/
|
|
170
|
+
xmlName: string;
|
|
171
|
+
/**
|
|
172
|
+
* - The name of the node in SuperDoc
|
|
173
|
+
*/
|
|
174
|
+
sdNodeOrKeyName: string;
|
|
175
|
+
/**
|
|
176
|
+
* - The type of the translator.
|
|
177
|
+
*/
|
|
178
|
+
type?: TranslatorType;
|
|
179
|
+
/**
|
|
180
|
+
* - The function to encode the data.
|
|
181
|
+
*/
|
|
182
|
+
encode: NodeTranslatorEncodeFn;
|
|
183
|
+
/**
|
|
184
|
+
* - The function to decode the data.
|
|
185
|
+
*/
|
|
186
|
+
decode?: NodeTranslatorDecodeFn;
|
|
187
|
+
/**
|
|
188
|
+
* - The priority of the handler.
|
|
189
|
+
*/
|
|
190
|
+
priority?: number;
|
|
191
|
+
/**
|
|
192
|
+
* - Attribute handlers list.
|
|
193
|
+
*/
|
|
194
|
+
attributes?: AttributesHandlerList[];
|
|
195
|
+
/**
|
|
196
|
+
* - The function to check if the handler can encode the data.
|
|
197
|
+
*/
|
|
198
|
+
matchesEncode?: MatchesEncodeFn;
|
|
199
|
+
/**
|
|
200
|
+
* - The function to check if the handler can decode the data.
|
|
201
|
+
*/
|
|
202
|
+
matchesDecode?: MatchesDecodeFn;
|
|
203
|
+
};
|
|
@@ -5,4 +5,3 @@ export function nodeNeedsSdBlockId(node: import("prosemirror-model").Node): bool
|
|
|
5
5
|
export function checkForNewBlockNodesInTrs(transactions: readonly Transaction[]): boolean;
|
|
6
6
|
import { PluginKey } from 'prosemirror-state';
|
|
7
7
|
import { Extension } from '@core/Extension.js';
|
|
8
|
-
import { Transaction } from 'prosemirror-state';
|
|
@@ -14,6 +14,7 @@ import { getStarterExtensions } from './extensions/index.js';
|
|
|
14
14
|
import { getRichTextExtensions } from './extensions/index.js';
|
|
15
15
|
import { createZip } from './core/super-converter/zipper.js';
|
|
16
16
|
import { getAllowedImageDimensions } from './extensions/image/imageHelpers/processUploadedImage.js';
|
|
17
|
+
import { registeredHandlers } from './core/super-converter/v3/handlers/index.js';
|
|
17
18
|
export namespace Extensions {
|
|
18
19
|
export { Node };
|
|
19
20
|
export { Attribute };
|
|
@@ -28,4 +29,4 @@ import { Attribute } from '@core/index.js';
|
|
|
28
29
|
import { Extension } from '@core/Extension.js';
|
|
29
30
|
import { Plugin } from 'prosemirror-state';
|
|
30
31
|
import { Mark } from '@core/Mark.js';
|
|
31
|
-
export { SuperConverter, DocxZipper, SuperToolbar, Editor, SuperEditor, SuperInput, BasicUpload, Toolbar, AIWriter, SlashMenu, helpers, fieldAnnotationHelpers, trackChangesHelpers, AnnotatorHelpers, SectionHelpers, getMarksFromSelection, getActiveFormatting, getStarterExtensions, getRichTextExtensions, createZip, getAllowedImageDimensions, TrackChangesBasePluginKey, CommentsPluginKey };
|
|
32
|
+
export { SuperConverter, DocxZipper, SuperToolbar, Editor, SuperEditor, SuperInput, BasicUpload, Toolbar, AIWriter, SlashMenu, helpers, fieldAnnotationHelpers, trackChangesHelpers, AnnotatorHelpers, SectionHelpers, getMarksFromSelection, getActiveFormatting, getStarterExtensions, getRichTextExtensions, createZip, getAllowedImageDimensions, registeredHandlers, TrackChangesBasePluginKey, CommentsPluginKey };
|
|
@@ -9,14 +9,14 @@ 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 __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
11
|
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
-
import { aw as getDefaultExportFromCjs, U as v4, T as TextSelection$1, q as getMarkRange, az as vClickOutside, y as findParentNode, aA as getActiveFormatting, aq as isInTable, aB as readFromClipboard, aC as handleClipboardPaste, aD as getFileObject, a as Plugin } from "./chunks/converter-
|
|
13
|
-
import {
|
|
14
|
-
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-
|
|
15
|
-
import { k, C, l, T, i, m, j } from "./chunks/editor-
|
|
12
|
+
import { aw as getDefaultExportFromCjs, U as v4, T as TextSelection$1, q as getMarkRange, az as vClickOutside, y as findParentNode, aA as getActiveFormatting, aq as isInTable, aB as readFromClipboard, aC as handleClipboardPaste, aD as getFileObject, aE as translator, aF as translator$1, a as Plugin } from "./chunks/converter-DvdFP4MZ.js";
|
|
13
|
+
import { aG, a4, d, a1 } from "./chunks/converter-DvdFP4MZ.js";
|
|
14
|
+
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-CeWNMKjc.js";
|
|
15
|
+
import { k, C, l, T, i, m, j } from "./chunks/editor-CeWNMKjc.js";
|
|
16
16
|
import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
|
|
17
|
-
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-
|
|
17
|
+
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-Di2oAvyr.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-CxFpxZUz.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
var hasRequiredEventemitter3;
|
|
@@ -4597,6 +4597,10 @@ const _sfc_main = {
|
|
|
4597
4597
|
}
|
|
4598
4598
|
};
|
|
4599
4599
|
const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
|
|
4600
|
+
const registeredHandlers = Object.freeze({
|
|
4601
|
+
"w:br": translator$1,
|
|
4602
|
+
"w:tab": translator
|
|
4603
|
+
});
|
|
4600
4604
|
const Extensions = {
|
|
4601
4605
|
Node,
|
|
4602
4606
|
Attribute,
|
|
@@ -4607,7 +4611,7 @@ const Extensions = {
|
|
|
4607
4611
|
export {
|
|
4608
4612
|
AIWriter,
|
|
4609
4613
|
k as AnnotatorHelpers,
|
|
4610
|
-
|
|
4614
|
+
aG as BasicUpload,
|
|
4611
4615
|
C as CommentsPluginKey,
|
|
4612
4616
|
D as DocxZipper,
|
|
4613
4617
|
Editor,
|
|
@@ -4628,5 +4632,6 @@ export {
|
|
|
4628
4632
|
getRichTextExtensions,
|
|
4629
4633
|
getStarterExtensions,
|
|
4630
4634
|
a1 as helpers,
|
|
4635
|
+
registeredHandlers,
|
|
4631
4636
|
j as trackChangesHelpers
|
|
4632
4637
|
};
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-aOm7eWFU.cjs");
|
|
4
4
|
require("./chunks/vue-DWle4Cai.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
|
@@ -25,4 +25,5 @@ exports.getMarksFromSelection = superEditor_es.getMarksFromSelection;
|
|
|
25
25
|
exports.getRichTextExtensions = superEditor_es.getRichTextExtensions;
|
|
26
26
|
exports.getStarterExtensions = superEditor_es.getStarterExtensions;
|
|
27
27
|
exports.helpers = superEditor_es.helpers;
|
|
28
|
+
exports.registeredHandlers = superEditor_es.registeredHandlers;
|
|
28
29
|
exports.trackChangesHelpers = superEditor_es.index;
|
package/dist/super-editor.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, q } from "./chunks/super-editor.es-
|
|
1
|
+
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BoCmoEkp.es.js";
|
|
2
2
|
import "./chunks/vue-CXxsqYcP.es.js";
|
|
3
3
|
export {
|
|
4
4
|
A as AIWriter,
|
|
@@ -24,5 +24,6 @@ export {
|
|
|
24
24
|
n as getRichTextExtensions,
|
|
25
25
|
o as getStarterExtensions,
|
|
26
26
|
p as helpers,
|
|
27
|
+
r as registeredHandlers,
|
|
27
28
|
q as trackChangesHelpers
|
|
28
29
|
};
|