@harbour-enterprises/superdoc 0.18.0-next.8 → 0.18.0
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-B6aQ9Btm.cjs → PdfViewer-DaCVS3a7.cjs} +1 -1
- package/dist/chunks/{PdfViewer-bV0Nu1AE.es.js → PdfViewer-nEK0Vfg8.es.js} +1 -1
- package/dist/chunks/{index-B4iJqRzO.es.js → index-C5Pduo01.es.js} +3 -3
- package/dist/chunks/{index-DHYO80_n.cjs → index-liKutwiS.cjs} +3 -3
- package/dist/chunks/{super-editor.es-CW3H3ZkZ.es.js → super-editor.es-BJ3WXpls.es.js} +123 -21
- package/dist/chunks/{super-editor.es-CLOaeb5i.cjs → super-editor.es-C6AwTfxt.cjs} +123 -21
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-w8KtZzlN.js → converter-CYyQ8x__.js} +144 -75
- package/dist/super-editor/chunks/{docx-zipper-HBvnt_-z.js → docx-zipper-Bp08RJ7s.js} +1 -1
- package/dist/super-editor/chunks/{editor-C2iCXpca.js → editor-l8pXp1qF.js} +40 -6
- package/dist/super-editor/chunks/{toolbar-BYNEDGz5.js → toolbar-VazJjXhB.js} +2 -2
- package/dist/super-editor/converter.es.js +2 -2
- 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/commands/insertContent.d.ts +4 -4
- package/dist/super-editor/src/core/helpers/contentProcessor.d.ts +13 -0
- package/dist/super-editor/src/core/helpers/htmlSanitizer.d.ts +8 -0
- package/dist/super-editor/src/core/helpers/importHtml.d.ts +3 -2
- package/dist/super-editor/src/core/helpers/importMarkdown.d.ts +2 -1
- package/dist/super-editor/src/core/helpers/index.d.ts +1 -0
- package/dist/super-editor/super-editor.es.js +18 -18
- 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 +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +124 -22
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -21791,11 +21791,48 @@ const isInTable = (state2) => {
|
|
|
21791
21791
|
}
|
|
21792
21792
|
return false;
|
|
21793
21793
|
};
|
|
21794
|
-
function
|
|
21794
|
+
function stripHtmlStyles(html) {
|
|
21795
|
+
if (!html) return "";
|
|
21796
|
+
const parser = new DOMParser();
|
|
21797
|
+
const doc2 = parser.parseFromString(html, "text/html");
|
|
21798
|
+
const SEMANTIC_ATTRS = [
|
|
21799
|
+
"href",
|
|
21800
|
+
"src",
|
|
21801
|
+
"alt",
|
|
21802
|
+
"title",
|
|
21803
|
+
"colspan",
|
|
21804
|
+
"rowspan",
|
|
21805
|
+
"headers",
|
|
21806
|
+
"scope",
|
|
21807
|
+
"lang",
|
|
21808
|
+
"dir",
|
|
21809
|
+
"cite",
|
|
21810
|
+
"start",
|
|
21811
|
+
"type"
|
|
21812
|
+
// for lists
|
|
21813
|
+
];
|
|
21814
|
+
const cleanNode = (node2) => {
|
|
21815
|
+
if (node2.nodeType !== Node.ELEMENT_NODE) return;
|
|
21816
|
+
[...node2.attributes].forEach((attr) => {
|
|
21817
|
+
if (!SEMANTIC_ATTRS.includes(attr.name.toLowerCase())) {
|
|
21818
|
+
node2.removeAttribute(attr.name);
|
|
21819
|
+
}
|
|
21820
|
+
});
|
|
21821
|
+
[...node2.children].forEach(cleanNode);
|
|
21822
|
+
};
|
|
21823
|
+
cleanNode(doc2.body);
|
|
21824
|
+
return doc2.body.innerHTML;
|
|
21825
|
+
}
|
|
21826
|
+
function createDocFromHTML(content, schema, options = {}) {
|
|
21827
|
+
const { isImport = false } = options;
|
|
21795
21828
|
let parsedContent;
|
|
21796
21829
|
if (typeof content === "string") {
|
|
21830
|
+
const cleanHtml = stripHtmlStyles(content);
|
|
21797
21831
|
const tempDiv = document.createElement("div");
|
|
21798
|
-
|
|
21832
|
+
if (isImport) {
|
|
21833
|
+
tempDiv.dataset.superdocImport = "true";
|
|
21834
|
+
}
|
|
21835
|
+
tempDiv.innerHTML = cleanHtml;
|
|
21799
21836
|
parsedContent = tempDiv;
|
|
21800
21837
|
} else {
|
|
21801
21838
|
parsedContent = content;
|
|
@@ -22879,14 +22916,39 @@ d.use({
|
|
|
22879
22916
|
gfm: true
|
|
22880
22917
|
// GitHub Flavored Markdown support
|
|
22881
22918
|
});
|
|
22882
|
-
function createDocFromMarkdown(markdown, schema) {
|
|
22919
|
+
function createDocFromMarkdown(markdown, schema, options = {}) {
|
|
22883
22920
|
const html = convertMarkdownToHTML(markdown);
|
|
22884
|
-
return createDocFromHTML(html, schema);
|
|
22921
|
+
return createDocFromHTML(html, schema, options);
|
|
22885
22922
|
}
|
|
22886
22923
|
function convertMarkdownToHTML(markdown) {
|
|
22887
22924
|
let html = d.parse(markdown, { async: false });
|
|
22888
22925
|
return html.replace(/<\/p>\n<ul>/g, "</p>\n<p> </p>\n<ul>").replace(/<\/p>\n<ol>/g, "</p>\n<p> </p>\n<ol>").replace(/<\/ul>\n<h/g, "</ul>\n<p> </p>\n<h").replace(/<\/ol>\n<h/g, "</ol>\n<p> </p>\n<h");
|
|
22889
22926
|
}
|
|
22927
|
+
function processContent({ content, type: type2, schema }) {
|
|
22928
|
+
let doc2;
|
|
22929
|
+
switch (type2) {
|
|
22930
|
+
case "html":
|
|
22931
|
+
doc2 = createDocFromHTML(content, schema, { isImport: true });
|
|
22932
|
+
break;
|
|
22933
|
+
case "markdown":
|
|
22934
|
+
doc2 = createDocFromMarkdown(content, schema, { isImport: true });
|
|
22935
|
+
break;
|
|
22936
|
+
case "text":
|
|
22937
|
+
const wrapper = document.createElement("div");
|
|
22938
|
+
wrapper.dataset.superdocImport = "true";
|
|
22939
|
+
const para = document.createElement("p");
|
|
22940
|
+
para.textContent = content;
|
|
22941
|
+
wrapper.appendChild(para);
|
|
22942
|
+
doc2 = DOMParser$1.fromSchema(schema).parse(wrapper);
|
|
22943
|
+
break;
|
|
22944
|
+
case "schema":
|
|
22945
|
+
doc2 = schema.nodeFromJSON(content);
|
|
22946
|
+
break;
|
|
22947
|
+
default:
|
|
22948
|
+
throw new Error(`Unknown content type: ${type2}`);
|
|
22949
|
+
}
|
|
22950
|
+
return doc2;
|
|
22951
|
+
}
|
|
22890
22952
|
const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
22891
22953
|
__proto__: null,
|
|
22892
22954
|
chainableEditorState,
|
|
@@ -22918,7 +22980,8 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22918
22980
|
isMarkActive,
|
|
22919
22981
|
isNodeActive,
|
|
22920
22982
|
isTextSelection,
|
|
22921
|
-
posToDOMRect
|
|
22983
|
+
posToDOMRect,
|
|
22984
|
+
processContent
|
|
22922
22985
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
22923
22986
|
const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, editor }) => {
|
|
22924
22987
|
if (typeof listType === "string") listType = editor.schema.nodes[listType];
|
|
@@ -22988,17 +23051,22 @@ const changeNumIdSameAbstract = (numId, level, listType, editor) => {
|
|
|
22988
23051
|
const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
|
|
22989
23052
|
const numbering = editor.converter.numbering;
|
|
22990
23053
|
const newNumbering = { ...numbering };
|
|
23054
|
+
if (!abstract) {
|
|
23055
|
+
ListHelpers.generateNewListDefinition({ numId: newId, listType, editor });
|
|
23056
|
+
return newId;
|
|
23057
|
+
}
|
|
22991
23058
|
const newAbstractId = getNewListId(editor, "abstracts");
|
|
22992
23059
|
const newAbstractDef = {
|
|
22993
23060
|
...abstract,
|
|
22994
23061
|
attributes: {
|
|
22995
|
-
...abstract.attributes,
|
|
23062
|
+
...abstract.attributes || {},
|
|
22996
23063
|
"w:abstractNumId": String(newAbstractId)
|
|
22997
23064
|
}
|
|
22998
23065
|
};
|
|
22999
23066
|
newNumbering.abstracts[newAbstractId] = newAbstractDef;
|
|
23000
23067
|
const newNumDef = getBasicNumIdTag(newId, newAbstractId);
|
|
23001
23068
|
newNumbering.definitions[newId] = newNumDef;
|
|
23069
|
+
editor.converter.numbering = newNumbering;
|
|
23002
23070
|
return newId;
|
|
23003
23071
|
};
|
|
23004
23072
|
const getBasicNumIdTag = (numId, abstractId) => {
|
|
@@ -30659,7 +30727,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
30659
30727
|
return;
|
|
30660
30728
|
}
|
|
30661
30729
|
}
|
|
30662
|
-
static updateDocumentVersion(docx = this.convertedXml, version = "0.17.
|
|
30730
|
+
static updateDocumentVersion(docx = this.convertedXml, version = "0.17.3") {
|
|
30663
30731
|
const customLocation = "docProps/custom.xml";
|
|
30664
30732
|
if (!docx[customLocation]) {
|
|
30665
30733
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31144,7 +31212,7 @@ function storeSuperdocVersion(docx) {
|
|
|
31144
31212
|
function generateCustomXml() {
|
|
31145
31213
|
return DEFAULT_CUSTOM_XML;
|
|
31146
31214
|
}
|
|
31147
|
-
function generateSuperdocVersion(pid = 2, version = "0.17.
|
|
31215
|
+
function generateSuperdocVersion(pid = 2, version = "0.17.3") {
|
|
31148
31216
|
return {
|
|
31149
31217
|
type: "element",
|
|
31150
31218
|
name: "property",
|
|
@@ -31168,79 +31236,80 @@ function generateSuperdocVersion(pid = 2, version = "0.17.1") {
|
|
|
31168
31236
|
};
|
|
31169
31237
|
}
|
|
31170
31238
|
export {
|
|
31171
|
-
|
|
31239
|
+
RemoveMarkStep as $,
|
|
31172
31240
|
AllSelection as A,
|
|
31173
|
-
|
|
31174
|
-
|
|
31241
|
+
isMacOS as B,
|
|
31242
|
+
isIOS as C,
|
|
31175
31243
|
DOMParser$1 as D,
|
|
31176
|
-
|
|
31244
|
+
DOMSerializer as E,
|
|
31177
31245
|
Fragment as F,
|
|
31178
|
-
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
|
|
31182
|
-
|
|
31246
|
+
Mark as G,
|
|
31247
|
+
dropPoint as H,
|
|
31248
|
+
process$1 as I,
|
|
31249
|
+
Buffer2 as J,
|
|
31250
|
+
getSchemaTypeByName as K,
|
|
31183
31251
|
ListHelpers as L,
|
|
31184
31252
|
Mapping as M,
|
|
31185
31253
|
NodeSelection as N,
|
|
31186
|
-
|
|
31254
|
+
inputRulesPlugin as O,
|
|
31187
31255
|
PluginKey as P,
|
|
31188
|
-
|
|
31256
|
+
TrackDeleteMarkName as Q,
|
|
31189
31257
|
ReplaceAroundStep as R,
|
|
31190
31258
|
Schema$1 as S,
|
|
31191
31259
|
TextSelection as T,
|
|
31192
|
-
|
|
31193
|
-
|
|
31194
|
-
|
|
31195
|
-
|
|
31196
|
-
|
|
31197
|
-
|
|
31198
|
-
|
|
31260
|
+
TrackInsertMarkName as U,
|
|
31261
|
+
v4 as V,
|
|
31262
|
+
TrackFormatMarkName as W,
|
|
31263
|
+
comments_module_events as X,
|
|
31264
|
+
findMark as Y,
|
|
31265
|
+
objectIncludes as Z,
|
|
31266
|
+
AddMarkStep as _,
|
|
31199
31267
|
Plugin as a,
|
|
31200
|
-
|
|
31201
|
-
|
|
31202
|
-
|
|
31203
|
-
|
|
31204
|
-
|
|
31205
|
-
|
|
31206
|
-
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
translator$
|
|
31216
|
-
translator$
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
|
|
31227
|
-
|
|
31228
|
-
|
|
31229
|
-
|
|
31230
|
-
|
|
31231
|
-
|
|
31232
|
-
|
|
31233
|
-
|
|
31234
|
-
|
|
31235
|
-
|
|
31236
|
-
|
|
31237
|
-
|
|
31238
|
-
|
|
31239
|
-
|
|
31240
|
-
|
|
31241
|
-
|
|
31242
|
-
|
|
31243
|
-
|
|
31268
|
+
twipsToLines as a0,
|
|
31269
|
+
pixelsToTwips as a1,
|
|
31270
|
+
helpers as a2,
|
|
31271
|
+
posToDOMRect as a3,
|
|
31272
|
+
CommandService as a4,
|
|
31273
|
+
SuperConverter as a5,
|
|
31274
|
+
createDocument as a6,
|
|
31275
|
+
createDocFromMarkdown as a7,
|
|
31276
|
+
createDocFromHTML as a8,
|
|
31277
|
+
EditorState as a9,
|
|
31278
|
+
vClickOutside as aA,
|
|
31279
|
+
getActiveFormatting as aB,
|
|
31280
|
+
readFromClipboard as aC,
|
|
31281
|
+
handleClipboardPaste as aD,
|
|
31282
|
+
getFileObject as aE,
|
|
31283
|
+
translator$1 as aF,
|
|
31284
|
+
translator$2 as aG,
|
|
31285
|
+
translator$3 as aH,
|
|
31286
|
+
_sfc_main as aI,
|
|
31287
|
+
hasSomeParentWithClass as aa,
|
|
31288
|
+
isActive as ab,
|
|
31289
|
+
unflattenListsInHtml as ac,
|
|
31290
|
+
parseSizeUnit as ad,
|
|
31291
|
+
minMax as ae,
|
|
31292
|
+
getLineHeightValueString as af,
|
|
31293
|
+
InputRule as ag,
|
|
31294
|
+
kebabCase as ah,
|
|
31295
|
+
findParentNodeClosestToPos as ai,
|
|
31296
|
+
getListItemStyleDefinitions as aj,
|
|
31297
|
+
docxNumberigHelpers as ak,
|
|
31298
|
+
parseIndentElement as al,
|
|
31299
|
+
combineIndents as am,
|
|
31300
|
+
StepMap as an,
|
|
31301
|
+
getColStyleDeclaration as ao,
|
|
31302
|
+
SelectionRange as ap,
|
|
31303
|
+
Transform as aq,
|
|
31304
|
+
isInTable as ar,
|
|
31305
|
+
createColGroup as as,
|
|
31306
|
+
generateDocxRandomId as at,
|
|
31307
|
+
insertNewRelationship as au,
|
|
31308
|
+
htmlHandler as av,
|
|
31309
|
+
commonjsGlobal as aw,
|
|
31310
|
+
getDefaultExportFromCjs$1 as ax,
|
|
31311
|
+
getContentTypesFromXml as ay,
|
|
31312
|
+
xmljs as az,
|
|
31244
31313
|
getMarkType as b,
|
|
31245
31314
|
callOrGet as c,
|
|
31246
31315
|
getMarksFromSelection as d,
|
|
@@ -31261,9 +31330,9 @@ export {
|
|
|
31261
31330
|
isMarkActive as s,
|
|
31262
31331
|
isNodeActive as t,
|
|
31263
31332
|
deleteProps as u,
|
|
31264
|
-
|
|
31265
|
-
|
|
31266
|
-
|
|
31267
|
-
|
|
31268
|
-
|
|
31333
|
+
processContent as v,
|
|
31334
|
+
ReplaceStep as w,
|
|
31335
|
+
NodeRange as x,
|
|
31336
|
+
findWrapping as y,
|
|
31337
|
+
findParentNode as z
|
|
31269
31338
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as process$1, aw as commonjsGlobal, J as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-CYyQ8x__.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, 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,
|
|
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, v as processContent, D as DOMParser$1, w as ReplaceStep, x as NodeRange, y as findWrapping, L as ListHelpers, z as findParentNode, B as isMacOS, C as isIOS, E as DOMSerializer, G as Mark$1, H as dropPoint, I as process$1, J as Buffer2, 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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-CYyQ8x__.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-Bp08RJ7s.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -1920,7 +1920,30 @@ const selectNodeBackward = () => ({ state, dispatch }) => {
|
|
|
1920
1920
|
const selectNodeForward = () => ({ state, dispatch }) => selectNodeForward$1(state, dispatch);
|
|
1921
1921
|
const selectTextblockStart = () => ({ state, dispatch }) => selectTextblockStart$1(state, dispatch);
|
|
1922
1922
|
const selectTextblockEnd = () => ({ state, dispatch }) => selectTextblockEnd$1(state, dispatch);
|
|
1923
|
-
const insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
1923
|
+
const insertContent = (value, options = {}) => ({ tr, state, commands: commands2, editor }) => {
|
|
1924
|
+
if (options.contentType) {
|
|
1925
|
+
const validTypes = ["html", "markdown", "text", "schema"];
|
|
1926
|
+
if (!validTypes.includes(options.contentType)) {
|
|
1927
|
+
console.error(`[insertContent] Invalid contentType: "${options.contentType}". Use: ${validTypes.join(", ")}`);
|
|
1928
|
+
return false;
|
|
1929
|
+
}
|
|
1930
|
+
try {
|
|
1931
|
+
const processedDoc = processContent({
|
|
1932
|
+
content: value,
|
|
1933
|
+
type: options.contentType,
|
|
1934
|
+
schema: state.schema
|
|
1935
|
+
});
|
|
1936
|
+
const jsonContent = processedDoc.toJSON();
|
|
1937
|
+
const ok = commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, jsonContent, options);
|
|
1938
|
+
if (ok && (options.contentType === "html" || options.contentType === "markdown")) {
|
|
1939
|
+
Promise.resolve().then(() => editor.migrateListsToV2?.());
|
|
1940
|
+
}
|
|
1941
|
+
return ok;
|
|
1942
|
+
} catch (error) {
|
|
1943
|
+
console.error(`[insertContent] Failed to process ${options.contentType}:`, error);
|
|
1944
|
+
return false;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1924
1947
|
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1925
1948
|
};
|
|
1926
1949
|
const removeWhitespaces = (node) => {
|
|
@@ -14373,7 +14396,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14373
14396
|
* @returns {Object | void} Migration results
|
|
14374
14397
|
*/
|
|
14375
14398
|
processCollaborationMigrations() {
|
|
14376
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.17.
|
|
14399
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.17.3");
|
|
14377
14400
|
if (!this.options.ydoc) return;
|
|
14378
14401
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14379
14402
|
let docVersion = metaMap.get("version");
|
|
@@ -14800,8 +14823,8 @@ generatePmData_fn = function() {
|
|
|
14800
14823
|
doc2 = createDocument(this.converter, this.schema, this);
|
|
14801
14824
|
doc2 = __privateMethod(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
|
|
14802
14825
|
if (this.options.markdown) {
|
|
14803
|
-
doc2 = createDocFromMarkdown(this.options.markdown, this.schema);
|
|
14804
|
-
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this.schema);
|
|
14826
|
+
doc2 = createDocFromMarkdown(this.options.markdown, this.schema, { isImport: true });
|
|
14827
|
+
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this.schema, { isImport: true });
|
|
14805
14828
|
else if (this.options.jsonOverride) doc2 = this.schema.nodeFromJSON(this.options.jsonOverride);
|
|
14806
14829
|
if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
|
|
14807
14830
|
}
|
|
@@ -18168,6 +18191,17 @@ const Paragraph = OxmlNode.create({
|
|
|
18168
18191
|
rsidDel: { rendered: false },
|
|
18169
18192
|
spacing: {
|
|
18170
18193
|
default: getDefaultSpacing(),
|
|
18194
|
+
parseDOM: (element) => {
|
|
18195
|
+
if (element && element.closest("[data-superdoc-import]")) {
|
|
18196
|
+
return {
|
|
18197
|
+
lineSpaceAfter: 11,
|
|
18198
|
+
lineSpaceBefore: 0,
|
|
18199
|
+
line: 1.15,
|
|
18200
|
+
lineRule: "auto"
|
|
18201
|
+
};
|
|
18202
|
+
}
|
|
18203
|
+
return void 0;
|
|
18204
|
+
},
|
|
18171
18205
|
renderDOM: (attrs) => {
|
|
18172
18206
|
const { spacing } = attrs;
|
|
18173
18207
|
if (!spacing) return {};
|
|
@@ -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 {
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { I as process$1 } from "./converter-CYyQ8x__.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-l8pXp1qF.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-l8pXp1qF.js";
|
|
2
|
+
import "./chunks/converter-CYyQ8x__.js";
|
|
3
|
+
import "./chunks/docx-zipper-Bp08RJ7s.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function insertContent(value:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
})
|
|
1
|
+
export function insertContent(value: string | any, options?: {
|
|
2
|
+
contentType?: string;
|
|
3
|
+
parseOptions?: boolean;
|
|
4
|
+
}): Function;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified content processor that handles all content types
|
|
3
|
+
* @param {Object} params
|
|
4
|
+
* @param {string} params.content - The content to process
|
|
5
|
+
* @param {string} params.type - Content type: 'html', 'markdown', 'text', 'schema'
|
|
6
|
+
* @param {Object} params.schema - ProseMirror schema
|
|
7
|
+
* @returns {Object} Processed ProseMirror document
|
|
8
|
+
*/
|
|
9
|
+
export function processContent({ content, type, schema }: {
|
|
10
|
+
content: string;
|
|
11
|
+
type: string;
|
|
12
|
+
schema: any;
|
|
13
|
+
}): any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip all inline styles and non-semantic attributes from HTML
|
|
3
|
+
* Preserves structure while removing presentation
|
|
4
|
+
*
|
|
5
|
+
* @param {string} html - Raw HTML string
|
|
6
|
+
* @returns {string} Clean HTML with semantic structure only
|
|
7
|
+
*/
|
|
8
|
+
export function stripHtmlStyles(html: string): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create a document from HTML content
|
|
3
|
-
* @private
|
|
4
3
|
* @param {string} content - HTML content
|
|
4
|
+
* @param {Object} schema - ProseMirror schema
|
|
5
|
+
* @param {Object} [options={}] - Import options
|
|
5
6
|
* @returns {Object} Document node
|
|
6
7
|
*/
|
|
7
|
-
export function createDocFromHTML(content: string, schema: any): any;
|
|
8
|
+
export function createDocFromHTML(content: string, schema: any, options?: any): any;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Create a ProseMirror document from Markdown content
|
|
3
3
|
* @param {string} markdown - Markdown content
|
|
4
4
|
* @param {Object} schema - ProseMirror schema
|
|
5
|
+
* @param {Object} [options={}] - Import options
|
|
5
6
|
* @returns {Object} Document node
|
|
6
7
|
*/
|
|
7
|
-
export function createDocFromMarkdown(markdown: string, schema: any): any;
|
|
8
|
+
export function createDocFromMarkdown(markdown: string, schema: any, options?: any): any;
|
|
8
9
|
/**
|
|
9
10
|
* Convert Markdown to HTML with SuperDoc/DOCX compatibility
|
|
10
11
|
* @param {string} markdown - Markdown content
|
|
@@ -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 {
|
|
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 { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, q as getMarkRange, aA as vClickOutside, z as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-CYyQ8x__.js";
|
|
13
|
+
import { aI, a5, d, a2 } from "./chunks/converter-CYyQ8x__.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-l8pXp1qF.js";
|
|
15
|
+
import { k, C, l, T, i, m, j } from "./chunks/editor-l8pXp1qF.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-VazJjXhB.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-Bp08RJ7s.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
var hasRequiredEventemitter3;
|
|
@@ -80,7 +80,7 @@ function requireEventemitter3() {
|
|
|
80
80
|
if (listeners.fn) return 1;
|
|
81
81
|
return listeners.length;
|
|
82
82
|
};
|
|
83
|
-
EventEmitter2.prototype.emit = function emit(event,
|
|
83
|
+
EventEmitter2.prototype.emit = function emit(event, a1, a22, a3, a4, a52) {
|
|
84
84
|
var evt = prefix ? prefix + event : event;
|
|
85
85
|
if (!this._events[evt]) return false;
|
|
86
86
|
var listeners = this._events[evt], len = arguments.length, args, i2;
|
|
@@ -90,15 +90,15 @@ function requireEventemitter3() {
|
|
|
90
90
|
case 1:
|
|
91
91
|
return listeners.fn.call(listeners.context), true;
|
|
92
92
|
case 2:
|
|
93
|
-
return listeners.fn.call(listeners.context,
|
|
93
|
+
return listeners.fn.call(listeners.context, a1), true;
|
|
94
94
|
case 3:
|
|
95
|
-
return listeners.fn.call(listeners.context,
|
|
95
|
+
return listeners.fn.call(listeners.context, a1, a22), true;
|
|
96
96
|
case 4:
|
|
97
|
-
return listeners.fn.call(listeners.context,
|
|
97
|
+
return listeners.fn.call(listeners.context, a1, a22, a3), true;
|
|
98
98
|
case 5:
|
|
99
|
-
return listeners.fn.call(listeners.context,
|
|
99
|
+
return listeners.fn.call(listeners.context, a1, a22, a3, a4), true;
|
|
100
100
|
case 6:
|
|
101
|
-
return listeners.fn.call(listeners.context,
|
|
101
|
+
return listeners.fn.call(listeners.context, a1, a22, a3, a4, a52), true;
|
|
102
102
|
}
|
|
103
103
|
for (i2 = 1, args = new Array(len - 1); i2 < len; i2++) {
|
|
104
104
|
args[i2 - 1] = arguments[i2];
|
|
@@ -113,13 +113,13 @@ function requireEventemitter3() {
|
|
|
113
113
|
listeners[i2].fn.call(listeners[i2].context);
|
|
114
114
|
break;
|
|
115
115
|
case 2:
|
|
116
|
-
listeners[i2].fn.call(listeners[i2].context,
|
|
116
|
+
listeners[i2].fn.call(listeners[i2].context, a1);
|
|
117
117
|
break;
|
|
118
118
|
case 3:
|
|
119
|
-
listeners[i2].fn.call(listeners[i2].context,
|
|
119
|
+
listeners[i2].fn.call(listeners[i2].context, a1, a22);
|
|
120
120
|
break;
|
|
121
121
|
case 4:
|
|
122
|
-
listeners[i2].fn.call(listeners[i2].context,
|
|
122
|
+
listeners[i2].fn.call(listeners[i2].context, a1, a22, a3);
|
|
123
123
|
break;
|
|
124
124
|
default:
|
|
125
125
|
if (!args) for (j2 = 1, args = new Array(len - 1); j2 < len; j2++) {
|
|
@@ -4612,14 +4612,14 @@ const Extensions = {
|
|
|
4612
4612
|
export {
|
|
4613
4613
|
AIWriter,
|
|
4614
4614
|
k as AnnotatorHelpers,
|
|
4615
|
-
|
|
4615
|
+
aI as BasicUpload,
|
|
4616
4616
|
C as CommentsPluginKey,
|
|
4617
4617
|
D as DocxZipper,
|
|
4618
4618
|
Editor,
|
|
4619
4619
|
Extensions,
|
|
4620
4620
|
l as SectionHelpers,
|
|
4621
4621
|
_sfc_main$4 as SlashMenu,
|
|
4622
|
-
|
|
4622
|
+
a5 as SuperConverter,
|
|
4623
4623
|
SuperEditor,
|
|
4624
4624
|
SuperInput,
|
|
4625
4625
|
SuperToolbar,
|
|
@@ -4632,7 +4632,7 @@ export {
|
|
|
4632
4632
|
d as getMarksFromSelection,
|
|
4633
4633
|
getRichTextExtensions,
|
|
4634
4634
|
getStarterExtensions,
|
|
4635
|
-
|
|
4635
|
+
a2 as helpers,
|
|
4636
4636
|
registeredHandlers,
|
|
4637
4637
|
j as trackChangesHelpers
|
|
4638
4638
|
};
|
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-C6AwTfxt.cjs");
|
|
4
4
|
require("./chunks/vue-DWle4Cai.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
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, r, 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-BJ3WXpls.es.js";
|
|
2
2
|
import "./chunks/vue-CXxsqYcP.es.js";
|
|
3
3
|
export {
|
|
4
4
|
A as AIWriter,
|
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
4
|
-
const superdoc = require("./chunks/index-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-C6AwTfxt.cjs");
|
|
4
|
+
const superdoc = require("./chunks/index-liKutwiS.cjs");
|
|
5
5
|
require("./chunks/vue-DWle4Cai.cjs");
|
|
6
6
|
require("./chunks/jszip-b7l8QkfH.cjs");
|
|
7
7
|
const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
|