@harbour-enterprises/superdoc 0.20.0-next.4 → 0.20.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-Ne_-LxpG.cjs → PdfViewer-Blwty0A0.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BjZBgs8x.es.js → PdfViewer-DcPZsBsK.es.js} +1 -1
  3. package/dist/chunks/{index-OFvCtpf7.cjs → index-BB5vhzVT.cjs} +2 -2
  4. package/dist/chunks/{index-BVjAJUtV.es.js → index-BZzn2Rcn.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-DgTNVbvS.es.js → super-editor.es-BTcVSa_f.es.js} +1056 -843
  6. package/dist/chunks/{super-editor.es-CCU9etUT.cjs → super-editor.es-BgBNGRxg.cjs} +1056 -843
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +1 -1
  9. package/dist/super-editor/chunks/{editor-C1C_smD4.js → editor-hh7sL4Wv.js} +632 -432
  10. package/dist/super-editor/chunks/{toolbar-pP4CmNcz.js → toolbar-B-apzt27.js} +1 -1
  11. package/dist/super-editor/editor.es.js +1 -1
  12. package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +1 -0
  13. package/dist/super-editor/src/extensions/image/imageHelpers/handleUrl.d.ts +2 -0
  14. package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +11 -0
  15. package/dist/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -1
  16. package/dist/super-editor/src/extensions/image/imageHelpers/processUploadedImage.d.ts +2 -2
  17. package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +18 -23
  18. package/dist/super-editor/super-editor.es.js +60 -45
  19. package/dist/super-editor/toolbar.es.js +2 -2
  20. package/dist/super-editor.cjs +1 -1
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.cjs +2 -2
  23. package/dist/superdoc.es.js +2 -2
  24. package/dist/superdoc.umd.js +1684 -1471
  25. package/dist/superdoc.umd.js.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/super-editor/src/extensions/image/imageHelpers/imagePlaceholderPlugin.d.ts +0 -5
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
2
2
  var __typeError = (msg) => {
3
3
  throw TypeError(msg);
4
4
  };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
6
+ var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
7
7
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
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);
@@ -662,11 +662,11 @@ function hasBlockDesc(dom) {
662
662
  const selectionCollapsed = function(domSel) {
663
663
  return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);
664
664
  };
665
- function keyEvent(keyCode, key) {
665
+ function keyEvent(keyCode, key2) {
666
666
  let event = document.createEvent("Event");
667
667
  event.initEvent("keydown", true, true);
668
668
  event.keyCode = keyCode;
669
- event.key = event.code = key;
669
+ event.key = event.code = key2;
670
670
  return event;
671
671
  }
672
672
  function deepActiveElement(doc2) {
@@ -5914,9 +5914,9 @@ const writeAny = (encoder, data) => {
5914
5914
  const keys2 = Object.keys(data);
5915
5915
  writeVarUint(encoder, keys2.length);
5916
5916
  for (let i = 0; i < keys2.length; i++) {
5917
- const key = keys2[i];
5918
- writeVarString(encoder, key);
5919
- writeAny(encoder, data[key]);
5917
+ const key2 = keys2[i];
5918
+ writeVarString(encoder, key2);
5919
+ writeAny(encoder, data[key2]);
5920
5920
  }
5921
5921
  }
5922
5922
  break;
@@ -5935,17 +5935,17 @@ const unexpectedCase = () => {
5935
5935
  throw create$1("Unexpected case");
5936
5936
  };
5937
5937
  const create = () => /* @__PURE__ */ new Map();
5938
- const setIfUndefined = (map2, key, createT) => {
5939
- let set = map2.get(key);
5938
+ const setIfUndefined = (map2, key2, createT) => {
5939
+ let set = map2.get(key2);
5940
5940
  if (set === void 0) {
5941
- map2.set(key, set = createT());
5941
+ map2.set(key2, set = createT());
5942
5942
  }
5943
5943
  return set;
5944
5944
  };
5945
5945
  const keys = Object.keys;
5946
5946
  const every = (obj, f) => {
5947
- for (const key in obj) {
5948
- if (!f(obj[key], key)) {
5947
+ for (const key2 in obj) {
5948
+ if (!f(obj[key2], key2)) {
5949
5949
  return false;
5950
5950
  }
5951
5951
  }
@@ -6001,14 +6001,14 @@ class VarStoragePolyfill {
6001
6001
  * @param {string} key
6002
6002
  * @param {any} newValue
6003
6003
  */
6004
- setItem(key, newValue) {
6005
- this.map.set(key, newValue);
6004
+ setItem(key2, newValue) {
6005
+ this.map.set(key2, newValue);
6006
6006
  }
6007
6007
  /**
6008
6008
  * @param {string} key
6009
6009
  */
6010
- getItem(key) {
6011
- return this.map.get(key);
6010
+ getItem(key2) {
6011
+ return this.map.get(key2);
6012
6012
  }
6013
6013
  }
6014
6014
  let _localStorage = new VarStoragePolyfill();
@@ -6051,9 +6051,9 @@ const computeParams = () => {
6051
6051
  params = create();
6052
6052
  (location.search || "?").slice(1).split("&").forEach((kv) => {
6053
6053
  if (kv.length !== 0) {
6054
- const [key, value] = kv.split("=");
6055
- params.set(`--${fromCamelCase(key, "-")}`, value);
6056
- params.set(`-${fromCamelCase(key, "-")}`, value);
6054
+ const [key2, value] = kv.split("=");
6055
+ params.set(`--${fromCamelCase(key2, "-")}`, value);
6056
+ params.set(`-${fromCamelCase(key2, "-")}`, value);
6057
6057
  }
6058
6058
  });
6059
6059
  } else {
@@ -6336,8 +6336,8 @@ const ySyncPlugin = (yXmlFragment, {
6336
6336
  const change = tr.getMeta(ySyncPluginKey);
6337
6337
  if (change !== void 0) {
6338
6338
  pluginState = Object.assign({}, pluginState);
6339
- for (const key in change) {
6340
- pluginState[key] = change[key];
6339
+ for (const key2 in change) {
6340
+ pluginState[key2] = change[key2];
6341
6341
  }
6342
6342
  }
6343
6343
  pluginState.addToHistory = tr.getMeta("addToHistory") !== false;
@@ -6609,7 +6609,7 @@ class ProsemirrorBinding {
6609
6609
  snapshot = Y.snapshot(historyDoc);
6610
6610
  if (historyType._item === null) {
6611
6611
  const rootKey = Array.from(this.doc.share.keys()).find(
6612
- (key) => this.doc.share.get(key) === this.type
6612
+ (key2) => this.doc.share.get(key2) === this.type
6613
6613
  );
6614
6614
  historyType = historyDoc.getXmlFragment(rootKey);
6615
6615
  } else {
@@ -6898,10 +6898,10 @@ const createTypeFromTextNodes = (nodes, meta) => {
6898
6898
  };
6899
6899
  const createTypeFromElementNode = (node, meta) => {
6900
6900
  const type = new Y.XmlElement(node.type.name);
6901
- for (const key in node.attrs) {
6902
- const val = node.attrs[key];
6903
- if (val !== null && key !== "ychange") {
6904
- type.setAttribute(key, val);
6901
+ for (const key2 in node.attrs) {
6902
+ const val = node.attrs[key2];
6903
+ if (val !== null && key2 !== "ychange") {
6904
+ type.setAttribute(key2, val);
6905
6905
  }
6906
6906
  }
6907
6907
  type.insert(
@@ -6916,13 +6916,13 @@ const createTypeFromElementNode = (node, meta) => {
6916
6916
  const createTypeFromTextOrElementNode = (node, meta) => node instanceof Array ? createTypeFromTextNodes(node, meta) : createTypeFromElementNode(node, meta);
6917
6917
  const isObject = (val) => typeof val === "object" && val !== null;
6918
6918
  const equalAttrs = (pattrs, yattrs) => {
6919
- const keys2 = Object.keys(pattrs).filter((key) => pattrs[key] !== null);
6920
- let eq = keys2.length === (yattrs == null ? 0 : Object.keys(yattrs).filter((key) => yattrs[key] !== null).length);
6919
+ const keys2 = Object.keys(pattrs).filter((key2) => pattrs[key2] !== null);
6920
+ let eq = keys2.length === (yattrs == null ? 0 : Object.keys(yattrs).filter((key2) => yattrs[key2] !== null).length);
6921
6921
  for (let i = 0; i < keys2.length && eq; i++) {
6922
- const key = keys2[i];
6923
- const l = pattrs[key];
6924
- const r2 = yattrs[key];
6925
- eq = key === "ychange" || l === r2 || isObject(l) && isObject(r2) && equalAttrs(l, r2);
6922
+ const key2 = keys2[i];
6923
+ const l = pattrs[key2];
6924
+ const r2 = yattrs[key2];
6925
+ eq = key2 === "ychange" || l === r2 || isObject(l) && isObject(r2) && equalAttrs(l, r2);
6926
6926
  }
6927
6927
  return eq;
6928
6928
  };
@@ -7069,18 +7069,18 @@ const updateYFragment = (y, yDomFragment, pNode, meta) => {
7069
7069
  if (yDomFragment instanceof Y.XmlElement) {
7070
7070
  const yDomAttrs = yDomFragment.getAttributes();
7071
7071
  const pAttrs = pNode.attrs;
7072
- for (const key in pAttrs) {
7073
- if (pAttrs[key] !== null) {
7074
- if (yDomAttrs[key] !== pAttrs[key] && key !== "ychange") {
7075
- yDomFragment.setAttribute(key, pAttrs[key]);
7072
+ for (const key2 in pAttrs) {
7073
+ if (pAttrs[key2] !== null) {
7074
+ if (yDomAttrs[key2] !== pAttrs[key2] && key2 !== "ychange") {
7075
+ yDomFragment.setAttribute(key2, pAttrs[key2]);
7076
7076
  }
7077
7077
  } else {
7078
- yDomFragment.removeAttribute(key);
7078
+ yDomFragment.removeAttribute(key2);
7079
7079
  }
7080
7080
  }
7081
- for (const key in yDomAttrs) {
7082
- if (pAttrs[key] === void 0) {
7083
- yDomFragment.removeAttribute(key);
7081
+ for (const key2 in yDomAttrs) {
7082
+ if (pAttrs[key2] === void 0) {
7083
+ yDomFragment.removeAttribute(key2);
7084
7084
  }
7085
7085
  }
7086
7086
  }
@@ -7211,19 +7211,19 @@ const updateMetas = () => {
7211
7211
  const tr = view.state.tr;
7212
7212
  const syncState = ySyncPluginKey.getState(view.state);
7213
7213
  if (syncState && syncState.binding && !syncState.binding.isDestroyed) {
7214
- metas.forEach((val, key) => {
7215
- tr.setMeta(key, val);
7214
+ metas.forEach((val, key2) => {
7215
+ tr.setMeta(key2, val);
7216
7216
  });
7217
7217
  view.dispatch(tr);
7218
7218
  }
7219
7219
  });
7220
7220
  };
7221
- const setMeta$1 = (view, key, value) => {
7221
+ const setMeta$1 = (view, key2, value) => {
7222
7222
  if (!viewsToUpdate) {
7223
7223
  viewsToUpdate = /* @__PURE__ */ new Map();
7224
7224
  timeout(0, updateMetas);
7225
7225
  }
7226
- setIfUndefined(viewsToUpdate, view, create).set(key, value);
7226
+ setIfUndefined(viewsToUpdate, view, create).set(key2, value);
7227
7227
  };
7228
7228
  const absolutePositionToRelativePosition = (pos, type, mapping) => {
7229
7229
  if (pos === 0) {
@@ -7923,21 +7923,21 @@ class Attribute {
7923
7923
  let attrs = {};
7924
7924
  for (const item of items) {
7925
7925
  const mergedAttributes = { ...attrs };
7926
- for (const [key, value] of Object.entries(item)) {
7927
- const exists = mergedAttributes[key];
7926
+ for (const [key2, value] of Object.entries(item)) {
7927
+ const exists = mergedAttributes[key2];
7928
7928
  if (!exists) {
7929
- mergedAttributes[key] = value;
7929
+ mergedAttributes[key2] = value;
7930
7930
  continue;
7931
7931
  }
7932
- if (key === "class") {
7932
+ if (key2 === "class") {
7933
7933
  const valueClasses = value ? value.split(" ") : [];
7934
- const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
7934
+ const existingClasses = mergedAttributes[key2] ? mergedAttributes[key2].split(" ") : [];
7935
7935
  const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
7936
- mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
7937
- } else if (key === "style") {
7938
- mergedAttributes[key] = [mergedAttributes[key], value].join("; ");
7936
+ mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
7937
+ } else if (key2 === "style") {
7938
+ mergedAttributes[key2] = [mergedAttributes[key2], value].join("; ");
7939
7939
  } else {
7940
- mergedAttributes[key] = value;
7940
+ mergedAttributes[key2] = value;
7941
7941
  }
7942
7942
  }
7943
7943
  attrs = mergedAttributes;
@@ -8247,8 +8247,8 @@ const insertTabNode = () => ({ tr, state, dispatch }) => {
8247
8247
  if (dispatch) dispatch(tr);
8248
8248
  return true;
8249
8249
  };
8250
- const setMeta = (key, value) => ({ tr }) => {
8251
- tr.setMeta(key, value);
8250
+ const setMeta = (key2, value) => ({ tr }) => {
8251
+ tr.setMeta(key2, value);
8252
8252
  return true;
8253
8253
  };
8254
8254
  const ensureMarks = (state, splittableMarks) => {
@@ -11376,14 +11376,14 @@ const updateYdocDocxData = async (editor, ydoc) => {
11376
11376
  const metaMap = ydoc.getMap("meta");
11377
11377
  const docx = [...metaMap.get("docx")];
11378
11378
  const newXml = await editor.exportDocx({ getUpdatedDocs: true });
11379
- Object.keys(newXml).forEach((key) => {
11380
- const fileIndex = docx.findIndex((item) => item.name === key);
11379
+ Object.keys(newXml).forEach((key2) => {
11380
+ const fileIndex = docx.findIndex((item) => item.name === key2);
11381
11381
  if (fileIndex > -1) {
11382
11382
  docx.splice(fileIndex, 1);
11383
11383
  }
11384
11384
  docx.push({
11385
- name: key,
11386
- content: newXml[key]
11385
+ name: key2,
11386
+ content: newXml[key2]
11387
11387
  });
11388
11388
  });
11389
11389
  ydoc.transact(
@@ -11399,8 +11399,8 @@ const initPaginationData = async (editor) => {
11399
11399
  const sectionData = { headers: {}, footers: {} };
11400
11400
  const headerIds = editor.converter.headerIds.ids;
11401
11401
  const footerIds = editor.converter.footerIds.ids;
11402
- for (let key in headerIds) {
11403
- const sectionId = headerIds[key];
11402
+ for (let key2 in headerIds) {
11403
+ const sectionId = headerIds[key2];
11404
11404
  if (!sectionId) continue;
11405
11405
  const dataForThisSection = editor.converter.headers[sectionId];
11406
11406
  if (!sectionData.headers[sectionId]) sectionData.headers[sectionId] = {};
@@ -11410,8 +11410,8 @@ const initPaginationData = async (editor) => {
11410
11410
  sectionData.headers[sectionId].sectionEditor = sectionEditor;
11411
11411
  sectionData.headers[sectionId].sectionContainer = sectionContainer;
11412
11412
  }
11413
- for (let key in footerIds) {
11414
- const sectionId = footerIds[key];
11413
+ for (let key2 in footerIds) {
11414
+ const sectionId = footerIds[key2];
11415
11415
  if (!sectionId) continue;
11416
11416
  const dataForThisSection = editor.converter.footers[sectionId];
11417
11417
  if (!sectionData.headers[sectionId]) sectionData.footers[sectionId] = {};
@@ -12480,16 +12480,16 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state }) =>
12480
12480
  if (rowsToGenerate <= 1) return;
12481
12481
  const validateAttributes = (attrs) => {
12482
12482
  const cleaned = {};
12483
- for (const [key, value] of Object.entries(attrs)) {
12483
+ for (const [key2, value] of Object.entries(attrs)) {
12484
12484
  if (value !== void 0 && value !== null) {
12485
- if (key === "displayLabel") {
12486
- cleaned[key] = String(value);
12487
- } else if (key === "rawHtml" || key === "linkUrl" || key === "imageSrc") {
12488
- cleaned[key] = String(value);
12485
+ if (key2 === "displayLabel") {
12486
+ cleaned[key2] = String(value);
12487
+ } else if (key2 === "rawHtml" || key2 === "linkUrl" || key2 === "imageSrc") {
12488
+ cleaned[key2] = String(value);
12489
12489
  } else if (typeof value === "string" && value.length > 0) {
12490
- cleaned[key] = value;
12490
+ cleaned[key2] = value;
12491
12491
  } else if (typeof value !== "string") {
12492
- cleaned[key] = value;
12492
+ cleaned[key2] = value;
12493
12493
  }
12494
12494
  }
12495
12495
  }
@@ -12767,10 +12767,10 @@ const Collaboration = Extension.create({
12767
12767
  this.options.fragment = fragment;
12768
12768
  const metaMap = this.options.ydoc.getMap("media");
12769
12769
  metaMap.observe((event) => {
12770
- event.changes.keys.forEach((_, key) => {
12771
- if (!(key in this.editor.storage.image.media)) {
12772
- const fileData = metaMap.get(key);
12773
- this.editor.storage.image.media[key] = fileData;
12770
+ event.changes.keys.forEach((_, key2) => {
12771
+ if (!(key2 in this.editor.storage.image.media)) {
12772
+ const fileData = metaMap.get(key2);
12773
+ this.editor.storage.image.media[key2] = fileData;
12774
12774
  }
12775
12775
  });
12776
12776
  });
@@ -12790,8 +12790,8 @@ const initializeMetaMap = (ydoc, editor) => {
12790
12790
  metaMap.set("docx", editor.options.content);
12791
12791
  metaMap.set("fonts", editor.options.fonts);
12792
12792
  const mediaMap = ydoc.getMap("media");
12793
- Object.entries(editor.options.mediaFiles).forEach(([key, value]) => {
12794
- mediaMap.set(key, value);
12793
+ Object.entries(editor.options.mediaFiles).forEach(([key2, value]) => {
12794
+ mediaMap.set(key2, value);
12795
12795
  });
12796
12796
  };
12797
12797
  const checkDocxChanged = (transaction) => {
@@ -13553,8 +13553,8 @@ function processRelationships(root, convertedXml, results) {
13553
13553
  };
13554
13554
  const seenIds = /* @__PURE__ */ new Set();
13555
13555
  const filtered = [];
13556
- function extractStringAttr(attrs, key) {
13557
- return typeof attrs[key] === "string" ? attrs[key].trim() : "";
13556
+ function extractStringAttr(attrs, key2) {
13557
+ return typeof attrs[key2] === "string" ? attrs[key2].trim() : "";
13558
13558
  }
13559
13559
  for (const rel of root.elements) {
13560
13560
  rel.attributes = rel.attributes || {};
@@ -13776,10 +13776,10 @@ class SuperValidator {
13776
13776
  this.logger.debug("Document analysis:", documentAnalysis);
13777
13777
  let hasModifiedDocument = false;
13778
13778
  const validationResults = [];
13779
- Object.entries(__privateGet(this, _stateValidators)).forEach(([key, validator]) => {
13780
- this.logger.debug(`🕵 Validating with ${key}...`);
13779
+ Object.entries(__privateGet(this, _stateValidators)).forEach(([key2, validator]) => {
13780
+ this.logger.debug(`🕵 Validating with ${key2}...`);
13781
13781
  const { results, modified } = validator(tr, documentAnalysis);
13782
- validationResults.push({ key, results });
13782
+ validationResults.push({ key: key2, results });
13783
13783
  hasModifiedDocument = hasModifiedDocument || modified;
13784
13784
  });
13785
13785
  if (!this.dryRun) dispatch(tr);
@@ -13796,10 +13796,10 @@ class SuperValidator {
13796
13796
  const { dispatch } = __privateGet(this, _editor).view;
13797
13797
  let hasModifiedDocument = false;
13798
13798
  const validationResults = [];
13799
- Object.entries(__privateGet(this, _xmlValidators)).forEach(([key, validator]) => {
13800
- this.logger.debug(`🕵 Validating export with ${key}...`);
13799
+ Object.entries(__privateGet(this, _xmlValidators)).forEach(([key2, validator]) => {
13800
+ this.logger.debug(`🕵 Validating export with ${key2}...`);
13801
13801
  const { results, modified } = validator();
13802
- validationResults.push({ key, results });
13802
+ validationResults.push({ key: key2, results });
13803
13803
  hasModifiedDocument = hasModifiedDocument || modified;
13804
13804
  });
13805
13805
  if (!this.dryRun && hasModifiedDocument) dispatch(tr);
@@ -13823,11 +13823,11 @@ initializeValidators_fn = function() {
13823
13823
  const requiredMarks = /* @__PURE__ */ new Set();
13824
13824
  const initializeValidatorSet = (validatorFactories) => {
13825
13825
  return Object.fromEntries(
13826
- Object.entries(validatorFactories).map(([key, factory]) => {
13827
- const validatorLogger = this.logger.withPrefix(key);
13826
+ Object.entries(validatorFactories).map(([key2, factory]) => {
13827
+ const validatorLogger = this.logger.withPrefix(key2);
13828
13828
  const validator = factory({ editor: __privateGet(this, _editor), logger: validatorLogger });
13829
13829
  __privateMethod(this, _SuperValidator_instances, collectValidatorRequirements_fn).call(this, validator, requiredNodes, requiredMarks);
13830
- return [key, validator];
13830
+ return [key2, validator];
13831
13831
  })
13832
13832
  );
13833
13833
  };
@@ -15149,8 +15149,8 @@ initMedia_fn = function() {
15149
15149
  if (!this.options.ydoc) return this.storage.image.media = this.options.mediaFiles;
15150
15150
  const mediaMap = this.options.ydoc.getMap("media");
15151
15151
  if (this.options.isNewFile) {
15152
- Object.entries(this.options.mediaFiles).forEach(([key, value]) => {
15153
- mediaMap.set(key, value);
15152
+ Object.entries(this.options.mediaFiles).forEach(([key2, value]) => {
15153
+ mediaMap.set(key2, value);
15154
15154
  });
15155
15155
  this.storage.image.media = this.options.mediaFiles;
15156
15156
  } else {
@@ -16034,11 +16034,11 @@ const FormatCommands = Extension.create({
16034
16034
  const { type, attrs } = mark;
16035
16035
  const { name } = type;
16036
16036
  if (name === "textStyle") {
16037
- Object.keys(attrs).forEach((key) => {
16038
- if (!attrs[key]) return;
16037
+ Object.keys(attrs).forEach((key2) => {
16038
+ if (!attrs[key2]) return;
16039
16039
  const attributes = {};
16040
- attributes[key] = attrs[key];
16041
- processedMarks.push({ name: key, attrs: attributes });
16040
+ attributes[key2] = attrs[key2];
16041
+ processedMarks.push({ name: key2, attrs: attributes });
16042
16042
  });
16043
16043
  } else {
16044
16044
  processedMarks.push({ name, attrs });
@@ -16053,13 +16053,13 @@ const FormatCommands = Extension.create({
16053
16053
  fontFamily: ["setFontFamily", "unsetFontFamily"]
16054
16054
  };
16055
16055
  let result = chain();
16056
- Object.keys(marksToCommands).forEach((key) => {
16057
- const [setCommand, unsetCommand, defaultParam] = marksToCommands[key];
16058
- const markToApply = processedMarks.find((mark) => mark.name === key);
16059
- const hasEmptyAttrs = markToApply?.attrs && markToApply?.attrs[key];
16056
+ Object.keys(marksToCommands).forEach((key2) => {
16057
+ const [setCommand, unsetCommand, defaultParam] = marksToCommands[key2];
16058
+ const markToApply = processedMarks.find((mark) => mark.name === key2);
16059
+ const hasEmptyAttrs = markToApply?.attrs && markToApply?.attrs[key2];
16060
16060
  let cmd = {};
16061
16061
  if (!markToApply && !hasEmptyAttrs) cmd = { command: unsetCommand, argument: defaultParam };
16062
- else cmd = { command: setCommand, argument: markToApply.attrs[key] || defaultParam };
16062
+ else cmd = { command: setCommand, argument: markToApply.attrs[key2] || defaultParam };
16063
16063
  result = result[cmd.command](cmd.argument);
16064
16064
  });
16065
16065
  this.storage.storedStyle = null;
@@ -17563,7 +17563,7 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
17563
17563
  resultStyles["text-transform"] = basedOnDefinitionStyles["text-transform"];
17564
17564
  }
17565
17565
  Object.entries(resultStyles).forEach(([k, value]) => {
17566
- const key = kebabCase(k);
17566
+ const key2 = kebabCase(k);
17567
17567
  const flattenedMarks = [];
17568
17568
  node?.marks?.forEach((n) => {
17569
17569
  if (n.type.name === "textStyle") {
@@ -17574,46 +17574,46 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
17574
17574
  });
17575
17575
  return;
17576
17576
  }
17577
- flattenedMarks.push({ key: n.type.name, value: n.attrs[key] });
17577
+ flattenedMarks.push({ key: n.type.name, value: n.attrs[key2] });
17578
17578
  });
17579
- const mark = flattenedMarks.find((n) => n.key === key);
17579
+ const mark = flattenedMarks.find((n) => n.key === key2);
17580
17580
  const hasParentIndent = Object.keys(parent?.attrs?.indent || {});
17581
17581
  const hasParentSpacing = Object.keys(parent?.attrs?.spacing || {});
17582
17582
  const listTypes = ["orderedList", "listItem"];
17583
17583
  if (!mark) {
17584
- if (key === "spacing" && includeSpacing && !hasParentSpacing) {
17584
+ if (key2 === "spacing" && includeSpacing && !hasParentSpacing) {
17585
17585
  const space = getSpacingStyle(value);
17586
17586
  Object.entries(space).forEach(([k2, v]) => {
17587
17587
  markValue[k2] = v;
17588
17588
  });
17589
- } else if (key === "indent" && includeSpacing && !hasParentIndent) {
17589
+ } else if (key2 === "indent" && includeSpacing && !hasParentIndent) {
17590
17590
  const { leftIndent, rightIndent, firstLine } = value;
17591
17591
  if (leftIndent) markValue["margin-left"] = leftIndent + "px";
17592
17592
  if (rightIndent) markValue["margin-right"] = rightIndent + "px";
17593
17593
  if (firstLine) markValue["text-indent"] = firstLine + "px";
17594
- } else if (key === "bold" && node) {
17594
+ } else if (key2 === "bold" && node) {
17595
17595
  const val = value?.value;
17596
17596
  if (!listTypes.includes(node.type.name) && val !== "0") {
17597
17597
  markValue["font-weight"] = "bold";
17598
17598
  }
17599
- } else if (key === "text-transform" && node) {
17599
+ } else if (key2 === "text-transform" && node) {
17600
17600
  if (!listTypes.includes(node.type.name)) {
17601
- markValue[key] = value;
17601
+ markValue[key2] = value;
17602
17602
  }
17603
- } else if (key === "font-size" && node) {
17603
+ } else if (key2 === "font-size" && node) {
17604
17604
  if (!listTypes.includes(node.type.name)) {
17605
- markValue[key] = value;
17605
+ markValue[key2] = value;
17606
17606
  }
17607
- } else if (key === "color" && node) {
17607
+ } else if (key2 === "color" && node) {
17608
17608
  if (!listTypes.includes(node.type.name)) {
17609
- markValue[key] = value;
17609
+ markValue[key2] = value;
17610
17610
  }
17611
17611
  } else if (typeof value === "string") {
17612
- markValue[key] = value;
17612
+ markValue[key2] = value;
17613
17613
  }
17614
17614
  }
17615
17615
  });
17616
- const final = Object.entries(markValue).map(([key, value]) => `${key}: ${value}`).join(";");
17616
+ const final = Object.entries(markValue).map(([key2, value]) => `${key2}: ${value}`).join(";");
17617
17617
  return final;
17618
17618
  };
17619
17619
  const applyLinkedStyleToTransaction = (tr, editor, style) => {
@@ -18308,7 +18308,7 @@ function orderedListSync(editor) {
18308
18308
  listNumberingType,
18309
18309
  customFormat
18310
18310
  };
18311
- const keysChanged = Object.keys(updatedAttrs).some((key) => node.attrs[key] !== updatedAttrs[key]);
18311
+ const keysChanged = Object.keys(updatedAttrs).some((key2) => node.attrs[key2] !== updatedAttrs[key2]);
18312
18312
  if (keysChanged) {
18313
18313
  tr.setNodeMarkup(pos, void 0, updatedAttrs);
18314
18314
  }
@@ -19435,11 +19435,11 @@ function updateTable(editor, node, table) {
19435
19435
  const allExtensionsAttrs = editor.extensionService.attributes;
19436
19436
  const tableExtensionAttrs = allExtensionsAttrs.filter((e) => e.type === "table");
19437
19437
  const htmlAttributes = Attribute.getAttributesToRender(node, tableExtensionAttrs);
19438
- Object.entries(htmlAttributes).forEach(([key, value]) => {
19439
- if (key === "style") {
19438
+ Object.entries(htmlAttributes).forEach(([key2, value]) => {
19439
+ if (key2 === "style") {
19440
19440
  table.style.cssText = value;
19441
19441
  } else {
19442
- table.setAttribute(key, value);
19442
+ table.setAttribute(key2, value);
19443
19443
  }
19444
19444
  });
19445
19445
  }
@@ -19511,22 +19511,22 @@ var readFromCache;
19511
19511
  var addToCache;
19512
19512
  if (typeof WeakMap != "undefined") {
19513
19513
  let cache = /* @__PURE__ */ new WeakMap();
19514
- readFromCache = (key) => cache.get(key);
19515
- addToCache = (key, value) => {
19516
- cache.set(key, value);
19514
+ readFromCache = (key2) => cache.get(key2);
19515
+ addToCache = (key2, value) => {
19516
+ cache.set(key2, value);
19517
19517
  return value;
19518
19518
  };
19519
19519
  } else {
19520
19520
  const cache = [];
19521
19521
  const cacheSize = 10;
19522
19522
  let cachePos = 0;
19523
- readFromCache = (key) => {
19523
+ readFromCache = (key2) => {
19524
19524
  for (let i = 0; i < cache.length; i += 2)
19525
- if (cache[i] == key) return cache[i + 1];
19525
+ if (cache[i] == key2) return cache[i + 1];
19526
19526
  };
19527
- addToCache = (key, value) => {
19527
+ addToCache = (key2, value) => {
19528
19528
  if (cachePos == cacheSize) cachePos = 0;
19529
- cache[cachePos++] = key;
19529
+ cache[cachePos++] = key2;
19530
19530
  return cache[cachePos++] = value;
19531
19531
  };
19532
19532
  }
@@ -21760,8 +21760,8 @@ const Table = Node$1.create({
21760
21760
  default: {},
21761
21761
  renderDOM({ borders }) {
21762
21762
  if (!borders) return {};
21763
- const style = Object.entries(borders).reduce((acc, [key, { size, color }]) => {
21764
- return `${acc}border-${key}: ${Math.ceil(size)}px solid ${color || "black"};`;
21763
+ const style = Object.entries(borders).reduce((acc, [key2, { size, color }]) => {
21764
+ return `${acc}border-${key2}: ${Math.ceil(size)}px solid ${color || "black"};`;
21765
21765
  }, "");
21766
21766
  return {
21767
21767
  style
@@ -22876,11 +22876,11 @@ createAnnotation_fn = function({ displayLabel } = {}) {
22876
22876
  let mergedAttrs = Attribute.mergeAttributes(this.htmlAttributes, {
22877
22877
  style: omitHighlight ? "" : annotationStyle
22878
22878
  });
22879
- for (let [key, value] of Object.entries(mergedAttrs)) {
22880
- if (key === "style") {
22879
+ for (let [key2, value] of Object.entries(mergedAttrs)) {
22880
+ if (key2 === "style") {
22881
22881
  annotation.style.cssText = value;
22882
22882
  } else {
22883
- annotation.setAttribute(key, value);
22883
+ annotation.setAttribute(key2, value);
22884
22884
  }
22885
22885
  }
22886
22886
  return {
@@ -23054,13 +23054,13 @@ function hash$2(str) {
23054
23054
  }
23055
23055
  const colorToInt = (x) => parseInt(x.replace(/_/g, ""), 36);
23056
23056
  const compressedColorMap = "1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((acc, next) => {
23057
- const key = colorToInt(next.substring(0, 3));
23057
+ const key2 = colorToInt(next.substring(0, 3));
23058
23058
  const hex = colorToInt(next.substring(3)).toString(16);
23059
23059
  let prefix = "";
23060
23060
  for (let i = 0; i < 6 - hex.length; i++) {
23061
23061
  prefix += "0";
23062
23062
  }
23063
- acc[key] = `${prefix}${hex}`;
23063
+ acc[key2] = `${prefix}${hex}`;
23064
23064
  return acc;
23065
23065
  }, {});
23066
23066
  function nameToHex(color) {
@@ -24176,41 +24176,480 @@ function getFormatAttrsFromMarks(marks) {
24176
24176
  }
24177
24177
  return formatAttrs;
24178
24178
  }
24179
- const ImagePlaceholderPluginKey = new PluginKey("ImagePlaceholder");
24180
- const ImagePlaceholderPlugin = () => {
24179
+ const simpleHash = (str) => {
24180
+ let hash2 = 0;
24181
+ for (let i = 0; i < str.length; i++) {
24182
+ const char = str.charCodeAt(i);
24183
+ hash2 = (hash2 << 5) - hash2 + char;
24184
+ hash2 = hash2 & hash2;
24185
+ }
24186
+ return Math.abs(hash2).toString();
24187
+ };
24188
+ const base64ToFile = (base64String) => {
24189
+ const arr = base64String.split(",");
24190
+ const mimeMatch = arr[0].match(/:(.*?);/);
24191
+ const mimeType = mimeMatch ? mimeMatch[1] : "";
24192
+ const data = arr[1];
24193
+ const binaryString = atob(data);
24194
+ const hash2 = simpleHash(binaryString);
24195
+ const extension = mimeType.split("/")[1] || "bin";
24196
+ const filename = `image-${hash2}.${extension}`;
24197
+ const bytes = new Uint8Array(binaryString.length);
24198
+ for (let i = 0; i < binaryString.length; i++) {
24199
+ bytes[i] = binaryString.charCodeAt(i);
24200
+ }
24201
+ const blob = new Blob([bytes], { type: mimeType });
24202
+ return new File([blob], filename, { type: mimeType });
24203
+ };
24204
+ const urlToFile = async (url, filename, mimeType) => {
24205
+ try {
24206
+ const response = await fetch(url, {
24207
+ mode: "cors",
24208
+ credentials: "omit",
24209
+ headers: {
24210
+ // Add common headers that might help with CORS
24211
+ Accept: "image/*,*/*;q=0.8"
24212
+ }
24213
+ });
24214
+ if (!response.ok) {
24215
+ console.warn(`Failed to fetch image from ${url}: ${response.status} ${response.statusText}`);
24216
+ return null;
24217
+ }
24218
+ const blob = await response.blob();
24219
+ const finalFilename = filename || extractFilenameFromUrl(url);
24220
+ const finalMimeType = mimeType || response.headers.get("content-type") || blob.type || "image/jpeg";
24221
+ return new File([blob], finalFilename, { type: finalMimeType });
24222
+ } catch (error) {
24223
+ if (isCorsError(error)) {
24224
+ console.warn(`CORS policy prevents accessing image from ${url}:`, error.message);
24225
+ return null;
24226
+ }
24227
+ console.error(`Error fetching image from ${url}:`, error);
24228
+ return null;
24229
+ }
24230
+ };
24231
+ const isCorsError = (error) => {
24232
+ const errorMessage = error.message.toLowerCase();
24233
+ const errorName = error.name.toLowerCase();
24234
+ return errorName.includes("cors") || errorMessage.includes("cors") || errorMessage.includes("cross-origin") || errorMessage.includes("access-control") || errorMessage.includes("network error") || // Often indicates CORS in browsers
24235
+ errorMessage.includes("failed to fetch");
24236
+ };
24237
+ const extractFilenameFromUrl = (url) => {
24238
+ try {
24239
+ const urlObj = new URL(url);
24240
+ const pathname = urlObj.pathname;
24241
+ const filename = pathname.split("/").pop();
24242
+ if (filename && !filename.includes(".")) {
24243
+ return `${filename}.jpg`;
24244
+ }
24245
+ return filename || "image.jpg";
24246
+ } catch {
24247
+ return "image.jpg";
24248
+ }
24249
+ };
24250
+ const validateUrlAccessibility = async (url) => {
24251
+ try {
24252
+ const response = await fetch(url, {
24253
+ method: "HEAD",
24254
+ mode: "cors",
24255
+ credentials: "omit"
24256
+ });
24257
+ return response.ok;
24258
+ } catch (_error) {
24259
+ return false;
24260
+ }
24261
+ };
24262
+ const handleImageUpload = (file) => {
24263
+ return new Promise((resolve, reject) => {
24264
+ let reader = new FileReader();
24265
+ reader.onload = (event) => {
24266
+ resolve(event.target.result);
24267
+ };
24268
+ reader.onerror = reject;
24269
+ setTimeout(() => reader.readAsDataURL(file), 250);
24270
+ });
24271
+ };
24272
+ const processUploadedImage = (fileData, getMaxContentSize) => {
24273
+ return new Promise((resolve, reject) => {
24274
+ const img = new window.Image();
24275
+ img.onload = () => {
24276
+ const canvas = document.createElement("canvas");
24277
+ const { width: logicalWidth, height: logicalHeight } = getAllowedImageDimensions(
24278
+ img.width,
24279
+ img.height,
24280
+ getMaxContentSize
24281
+ );
24282
+ canvas.width = img.width;
24283
+ canvas.height = img.height;
24284
+ const ctx = canvas.getContext("2d");
24285
+ if (ctx) {
24286
+ ctx.imageSmoothingEnabled = true;
24287
+ try {
24288
+ ctx.imageSmoothingQuality = "high";
24289
+ } catch {
24290
+ }
24291
+ }
24292
+ ctx.drawImage(img, 0, 0, img.width, img.height);
24293
+ const dpr = typeof window !== "undefined" && window.devicePixelRatio ? window.devicePixelRatio : 1;
24294
+ const targetPixelWidth = Math.round(logicalWidth * dpr);
24295
+ const targetPixelHeight = Math.round(logicalHeight * dpr);
24296
+ const finalTargetWidth = Math.min(targetPixelWidth, img.width);
24297
+ const finalTargetHeight = Math.min(targetPixelHeight, img.height);
24298
+ const resizeNeeded = finalTargetWidth !== img.width || finalTargetHeight !== img.height;
24299
+ if (resizeNeeded) {
24300
+ multiStepResize(canvas, finalTargetWidth, finalTargetHeight);
24301
+ }
24302
+ if (typeof fileData === "string") {
24303
+ const resizedBase64 = canvas.toDataURL();
24304
+ resolve(resizedBase64);
24305
+ } else {
24306
+ canvas.toBlob((blob) => {
24307
+ const updatedFile = new File([blob], fileData.name, {
24308
+ type: fileData.type,
24309
+ lastModified: Date.now()
24310
+ });
24311
+ resolve({ file: updatedFile, width: logicalWidth, height: logicalHeight });
24312
+ });
24313
+ }
24314
+ };
24315
+ img.onerror = (error) => reject(error);
24316
+ img.src = typeof fileData === "string" ? fileData : URL.createObjectURL(fileData);
24317
+ });
24318
+ };
24319
+ const getAllowedImageDimensions = (width, height, getMaxContentSize) => {
24320
+ const { width: maxWidth, height: maxHeight } = getMaxContentSize();
24321
+ if (!maxWidth || !maxHeight) return { width, height };
24322
+ let adjustedWidth = width;
24323
+ let adjustedHeight = height;
24324
+ const aspectRatio = width / height;
24325
+ if (height > maxHeight) {
24326
+ adjustedHeight = maxHeight;
24327
+ adjustedWidth = Math.round(maxHeight * aspectRatio);
24328
+ }
24329
+ if (adjustedWidth > maxWidth) {
24330
+ adjustedWidth = maxWidth;
24331
+ adjustedHeight = Math.round(maxWidth / aspectRatio);
24332
+ }
24333
+ return { width: adjustedWidth, height: adjustedHeight };
24334
+ };
24335
+ function resample_high_quality(canvas, width, height, resize_canvas) {
24336
+ var width_source = canvas.width;
24337
+ var height_source = canvas.height;
24338
+ width = Math.round(width);
24339
+ height = Math.round(height);
24340
+ var ratio_w = width_source / width;
24341
+ var ratio_h = height_source / height;
24342
+ var ratio_w_half = Math.ceil(ratio_w / 2);
24343
+ var ratio_h_half = Math.ceil(ratio_h / 2);
24344
+ var ctx = canvas.getContext("2d");
24345
+ var img = ctx.getImageData(0, 0, width_source, height_source);
24346
+ var img2 = ctx.createImageData(width, height);
24347
+ var data = img.data;
24348
+ var data2 = img2.data;
24349
+ for (var j = 0; j < height; j++) {
24350
+ for (var i = 0; i < width; i++) {
24351
+ var x2 = (i + j * width) * 4;
24352
+ var weight = 0;
24353
+ var weights = 0;
24354
+ var weights_alpha = 0;
24355
+ var gx_r = 0;
24356
+ var gx_g = 0;
24357
+ var gx_b = 0;
24358
+ var gx_a = 0;
24359
+ var center_y = (j + 0.5) * ratio_h;
24360
+ var yy_start = Math.floor(j * ratio_h);
24361
+ var yy_stop = Math.ceil((j + 1) * ratio_h);
24362
+ for (var yy = yy_start; yy < yy_stop; yy++) {
24363
+ var dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half;
24364
+ var center_x = (i + 0.5) * ratio_w;
24365
+ var w0 = dy * dy;
24366
+ var xx_start = Math.floor(i * ratio_w);
24367
+ var xx_stop = Math.ceil((i + 1) * ratio_w);
24368
+ for (var xx = xx_start; xx < xx_stop; xx++) {
24369
+ var dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half;
24370
+ var w = Math.sqrt(w0 + dx * dx);
24371
+ if (w >= 1) {
24372
+ continue;
24373
+ }
24374
+ weight = 2 * w * w * w - 3 * w * w + 1;
24375
+ var pos_x = 4 * (xx + yy * width_source);
24376
+ gx_a += weight * data[pos_x + 3];
24377
+ weights_alpha += weight;
24378
+ if (data[pos_x + 3] < 255) weight = weight * data[pos_x + 3] / 250;
24379
+ gx_r += weight * data[pos_x];
24380
+ gx_g += weight * data[pos_x + 1];
24381
+ gx_b += weight * data[pos_x + 2];
24382
+ weights += weight;
24383
+ }
24384
+ }
24385
+ data2[x2] = gx_r / weights;
24386
+ data2[x2 + 1] = gx_g / weights;
24387
+ data2[x2 + 2] = gx_b / weights;
24388
+ data2[x2 + 3] = gx_a / weights_alpha;
24389
+ }
24390
+ }
24391
+ {
24392
+ canvas.width = width;
24393
+ canvas.height = height;
24394
+ }
24395
+ ctx.putImageData(img2, 0, 0);
24396
+ }
24397
+ function multiStepResize(canvas, width, height) {
24398
+ let oc = document.createElement("canvas");
24399
+ let octx = oc.getContext("2d");
24400
+ let ctx = canvas.getContext("2d");
24401
+ let steps = Math.ceil(Math.log(canvas.width / width) / Math.log(2));
24402
+ steps = Math.max(steps, 1);
24403
+ let stepWidth = width * Math.pow(2, steps - 1);
24404
+ let stepHeight = height * Math.pow(2, steps - 1);
24405
+ let currentWidth = canvas.width;
24406
+ let currentHeight = canvas.height;
24407
+ oc.width = currentWidth;
24408
+ oc.height = currentHeight;
24409
+ octx.drawImage(canvas, 0, 0);
24410
+ while (steps > 0) {
24411
+ stepWidth = Math.max(stepWidth, width);
24412
+ stepHeight = Math.max(stepHeight, height);
24413
+ canvas.width = stepWidth;
24414
+ canvas.height = stepHeight;
24415
+ ctx.drawImage(oc, 0, 0, currentWidth, currentHeight, 0, 0, stepWidth, stepHeight);
24416
+ currentWidth = stepWidth;
24417
+ currentHeight = stepHeight;
24418
+ oc.width = currentWidth;
24419
+ oc.height = currentHeight;
24420
+ octx.drawImage(canvas, 0, 0);
24421
+ stepWidth = Math.round(stepWidth / 2);
24422
+ stepHeight = Math.round(stepHeight / 2);
24423
+ steps--;
24424
+ }
24425
+ resample_high_quality(canvas, width, height);
24426
+ }
24427
+ const fileTooLarge = (file) => {
24428
+ let fileSizeMb = Number((file.size / (1024 * 1024)).toFixed(4));
24429
+ if (fileSizeMb > 5) {
24430
+ window.alert("Image size must be less than 5MB");
24431
+ return true;
24432
+ }
24433
+ return false;
24434
+ };
24435
+ const checkAndProcessImage = async ({ getMaxContentSize, file }) => {
24436
+ if (fileTooLarge(file)) {
24437
+ return { file: null, size: { width: 0, height: 0 } };
24438
+ }
24439
+ try {
24440
+ const processedImageResult = await processUploadedImage(file, getMaxContentSize);
24441
+ const process = processedImageResult;
24442
+ return { file: process.file, size: { width: process.width, height: process.height } };
24443
+ } catch (err) {
24444
+ console.warn("Error processing image:", err);
24445
+ return { file: null, size: { width: 0, height: 0 } };
24446
+ }
24447
+ };
24448
+ function replaceSelectionWithImagePlaceholder({ editorOptions, view, id }) {
24449
+ let { tr } = view.state;
24450
+ let { selection } = tr;
24451
+ if (editorOptions.isHeaderOrFooter) {
24452
+ selection = editorOptions.lastSelection;
24453
+ }
24454
+ if (!selection.empty && !editorOptions.isHeaderOrFooter) {
24455
+ tr.deleteSelection();
24456
+ }
24457
+ tr = addImagePlaceholder(view.state, tr, id, selection.from);
24458
+ view.dispatch(tr);
24459
+ }
24460
+ async function uploadAndInsertImage({ editor, view, file, size, id }) {
24461
+ const imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
24462
+ try {
24463
+ let url = await imageUploadHandler(file);
24464
+ let fileName = file.name.replace(" ", "_");
24465
+ let placeholderPos = findPlaceholder(view.state, id);
24466
+ if (placeholderPos == null) {
24467
+ return;
24468
+ }
24469
+ let mediaPath = `word/media/${fileName}`;
24470
+ let rId = null;
24471
+ if (editor.options.mode === "docx") {
24472
+ const [, path] = mediaPath.split("word/");
24473
+ const id2 = addImageRelationship({ editor, path });
24474
+ if (id2) rId = id2;
24475
+ }
24476
+ let imageNode = view.state.schema.nodes.image.create({
24477
+ src: mediaPath,
24478
+ size,
24479
+ id,
24480
+ rId
24481
+ });
24482
+ editor.storage.image.media = Object.assign(editor.storage.image.media, { [mediaPath]: url });
24483
+ if (editor.options.ydoc && typeof editor.commands.addImageToCollaboration === "function") {
24484
+ editor.commands.addImageToCollaboration({ mediaPath, fileData: url });
24485
+ }
24486
+ let tr = view.state.tr;
24487
+ tr.replaceWith(placeholderPos, placeholderPos, imageNode);
24488
+ tr = removeImagePlaceholder(view.state, tr, id);
24489
+ view.dispatch(tr);
24490
+ } catch {
24491
+ const tr = removeImagePlaceholder(view.state, view.state.tr, id);
24492
+ view.dispatch(tr);
24493
+ }
24494
+ }
24495
+ function addImageRelationship({ editor, path }) {
24496
+ const target = path;
24497
+ const type = "image";
24498
+ try {
24499
+ const id = insertNewRelationship(target, type, editor);
24500
+ return id;
24501
+ } catch {
24502
+ return null;
24503
+ }
24504
+ }
24505
+ const key = new PluginKey("ImageRegistration");
24506
+ const ImageRegistrationPlugin = ({ editor }) => {
24507
+ const { view } = editor;
24181
24508
  return new Plugin({
24182
- key: ImagePlaceholderPluginKey,
24509
+ key,
24183
24510
  state: {
24184
24511
  init() {
24185
- return DecorationSet.empty;
24512
+ return { set: DecorationSet.empty };
24186
24513
  },
24187
- apply(tr, set) {
24514
+ apply(tr, { set }) {
24515
+ const meta = tr.getMeta(key);
24516
+ if (meta) {
24517
+ set = meta.set;
24518
+ return { set };
24519
+ }
24188
24520
  set = set.map(tr.mapping, tr.doc);
24189
- let action = tr.getMeta(ImagePlaceholderPluginKey);
24190
- if (action?.type === "add") {
24191
- let widget = document.createElement("placeholder");
24192
- let deco = Decoration.widget(action.pos, widget, {
24193
- id: action.id
24521
+ return { set };
24522
+ }
24523
+ },
24524
+ appendTransaction: (trs, _oldState, state) => {
24525
+ let foundImages = [];
24526
+ trs.forEach((tr2) => {
24527
+ if (tr2.docChanged) {
24528
+ tr2.steps.forEach((step, index2) => {
24529
+ const stepMap = step.getMap();
24530
+ foundImages = foundImages.map(({ node, pos, id }) => {
24531
+ const mappedPos = stepMap.map(pos, -1);
24532
+ return { node, pos: mappedPos, id };
24533
+ });
24534
+ if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
24535
+ (tr2.docs[index2 + 1] || tr2.doc).nodesBetween(
24536
+ stepMap.map(step.from, -1),
24537
+ stepMap.map(step.to, 1),
24538
+ (node, pos) => {
24539
+ if (node.type.name === "image" && !node.attrs.src.startsWith("word/media")) {
24540
+ const id = {};
24541
+ foundImages.push({ node, pos, id });
24542
+ } else {
24543
+ return true;
24544
+ }
24545
+ }
24546
+ );
24547
+ }
24194
24548
  });
24195
- set = set.add(tr.doc, [deco]);
24196
- } else if (action?.type === "remove") {
24197
- set = set.remove(set.find(null, null, (spec) => spec.id == action.id));
24198
24549
  }
24199
- return set;
24550
+ });
24551
+ if (!foundImages || foundImages.length === 0) {
24552
+ return null;
24200
24553
  }
24554
+ registerImages(foundImages, editor, view);
24555
+ const tr = state.tr;
24556
+ let { set } = key.getState(state);
24557
+ foundImages.slice().sort((a, b) => a.pos - b.pos).forEach(({ pos, id }) => {
24558
+ let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
24559
+ side: -1,
24560
+ id
24561
+ });
24562
+ set = set.add(tr.doc, [deco]);
24563
+ });
24564
+ foundImages.slice().sort((a, b) => b.pos - a.pos).forEach(({ node, pos }) => {
24565
+ tr.delete(pos, pos + node.nodeSize);
24566
+ });
24567
+ set = set.map(tr.mapping, tr.doc);
24568
+ tr.setMeta(key, { set });
24569
+ return tr;
24201
24570
  },
24202
24571
  props: {
24203
24572
  decorations(state) {
24204
- return this.getState(state);
24573
+ let { set } = key.getState(state);
24574
+ return set;
24205
24575
  }
24206
24576
  }
24207
24577
  });
24208
24578
  };
24209
24579
  const findPlaceholder = (state, id) => {
24210
- let decos = ImagePlaceholderPluginKey.getState(state);
24211
- let found = decos?.find(null, null, (spec) => spec.id === id);
24580
+ let { set } = key.getState(state);
24581
+ let found = set?.find(null, null, (spec) => spec.id === id);
24212
24582
  return found?.length ? found[0].from : null;
24213
24583
  };
24584
+ const removeImagePlaceholder = (state, tr, id) => {
24585
+ let { set } = key.getState(state);
24586
+ set = set.map(tr.mapping, tr.doc);
24587
+ set = set.remove(set.find(null, null, (spec) => spec.id == id));
24588
+ return tr.setMeta(key, { set, type: "remove" });
24589
+ };
24590
+ const addImagePlaceholder = (state, tr, id, pos) => {
24591
+ let { set } = key.getState(state);
24592
+ set = set.map(tr.mapping, tr.doc);
24593
+ let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
24594
+ id
24595
+ });
24596
+ set = set.add(tr.doc, [deco]);
24597
+ return tr.setMeta(key, { set, type: "add" });
24598
+ };
24599
+ const getImageRegistrationMetaType = (tr) => {
24600
+ const meta = tr.getMeta(key);
24601
+ if (meta && meta.type) {
24602
+ return meta.type;
24603
+ }
24604
+ return null;
24605
+ };
24606
+ const registerImages = async (foundImages, editor, view) => {
24607
+ foundImages.forEach(async (image) => {
24608
+ const src = image.node.attrs.src;
24609
+ const id = image.id;
24610
+ let file = null;
24611
+ if (src.startsWith("http")) {
24612
+ const isAccessible = await validateUrlAccessibility(src);
24613
+ if (isAccessible) {
24614
+ file = await urlToFile(src);
24615
+ } else {
24616
+ console.warn(`Image URL ${src} is not accessible due to CORS or other restrictions. Using original URL.`);
24617
+ const tr = view.state.tr;
24618
+ removeImagePlaceholder(view.state, tr, id);
24619
+ view.dispatch(tr);
24620
+ return;
24621
+ }
24622
+ } else if (src.startsWith("data:")) {
24623
+ file = base64ToFile(src);
24624
+ } else {
24625
+ console.error(`Unsupported image source: ${src}`);
24626
+ }
24627
+ if (!file) {
24628
+ const tr = view.state.tr;
24629
+ removeImagePlaceholder(view.state, tr, id);
24630
+ view.dispatch(tr);
24631
+ return;
24632
+ }
24633
+ try {
24634
+ const process = await checkAndProcessImage({
24635
+ getMaxContentSize: () => editor.getMaxContentSize(),
24636
+ file
24637
+ });
24638
+ if (!process.file) {
24639
+ const tr = view.state.tr;
24640
+ removeImagePlaceholder(view.state, tr, id);
24641
+ view.dispatch(tr);
24642
+ return;
24643
+ }
24644
+ await uploadAndInsertImage({ editor, view, file: process.file, size: process.size, id });
24645
+ } catch (error) {
24646
+ console.error(`Error processing image from ${src}:`, error);
24647
+ const tr = view.state.tr;
24648
+ removeImagePlaceholder(view.state, tr, id);
24649
+ view.dispatch(tr);
24650
+ }
24651
+ });
24652
+ };
24214
24653
  const ImagePositionPluginKey = new PluginKey("ImagePosition");
24215
24654
  const ImagePositionPlugin = ({ editor }) => {
24216
24655
  const { view } = editor;
@@ -24543,7 +24982,7 @@ const Image = Node$1.create({
24543
24982
  };
24544
24983
  },
24545
24984
  addPmPlugins() {
24546
- return [ImagePlaceholderPlugin(), ImagePositionPlugin({ editor: this.editor })];
24985
+ return [ImageRegistrationPlugin({ editor: this.editor }), ImagePositionPlugin({ editor: this.editor })];
24547
24986
  }
24548
24987
  });
24549
24988
  const ACCEPT_IMAGE_TYPES = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"];
@@ -24568,247 +25007,6 @@ const getFileOpener = () => {
24568
25007
  };
24569
25008
  return openFile;
24570
25009
  };
24571
- const handleImageUpload = (file) => {
24572
- return new Promise((resolve, reject) => {
24573
- let reader = new FileReader();
24574
- reader.onload = (event) => {
24575
- resolve(event.target.result);
24576
- };
24577
- reader.onerror = reject;
24578
- setTimeout(() => reader.readAsDataURL(file), 250);
24579
- });
24580
- };
24581
- const processUploadedImage = (fileData, editor) => {
24582
- return new Promise((resolve, reject) => {
24583
- const img = new window.Image();
24584
- img.onload = () => {
24585
- const canvas = document.createElement("canvas");
24586
- const { width: logicalWidth, height: logicalHeight } = getAllowedImageDimensions(img.width, img.height, editor);
24587
- canvas.width = img.width;
24588
- canvas.height = img.height;
24589
- const ctx = canvas.getContext("2d");
24590
- if (ctx) {
24591
- ctx.imageSmoothingEnabled = true;
24592
- try {
24593
- ctx.imageSmoothingQuality = "high";
24594
- } catch {
24595
- }
24596
- }
24597
- ctx.drawImage(img, 0, 0, img.width, img.height);
24598
- const dpr = typeof window !== "undefined" && window.devicePixelRatio ? window.devicePixelRatio : 1;
24599
- const targetPixelWidth = Math.round(logicalWidth * dpr);
24600
- const targetPixelHeight = Math.round(logicalHeight * dpr);
24601
- const finalTargetWidth = Math.min(targetPixelWidth, img.width);
24602
- const finalTargetHeight = Math.min(targetPixelHeight, img.height);
24603
- const resizeNeeded = finalTargetWidth !== img.width || finalTargetHeight !== img.height;
24604
- if (resizeNeeded) {
24605
- multiStepResize(canvas, finalTargetWidth, finalTargetHeight);
24606
- }
24607
- if (typeof fileData === "string") {
24608
- const resizedBase64 = canvas.toDataURL();
24609
- resolve(resizedBase64);
24610
- } else {
24611
- canvas.toBlob((blob) => {
24612
- const updatedFile = new File([blob], fileData.name, {
24613
- type: fileData.type,
24614
- lastModified: Date.now()
24615
- });
24616
- resolve({ file: updatedFile, width: logicalWidth, height: logicalHeight });
24617
- });
24618
- }
24619
- };
24620
- img.onerror = (error) => reject(error);
24621
- img.src = typeof fileData === "string" ? fileData : URL.createObjectURL(fileData);
24622
- });
24623
- };
24624
- const getAllowedImageDimensions = (width, height, editor) => {
24625
- const { width: maxWidth, height: maxHeight } = editor.getMaxContentSize();
24626
- if (!maxWidth || !maxHeight) return { width, height };
24627
- let adjustedWidth = width;
24628
- let adjustedHeight = height;
24629
- const aspectRatio = width / height;
24630
- if (height > maxHeight) {
24631
- adjustedHeight = maxHeight;
24632
- adjustedWidth = Math.round(maxHeight * aspectRatio);
24633
- }
24634
- if (adjustedWidth > maxWidth) {
24635
- adjustedWidth = maxWidth;
24636
- adjustedHeight = Math.round(maxWidth / aspectRatio);
24637
- }
24638
- return { width: adjustedWidth, height: adjustedHeight };
24639
- };
24640
- function resample_high_quality(canvas, width, height, resize_canvas) {
24641
- var width_source = canvas.width;
24642
- var height_source = canvas.height;
24643
- width = Math.round(width);
24644
- height = Math.round(height);
24645
- var ratio_w = width_source / width;
24646
- var ratio_h = height_source / height;
24647
- var ratio_w_half = Math.ceil(ratio_w / 2);
24648
- var ratio_h_half = Math.ceil(ratio_h / 2);
24649
- var ctx = canvas.getContext("2d");
24650
- var img = ctx.getImageData(0, 0, width_source, height_source);
24651
- var img2 = ctx.createImageData(width, height);
24652
- var data = img.data;
24653
- var data2 = img2.data;
24654
- for (var j = 0; j < height; j++) {
24655
- for (var i = 0; i < width; i++) {
24656
- var x2 = (i + j * width) * 4;
24657
- var weight = 0;
24658
- var weights = 0;
24659
- var weights_alpha = 0;
24660
- var gx_r = 0;
24661
- var gx_g = 0;
24662
- var gx_b = 0;
24663
- var gx_a = 0;
24664
- var center_y = (j + 0.5) * ratio_h;
24665
- var yy_start = Math.floor(j * ratio_h);
24666
- var yy_stop = Math.ceil((j + 1) * ratio_h);
24667
- for (var yy = yy_start; yy < yy_stop; yy++) {
24668
- var dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half;
24669
- var center_x = (i + 0.5) * ratio_w;
24670
- var w0 = dy * dy;
24671
- var xx_start = Math.floor(i * ratio_w);
24672
- var xx_stop = Math.ceil((i + 1) * ratio_w);
24673
- for (var xx = xx_start; xx < xx_stop; xx++) {
24674
- var dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half;
24675
- var w = Math.sqrt(w0 + dx * dx);
24676
- if (w >= 1) {
24677
- continue;
24678
- }
24679
- weight = 2 * w * w * w - 3 * w * w + 1;
24680
- var pos_x = 4 * (xx + yy * width_source);
24681
- gx_a += weight * data[pos_x + 3];
24682
- weights_alpha += weight;
24683
- if (data[pos_x + 3] < 255) weight = weight * data[pos_x + 3] / 250;
24684
- gx_r += weight * data[pos_x];
24685
- gx_g += weight * data[pos_x + 1];
24686
- gx_b += weight * data[pos_x + 2];
24687
- weights += weight;
24688
- }
24689
- }
24690
- data2[x2] = gx_r / weights;
24691
- data2[x2 + 1] = gx_g / weights;
24692
- data2[x2 + 2] = gx_b / weights;
24693
- data2[x2 + 3] = gx_a / weights_alpha;
24694
- }
24695
- }
24696
- {
24697
- canvas.width = width;
24698
- canvas.height = height;
24699
- }
24700
- ctx.putImageData(img2, 0, 0);
24701
- }
24702
- function multiStepResize(canvas, targetWidth, targetHeight) {
24703
- const originalWidth = canvas.width;
24704
- const originalHeight = canvas.height;
24705
- const scaleX = targetWidth / originalWidth;
24706
- const scaleY = targetHeight / originalHeight;
24707
- const scaleFactor = Math.min(scaleX, scaleY);
24708
- if (scaleFactor < 0.5) {
24709
- let currentWidth = originalWidth;
24710
- let currentHeight = originalHeight;
24711
- while (currentWidth > targetWidth * 2 || currentHeight > targetHeight * 2) {
24712
- const nextWidth = Math.round(currentWidth / 2);
24713
- const nextHeight = Math.round(currentHeight / 2);
24714
- resample_high_quality(canvas, nextWidth, nextHeight);
24715
- currentWidth = nextWidth;
24716
- currentHeight = nextHeight;
24717
- }
24718
- if (currentWidth !== targetWidth || currentHeight !== targetHeight) {
24719
- resample_high_quality(canvas, targetWidth, targetHeight);
24720
- }
24721
- } else {
24722
- resample_high_quality(canvas, targetWidth, targetHeight);
24723
- }
24724
- }
24725
- const startImageUpload = async ({ editor, view, file }) => {
24726
- const imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
24727
- let fileSizeMb = Number((file.size / (1024 * 1024)).toFixed(4));
24728
- if (fileSizeMb > 5) {
24729
- window.alert("Image size must be less than 5MB");
24730
- return;
24731
- }
24732
- let width;
24733
- let height;
24734
- try {
24735
- const processedImageResult = await processUploadedImage(file, editor);
24736
- width = processedImageResult.width;
24737
- height = processedImageResult.height;
24738
- file = processedImageResult.file;
24739
- } catch (err) {
24740
- console.warn("Error processing image:", err);
24741
- editor.emit("exception", { error: err, editor });
24742
- return;
24743
- }
24744
- await uploadImage({
24745
- editor,
24746
- view,
24747
- file,
24748
- size: { width, height },
24749
- uploadHandler: imageUploadHandler
24750
- });
24751
- };
24752
- async function uploadImage({ editor, view, file, size, uploadHandler }) {
24753
- let id = {};
24754
- let { tr, schema } = view.state;
24755
- let { selection } = tr;
24756
- if (editor.options.isHeaderOrFooter) {
24757
- selection = editor.options.lastSelection;
24758
- }
24759
- if (!selection.empty && !editor.options.isHeaderOrFooter) {
24760
- tr.deleteSelection();
24761
- }
24762
- let imageMeta = {
24763
- type: "add",
24764
- pos: selection.from,
24765
- id
24766
- };
24767
- tr.setMeta(ImagePlaceholderPluginKey, imageMeta);
24768
- view.dispatch(tr);
24769
- try {
24770
- let url = await uploadHandler(file);
24771
- let fileName = file.name.replace(" ", "_");
24772
- let placeholderPos = findPlaceholder(view.state, id);
24773
- if (placeholderPos == null) {
24774
- return;
24775
- }
24776
- let removeMeta = { type: "remove", id };
24777
- let mediaPath = `word/media/${fileName}`;
24778
- let rId = null;
24779
- if (editor.options.mode === "docx") {
24780
- const [, path] = mediaPath.split("word/");
24781
- const imageid = addImageRelationship({ editor, path });
24782
- if (imageid) rId = imageid;
24783
- }
24784
- let imageNode = schema.nodes.image.create({
24785
- src: mediaPath,
24786
- size,
24787
- rId
24788
- });
24789
- editor.storage.image.media = Object.assign(editor.storage.image.media, { [mediaPath]: url });
24790
- if (editor.options.ydoc) {
24791
- editor.commands.addImageToCollaboration({ mediaPath, fileData: url });
24792
- }
24793
- view.dispatch(
24794
- view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
24795
- );
24796
- } catch (error) {
24797
- let removeMeta = { type: "remove", id };
24798
- view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
24799
- editor.emit("exception", { error, editor });
24800
- }
24801
- }
24802
- function addImageRelationship({ editor, path }) {
24803
- const target = path;
24804
- const type = "image";
24805
- try {
24806
- const relationshipId = insertNewRelationship(target, type, editor);
24807
- return relationshipId;
24808
- } catch {
24809
- return null;
24810
- }
24811
- }
24812
25010
  const BookmarkStart = Node$1.create({
24813
25011
  name: "bookmarkStart",
24814
25012
  group: "inline",
@@ -25123,8 +25321,8 @@ renderDom_fn = function(node, htmlAttributes) {
25123
25321
  __privateMethod(this, _AutoPageNumberNodeView_instances, scheduleUpdateNodeStyle_fn).call(this, currentPos, marks);
25124
25322
  Object.assign(nodeContent.style, styles);
25125
25323
  nodeContent.appendChild(content);
25126
- Object.entries(htmlAttributes).forEach(([key, value]) => {
25127
- if (value) nodeContent.setAttribute(key, value);
25324
+ Object.entries(htmlAttributes).forEach(([key2, value]) => {
25325
+ if (value) nodeContent.setAttribute(key2, value);
25128
25326
  });
25129
25327
  return nodeContent;
25130
25328
  };
@@ -25190,8 +25388,8 @@ const processMarks = (marks) => {
25190
25388
  break;
25191
25389
  default:
25192
25390
  if (attrs?.style) {
25193
- Object.entries(attrs.style).forEach(([key, value]) => {
25194
- styles[key] = value;
25391
+ Object.entries(attrs.style).forEach(([key2, value]) => {
25392
+ styles[key2] = value;
25195
25393
  });
25196
25394
  }
25197
25395
  break;
@@ -27853,8 +28051,8 @@ function mergePaddingObject(paddingObject) {
27853
28051
  return Object.assign({}, getFreshSideObject(), paddingObject);
27854
28052
  }
27855
28053
  function expandToHashMap(value, keys2) {
27856
- return keys2.reduce(function(hashMap, key) {
27857
- hashMap[key] = value;
28054
+ return keys2.reduce(function(hashMap, key2) {
28055
+ hashMap[key2] = value;
27858
28056
  return hashMap;
27859
28057
  }, {});
27860
28058
  }
@@ -28310,10 +28508,10 @@ function detectOverflow$1(state, options) {
28310
28508
  var offsetData = state.modifiersData.offset;
28311
28509
  if (elementContext === popper && offsetData) {
28312
28510
  var offset2 = offsetData[placement];
28313
- Object.keys(overflowOffsets).forEach(function(key) {
28314
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
28315
- var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
28316
- overflowOffsets[key] += offset2[axis] * multiply;
28511
+ Object.keys(overflowOffsets).forEach(function(key2) {
28512
+ var multiply = [right, bottom].indexOf(key2) >= 0 ? 1 : -1;
28513
+ var axis = [top, bottom].indexOf(key2) >= 0 ? "y" : "x";
28514
+ overflowOffsets[key2] += offset2[axis] * multiply;
28317
28515
  });
28318
28516
  }
28319
28517
  return overflowOffsets;
@@ -28760,8 +28958,8 @@ function mergeByName(modifiers2) {
28760
28958
  }) : current;
28761
28959
  return merged2;
28762
28960
  }, {});
28763
- return Object.keys(merged).map(function(key) {
28764
- return merged[key];
28961
+ return Object.keys(merged).map(function(key2) {
28962
+ return merged[key2];
28765
28963
  });
28766
28964
  }
28767
28965
  var DEFAULT_OPTIONS = {
@@ -28918,8 +29116,8 @@ var TOUCH_OPTIONS = {
28918
29116
  var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
28919
29117
  return document.body;
28920
29118
  };
28921
- function hasOwnProperty(obj, key) {
28922
- return {}.hasOwnProperty.call(obj, key);
29119
+ function hasOwnProperty(obj, key2) {
29120
+ return {}.hasOwnProperty.call(obj, key2);
28923
29121
  }
28924
29122
  function getValueAtIndexOrReturn(value, index2, defaultValue) {
28925
29123
  if (Array.isArray(value)) {
@@ -28949,8 +29147,8 @@ function debounce(fn2, ms) {
28949
29147
  }
28950
29148
  function removeProperties(obj, keys2) {
28951
29149
  var clone = Object.assign({}, obj);
28952
- keys2.forEach(function(key) {
28953
- delete clone[key];
29150
+ keys2.forEach(function(key2) {
29151
+ delete clone[key2];
28954
29152
  });
28955
29153
  return clone;
28956
29154
  }
@@ -28977,9 +29175,9 @@ function arrayFrom(value) {
28977
29175
  return [].slice.call(value);
28978
29176
  }
28979
29177
  function removeUndefinedProps(obj) {
28980
- return Object.keys(obj).reduce(function(acc, key) {
28981
- if (obj[key] !== void 0) {
28982
- acc[key] = obj[key];
29178
+ return Object.keys(obj).reduce(function(acc, key2) {
29179
+ if (obj[key2] !== void 0) {
29180
+ acc[key2] = obj[key2];
28983
29181
  }
28984
29182
  return acc;
28985
29183
  }, {});
@@ -29231,8 +29429,8 @@ var setDefaultProps = function setDefaultProps2(partialProps) {
29231
29429
  validateProps(partialProps, []);
29232
29430
  }
29233
29431
  var keys2 = Object.keys(partialProps);
29234
- keys2.forEach(function(key) {
29235
- defaultProps[key] = partialProps[key];
29432
+ keys2.forEach(function(key2) {
29433
+ defaultProps[key2] = partialProps[key2];
29236
29434
  });
29237
29435
  };
29238
29436
  function getExtendedPassedProps(passedProps) {
@@ -29251,18 +29449,18 @@ function getDataAttributeProps(reference2, plugins) {
29251
29449
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
29252
29450
  plugins
29253
29451
  }))) : defaultKeys;
29254
- var props = propKeys.reduce(function(acc, key) {
29255
- var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
29452
+ var props = propKeys.reduce(function(acc, key2) {
29453
+ var valueAsString = (reference2.getAttribute("data-tippy-" + key2) || "").trim();
29256
29454
  if (!valueAsString) {
29257
29455
  return acc;
29258
29456
  }
29259
- if (key === "content") {
29260
- acc[key] = valueAsString;
29457
+ if (key2 === "content") {
29458
+ acc[key2] = valueAsString;
29261
29459
  } else {
29262
29460
  try {
29263
- acc[key] = JSON.parse(valueAsString);
29461
+ acc[key2] = JSON.parse(valueAsString);
29264
29462
  } catch (e) {
29265
- acc[key] = valueAsString;
29463
+ acc[key2] = valueAsString;
29266
29464
  }
29267
29465
  }
29268
29466
  return acc;
@@ -30186,8 +30384,8 @@ tippy.setDefaultProps({
30186
30384
  });
30187
30385
  const _export_sfc = (sfc, props) => {
30188
30386
  const target = sfc.__vccOpts || sfc;
30189
- for (const [key, val] of props) {
30190
- target[key] = val;
30387
+ for (const [key2, val] of props) {
30388
+ target[key2] = val;
30191
30389
  }
30192
30390
  return target;
30193
30391
  };
@@ -31579,9 +31777,9 @@ const Pagination = Extension.create({
31579
31777
  if (syncMeta && syncMeta.isChangeOrigin || listSyncMeta) {
31580
31778
  return { ...oldState };
31581
31779
  }
31582
- const imagePluginTransaction = tr.getMeta(ImagePlaceholderPluginKey);
31583
- if (imagePluginTransaction) {
31584
- if (imagePluginTransaction.type === "remove") {
31780
+ const imageRegistrationMetaType = getImageRegistrationMetaType(tr);
31781
+ if (imageRegistrationMetaType) {
31782
+ if (imageRegistrationMetaType === "remove") {
31585
31783
  onImageLoad(editor);
31586
31784
  }
31587
31785
  return { ...oldState };
@@ -32982,18 +33180,20 @@ export {
32982
33180
  getQuickFormatList as a,
32983
33181
  generateLinkedStyleString as b,
32984
33182
  getFileOpener as c,
32985
- undoDepth as d,
32986
- getStarterExtensions as e,
32987
- getRichTextExtensions as f,
33183
+ checkAndProcessImage as d,
33184
+ uploadAndInsertImage as e,
33185
+ undoDepth as f,
32988
33186
  global as g,
32989
- Extension as h,
32990
- index$1 as i,
32991
- index as j,
32992
- AnnotatorHelpers as k,
32993
- SectionHelpers as l,
32994
- getAllowedImageDimensions as m,
32995
- redoDepth as r,
32996
- startImageUpload as s,
33187
+ redoDepth as h,
33188
+ getStarterExtensions as i,
33189
+ getRichTextExtensions as j,
33190
+ Extension as k,
33191
+ index$1 as l,
33192
+ index as m,
33193
+ AnnotatorHelpers as n,
33194
+ SectionHelpers as o,
33195
+ getAllowedImageDimensions as p,
33196
+ replaceSelectionWithImagePlaceholder as r,
32997
33197
  useHighContrastMode as u,
32998
33198
  yUndoPluginKey as y
32999
33199
  };