@toast-ui/editor 3.1.8 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/esm/i18n/ar.js +1 -1
  2. package/dist/esm/i18n/cs-cz.js +1 -1
  3. package/dist/esm/i18n/de-de.js +1 -1
  4. package/dist/esm/i18n/en-us.js +1 -1
  5. package/dist/esm/i18n/es-es.js +1 -1
  6. package/dist/esm/i18n/fi-fi.js +1 -1
  7. package/dist/esm/i18n/fr-fr.js +1 -1
  8. package/dist/esm/i18n/gl-es.js +1 -1
  9. package/dist/esm/i18n/hr-hr.js +1 -1
  10. package/dist/esm/i18n/i18n.js +1 -1
  11. package/dist/esm/i18n/it-it.js +1 -1
  12. package/dist/esm/i18n/ja-jp.js +1 -1
  13. package/dist/esm/i18n/ko-kr.js +1 -1
  14. package/dist/esm/i18n/nb-no.js +1 -1
  15. package/dist/esm/i18n/nl-nl.js +1 -1
  16. package/dist/esm/i18n/pl-pl.js +1 -1
  17. package/dist/esm/i18n/pt-br.js +1 -1
  18. package/dist/esm/i18n/ru-ru.js +1 -1
  19. package/dist/esm/i18n/sv-se.js +1 -1
  20. package/dist/esm/i18n/tr-tr.js +1 -1
  21. package/dist/esm/i18n/uk-ua.js +1 -1
  22. package/dist/esm/i18n/zh-cn.js +1 -1
  23. package/dist/esm/i18n/zh-tw.js +1 -1
  24. package/dist/esm/index.js +96 -31
  25. package/dist/esm/indexViewer.js +39 -7
  26. package/dist/i18n/ar.js +1 -1
  27. package/dist/i18n/cs-cz.js +1 -1
  28. package/dist/i18n/de-de.js +1 -1
  29. package/dist/i18n/es-es.js +1 -1
  30. package/dist/i18n/fi-fi.js +1 -1
  31. package/dist/i18n/fr-fr.js +1 -1
  32. package/dist/i18n/gl-es.js +1 -1
  33. package/dist/i18n/hr-hr.js +1 -1
  34. package/dist/i18n/it-it.js +1 -1
  35. package/dist/i18n/ja-jp.js +1 -1
  36. package/dist/i18n/ko-kr.js +1 -1
  37. package/dist/i18n/nb-no.js +1 -1
  38. package/dist/i18n/nl-nl.js +1 -1
  39. package/dist/i18n/pl-pl.js +1 -1
  40. package/dist/i18n/pt-br.js +1 -1
  41. package/dist/i18n/ru-ru.js +1 -1
  42. package/dist/i18n/sv-se.js +1 -1
  43. package/dist/i18n/tr-tr.js +1 -1
  44. package/dist/i18n/uk-ua.js +1 -1
  45. package/dist/i18n/zh-cn.js +1 -1
  46. package/dist/i18n/zh-tw.js +1 -1
  47. package/dist/toastui-editor-only.css +1 -1
  48. package/dist/toastui-editor-viewer.css +1 -1
  49. package/dist/toastui-editor-viewer.js +54 -12
  50. package/dist/toastui-editor.css +9 -1
  51. package/dist/toastui-editor.js +81 -11
  52. package/package.json +1 -1
  53. package/types/convertor.d.ts +1 -1
  54. package/types/editor.d.ts +21 -0
  55. package/types/index.d.ts +1 -1
  56. package/types/prosemirror-commands.d.ts +15 -0
  57. package/types/prosemirror-model.d.ts +1 -10
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1537,6 +1537,14 @@ function replaceBRWithEmptyBlock(html) {
1537
1537
  });
1538
1538
  return replacedHTML;
1539
1539
  }
1540
+ function removeProseMirrorHackNodes(html) {
1541
+ var reProseMirrorImage = /<img class="ProseMirror-separator" alt="">/g;
1542
+ var reProseMirrorTrailingBreak = / class="ProseMirror-trailingBreak"/g;
1543
+ var resultHTML = html;
1544
+ resultHTML = resultHTML.replace(reProseMirrorImage, '');
1545
+ resultHTML = resultHTML.replace(reProseMirrorTrailingBreak, '');
1546
+ return resultHTML;
1547
+ }
1540
1548
 
1541
1549
  var pluginKey$1 = new PluginKey('widget');
1542
1550
  var MARGIN = 5;
@@ -15660,7 +15668,7 @@ var MarkdownPreview = /** @class */ (function () {
15660
15668
  return this.el;
15661
15669
  };
15662
15670
  MarkdownPreview.prototype.getHTML = function () {
15663
- return this.previewContent.innerHTML;
15671
+ return removeProseMirrorHackNodes(this.previewContent.innerHTML);
15664
15672
  };
15665
15673
  MarkdownPreview.prototype.setHTML = function (html) {
15666
15674
  this.previewContent.innerHTML = html;
@@ -15748,7 +15756,7 @@ function getDefaultCustomAttrs() {
15748
15756
  classNames: { default: null },
15749
15757
  };
15750
15758
  }
15751
- function getCustomAttrs(attrs) {
15759
+ function getCustomAttrs$1(attrs) {
15752
15760
  var htmlAttrs = attrs.htmlAttrs, classNames = attrs.classNames;
15753
15761
  return __assign$1(__assign$1({}, htmlAttrs), { class: classNames ? classNames.join(' ') : null });
15754
15762
  }
@@ -16338,10 +16346,14 @@ var CellSelection = /** @class */ (function (_super) {
16338
16346
  }
16339
16347
  var copiedRow = row.copy(Fragment.from(cells));
16340
16348
  var targetNode = isTableHeadCell ? tableHead : tableBody;
16349
+ // @ts-ignore
16341
16350
  targetNode.content = targetNode.content.append(Fragment.from(copiedRow));
16342
16351
  }
16343
16352
  return new Slice(createTableFragment(tableHead, tableBody), 1, 1);
16344
16353
  };
16354
+ CellSelection.prototype.toJSON = function () {
16355
+ return JSON.stringify(this);
16356
+ };
16345
16357
  return CellSelection;
16346
16358
  }(Selection));
16347
16359
 
@@ -17091,7 +17103,7 @@ var ImageView = /** @class */ (function () {
17091
17103
  ImageView.prototype.createImageElement = function (node) {
17092
17104
  var image = document.createElement('img');
17093
17105
  var _a = node.attrs, imageUrl = _a.imageUrl, altText = _a.altText;
17094
- var attrs = getCustomAttrs(node.attrs);
17106
+ var attrs = getCustomAttrs$1(node.attrs);
17095
17107
  image.src = imageUrl;
17096
17108
  if (altText) {
17097
17109
  image.alt = altText;
@@ -17120,7 +17132,6 @@ var CODE_BLOCK_LANG_CLASS_NAME = 'toastui-editor-ww-code-block-language';
17120
17132
  var CodeBlockView = /** @class */ (function () {
17121
17133
  function CodeBlockView(node, view, getPos, eventEmitter) {
17122
17134
  var _this = this;
17123
- this.dom = null;
17124
17135
  this.contentDOM = null;
17125
17136
  this.input = null;
17126
17137
  this.timer = null;
@@ -17162,7 +17173,7 @@ var CodeBlockView = /** @class */ (function () {
17162
17173
  var pre = document.createElement('pre');
17163
17174
  var code = document.createElement('code');
17164
17175
  var language = this.node.attrs.language;
17165
- var attrs = getCustomAttrs(this.node.attrs);
17176
+ var attrs = getCustomAttrs$1(this.node.attrs);
17166
17177
  if (language) {
17167
17178
  code.setAttribute('data-language', language);
17168
17179
  }
@@ -17743,7 +17754,7 @@ var Paragraph = /** @class */ (function (_super) {
17743
17754
  parseDOM: [{ tag: 'p' }],
17744
17755
  toDOM: function (_a) {
17745
17756
  var attrs = _a.attrs;
17746
- return ['p', getCustomAttrs(attrs), 0];
17757
+ return ['p', getCustomAttrs$1(attrs), 0];
17747
17758
  },
17748
17759
  };
17749
17760
  },
@@ -17852,7 +17863,7 @@ var Heading = /** @class */ (function (_super) {
17852
17863
  parseDOM: parseDOM,
17853
17864
  toDOM: function (_a) {
17854
17865
  var attrs = _a.attrs;
17855
- return ["h" + attrs.level, getCustomAttrs(attrs), 0];
17866
+ return ["h" + attrs.level, getCustomAttrs$1(attrs), 0];
17856
17867
  },
17857
17868
  };
17858
17869
  },
@@ -17904,7 +17915,7 @@ var CodeBlock = /** @class */ (function (_super) {
17904
17915
  var attrs = _a.attrs;
17905
17916
  return [
17906
17917
  attrs.rawHTML || 'pre',
17907
- ['code', __assign$1({ 'data-language': attrs.language }, getCustomAttrs(attrs)), 0],
17918
+ ['code', __assign$1({ 'data-language': attrs.language }, getCustomAttrs$1(attrs)), 0],
17908
17919
  ];
17909
17920
  },
17910
17921
  };
@@ -17973,7 +17984,7 @@ var BulletList = /** @class */ (function (_super) {
17973
17984
  parseDOM: [createDOMInfoParsedRawHTML('ul')],
17974
17985
  toDOM: function (_a) {
17975
17986
  var attrs = _a.attrs;
17976
- return ['ul', getCustomAttrs(attrs), 0];
17987
+ return ['ul', getCustomAttrs$1(attrs), 0];
17977
17988
  },
17978
17989
  };
17979
17990
  },
@@ -18034,7 +18045,7 @@ var OrderedList = /** @class */ (function (_super) {
18034
18045
  var attrs = _a.attrs;
18035
18046
  return [
18036
18047
  attrs.rawHTML || 'ol',
18037
- __assign$1({ start: attrs.order === 1 ? null : attrs.order }, getCustomAttrs(attrs)),
18048
+ __assign$1({ start: attrs.order === 1 ? null : attrs.order }, getCustomAttrs$1(attrs)),
18038
18049
  0,
18039
18050
  ];
18040
18051
  },
@@ -18172,7 +18183,7 @@ var BlockQuote = /** @class */ (function (_super) {
18172
18183
  parseDOM: [createDOMInfoParsedRawHTML('blockquote')],
18173
18184
  toDOM: function (_a) {
18174
18185
  var attrs = _a.attrs;
18175
- return ['blockquote', getCustomAttrs(attrs), 0];
18186
+ return ['blockquote', getCustomAttrs$1(attrs), 0];
18176
18187
  },
18177
18188
  };
18178
18189
  },
@@ -18409,7 +18420,7 @@ var Table = /** @class */ (function (_super) {
18409
18420
  parseDOM: [createDOMInfoParsedRawHTML('table')],
18410
18421
  toDOM: function (_a) {
18411
18422
  var attrs = _a.attrs;
18412
- return ['table', getCustomAttrs(attrs), 0];
18423
+ return ['table', getCustomAttrs$1(attrs), 0];
18413
18424
  },
18414
18425
  };
18415
18426
  },
@@ -18759,7 +18770,7 @@ var TableHead = /** @class */ (function (_super) {
18759
18770
  parseDOM: [createDOMInfoParsedRawHTML('thead')],
18760
18771
  toDOM: function (_a) {
18761
18772
  var attrs = _a.attrs;
18762
- return ['thead', getCustomAttrs(attrs), 0];
18773
+ return ['thead', getCustomAttrs$1(attrs), 0];
18763
18774
  },
18764
18775
  };
18765
18776
  },
@@ -18802,7 +18813,7 @@ var TableBody = /** @class */ (function (_super) {
18802
18813
  ],
18803
18814
  toDOM: function (_a) {
18804
18815
  var attrs = _a.attrs;
18805
- return ['tbody', getCustomAttrs(attrs), 0];
18816
+ return ['tbody', getCustomAttrs$1(attrs), 0];
18806
18817
  },
18807
18818
  };
18808
18819
  },
@@ -18844,7 +18855,7 @@ var TableRow = /** @class */ (function (_super) {
18844
18855
  ],
18845
18856
  toDOM: function (_a) {
18846
18857
  var attrs = _a.attrs;
18847
- return ['tr', getCustomAttrs(attrs), 0];
18858
+ return ['tr', getCustomAttrs$1(attrs), 0];
18848
18859
  },
18849
18860
  };
18850
18861
  },
@@ -18876,7 +18887,7 @@ var TableHeadCell = /** @class */ (function (_super) {
18876
18887
  toDOM: function (_a) {
18877
18888
  var attrs = _a.attrs;
18878
18889
  var cellAttrs = createCellAttrs(attrs);
18879
- return ['th', __assign$1(__assign$1({}, cellAttrs), getCustomAttrs(attrs)), 0];
18890
+ return ['th', __assign$1(__assign$1({}, cellAttrs), getCustomAttrs$1(attrs)), 0];
18880
18891
  },
18881
18892
  };
18882
18893
  },
@@ -18962,7 +18973,7 @@ var Image = /** @class */ (function (_super) {
18962
18973
  var attrs = _a.attrs;
18963
18974
  return [
18964
18975
  attrs.rawHTML || 'img',
18965
- __assign$1(__assign$1({ src: escapeXml$1(attrs.imageUrl) }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs(attrs)),
18976
+ __assign$1(__assign$1({ src: escapeXml$1(attrs.imageUrl) }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs$1(attrs)),
18966
18977
  ];
18967
18978
  },
18968
18979
  };
@@ -19012,7 +19023,7 @@ var ThematicBreak = /** @class */ (function (_super) {
19012
19023
  selectable: false,
19013
19024
  toDOM: function (_a) {
19014
19025
  var attrs = _a.attrs;
19015
- return ['div', getCustomAttrs(attrs), [attrs.rawHTML || 'hr']];
19026
+ return ['div', getCustomAttrs$1(attrs), [attrs.rawHTML || 'hr']];
19016
19027
  },
19017
19028
  };
19018
19029
  },
@@ -19082,7 +19093,7 @@ var Strong = /** @class */ (function (_super) {
19082
19093
  parseDOM: parseDOM,
19083
19094
  toDOM: function (_a) {
19084
19095
  var attrs = _a.attrs;
19085
- return [attrs.rawHTML || 'strong', getCustomAttrs(attrs)];
19096
+ return [attrs.rawHTML || 'strong', getCustomAttrs$1(attrs)];
19086
19097
  },
19087
19098
  };
19088
19099
  },
@@ -19133,7 +19144,7 @@ var Emph = /** @class */ (function (_super) {
19133
19144
  parseDOM: parseDOM,
19134
19145
  toDOM: function (_a) {
19135
19146
  var attrs = _a.attrs;
19136
- return [attrs.rawHTML || 'em', getCustomAttrs(attrs)];
19147
+ return [attrs.rawHTML || 'em', getCustomAttrs$1(attrs)];
19137
19148
  },
19138
19149
  };
19139
19150
  },
@@ -19184,7 +19195,7 @@ var Strike = /** @class */ (function (_super) {
19184
19195
  parseDOM: parseDOM,
19185
19196
  toDOM: function (_a) {
19186
19197
  var attrs = _a.attrs;
19187
- return [attrs.rawHTML || 'del', getCustomAttrs(attrs)];
19198
+ return [attrs.rawHTML || 'del', getCustomAttrs$1(attrs)];
19188
19199
  },
19189
19200
  };
19190
19201
  },
@@ -19311,7 +19322,7 @@ var Code = /** @class */ (function (_super) {
19311
19322
  ],
19312
19323
  toDOM: function (_a) {
19313
19324
  var attrs = _a.attrs;
19314
- return [attrs.rawHTML || 'code', getCustomAttrs(attrs)];
19325
+ return [attrs.rawHTML || 'code', getCustomAttrs$1(attrs)];
19315
19326
  },
19316
19327
  };
19317
19328
  },
@@ -19629,7 +19640,7 @@ var WysiwygEditor = /** @class */ (function (_super) {
19629
19640
  return this.specs.commands(this.view, getWwCommands());
19630
19641
  };
19631
19642
  WysiwygEditor.prototype.getHTML = function () {
19632
- return this.view.dom.innerHTML;
19643
+ return removeProseMirrorHackNodes(this.view.dom.innerHTML);
19633
19644
  };
19634
19645
  WysiwygEditor.prototype.getModel = function () {
19635
19646
  return this.view.state.doc;
@@ -21669,22 +21680,40 @@ var Convertor = /** @class */ (function () {
21669
21680
  return Convertor;
21670
21681
  }());
21671
21682
 
21672
- function execPlugin(plugin, eventEmitter, usageStatistics) {
21683
+ function execPlugin(pluginInfo) {
21684
+ var plugin = pluginInfo.plugin, eventEmitter = pluginInfo.eventEmitter, usageStatistics = pluginInfo.usageStatistics, instance = pluginInfo.instance;
21673
21685
  var pmState = { Plugin: Plugin, PluginKey: PluginKey, Selection: Selection, TextSelection: TextSelection };
21674
21686
  var pmView = { Decoration: Decoration, DecorationSet: DecorationSet };
21675
21687
  var pmModel = { Fragment: Fragment };
21676
21688
  var pmRules = { InputRule: InputRule, inputRules: inputRules, undoInputRule: undoInputRule };
21677
- var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, pmRules: pmRules, i18n: i18n };
21689
+ var pmKeymap = { keymap: keymap };
21690
+ var context = {
21691
+ eventEmitter: eventEmitter,
21692
+ usageStatistics: usageStatistics,
21693
+ instance: instance,
21694
+ pmState: pmState,
21695
+ pmView: pmView,
21696
+ pmModel: pmModel,
21697
+ pmRules: pmRules,
21698
+ pmKeymap: pmKeymap,
21699
+ i18n: i18n,
21700
+ };
21678
21701
  if (isArray_1(plugin)) {
21679
21702
  var pluginFn = plugin[0], _a = plugin[1], options = _a === void 0 ? {} : _a;
21680
21703
  return pluginFn(context, options);
21681
21704
  }
21682
21705
  return plugin(context);
21683
21706
  }
21684
- function getPluginInfo(plugins, eventEmitter, usageStatistics) {
21707
+ function getPluginInfo(pluginsInfo) {
21708
+ var plugins = pluginsInfo.plugins, eventEmitter = pluginsInfo.eventEmitter, usageStatistics = pluginsInfo.usageStatistics, instance = pluginsInfo.instance;
21685
21709
  eventEmitter.listen('mixinTableOffsetMapPrototype', mixinTableOffsetMapPrototype);
21686
21710
  return (plugins !== null && plugins !== void 0 ? plugins : []).reduce(function (acc, plugin) {
21687
- var pluginInfoResult = execPlugin(plugin, eventEmitter, usageStatistics);
21711
+ var pluginInfoResult = execPlugin({
21712
+ plugin: plugin,
21713
+ eventEmitter: eventEmitter,
21714
+ usageStatistics: usageStatistics,
21715
+ instance: instance,
21716
+ });
21688
21717
  if (!pluginInfoResult) {
21689
21718
  throw new Error('The return value of the executed plugin is empty.');
21690
21719
  }
@@ -21776,7 +21805,12 @@ var ToastUIEditorViewer = /** @class */ (function () {
21776
21805
  }, options);
21777
21806
  this.eventEmitter = new EventEmitter();
21778
21807
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
21779
- var _a = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
21808
+ var _a = getPluginInfo({
21809
+ plugins: this.options.plugins,
21810
+ eventEmitter: this.eventEmitter,
21811
+ usageStatistics: this.options.usageStatistics,
21812
+ instance: this,
21813
+ }) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
21780
21814
  var _b = this.options, customHTMLRenderer = _b.customHTMLRenderer, extendedAutolinks = _b.extendedAutolinks, referenceDefinition = _b.referenceDefinition, frontMatter = _b.frontMatter, customHTMLSanitizer = _b.customHTMLSanitizer;
21781
21815
  var rendererOptions = {
21782
21816
  linkAttributes: linkAttributes,
@@ -22329,7 +22363,12 @@ var ToastUIEditorCore = /** @class */ (function () {
22329
22363
  this.eventEmitter = new EventEmitter();
22330
22364
  setWidgetRules(widgetRules);
22331
22365
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
22332
- this.pluginInfo = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics);
22366
+ this.pluginInfo = getPluginInfo({
22367
+ plugins: this.options.plugins,
22368
+ eventEmitter: this.eventEmitter,
22369
+ usageStatistics: this.options.usageStatistics,
22370
+ instance: this,
22371
+ });
22333
22372
  var _b = this.pluginInfo, toHTMLRenderers = _b.toHTMLRenderers, toMarkdownRenderers = _b.toMarkdownRenderers, mdPlugins = _b.mdPlugins, wwPlugins = _b.wwPlugins, wwNodeViews = _b.wwNodeViews, mdCommands = _b.mdCommands, wwCommands = _b.wwCommands, markdownParsers = _b.markdownParsers;
22334
22373
  var rendererOptions = {
22335
22374
  linkAttributes: linkAttributes,
@@ -22583,7 +22622,7 @@ var ToastUIEditorCore = /** @class */ (function () {
22583
22622
  _this.wwEditor.setModel(wwNode);
22584
22623
  }
22585
22624
  });
22586
- var html = this.wwEditor.view.dom.innerHTML;
22625
+ var html = removeProseMirrorHackNodes(this.wwEditor.view.dom.innerHTML);
22587
22626
  if (this.placeholder) {
22588
22627
  var rePlaceholder = new RegExp("<span class=\"placeholder[^>]+>" + this.placeholder + "</span>", 'i');
22589
22628
  return html.replace(rePlaceholder, '');
@@ -22858,6 +22897,32 @@ var ToastUIEditorCore = /** @class */ (function () {
22858
22897
  wwEditor: this.wwEditor.getElement(),
22859
22898
  };
22860
22899
  };
22900
+ /**
22901
+ * Convert position to match editor mode
22902
+ * @param {number|Array.<number>} start - start position
22903
+ * @param {number|Array.<number>} end - end position
22904
+ * @param {string} mode - Editor mode name of want to match converted position to
22905
+ */
22906
+ ToastUIEditorCore.prototype.convertPosToMatchEditorMode = function (start, end, mode) {
22907
+ var _a, _b;
22908
+ if (end === void 0) { end = start; }
22909
+ if (mode === void 0) { mode = this.mode; }
22910
+ var doc = this.mdEditor.view.state.doc;
22911
+ var isFromArray = Array.isArray(start);
22912
+ var isToArray = Array.isArray(end);
22913
+ var convertedFrom = start;
22914
+ var convertedTo = end;
22915
+ if (isFromArray !== isToArray) {
22916
+ throw new Error('Types of arguments must be same');
22917
+ }
22918
+ if (mode === 'markdown' && !isFromArray && !isToArray) {
22919
+ _a = getEditorToMdPos(doc, start, end), convertedFrom = _a[0], convertedTo = _a[1];
22920
+ }
22921
+ else if (mode === 'wysiwyg' && isFromArray && isToArray) {
22922
+ _b = getMdToEditorPos(doc, start, end), convertedFrom = _b[0], convertedTo = _b[1];
22923
+ }
22924
+ return [convertedFrom, convertedTo];
22925
+ };
22861
22926
  return ToastUIEditorCore;
22862
22927
  }());
22863
22928
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : viewer
3
- * @version 3.1.8 | Tue Jul 12 2022
3
+ * @version 3.2.0 | Fri Aug 05 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -8,6 +8,7 @@
8
8
  import { Plugin, PluginKey, Selection, TextSelection } from 'prosemirror-state';
9
9
  import { InputRule, inputRules, undoInputRule } from 'prosemirror-inputrules';
10
10
  import { Decoration, DecorationSet } from 'prosemirror-view';
11
+ import { keymap } from 'prosemirror-keymap';
11
12
  import { Fragment } from 'prosemirror-model';
12
13
 
13
14
  /*! *****************************************************************************
@@ -10020,6 +10021,14 @@ function createElementWith(contents, target) {
10020
10021
  }
10021
10022
  return firstChild;
10022
10023
  }
10024
+ function removeProseMirrorHackNodes(html) {
10025
+ var reProseMirrorImage = /<img class="ProseMirror-separator" alt="">/g;
10026
+ var reProseMirrorTrailingBreak = / class="ProseMirror-trailingBreak"/g;
10027
+ var resultHTML = html;
10028
+ resultHTML = resultHTML.replace(reProseMirrorImage, '');
10029
+ resultHTML = resultHTML.replace(reProseMirrorTrailingBreak, '');
10030
+ return resultHTML;
10031
+ }
10023
10032
 
10024
10033
  /**
10025
10034
  * @fileoverview Check whether the given variable is a function or not.
@@ -11911,7 +11920,7 @@ var MarkdownPreview = /** @class */ (function () {
11911
11920
  return this.el;
11912
11921
  };
11913
11922
  MarkdownPreview.prototype.getHTML = function () {
11914
- return this.previewContent.innerHTML;
11923
+ return removeProseMirrorHackNodes(this.previewContent.innerHTML);
11915
11924
  };
11916
11925
  MarkdownPreview.prototype.setHTML = function (html) {
11917
11926
  this.previewContent.innerHTML = html;
@@ -12224,22 +12233,40 @@ function mixinTableOffsetMapPrototype(offsetMapMixin, createOffsetMapMixin) {
12224
12233
  return TableOffsetMap;
12225
12234
  }
12226
12235
 
12227
- function execPlugin(plugin, eventEmitter, usageStatistics) {
12236
+ function execPlugin(pluginInfo) {
12237
+ var plugin = pluginInfo.plugin, eventEmitter = pluginInfo.eventEmitter, usageStatistics = pluginInfo.usageStatistics, instance = pluginInfo.instance;
12228
12238
  var pmState = { Plugin: Plugin, PluginKey: PluginKey, Selection: Selection, TextSelection: TextSelection };
12229
12239
  var pmView = { Decoration: Decoration, DecorationSet: DecorationSet };
12230
12240
  var pmModel = { Fragment: Fragment };
12231
12241
  var pmRules = { InputRule: InputRule, inputRules: inputRules, undoInputRule: undoInputRule };
12232
- var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, pmRules: pmRules, i18n: i18n };
12242
+ var pmKeymap = { keymap: keymap };
12243
+ var context = {
12244
+ eventEmitter: eventEmitter,
12245
+ usageStatistics: usageStatistics,
12246
+ instance: instance,
12247
+ pmState: pmState,
12248
+ pmView: pmView,
12249
+ pmModel: pmModel,
12250
+ pmRules: pmRules,
12251
+ pmKeymap: pmKeymap,
12252
+ i18n: i18n,
12253
+ };
12233
12254
  if (isArray_1(plugin)) {
12234
12255
  var pluginFn = plugin[0], _a = plugin[1], options = _a === void 0 ? {} : _a;
12235
12256
  return pluginFn(context, options);
12236
12257
  }
12237
12258
  return plugin(context);
12238
12259
  }
12239
- function getPluginInfo(plugins, eventEmitter, usageStatistics) {
12260
+ function getPluginInfo(pluginsInfo) {
12261
+ var plugins = pluginsInfo.plugins, eventEmitter = pluginsInfo.eventEmitter, usageStatistics = pluginsInfo.usageStatistics, instance = pluginsInfo.instance;
12240
12262
  eventEmitter.listen('mixinTableOffsetMapPrototype', mixinTableOffsetMapPrototype);
12241
12263
  return (plugins !== null && plugins !== void 0 ? plugins : []).reduce(function (acc, plugin) {
12242
- var pluginInfoResult = execPlugin(plugin, eventEmitter, usageStatistics);
12264
+ var pluginInfoResult = execPlugin({
12265
+ plugin: plugin,
12266
+ eventEmitter: eventEmitter,
12267
+ usageStatistics: usageStatistics,
12268
+ instance: instance,
12269
+ });
12243
12270
  if (!pluginInfoResult) {
12244
12271
  throw new Error('The return value of the executed plugin is empty.');
12245
12272
  }
@@ -12621,7 +12648,12 @@ var ToastUIEditorViewer = /** @class */ (function () {
12621
12648
  }, options);
12622
12649
  this.eventEmitter = new EventEmitter();
12623
12650
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
12624
- var _a = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
12651
+ var _a = getPluginInfo({
12652
+ plugins: this.options.plugins,
12653
+ eventEmitter: this.eventEmitter,
12654
+ usageStatistics: this.options.usageStatistics,
12655
+ instance: this,
12656
+ }) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
12625
12657
  var _b = this.options, customHTMLRenderer = _b.customHTMLRenderer, extendedAutolinks = _b.extendedAutolinks, referenceDefinition = _b.referenceDefinition, frontMatter = _b.frontMatter, customHTMLSanitizer = _b.customHTMLSanitizer;
12626
12658
  var rendererOptions = {
12627
12659
  linkAttributes: linkAttributes,