@harbour-enterprises/superdoc 0.18.0-next.9 → 0.18.1-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.
Files changed (32) hide show
  1. package/dist/chunks/{PdfViewer-Dq63yg58.cjs → PdfViewer-C6YOU13j.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BJhrCot5.es.js → PdfViewer-D-101zOe.es.js} +1 -1
  3. package/dist/chunks/{index-CJZL4fJB.cjs → index-CQRSKXRT.cjs} +3 -3
  4. package/dist/chunks/{index-BN78x3pO.es.js → index-DrbaF9yQ.es.js} +3 -3
  5. package/dist/chunks/{super-editor.es-wdh3sSj4.es.js → super-editor.es-C_XaJkxe.es.js} +117 -20
  6. package/dist/chunks/{super-editor.es-By4UqJbm.cjs → super-editor.es-DglJs8Qv.cjs} +117 -20
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-B1DscbBQ.js → converter-DEwUdN2M.js} +138 -74
  10. package/dist/super-editor/chunks/{docx-zipper-X8EwoXbC.js → docx-zipper-C7EwE5md.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-BbzNzl_2.js → editor-TUGjgpIf.js} +40 -6
  12. package/dist/super-editor/chunks/{toolbar-NTW8zQ0r.js → toolbar-2VnmJqnu.js} +2 -2
  13. package/dist/super-editor/converter.es.js +2 -2
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/commands/insertContent.d.ts +4 -4
  18. package/dist/super-editor/src/core/helpers/contentProcessor.d.ts +13 -0
  19. package/dist/super-editor/src/core/helpers/htmlSanitizer.d.ts +8 -0
  20. package/dist/super-editor/src/core/helpers/importHtml.d.ts +3 -2
  21. package/dist/super-editor/src/core/helpers/importMarkdown.d.ts +2 -1
  22. package/dist/super-editor/src/core/helpers/index.d.ts +1 -0
  23. package/dist/super-editor/src/tests/import/testUtils.d.ts +1 -0
  24. package/dist/super-editor/super-editor.es.js +18 -18
  25. package/dist/super-editor/toolbar.es.js +2 -2
  26. package/dist/super-editor.cjs +1 -1
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.cjs +2 -2
  29. package/dist/superdoc.es.js +2 -2
  30. package/dist/superdoc.umd.js +118 -21
  31. package/dist/superdoc.umd.js.map +1 -1
  32. package/package.json +1 -1
@@ -21791,11 +21791,48 @@ const isInTable = (state2) => {
21791
21791
  }
21792
21792
  return false;
21793
21793
  };
21794
- function createDocFromHTML(content, schema) {
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
- tempDiv.innerHTML = content;
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>&nbsp;</p>\n<ul>").replace(/<\/p>\n<ol>/g, "</p>\n<p>&nbsp;</p>\n<ol>").replace(/<\/ul>\n<h/g, "</ul>\n<p>&nbsp;</p>\n<h").replace(/<\/ol>\n<h/g, "</ol>\n<p>&nbsp;</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];
@@ -30664,7 +30727,7 @@ const _SuperConverter = class _SuperConverter {
30664
30727
  return;
30665
30728
  }
30666
30729
  }
30667
- static updateDocumentVersion(docx = this.convertedXml, version = "0.17.1") {
30730
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.19.0-next.0") {
30668
30731
  const customLocation = "docProps/custom.xml";
30669
30732
  if (!docx[customLocation]) {
30670
30733
  docx[customLocation] = generateCustomXml();
@@ -31149,7 +31212,7 @@ function storeSuperdocVersion(docx) {
31149
31212
  function generateCustomXml() {
31150
31213
  return DEFAULT_CUSTOM_XML;
31151
31214
  }
31152
- function generateSuperdocVersion(pid = 2, version = "0.17.1") {
31215
+ function generateSuperdocVersion(pid = 2, version = "0.19.0-next.0") {
31153
31216
  return {
31154
31217
  type: "element",
31155
31218
  name: "property",
@@ -31173,79 +31236,80 @@ function generateSuperdocVersion(pid = 2, version = "0.17.1") {
31173
31236
  };
31174
31237
  }
31175
31238
  export {
31176
- twipsToLines as $,
31239
+ RemoveMarkStep as $,
31177
31240
  AllSelection as A,
31178
- isIOS as B,
31179
- DOMSerializer as C,
31241
+ isMacOS as B,
31242
+ isIOS as C,
31180
31243
  DOMParser$1 as D,
31181
- Mark as E,
31244
+ DOMSerializer as E,
31182
31245
  Fragment as F,
31183
- dropPoint as G,
31184
- process$1 as H,
31185
- Buffer2 as I,
31186
- getSchemaTypeByName as J,
31187
- inputRulesPlugin as K,
31246
+ Mark as G,
31247
+ dropPoint as H,
31248
+ process$1 as I,
31249
+ Buffer2 as J,
31250
+ getSchemaTypeByName as K,
31188
31251
  ListHelpers as L,
31189
31252
  Mapping as M,
31190
31253
  NodeSelection as N,
31191
- TrackDeleteMarkName as O,
31254
+ inputRulesPlugin as O,
31192
31255
  PluginKey as P,
31193
- TrackInsertMarkName as Q,
31256
+ TrackDeleteMarkName as Q,
31194
31257
  ReplaceAroundStep as R,
31195
31258
  Schema$1 as S,
31196
31259
  TextSelection as T,
31197
- v4 as U,
31198
- TrackFormatMarkName as V,
31199
- comments_module_events as W,
31200
- findMark as X,
31201
- objectIncludes as Y,
31202
- AddMarkStep as Z,
31203
- RemoveMarkStep as _,
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 _,
31204
31267
  Plugin as a,
31205
- pixelsToTwips as a0,
31206
- helpers as a1,
31207
- posToDOMRect as a2,
31208
- CommandService as a3,
31209
- SuperConverter as a4,
31210
- createDocument as a5,
31211
- createDocFromMarkdown as a6,
31212
- createDocFromHTML as a7,
31213
- EditorState as a8,
31214
- hasSomeParentWithClass as a9,
31215
- getActiveFormatting as aA,
31216
- readFromClipboard as aB,
31217
- handleClipboardPaste as aC,
31218
- getFileObject as aD,
31219
- translator$1 as aE,
31220
- translator$2 as aF,
31221
- translator$3 as aG,
31222
- _sfc_main as aH,
31223
- isActive as aa,
31224
- unflattenListsInHtml as ab,
31225
- parseSizeUnit as ac,
31226
- minMax as ad,
31227
- getLineHeightValueString as ae,
31228
- InputRule as af,
31229
- kebabCase as ag,
31230
- findParentNodeClosestToPos as ah,
31231
- getListItemStyleDefinitions as ai,
31232
- docxNumberigHelpers as aj,
31233
- parseIndentElement as ak,
31234
- combineIndents as al,
31235
- StepMap as am,
31236
- getColStyleDeclaration as an,
31237
- SelectionRange as ao,
31238
- Transform as ap,
31239
- isInTable as aq,
31240
- createColGroup as ar,
31241
- generateDocxRandomId as as,
31242
- insertNewRelationship as at,
31243
- htmlHandler as au,
31244
- commonjsGlobal as av,
31245
- getDefaultExportFromCjs$1 as aw,
31246
- getContentTypesFromXml as ax,
31247
- xmljs as ay,
31248
- vClickOutside as az,
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,
31249
31313
  getMarkType as b,
31250
31314
  callOrGet as c,
31251
31315
  getMarksFromSelection as d,
@@ -31266,9 +31330,9 @@ export {
31266
31330
  isMarkActive as s,
31267
31331
  isNodeActive as t,
31268
31332
  deleteProps as u,
31269
- ReplaceStep as v,
31270
- NodeRange as w,
31271
- findWrapping as x,
31272
- findParentNode as y,
31273
- isMacOS as z
31333
+ processContent as v,
31334
+ ReplaceStep as w,
31335
+ NodeRange as x,
31336
+ findWrapping as y,
31337
+ findParentNode as z
31274
31338
  };
@@ -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-B1DscbBQ.js";
1
+ import { I as process$1, aw as commonjsGlobal, J as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-DEwUdN2M.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, 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-B1DscbBQ.js";
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-DEwUdN2M.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-X8EwoXbC.js";
17
+ import { D as DocxZipper } from "./docx-zipper-C7EwE5md.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.1");
14399
+ console.debug("[checkVersionMigrations] Current editor version", "0.19.0-next.0");
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 { H as process$1 } from "./converter-B1DscbBQ.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BbzNzl_2.js";
2
+ import { I as process$1 } from "./converter-DEwUdN2M.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-TUGjgpIf.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,5 +1,5 @@
1
- import { a4 } from "./chunks/converter-B1DscbBQ.js";
1
+ import { a5 } from "./chunks/converter-DEwUdN2M.js";
2
2
  import "vue";
3
3
  export {
4
- a4 as SuperConverter
4
+ a5 as SuperConverter
5
5
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-B1DscbBQ.js";
2
- import { D } from "./chunks/docx-zipper-X8EwoXbC.js";
1
+ import "./chunks/converter-DEwUdN2M.js";
2
+ import { D } from "./chunks/docx-zipper-C7EwE5md.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-BbzNzl_2.js";
2
- import "./chunks/converter-B1DscbBQ.js";
3
- import "./chunks/docx-zipper-X8EwoXbC.js";
1
+ import { E } from "./chunks/editor-TUGjgpIf.js";
2
+ import "./chunks/converter-DEwUdN2M.js";
3
+ import "./chunks/docx-zipper-C7EwE5md.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-X8EwoXbC.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-C7EwE5md.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -1,4 +1,4 @@
1
- export function insertContent(value: any, options: any): ({ tr, commands }: {
2
- tr: any;
3
- commands: any;
4
- }) => any;
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
@@ -26,3 +26,4 @@ export * from "./findMark.js";
26
26
  export * from "./isInTable.js";
27
27
  export * from "./importHtml.js";
28
28
  export * from "./importMarkdown.js";
29
+ export * from "./contentProcessor.js";
@@ -0,0 +1 @@
1
+ export function createNodeListHandlerMock(): NodeListHandler;
@@ -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, aE as translator, aF as translator$1, aG as translator$2, a as Plugin } from "./chunks/converter-B1DscbBQ.js";
13
- import { aH, a4, d, a1 } from "./chunks/converter-B1DscbBQ.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-BbzNzl_2.js";
15
- import { k, C, l, T, i, m, j } from "./chunks/editor-BbzNzl_2.js";
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-DEwUdN2M.js";
13
+ import { aI, a5, d, a2 } from "./chunks/converter-DEwUdN2M.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-TUGjgpIf.js";
15
+ import { k, C, l, T, i, m, j } from "./chunks/editor-TUGjgpIf.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-NTW8zQ0r.js";
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-2VnmJqnu.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-X8EwoXbC.js";
19
+ import { D } from "./chunks/docx-zipper-C7EwE5md.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, a12, a2, a3, a42, a5) {
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, a12), true;
93
+ return listeners.fn.call(listeners.context, a1), true;
94
94
  case 3:
95
- return listeners.fn.call(listeners.context, a12, a2), true;
95
+ return listeners.fn.call(listeners.context, a1, a22), true;
96
96
  case 4:
97
- return listeners.fn.call(listeners.context, a12, a2, a3), true;
97
+ return listeners.fn.call(listeners.context, a1, a22, a3), true;
98
98
  case 5:
99
- return listeners.fn.call(listeners.context, a12, a2, a3, a42), true;
99
+ return listeners.fn.call(listeners.context, a1, a22, a3, a4), true;
100
100
  case 6:
101
- return listeners.fn.call(listeners.context, a12, a2, a3, a42, a5), true;
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, a12);
116
+ listeners[i2].fn.call(listeners[i2].context, a1);
117
117
  break;
118
118
  case 3:
119
- listeners[i2].fn.call(listeners[i2].context, a12, a2);
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, a12, a2, a3);
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
- aH as BasicUpload,
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
- a4 as SuperConverter,
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
- a1 as helpers,
4635
+ a2 as helpers,
4636
4636
  registeredHandlers,
4637
4637
  j as trackChangesHelpers
4638
4638
  };
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-NTW8zQ0r.js";
3
- import "./chunks/editor-BbzNzl_2.js";
2
+ import { T } from "./chunks/toolbar-2VnmJqnu.js";
3
+ import "./chunks/editor-TUGjgpIf.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -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-By4UqJbm.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DglJs8Qv.cjs");
4
4
  require("./chunks/vue-DWle4Cai.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -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-wdh3sSj4.es.js";
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-C_XaJkxe.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-By4UqJbm.cjs");
4
- const superdoc = require("./chunks/index-CJZL4fJB.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DglJs8Qv.cjs");
4
+ const superdoc = require("./chunks/index-CQRSKXRT.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");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-wdh3sSj4.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-BN78x3pO.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-C_XaJkxe.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-DrbaF9yQ.es.js";
3
3
  import "./chunks/vue-CXxsqYcP.es.js";
4
4
  import "./chunks/jszip-B8KIZSNe.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";