@harbour-enterprises/superdoc 0.8.11 → 0.8.12

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 (26) hide show
  1. package/dist/chunks/{super-editor.es-DIeHC3Si.js → super-editor.es-D8IC7SPE.js} +239 -211
  2. package/dist/chunks/{super-editor.es-DIeHC3Si.js.map → super-editor.es-D8IC7SPE.js.map} +1 -1
  3. package/dist/super-editor/chunks/{converter-CVSaF15S.js → converter-vMwuPcFT.js} +3 -3
  4. package/dist/super-editor/chunks/{converter-CVSaF15S.js.map → converter-vMwuPcFT.js.map} +1 -1
  5. package/dist/super-editor/chunks/{docx-zipper-BHwY_rz6.js → docx-zipper-CNguQWs9.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-BHwY_rz6.js.map → docx-zipper-CNguQWs9.js.map} +1 -1
  7. package/dist/super-editor/chunks/{editor-H6Apbtdi.js → editor-aREw3zbp.js} +239 -211
  8. package/dist/super-editor/chunks/editor-aREw3zbp.js.map +1 -0
  9. package/dist/super-editor/chunks/{toolbar-D9ELD8Tt.js → toolbar-BQJNZhd8.js} +3 -3
  10. package/dist/super-editor/chunks/{toolbar-D9ELD8Tt.js.map → toolbar-BQJNZhd8.js.map} +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/docx-zipper.es.js +2 -2
  13. package/dist/super-editor/editor.es.js +3 -3
  14. package/dist/super-editor/extensions/comment/comments-plugin.d.ts.map +1 -1
  15. package/dist/super-editor/extensions/track-changes/trackChangesHelpers/addMarkStep.d.ts.map +1 -1
  16. package/dist/super-editor/extensions/track-changes/trackChangesHelpers/removeMarkStep.d.ts.map +1 -1
  17. package/dist/super-editor/extensions/track-changes/trackChangesHelpers/replaceStep.d.ts.map +1 -1
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.es.js +3 -3
  23. package/dist/superdoc.umd.js +239 -211
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/super-editor/chunks/editor-H6Apbtdi.js.map +0 -1
@@ -20664,7 +20664,7 @@ const _SuperConverter = class _SuperConverter2 {
20664
20664
  return;
20665
20665
  }
20666
20666
  }
20667
- static updateDocumentVersion(docx = this.convertedXml, version = "0.8.11") {
20667
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.8.12") {
20668
20668
  const customLocation = "docProps/custom.xml";
20669
20669
  if (!docx[customLocation]) {
20670
20670
  docx[customLocation] = generateCustomXml();
@@ -20937,7 +20937,7 @@ function storeSuperdocVersion(docx) {
20937
20937
  function generateCustomXml() {
20938
20938
  return DEFAULT_CUSTOM_XML;
20939
20939
  }
20940
- function generateSuperdocVersion(pid = 2, version = "0.8.11") {
20940
+ function generateSuperdocVersion(pid = 2, version = "0.8.12") {
20941
20941
  return {
20942
20942
  type: "element",
20943
20943
  name: "property",
@@ -33986,199 +33986,6 @@ const getTrackChangesDecorations = (state2, onlyOriginalShown, onlyModifiedShown
33986
33986
  });
33987
33987
  return DecorationSet.create(state2.doc, decorations);
33988
33988
  };
33989
- const replaceStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date, originalStep, originalStepIndex }) => {
33990
- const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName];
33991
- const deletionMark = findMark(state2, deletionMarkSchema, false);
33992
- const positionTo = deletionMark ? deletionMark.to : step.to;
33993
- const newStep = new ReplaceStep(
33994
- positionTo,
33995
- // We insert all the same steps, but with "from"/"to" both set to "to" in order not to delete content. Mapped as needed.
33996
- positionTo,
33997
- step.slice,
33998
- step.structure
33999
- );
34000
- const invertStep = originalStep.invert(tr.docs[originalStepIndex]).map(map22);
34001
- map22.appendMap(invertStep.getMap());
34002
- const meta = {};
34003
- if (newStep) {
34004
- const trTemp = state2.apply(newTr).tr;
34005
- if (trTemp.maybeStep(newStep).failed) {
34006
- return;
34007
- }
34008
- const mappedNewStepTo = newStep.getMap().map(newStep.to);
34009
- const insertedMark = markInsertion({
34010
- tr: trTemp,
34011
- from: newStep.from,
34012
- to: mappedNewStepTo,
34013
- user,
34014
- date
34015
- });
34016
- const condensedStep = new ReplaceStep(newStep.from, newStep.to, trTemp.doc.slice(newStep.from, mappedNewStepTo));
34017
- newTr.step(condensedStep);
34018
- const mirrorIndex = map22.maps.length - 1;
34019
- map22.appendMap(condensedStep.getMap(), mirrorIndex);
34020
- if (newStep.from !== mappedNewStepTo) {
34021
- meta.insertedMark = insertedMark;
34022
- meta.step = condensedStep;
34023
- }
34024
- if (!newTr.selection.eq(trTemp.selection)) {
34025
- newTr.setSelection(trTemp.selection);
34026
- }
34027
- }
34028
- if (step.from !== step.to) {
34029
- const { deletionMark: deletionMark2, deletionMap, nodes: deletionNodes } = markDeletion({
34030
- tr: newTr,
34031
- from: step.from,
34032
- to: step.to,
34033
- user,
34034
- date
34035
- });
34036
- meta.deletionNodes = deletionNodes;
34037
- meta.deletionMark = deletionMark2;
34038
- map22.appendMapping(deletionMap);
34039
- }
34040
- newTr.setMeta(TrackChangesBasePluginKey, meta);
34041
- };
34042
- const markWrapping = () => {
34043
- };
34044
- const replaceAroundStep = () => {
34045
- };
34046
- const addMarkStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date }) => {
34047
- const meta = {};
34048
- doc2.nodesBetween(step.from, step.to, (node2, pos) => {
34049
- if (!node2.isInline) {
34050
- return;
34051
- }
34052
- if (node2.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
34053
- return false;
34054
- }
34055
- const existingChangeMark = node2.marks.find((mark) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark.type.name));
34056
- const wid = existingChangeMark ? existingChangeMark.attrs.id : v4();
34057
- newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
34058
- const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
34059
- if (allowedMarks.includes(step.mark.type.name) && !node2.marks.find((mark) => mark.type === step.mark.type)) {
34060
- const formatChangeMark = node2.marks.find((mark) => mark.type.name === TrackFormatMarkName);
34061
- let after = [];
34062
- let before = [];
34063
- if (formatChangeMark) {
34064
- let foundBefore = formatChangeMark.attrs.before.find((mark) => {
34065
- if (mark.type === "textStyle") {
34066
- return mark.type === step.mark.type.name && objectIncludes(mark.attrs, step.mark.attrs);
34067
- }
34068
- return mark.type === step.mark.type.name;
34069
- });
34070
- if (foundBefore) {
34071
- before = [...formatChangeMark.attrs.before.filter((mark) => mark.type !== step.mark.type.name)];
34072
- after = [...formatChangeMark.attrs.after];
34073
- } else {
34074
- before = [...formatChangeMark.attrs.before];
34075
- after = [
34076
- ...formatChangeMark.attrs.after,
34077
- {
34078
- type: step.mark.type.name,
34079
- attrs: { ...step.mark.attrs }
34080
- }
34081
- ];
34082
- }
34083
- } else {
34084
- before = node2.marks.map((mark) => ({
34085
- type: mark.type.name,
34086
- attrs: { ...mark.attrs }
34087
- }));
34088
- after = [
34089
- {
34090
- type: step.mark.type.name,
34091
- attrs: { ...step.mark.attrs }
34092
- }
34093
- ];
34094
- }
34095
- if (after.length || before.length) {
34096
- const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
34097
- id: wid,
34098
- author: user.name,
34099
- authorEmail: user.email,
34100
- date,
34101
- before,
34102
- after
34103
- });
34104
- newTr.addMark(
34105
- step.from,
34106
- // Math.max(step.from, pos)
34107
- step.to,
34108
- // Math.min(step.to, pos + node.nodeSize),
34109
- newFormatMark
34110
- );
34111
- meta.formatMark = newFormatMark;
34112
- meta.step = step;
34113
- newTr.setMeta(TrackChangesBasePluginKey, meta);
34114
- } else if (formatChangeMark) {
34115
- newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), formatChangeMark);
34116
- }
34117
- }
34118
- });
34119
- };
34120
- const removeMarkStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date }) => {
34121
- const meta = {};
34122
- doc2.nodesBetween(step.from, step.to, (node2, pos) => {
34123
- if (!node2.isInline) {
34124
- return true;
34125
- }
34126
- if (node2.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
34127
- return false;
34128
- }
34129
- newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
34130
- const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
34131
- if (allowedMarks.includes(step.mark.type.name) && node2.marks.find((mark) => mark.type === step.mark.type)) {
34132
- const formatChangeMark = node2.marks.find((mark) => mark.type.name === TrackFormatMarkName);
34133
- let after = [];
34134
- let before = [];
34135
- if (formatChangeMark) {
34136
- let foundAfter = formatChangeMark.attrs.after.find((mark) => mark.type === step.mark.type.name);
34137
- if (foundAfter) {
34138
- after = [...formatChangeMark.attrs.after.filter((mark) => mark.type !== step.mark.type.name)];
34139
- before = [...formatChangeMark.attrs.before];
34140
- } else {
34141
- after = [...formatChangeMark.attrs.after];
34142
- before = [
34143
- ...formatChangeMark.attrs.before,
34144
- {
34145
- type: step.mark.type.name,
34146
- attrs: { ...step.mark.attrs }
34147
- }
34148
- ];
34149
- }
34150
- } else {
34151
- after = [];
34152
- before = [
34153
- {
34154
- type: step.mark.type.name,
34155
- attrs: { ...step.mark.attrs }
34156
- }
34157
- ];
34158
- }
34159
- if (after.length || before.length) {
34160
- const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
34161
- id: v4(),
34162
- author: user.name,
34163
- authorEmail: user.email,
34164
- date,
34165
- before,
34166
- after
34167
- });
34168
- newTr.addMark(
34169
- Math.max(step.from, pos),
34170
- Math.min(step.to, pos + node2.nodeSize),
34171
- newFormatMark
34172
- );
34173
- meta.formatMark = newFormatMark;
34174
- meta.step = step;
34175
- newTr.setMeta(TrackChangesBasePluginKey, meta);
34176
- } else if (formatChangeMark) {
34177
- newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), formatChangeMark);
34178
- }
34179
- }
34180
- });
34181
- };
34182
33989
  const CommentMarkName = "commentMark";
34183
33990
  const removeCommentsById = ({ commentId, state: state2, tr, dispatch }) => {
34184
33991
  const positions = getCommentPositionsById(commentId, state2.doc);
@@ -34585,7 +34392,7 @@ const CommentsPlugin = Extension.create({
34585
34392
  update(view, prevState) {
34586
34393
  const { state: state2 } = view;
34587
34394
  const { doc: doc2, tr } = state2;
34588
- if (prevDoc && prevDoc.eq(doc2)) shouldUpdate = true;
34395
+ if (prevDoc && !prevDoc.eq(doc2)) shouldUpdate = true;
34589
34396
  if (!shouldUpdate) return;
34590
34397
  prevDoc = doc2;
34591
34398
  shouldUpdate = false;
@@ -34619,10 +34426,14 @@ const CommentsPlugin = Extension.create({
34619
34426
  if (hasActive && activeThreadId !== threadId) return;
34620
34427
  decorations.push(deco);
34621
34428
  });
34622
- const trackedChangeNode = getTrackedChangeNode(node2);
34623
- if (trackedChangeNode) {
34429
+ const trackedChangeMark = findTrackedMark({
34430
+ doc: doc2,
34431
+ from: pos,
34432
+ to: pos + node2.nodeSize
34433
+ });
34434
+ if (trackedChangeMark) {
34624
34435
  const currentBounds = view.coordsAtPos(pos);
34625
- const { id } = trackedChangeNode.attrs;
34436
+ const { id } = trackedChangeMark.mark.attrs;
34626
34437
  updatePosition({
34627
34438
  allCommentPositions,
34628
34439
  threadId: id,
@@ -34690,9 +34501,13 @@ const getActiveCommentId = (doc2, selection) => {
34690
34501
  if ($from.pos !== $to.pos) return;
34691
34502
  const nodeAtPos = doc2.nodeAt($from.pos);
34692
34503
  if (!nodeAtPos) return;
34693
- const trackedChangeNode = getTrackedChangeNode(nodeAtPos);
34694
- if (trackedChangeNode) {
34695
- return trackedChangeNode.attrs.id;
34504
+ const trackedChangeMark = findTrackedMark({
34505
+ doc: doc2,
34506
+ from: $from.pos,
34507
+ to: $to.pos
34508
+ });
34509
+ if (trackedChangeMark) {
34510
+ return trackedChangeMark.mark.attrs.id;
34696
34511
  }
34697
34512
  const overlaps = [];
34698
34513
  let found2 = false;
@@ -34729,13 +34544,30 @@ const getActiveCommentId = (doc2, selection) => {
34729
34544
  const closestCommentMark = closestMarks.find((mark) => mark.type.name === CommentMarkName);
34730
34545
  return closestCommentMark?.attrs?.commentId || closestCommentMark?.attrs?.importedId;
34731
34546
  };
34732
- const getTrackedChangeNode = (node2) => {
34733
- if (!node2) return;
34734
- const nodeMarks = node2.marks;
34735
- const trackedInsertMark = nodeMarks?.find((mark) => mark.type.name === TrackInsertMarkName);
34736
- const trackedDeleteMark = nodeMarks?.find((mark) => mark.type.name === TrackDeleteMarkName);
34737
- const trackedFormatMark = nodeMarks?.find((mark) => mark.type.name === TrackFormatMarkName);
34738
- return trackedInsertMark || trackedDeleteMark || trackedFormatMark;
34547
+ const findTrackedMark = ({
34548
+ doc: doc2,
34549
+ from: from2,
34550
+ to,
34551
+ offset: offset2 = 1
34552
+ // To get non-inclusive marks.
34553
+ }) => {
34554
+ const startPos = Math.max(from2 - offset2, 0);
34555
+ const endPos = Math.min(to + offset2, doc2.content.size);
34556
+ let markFound;
34557
+ doc2.nodesBetween(startPos, endPos, (node2, pos) => {
34558
+ if (!node2 || node2?.nodeSize === void 0) {
34559
+ return;
34560
+ }
34561
+ const mark = node2.marks.find((mark2) => TRACK_CHANGE_MARKS.includes(mark2.type.name));
34562
+ if (mark && !markFound) {
34563
+ markFound = {
34564
+ from: pos,
34565
+ to: pos + node2.nodeSize,
34566
+ mark
34567
+ };
34568
+ }
34569
+ });
34570
+ return markFound;
34739
34571
  };
34740
34572
  const handleTrackedChangeTransaction = (trackedChangeMeta, trackedChanges, newEditorState, editor) => {
34741
34573
  const {
@@ -34875,6 +34707,202 @@ function findNode$1(node2, predicate) {
34875
34707
  });
34876
34708
  return found2;
34877
34709
  }
34710
+ const replaceStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date, originalStep, originalStepIndex }) => {
34711
+ const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName];
34712
+ const deletionMark = findMark(state2, deletionMarkSchema, false);
34713
+ const positionTo = deletionMark ? deletionMark.to : step.to;
34714
+ const newStep = new ReplaceStep(
34715
+ positionTo,
34716
+ // We insert all the same steps, but with "from"/"to" both set to "to" in order not to delete content. Mapped as needed.
34717
+ positionTo,
34718
+ step.slice,
34719
+ step.structure
34720
+ );
34721
+ const invertStep = originalStep.invert(tr.docs[originalStepIndex]).map(map22);
34722
+ map22.appendMap(invertStep.getMap());
34723
+ const meta = {};
34724
+ if (newStep) {
34725
+ const trTemp = state2.apply(newTr).tr;
34726
+ if (trTemp.maybeStep(newStep).failed) {
34727
+ return;
34728
+ }
34729
+ const mappedNewStepTo = newStep.getMap().map(newStep.to);
34730
+ const insertedMark = markInsertion({
34731
+ tr: trTemp,
34732
+ from: newStep.from,
34733
+ to: mappedNewStepTo,
34734
+ user,
34735
+ date
34736
+ });
34737
+ const condensedStep = new ReplaceStep(newStep.from, newStep.to, trTemp.doc.slice(newStep.from, mappedNewStepTo));
34738
+ newTr.step(condensedStep);
34739
+ const mirrorIndex = map22.maps.length - 1;
34740
+ map22.appendMap(condensedStep.getMap(), mirrorIndex);
34741
+ if (newStep.from !== mappedNewStepTo) {
34742
+ meta.insertedMark = insertedMark;
34743
+ meta.step = condensedStep;
34744
+ }
34745
+ if (!newTr.selection.eq(trTemp.selection)) {
34746
+ newTr.setSelection(trTemp.selection);
34747
+ }
34748
+ }
34749
+ if (step.from !== step.to) {
34750
+ const { deletionMark: deletionMark2, deletionMap, nodes: deletionNodes } = markDeletion({
34751
+ tr: newTr,
34752
+ from: step.from,
34753
+ to: step.to,
34754
+ user,
34755
+ date
34756
+ });
34757
+ meta.deletionNodes = deletionNodes;
34758
+ meta.deletionMark = deletionMark2;
34759
+ map22.appendMapping(deletionMap);
34760
+ }
34761
+ newTr.setMeta(TrackChangesBasePluginKey, meta);
34762
+ newTr.setMeta(CommentsPluginKey, { type: "force" });
34763
+ };
34764
+ const markWrapping = () => {
34765
+ };
34766
+ const replaceAroundStep = () => {
34767
+ };
34768
+ const addMarkStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date }) => {
34769
+ const meta = {};
34770
+ doc2.nodesBetween(step.from, step.to, (node2, pos) => {
34771
+ if (!node2.isInline) {
34772
+ return;
34773
+ }
34774
+ if (node2.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
34775
+ return false;
34776
+ }
34777
+ const existingChangeMark = node2.marks.find((mark) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark.type.name));
34778
+ const wid = existingChangeMark ? existingChangeMark.attrs.id : v4();
34779
+ newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
34780
+ const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
34781
+ if (allowedMarks.includes(step.mark.type.name) && !node2.marks.find((mark) => mark.type === step.mark.type)) {
34782
+ const formatChangeMark = node2.marks.find((mark) => mark.type.name === TrackFormatMarkName);
34783
+ let after = [];
34784
+ let before = [];
34785
+ if (formatChangeMark) {
34786
+ let foundBefore = formatChangeMark.attrs.before.find((mark) => {
34787
+ if (mark.type === "textStyle") {
34788
+ return mark.type === step.mark.type.name && objectIncludes(mark.attrs, step.mark.attrs);
34789
+ }
34790
+ return mark.type === step.mark.type.name;
34791
+ });
34792
+ if (foundBefore) {
34793
+ before = [...formatChangeMark.attrs.before.filter((mark) => mark.type !== step.mark.type.name)];
34794
+ after = [...formatChangeMark.attrs.after];
34795
+ } else {
34796
+ before = [...formatChangeMark.attrs.before];
34797
+ after = [
34798
+ ...formatChangeMark.attrs.after,
34799
+ {
34800
+ type: step.mark.type.name,
34801
+ attrs: { ...step.mark.attrs }
34802
+ }
34803
+ ];
34804
+ }
34805
+ } else {
34806
+ before = node2.marks.map((mark) => ({
34807
+ type: mark.type.name,
34808
+ attrs: { ...mark.attrs }
34809
+ }));
34810
+ after = [
34811
+ {
34812
+ type: step.mark.type.name,
34813
+ attrs: { ...step.mark.attrs }
34814
+ }
34815
+ ];
34816
+ }
34817
+ if (after.length || before.length) {
34818
+ const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
34819
+ id: wid,
34820
+ author: user.name,
34821
+ authorEmail: user.email,
34822
+ date,
34823
+ before,
34824
+ after
34825
+ });
34826
+ newTr.addMark(
34827
+ step.from,
34828
+ // Math.max(step.from, pos)
34829
+ step.to,
34830
+ // Math.min(step.to, pos + node.nodeSize),
34831
+ newFormatMark
34832
+ );
34833
+ meta.formatMark = newFormatMark;
34834
+ meta.step = step;
34835
+ newTr.setMeta(TrackChangesBasePluginKey, meta);
34836
+ newTr.setMeta(CommentsPluginKey, { type: "force" });
34837
+ } else if (formatChangeMark) {
34838
+ newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), formatChangeMark);
34839
+ }
34840
+ }
34841
+ });
34842
+ };
34843
+ const removeMarkStep = ({ state: state2, tr, step, newTr, map: map22, doc: doc2, user, date }) => {
34844
+ const meta = {};
34845
+ doc2.nodesBetween(step.from, step.to, (node2, pos) => {
34846
+ if (!node2.isInline) {
34847
+ return true;
34848
+ }
34849
+ if (node2.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
34850
+ return false;
34851
+ }
34852
+ newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), step.mark);
34853
+ const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
34854
+ if (allowedMarks.includes(step.mark.type.name) && node2.marks.find((mark) => mark.type === step.mark.type)) {
34855
+ const formatChangeMark = node2.marks.find((mark) => mark.type.name === TrackFormatMarkName);
34856
+ let after = [];
34857
+ let before = [];
34858
+ if (formatChangeMark) {
34859
+ let foundAfter = formatChangeMark.attrs.after.find((mark) => mark.type === step.mark.type.name);
34860
+ if (foundAfter) {
34861
+ after = [...formatChangeMark.attrs.after.filter((mark) => mark.type !== step.mark.type.name)];
34862
+ before = [...formatChangeMark.attrs.before];
34863
+ } else {
34864
+ after = [...formatChangeMark.attrs.after];
34865
+ before = [
34866
+ ...formatChangeMark.attrs.before,
34867
+ {
34868
+ type: step.mark.type.name,
34869
+ attrs: { ...step.mark.attrs }
34870
+ }
34871
+ ];
34872
+ }
34873
+ } else {
34874
+ after = [];
34875
+ before = [
34876
+ {
34877
+ type: step.mark.type.name,
34878
+ attrs: { ...step.mark.attrs }
34879
+ }
34880
+ ];
34881
+ }
34882
+ if (after.length || before.length) {
34883
+ const newFormatMark = state2.schema.marks[TrackFormatMarkName].create({
34884
+ id: v4(),
34885
+ author: user.name,
34886
+ authorEmail: user.email,
34887
+ date,
34888
+ before,
34889
+ after
34890
+ });
34891
+ newTr.addMark(
34892
+ Math.max(step.from, pos),
34893
+ Math.min(step.to, pos + node2.nodeSize),
34894
+ newFormatMark
34895
+ );
34896
+ meta.formatMark = newFormatMark;
34897
+ meta.step = step;
34898
+ newTr.setMeta(TrackChangesBasePluginKey, meta);
34899
+ newTr.setMeta(CommentsPluginKey, { type: "force" });
34900
+ } else if (formatChangeMark) {
34901
+ newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node2.nodeSize), formatChangeMark);
34902
+ }
34903
+ }
34904
+ });
34905
+ };
34878
34906
  const trackedTransaction = ({ tr, state: state2, user }) => {
34879
34907
  const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
34880
34908
  const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
@@ -35472,7 +35500,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
35472
35500
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
35473
35501
  */
35474
35502
  processCollaborationMigrations() {
35475
- console.debug("[checkVersionMigrations] Current editor version", "0.8.11");
35503
+ console.debug("[checkVersionMigrations] Current editor version", "0.8.12");
35476
35504
  if (!this.options.ydoc) return;
35477
35505
  const metaMap = this.options.ydoc.getMap("meta");
35478
35506
  let docVersion = metaMap.get("version");
@@ -59103,4 +59131,4 @@ export {
59103
59131
  helpers as m,
59104
59132
  index as n
59105
59133
  };
59106
- //# sourceMappingURL=super-editor.es-DIeHC3Si.js.map
59134
+ //# sourceMappingURL=super-editor.es-D8IC7SPE.js.map