@toast-ui/editor 3.1.10 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +50 -11
  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 +54 -11
  52. package/package.json +8 -9
  53. package/types/convertor.d.ts +1 -1
  54. package/types/editor.d.ts +19 -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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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;
@@ -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
 
@@ -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;
@@ -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, '');
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : viewer
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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,
package/dist/i18n/ar.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * TOAST UI Editor : i18n
3
- * @version 3.1.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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.10
3
+ * @version 3.2.1
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
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 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
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -1,19 +1,19 @@
1
1
  /*!
2
2
  * @toast-ui/editor
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
7
7
  (function webpackUniversalModuleDefinition(root, factory) {
8
8
  if(typeof exports === 'object' && typeof module === 'object')
9
- module.exports = factory(require("prosemirror-inputrules"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-view"));
9
+ module.exports = factory(require("prosemirror-inputrules"), require("prosemirror-keymap"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-view"));
10
10
  else if(typeof define === 'function' && define.amd)
11
- define(["prosemirror-inputrules", "prosemirror-model", "prosemirror-state", "prosemirror-view"], factory);
11
+ define(["prosemirror-inputrules", "prosemirror-keymap", "prosemirror-model", "prosemirror-state", "prosemirror-view"], factory);
12
12
  else if(typeof exports === 'object')
13
- exports["toastui"] = factory(require("prosemirror-inputrules"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-view"));
13
+ exports["toastui"] = factory(require("prosemirror-inputrules"), require("prosemirror-keymap"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-view"));
14
14
  else
15
- root["toastui"] = root["toastui"] || {}, root["toastui"]["Editor"] = factory(root[undefined], root[undefined], root[undefined], root[undefined]);
16
- })(self, function(__WEBPACK_EXTERNAL_MODULE__479__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__814__, __WEBPACK_EXTERNAL_MODULE__311__) {
15
+ root["toastui"] = root["toastui"] || {}, root["toastui"]["Editor"] = factory(root[undefined], root[undefined], root[undefined], root[undefined], root[undefined]);
16
+ })(self, function(__WEBPACK_EXTERNAL_MODULE__479__, __WEBPACK_EXTERNAL_MODULE__481__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__814__, __WEBPACK_EXTERNAL_MODULE__311__) {
17
17
  return /******/ (function() { // webpackBootstrap
18
18
  /******/ var __webpack_modules__ = ({
19
19
 
@@ -2722,6 +2722,14 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__479__;
2722
2722
 
2723
2723
  /***/ }),
2724
2724
 
2725
+ /***/ 481:
2726
+ /***/ (function(module) {
2727
+
2728
+ "use strict";
2729
+ module.exports = __WEBPACK_EXTERNAL_MODULE__481__;
2730
+
2731
+ /***/ }),
2732
+
2725
2733
  /***/ 43:
2726
2734
  /***/ (function(module) {
2727
2735
 
@@ -12538,6 +12546,14 @@ function replaceBRWithEmptyBlock(html) {
12538
12546
  });
12539
12547
  return replacedHTML;
12540
12548
  }
12549
+ function removeProseMirrorHackNodes(html) {
12550
+ var reProseMirrorImage = /<img class="ProseMirror-separator" alt="">/g;
12551
+ var reProseMirrorTrailingBreak = / class="ProseMirror-trailingBreak"/g;
12552
+ var resultHTML = html;
12553
+ resultHTML = resultHTML.replace(reProseMirrorImage, '');
12554
+ resultHTML = resultHTML.replace(reProseMirrorTrailingBreak, '');
12555
+ return resultHTML;
12556
+ }
12541
12557
 
12542
12558
  // EXTERNAL MODULE: ../../node_modules/tui-code-snippet/type/isFunction.js
12543
12559
  var isFunction = __webpack_require__(294);
@@ -13406,7 +13422,7 @@ var MarkdownPreview = /** @class */ (function () {
13406
13422
  return this.el;
13407
13423
  };
13408
13424
  MarkdownPreview.prototype.getHTML = function () {
13409
- return this.previewContent.innerHTML;
13425
+ return removeProseMirrorHackNodes(this.previewContent.innerHTML);
13410
13426
  };
13411
13427
  MarkdownPreview.prototype.setHTML = function (html) {
13412
13428
  this.previewContent.innerHTML = html;
@@ -13427,6 +13443,8 @@ var external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemir
13427
13443
  var external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_ = __webpack_require__(479);
13428
13444
  // EXTERNAL MODULE: external {"commonjs":"prosemirror-view","commonjs2":"prosemirror-view","amd":"prosemirror-view"}
13429
13445
  var external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_ = __webpack_require__(311);
13446
+ // EXTERNAL MODULE: external {"commonjs":"prosemirror-keymap","commonjs2":"prosemirror-keymap","amd":"prosemirror-keymap"}
13447
+ var external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_ = __webpack_require__(481);
13430
13448
  // EXTERNAL MODULE: external {"commonjs":"prosemirror-model","commonjs2":"prosemirror-model","amd":"prosemirror-model"}
13431
13449
  var external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_ = __webpack_require__(43);
13432
13450
  // EXTERNAL MODULE: ../../node_modules/tui-code-snippet/array/inArray.js
@@ -13822,22 +13840,41 @@ function mixinTableOffsetMapPrototype(offsetMapMixin, createOffsetMapMixin) {
13822
13840
 
13823
13841
 
13824
13842
 
13825
- function execPlugin(plugin, eventEmitter, usageStatistics) {
13843
+
13844
+ function execPlugin(pluginInfo) {
13845
+ var plugin = pluginInfo.plugin, eventEmitter = pluginInfo.eventEmitter, usageStatistics = pluginInfo.usageStatistics, instance = pluginInfo.instance;
13826
13846
  var pmState = { Plugin: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Plugin, PluginKey: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.PluginKey, Selection: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Selection, TextSelection: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.TextSelection };
13827
13847
  var pmView = { Decoration: external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_.Decoration, DecorationSet: external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_.DecorationSet };
13828
13848
  var pmModel = { Fragment: external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Fragment };
13829
13849
  var pmRules = { InputRule: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.InputRule, inputRules: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.inputRules, undoInputRule: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.undoInputRule };
13830
- var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, pmRules: pmRules, i18n: i18n };
13850
+ var pmKeymap = { keymap: external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap };
13851
+ var context = {
13852
+ eventEmitter: eventEmitter,
13853
+ usageStatistics: usageStatistics,
13854
+ instance: instance,
13855
+ pmState: pmState,
13856
+ pmView: pmView,
13857
+ pmModel: pmModel,
13858
+ pmRules: pmRules,
13859
+ pmKeymap: pmKeymap,
13860
+ i18n: i18n,
13861
+ };
13831
13862
  if (isArray_default()(plugin)) {
13832
13863
  var pluginFn = plugin[0], _a = plugin[1], options = _a === void 0 ? {} : _a;
13833
13864
  return pluginFn(context, options);
13834
13865
  }
13835
13866
  return plugin(context);
13836
13867
  }
13837
- function getPluginInfo(plugins, eventEmitter, usageStatistics) {
13868
+ function getPluginInfo(pluginsInfo) {
13869
+ var plugins = pluginsInfo.plugins, eventEmitter = pluginsInfo.eventEmitter, usageStatistics = pluginsInfo.usageStatistics, instance = pluginsInfo.instance;
13838
13870
  eventEmitter.listen('mixinTableOffsetMapPrototype', mixinTableOffsetMapPrototype);
13839
13871
  return (plugins !== null && plugins !== void 0 ? plugins : []).reduce(function (acc, plugin) {
13840
- var pluginInfoResult = execPlugin(plugin, eventEmitter, usageStatistics);
13872
+ var pluginInfoResult = execPlugin({
13873
+ plugin: plugin,
13874
+ eventEmitter: eventEmitter,
13875
+ usageStatistics: usageStatistics,
13876
+ instance: instance,
13877
+ });
13841
13878
  if (!pluginInfoResult) {
13842
13879
  throw new Error('The return value of the executed plugin is empty.');
13843
13880
  }
@@ -14166,7 +14203,12 @@ var ToastUIEditorViewer = /** @class */ (function () {
14166
14203
  }, options);
14167
14204
  this.eventEmitter = new eventEmitter();
14168
14205
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
14169
- var _a = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
14206
+ var _a = getPluginInfo({
14207
+ plugins: this.options.plugins,
14208
+ eventEmitter: this.eventEmitter,
14209
+ usageStatistics: this.options.usageStatistics,
14210
+ instance: this,
14211
+ }) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
14170
14212
  var _b = this.options, customHTMLRenderer = _b.customHTMLRenderer, extendedAutolinks = _b.extendedAutolinks, referenceDefinition = _b.referenceDefinition, frontMatter = _b.frontMatter, customHTMLSanitizer = _b.customHTMLSanitizer;
14171
14213
  var rendererOptions = {
14172
14214
  linkAttributes: linkAttributes,
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @toast-ui/editor
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -48,6 +48,14 @@ li.ProseMirror-selectednode:after {
48
48
  pointer-events: none;
49
49
  }
50
50
 
51
+ /* Protect against generic img rules */
52
+
53
+ img.ProseMirror-separator {
54
+ display: inline !important;
55
+ border: none !important;
56
+ margin: 0 !important;
57
+ }
58
+
51
59
  @charset "utf-8";
52
60
  /* height */
53
61
  .auto-height,
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @toast-ui/editor
3
- * @version 3.1.10 | Wed Jul 27 2022
3
+ * @version 3.2.1 | Thu Sep 29 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -4236,6 +4236,14 @@ function replaceBRWithEmptyBlock(html) {
4236
4236
  });
4237
4237
  return replacedHTML;
4238
4238
  }
4239
+ function removeProseMirrorHackNodes(html) {
4240
+ var reProseMirrorImage = /<img class="ProseMirror-separator" alt="">/g;
4241
+ var reProseMirrorTrailingBreak = / class="ProseMirror-trailingBreak"/g;
4242
+ var resultHTML = html;
4243
+ resultHTML = resultHTML.replace(reProseMirrorImage, '');
4244
+ resultHTML = resultHTML.replace(reProseMirrorTrailingBreak, '');
4245
+ return resultHTML;
4246
+ }
4239
4247
 
4240
4248
  ;// CONCATENATED MODULE: ./src/plugins/popupWidget.ts
4241
4249
 
@@ -16945,7 +16953,7 @@ var MarkdownPreview = /** @class */ (function () {
16945
16953
  return this.el;
16946
16954
  };
16947
16955
  MarkdownPreview.prototype.getHTML = function () {
16948
- return this.previewContent.innerHTML;
16956
+ return removeProseMirrorHackNodes(this.previewContent.innerHTML);
16949
16957
  };
16950
16958
  MarkdownPreview.prototype.setHTML = function (html) {
16951
16959
  this.previewContent.innerHTML = html;
@@ -17648,10 +17656,14 @@ var CellSelection = /** @class */ (function (_super) {
17648
17656
  }
17649
17657
  var copiedRow = row.copy(external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Fragment.from(cells));
17650
17658
  var targetNode = isTableHeadCell ? tableHead : tableBody;
17659
+ // @ts-ignore
17651
17660
  targetNode.content = targetNode.content.append(external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Fragment.from(copiedRow));
17652
17661
  }
17653
17662
  return new external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Slice(createTableFragment(tableHead, tableBody), 1, 1);
17654
17663
  };
17664
+ CellSelection.prototype.toJSON = function () {
17665
+ return JSON.stringify(this);
17666
+ };
17655
17667
  return CellSelection;
17656
17668
  }(external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Selection));
17657
17669
  /* harmony default export */ var selection_cellSelection = (CellSelection);
@@ -18492,7 +18504,6 @@ var CODE_BLOCK_LANG_CLASS_NAME = 'toastui-editor-ww-code-block-language';
18492
18504
  var CodeBlockView = /** @class */ (function () {
18493
18505
  function CodeBlockView(node, view, getPos, eventEmitter) {
18494
18506
  var _this = this;
18495
- this.dom = null;
18496
18507
  this.contentDOM = null;
18497
18508
  this.input = null;
18498
18509
  this.timer = null;
@@ -21230,7 +21241,7 @@ var WysiwygEditor = /** @class */ (function (_super) {
21230
21241
  return this.specs.commands(this.view, getWwCommands());
21231
21242
  };
21232
21243
  WysiwygEditor.prototype.getHTML = function () {
21233
- return this.view.dom.innerHTML;
21244
+ return removeProseMirrorHackNodes(this.view.dom.innerHTML);
21234
21245
  };
21235
21246
  WysiwygEditor.prototype.getModel = function () {
21236
21247
  return this.view.state.doc;
@@ -23256,22 +23267,41 @@ var Convertor = /** @class */ (function () {
23256
23267
 
23257
23268
 
23258
23269
 
23259
- function execPlugin(plugin, eventEmitter, usageStatistics) {
23270
+
23271
+ function execPlugin(pluginInfo) {
23272
+ var plugin = pluginInfo.plugin, eventEmitter = pluginInfo.eventEmitter, usageStatistics = pluginInfo.usageStatistics, instance = pluginInfo.instance;
23260
23273
  var pmState = { Plugin: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Plugin, PluginKey: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.PluginKey, Selection: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Selection, TextSelection: external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.TextSelection };
23261
23274
  var pmView = { Decoration: external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_.Decoration, DecorationSet: external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_.DecorationSet };
23262
23275
  var pmModel = { Fragment: external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Fragment };
23263
23276
  var pmRules = { InputRule: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.InputRule, inputRules: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.inputRules, undoInputRule: external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.undoInputRule };
23264
- var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, pmRules: pmRules, i18n: i18n };
23277
+ var pmKeymap = { keymap: external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap };
23278
+ var context = {
23279
+ eventEmitter: eventEmitter,
23280
+ usageStatistics: usageStatistics,
23281
+ instance: instance,
23282
+ pmState: pmState,
23283
+ pmView: pmView,
23284
+ pmModel: pmModel,
23285
+ pmRules: pmRules,
23286
+ pmKeymap: pmKeymap,
23287
+ i18n: i18n,
23288
+ };
23265
23289
  if (isArray_default()(plugin)) {
23266
23290
  var pluginFn = plugin[0], _a = plugin[1], options = _a === void 0 ? {} : _a;
23267
23291
  return pluginFn(context, options);
23268
23292
  }
23269
23293
  return plugin(context);
23270
23294
  }
23271
- function getPluginInfo(plugins, eventEmitter, usageStatistics) {
23295
+ function getPluginInfo(pluginsInfo) {
23296
+ var plugins = pluginsInfo.plugins, eventEmitter = pluginsInfo.eventEmitter, usageStatistics = pluginsInfo.usageStatistics, instance = pluginsInfo.instance;
23272
23297
  eventEmitter.listen('mixinTableOffsetMapPrototype', mixinTableOffsetMapPrototype);
23273
23298
  return (plugins !== null && plugins !== void 0 ? plugins : []).reduce(function (acc, plugin) {
23274
- var pluginInfoResult = execPlugin(plugin, eventEmitter, usageStatistics);
23299
+ var pluginInfoResult = execPlugin({
23300
+ plugin: plugin,
23301
+ eventEmitter: eventEmitter,
23302
+ usageStatistics: usageStatistics,
23303
+ instance: instance,
23304
+ });
23275
23305
  if (!pluginInfoResult) {
23276
23306
  throw new Error('The return value of the executed plugin is empty.');
23277
23307
  }
@@ -23376,7 +23406,12 @@ var ToastUIEditorViewer = /** @class */ (function () {
23376
23406
  }, options);
23377
23407
  this.eventEmitter = new eventEmitter();
23378
23408
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
23379
- var _a = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
23409
+ var _a = getPluginInfo({
23410
+ plugins: this.options.plugins,
23411
+ eventEmitter: this.eventEmitter,
23412
+ usageStatistics: this.options.usageStatistics,
23413
+ instance: this,
23414
+ }) || {}, toHTMLRenderers = _a.toHTMLRenderers, markdownParsers = _a.markdownParsers;
23380
23415
  var _b = this.options, customHTMLRenderer = _b.customHTMLRenderer, extendedAutolinks = _b.extendedAutolinks, referenceDefinition = _b.referenceDefinition, frontMatter = _b.frontMatter, customHTMLSanitizer = _b.customHTMLSanitizer;
23381
23416
  var rendererOptions = {
23382
23417
  linkAttributes: linkAttributes,
@@ -23982,7 +24017,12 @@ var ToastUIEditorCore = /** @class */ (function () {
23982
24017
  this.eventEmitter = new eventEmitter();
23983
24018
  setWidgetRules(widgetRules);
23984
24019
  var linkAttributes = sanitizeLinkAttribute(this.options.linkAttributes);
23985
- this.pluginInfo = getPluginInfo(this.options.plugins, this.eventEmitter, this.options.usageStatistics);
24020
+ this.pluginInfo = getPluginInfo({
24021
+ plugins: this.options.plugins,
24022
+ eventEmitter: this.eventEmitter,
24023
+ usageStatistics: this.options.usageStatistics,
24024
+ instance: this,
24025
+ });
23986
24026
  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;
23987
24027
  var rendererOptions = {
23988
24028
  linkAttributes: linkAttributes,
@@ -24236,7 +24276,7 @@ var ToastUIEditorCore = /** @class */ (function () {
24236
24276
  _this.wwEditor.setModel(wwNode);
24237
24277
  }
24238
24278
  });
24239
- var html = this.wwEditor.view.dom.innerHTML;
24279
+ var html = removeProseMirrorHackNodes(this.wwEditor.view.dom.innerHTML);
24240
24280
  if (this.placeholder) {
24241
24281
  var rePlaceholder = new RegExp("<span class=\"placeholder[^>]+>" + this.placeholder + "</span>", 'i');
24242
24282
  return html.replace(rePlaceholder, '');
@@ -27382,6 +27422,9 @@ var ToastUIEditor = /** @class */ (function (_super) {
27382
27422
  /* harmony default export */ var editor = (ToastUIEditor);
27383
27423
  var editor_templateObject_1;
27384
27424
 
27425
+ ;// CONCATENATED MODULE: ../../node_modules/prosemirror-view/style/prosemirror.css
27426
+ // extracted by mini-css-extract-plugin
27427
+
27385
27428
  ;// CONCATENATED MODULE: ./src/i18n/en-us.ts
27386
27429
  /**
27387
27430
  * @fileoverview I18N for English
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toast-ui/editor",
3
- "version": "3.1.10",
3
+ "version": "3.2.1",
4
4
  "description": "GFM Markdown Wysiwyg Editor - Productive and Extensible",
5
5
  "keywords": [
6
6
  "nhn",
@@ -83,13 +83,12 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "dompurify": "^2.3.3",
86
- "prosemirror-commands": "~1.1.9",
87
- "prosemirror-history": "~1.1.3",
88
- "prosemirror-inputrules": "~1.1.3",
89
- "prosemirror-keymap": "~1.1.4",
90
- "prosemirror-model": "~1.14.1",
91
- "prosemirror-state": "~1.3.4",
92
- "prosemirror-view": "~1.18.7",
93
- "prosemirror-transform": "~1.3.0"
86
+ "prosemirror-commands": "^1.1.9",
87
+ "prosemirror-history": "^1.1.3",
88
+ "prosemirror-inputrules": "^1.1.3",
89
+ "prosemirror-keymap": "^1.1.4",
90
+ "prosemirror-model": "^1.14.1",
91
+ "prosemirror-state": "^1.3.4",
92
+ "prosemirror-view": "^1.18.7"
94
93
  }
95
94
  }
@@ -1,4 +1,4 @@
1
- import { NodeType, MarkType, Schema, Node as ProsemirrorNode, Mark } from 'prosemirror-model';
1
+ import { NodeType, MarkType, Schema, ProsemirrorNode, Mark } from 'prosemirror-model';
2
2
  import { MdNode, MdNodeType, RendererOptions, HTMLToken, MdPos } from './toastmark';
3
3
  import { WwNodeType, WwMarkType } from './wysiwyg';
4
4
 
package/types/editor.d.ts CHANGED
@@ -2,6 +2,8 @@ import { Schema, NodeSpec, MarkSpec, Fragment } from 'prosemirror-model';
2
2
  import { EditorView, Decoration, DecorationSet } from 'prosemirror-view';
3
3
  import { EditorState, Plugin, PluginKey, Selection, TextSelection } from 'prosemirror-state';
4
4
  import { undoInputRule, InputRule, inputRules } from 'prosemirror-inputrules';
5
+ import { keymap } from 'prosemirror-keymap';
6
+ import { Editor } from '@t/index';
5
7
 
6
8
  import {
7
9
  HTMLConvertor,
@@ -122,6 +124,7 @@ export interface PluginContext {
122
124
  eventEmitter: Emitter;
123
125
  usageStatistics?: boolean;
124
126
  i18n: I18n;
127
+ instance: Editor | Viewer;
125
128
  pmState: {
126
129
  Plugin: typeof Plugin;
127
130
  PluginKey: typeof PluginKey;
@@ -135,10 +138,26 @@ export interface PluginContext {
135
138
  InputRule: typeof InputRule;
136
139
  undoInputRule: typeof undoInputRule;
137
140
  };
141
+ pmKeymap: {
142
+ keymap: typeof keymap;
143
+ };
138
144
  }
139
145
 
140
146
  export type PluginFn = (context: PluginContext, options?: any) => PluginInfo | null;
141
147
  export type EditorPlugin = PluginFn | [PluginFn, any];
148
+ type ContextInfo = {
149
+ eventEmitter: Emitter;
150
+ usageStatistics: boolean;
151
+ instance: Editor | Viewer;
152
+ };
153
+
154
+ export type EditorPluginInfo = ContextInfo & {
155
+ plugin: EditorPlugin;
156
+ };
157
+
158
+ export type EditorPluginsInfo = ContextInfo & {
159
+ plugins: EditorPlugin[];
160
+ };
142
161
 
143
162
  export interface EditorOptions {
144
163
  el: HTMLElement;
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for TOAST UI Editor v3.1.10
1
+ // Type definitions for TOAST UI Editor v3.2.1
2
2
  // TypeScript Version: 4.2.3
3
3
  import {
4
4
  EditorCore,
@@ -0,0 +1,15 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { Schema } from 'prosemirror-model';
4
+
5
+ import 'prosemirror-commands';
6
+
7
+ declare module 'prosemirror-commands' {
8
+ export interface Command<S extends Schema = any> {
9
+ (state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void, view?: EditorView<S>): boolean;
10
+ }
11
+
12
+ export interface Keymap<S extends Schema = any> {
13
+ [key: string]: Command<S>;
14
+ }
15
+ }
@@ -7,16 +7,7 @@ declare module 'prosemirror-model' {
7
7
  findDiffEnd(other: ProsemirrorNode | Fragment): { a: number; b: number } | null | undefined;
8
8
  }
9
9
 
10
- export interface ProsemirrorNode extends Model.Node {
11
- descendants(
12
- fn: (
13
- node: Model.Node,
14
- pos: number,
15
- parent: Model.Node,
16
- index?: number
17
- ) => boolean | void | null | undefined
18
- ): void;
19
- }
10
+ export type ProsemirrorNode = Model.Node;
20
11
 
21
12
  export interface NodeType {
22
13
  compatibleContent(node: NodeType): boolean;