superdoc 1.0.0-beta.16 → 1.0.0-beta.17

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 (29) hide show
  1. package/dist/chunks/{PdfViewer-93eWvs8z.cjs → PdfViewer-BIlJaTm7.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-ODeuH1gb.es.js → PdfViewer-cvzMUtBh.es.js} +1 -1
  3. package/dist/chunks/{index-DW5_UKLM.es.js → index-CrIfBvBN.es.js} +3 -3
  4. package/dist/chunks/{index-RquHXtgI.cjs → index-DDx90Dl3.cjs} +3 -3
  5. package/dist/chunks/{index-DexFffM7-XZD_g6eY.cjs → index-VCeRjVPO-DjkejB6t.cjs} +1 -1
  6. package/dist/chunks/{index-DexFffM7-Cbdy0Zy6.es.js → index-VCeRjVPO-FBgR9qxX.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-Dg5uoFkw.es.js → super-editor.es-00SpI-wK.es.js} +690 -146
  8. package/dist/chunks/{super-editor.es-BLKWkx5G.cjs → super-editor.es-Mlj7AGyt.cjs} +690 -146
  9. package/dist/style.css +6 -6
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-C_R_BK8X.js → converter-B9zUZjYT.js} +71 -34
  12. package/dist/super-editor/chunks/{docx-zipper-BvQAYmi1.js → docx-zipper-r5KdE_SA.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-DFFvalb1.js → editor-D2k2BwSG.js} +524 -105
  14. package/dist/super-editor/chunks/{index-DexFffM7.js → index-VCeRjVPO.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-DLPfegtw.js → toolbar-8o_LgoiW.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/style.css +6 -6
  21. package/dist/super-editor/super-editor.es.js +131 -42
  22. package/dist/super-editor/toolbar.es.js +2 -2
  23. package/dist/super-editor.cjs +1 -1
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.cjs +2 -2
  26. package/dist/superdoc.es.js +2 -2
  27. package/dist/superdoc.umd.js +692 -148
  28. package/dist/superdoc.umd.js.map +1 -1
  29. package/package.json +1 -1
package/dist/style.css CHANGED
@@ -2263,18 +2263,18 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2263
2263
  min-height: 40px;
2264
2264
  }
2265
2265
 
2266
- .superdoc-table-resize-overlay[data-v-3f4a506b] {
2266
+ .superdoc-table-resize-overlay[data-v-2fdf7836] {
2267
2267
  position: absolute;
2268
2268
  pointer-events: none;
2269
2269
  user-select: none;
2270
2270
  }
2271
- .resize-handle[data-v-3f4a506b] {
2271
+ .resize-handle[data-v-2fdf7836] {
2272
2272
  position: absolute;
2273
2273
  cursor: col-resize;
2274
2274
  user-select: none;
2275
2275
  z-index: 15;
2276
2276
  }
2277
- .resize-handle[data-v-3f4a506b]::before {
2277
+ .resize-handle[data-v-2fdf7836]::before {
2278
2278
  content: '';
2279
2279
  position: absolute;
2280
2280
  left: 50%;
@@ -2287,17 +2287,17 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2287
2287
  background-color 0.2s ease,
2288
2288
  width 0.2s ease;
2289
2289
  }
2290
- .resize-handle[data-v-3f4a506b]:hover::before {
2290
+ .resize-handle[data-v-2fdf7836]:hover::before {
2291
2291
  background-color: #4a90e2;
2292
2292
  width: 3px;
2293
2293
  transform: translateX(-1.5px);
2294
2294
  }
2295
- .resize-handle--active[data-v-3f4a506b]::before {
2295
+ .resize-handle--active[data-v-2fdf7836]::before {
2296
2296
  background-color: #4a90e2;
2297
2297
  width: 2px;
2298
2298
  transform: translateX(-1px);
2299
2299
  }
2300
- .resize-guideline[data-v-3f4a506b] {
2300
+ .resize-guideline[data-v-2fdf7836] {
2301
2301
  position: absolute;
2302
2302
  background-color: #4a90e2;
2303
2303
  pointer-events: none;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-C_R_BK8X.js";
3
- import { _ as _export_sfc } from "./chunks/editor-DFFvalb1.js";
2
+ import { T as TextSelection } from "./chunks/converter-B9zUZjYT.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-D2k2BwSG.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -19773,7 +19773,7 @@ function decodeRPrFromMarks(marks) {
19773
19773
  return runProperties;
19774
19774
  }
19775
19775
  marks.forEach((mark) => {
19776
- switch (mark.type) {
19776
+ switch (mark.type.name ?? mark.type) {
19777
19777
  case "strike":
19778
19778
  case "italic":
19779
19779
  case "bold":
@@ -20839,6 +20839,11 @@ const decode$q = (params, decodedAttrs = {}) => {
20839
20839
  runs.push(trackedClone);
20840
20840
  return;
20841
20841
  }
20842
+ if (child.name === "w:commentRangeStart" || child.name === "w:commentRangeEnd") {
20843
+ const commentRangeClone = cloneXmlNode(child);
20844
+ runs.push(commentRangeClone);
20845
+ return;
20846
+ }
20842
20847
  const runWrapper = { name: XML_NODE_NAME$i, elements: [] };
20843
20848
  applyBaseRunProps(runWrapper);
20844
20849
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
@@ -27964,9 +27969,11 @@ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, e
27964
27969
  const newAttrs = {
27965
27970
  ...paragraphNode.attrs,
27966
27971
  paragraphProperties: newProperties,
27967
- numberingProperties: newProperties.numberingProperties,
27968
- listRendering: null
27972
+ numberingProperties: newProperties.numberingProperties
27969
27973
  };
27974
+ if (!newNumberingProperties) {
27975
+ newAttrs.listRendering = null;
27976
+ }
27970
27977
  tr.setNodeMarkup(pos, null, newAttrs);
27971
27978
  }
27972
27979
  const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, editor }) => {
@@ -28498,13 +28505,36 @@ const handleDocxPaste = (html, editor, view) => {
28498
28505
  extractAndRemoveConditionalPrefix(item);
28499
28506
  });
28500
28507
  transformWordLists(tempDiv, editor);
28501
- const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
28508
+ let doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
28509
+ doc2 = wrapTextsInRuns(doc2);
28502
28510
  tempDiv.remove();
28503
28511
  const { dispatch } = editor.view;
28504
28512
  if (!dispatch) return false;
28505
28513
  dispatch(view.state.tr.replaceSelectionWith(doc2, true));
28506
28514
  return true;
28507
28515
  };
28516
+ const wrapTextsInRuns = (doc2) => {
28517
+ const runType = doc2.type?.schema?.nodes?.run;
28518
+ if (!runType) return doc2;
28519
+ const wrapNode = (node, parent) => {
28520
+ if (node.isText) {
28521
+ if (parent?.type?.name === "run") return node;
28522
+ const runProperties = decodeRPrFromMarks(node.marks);
28523
+ return runType.create({ runProperties }, [node]);
28524
+ }
28525
+ if (!node.childCount) return node;
28526
+ let changed = false;
28527
+ const wrappedChildren = [];
28528
+ node.forEach((child) => {
28529
+ const wrappedChild = wrapNode(child, node);
28530
+ if (wrappedChild !== child) changed = true;
28531
+ wrappedChildren.push(wrappedChild);
28532
+ });
28533
+ if (!changed) return node;
28534
+ return node.copy(Fragment.fromArray(wrappedChildren));
28535
+ };
28536
+ return wrapNode(doc2, null);
28537
+ };
28508
28538
  const transformWordLists = (container, editor) => {
28509
28539
  const listItems = Array.from(container.querySelectorAll("[data-num-id]"));
28510
28540
  const lists = {};
@@ -28934,7 +28964,8 @@ const handleGoogleDocsHtml = (html, editor, view) => {
28934
28964
  tempDiv.innerHTML = cleanedHtml;
28935
28965
  const htmlWithMergedLists = mergeSeparateLists(tempDiv);
28936
28966
  const flattenHtml = flattenListsInHtml(htmlWithMergedLists, editor);
28937
- const doc2 = DOMParser$1.fromSchema(editor.schema).parse(flattenHtml);
28967
+ let doc2 = DOMParser$1.fromSchema(editor.schema).parse(flattenHtml);
28968
+ doc2 = wrapTextsInRuns(doc2);
28938
28969
  tempDiv.remove();
28939
28970
  const { dispatch } = editor.view;
28940
28971
  if (!dispatch) return false;
@@ -29267,7 +29298,8 @@ function isGoogleDocsHtml(html) {
29267
29298
  function handleHtmlPaste(html, editor, source) {
29268
29299
  let cleanedHtml;
29269
29300
  cleanedHtml = htmlHandler(html, editor);
29270
- const doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
29301
+ let doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
29302
+ doc2 = wrapTextsInRuns(doc2);
29271
29303
  const { dispatch, state: state2 } = editor.view;
29272
29304
  if (!dispatch) return false;
29273
29305
  const { $from } = state2.selection;
@@ -29372,7 +29404,9 @@ function createDocFromHTML(content, editor, options = {}) {
29372
29404
  } else {
29373
29405
  parsedContent = content;
29374
29406
  }
29375
- return DOMParser$1.fromSchema(editor.schema).parse(parsedContent);
29407
+ let doc2 = DOMParser$1.fromSchema(editor.schema).parse(parsedContent);
29408
+ doc2 = wrapTextsInRuns(doc2);
29409
+ return doc2;
29376
29410
  }
29377
29411
  function L() {
29378
29412
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
@@ -30496,9 +30530,11 @@ function processContent({ content, type: type2, editor }) {
30496
30530
  para.textContent = content;
30497
30531
  wrapper.appendChild(para);
30498
30532
  doc2 = DOMParser$1.fromSchema(editor.schema).parse(wrapper);
30533
+ doc2 = wrapTextsInRuns(doc2);
30499
30534
  break;
30500
30535
  case "schema":
30501
30536
  doc2 = editor.schema.nodeFromJSON(content);
30537
+ doc2 = wrapTextsInRuns(doc2);
30502
30538
  break;
30503
30539
  default:
30504
30540
  throw new Error(`Unknown content type: ${type2}`);
@@ -36530,7 +36566,7 @@ const _SuperConverter = class _SuperConverter {
36530
36566
  static getStoredSuperdocVersion(docx) {
36531
36567
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
36532
36568
  }
36533
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.16") {
36569
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.17") {
36534
36570
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
36535
36571
  }
36536
36572
  /**
@@ -37154,22 +37190,23 @@ export {
37154
37190
  twipsToLines as a7,
37155
37191
  pixelsToTwips as a8,
37156
37192
  helpers as a9,
37157
- Transform as aA,
37158
- findParentNodeClosestToPos as aB,
37159
- isInTable as aC,
37160
- generateDocxRandomId as aD,
37161
- insertNewRelationship as aE,
37162
- inchesToPixels as aF,
37163
- kebabCase as aG,
37164
- getUnderlineCssString as aH,
37165
- commonjsGlobal as aI,
37166
- getDefaultExportFromCjs$2 as aJ,
37167
- getContentTypesFromXml as aK,
37168
- xmljs as aL,
37169
- vClickOutside as aM,
37170
- getActiveFormatting as aN,
37171
- getFileObject as aO,
37172
- registeredHandlers as aP,
37193
+ SelectionRange as aA,
37194
+ Transform as aB,
37195
+ findParentNodeClosestToPos as aC,
37196
+ isInTable as aD,
37197
+ generateDocxRandomId as aE,
37198
+ insertNewRelationship as aF,
37199
+ inchesToPixels as aG,
37200
+ kebabCase as aH,
37201
+ getUnderlineCssString as aI,
37202
+ commonjsGlobal as aJ,
37203
+ getDefaultExportFromCjs$2 as aK,
37204
+ getContentTypesFromXml as aL,
37205
+ xmljs as aM,
37206
+ vClickOutside as aN,
37207
+ getActiveFormatting as aO,
37208
+ getFileObject as aP,
37209
+ registeredHandlers as aQ,
37173
37210
  posToDOMRect as aa,
37174
37211
  CommandService as ab,
37175
37212
  SuperConverter as ac,
@@ -37186,16 +37223,16 @@ export {
37186
37223
  updateDOMAttributes as an,
37187
37224
  findChildren as ao,
37188
37225
  generateRandomSigned32BitIntStrId as ap,
37189
- calculateResolvedParagraphProperties as aq,
37190
- encodeCSSFromPPr as ar,
37191
- twipsToPixels as as,
37192
- resolveRunProperties as at,
37193
- encodeCSSFromRPr as au,
37194
- generateOrderedListIndex as av,
37195
- docxNumberingHelpers as aw,
37196
- InputRule as ax,
37197
- convertSizeToCSS as ay,
37198
- SelectionRange as az,
37226
+ decodeRPrFromMarks as aq,
37227
+ calculateResolvedParagraphProperties as ar,
37228
+ encodeCSSFromPPr as as,
37229
+ twipsToPixels as at,
37230
+ resolveRunProperties as au,
37231
+ encodeCSSFromRPr as av,
37232
+ generateOrderedListIndex as aw,
37233
+ docxNumberingHelpers as ax,
37234
+ InputRule as ay,
37235
+ convertSizeToCSS as az,
37199
37236
  Slice as b,
37200
37237
  DOMParser$1 as c,
37201
37238
  Mark as d,
@@ -1,4 +1,4 @@
1
- import { p as process$1, aI as commonjsGlobal, B as Buffer, aJ as getDefaultExportFromCjs, aK as getContentTypesFromXml, aL as xmljs } from "./converter-C_R_BK8X.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-B9zUZjYT.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
  }