@toast-ui/editor 3.1.6 → 3.1.9

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 (54) 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 +98 -20
  25. package/dist/esm/indexViewer.js +4 -2
  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 +24 -8
  50. package/dist/toastui-editor.css +1 -1
  51. package/dist/toastui-editor.js +100 -20
  52. package/package.json +1 -1
  53. package/types/convertor.d.ts +6 -2
  54. package/types/index.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : i18n
3
- * @version 3.1.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -704,7 +704,8 @@ var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_]
704
704
  var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
705
705
  var reEscapePairedChars = /[*_~`]/g;
706
706
  var reMdImageSyntax = /!\[.*\]\(.*\)/g;
707
- var reEscapedCharInLinkSyntax = /[[\]]/g; //
707
+ var reEscapedCharInLinkSyntax = /[[\]]/g;
708
+ var reEscapeBackSlashInSentence = /(?:^|[^\\])\\(?!\\)/g;
708
709
  var XMLSPECIAL$1 = '[&<>"]';
709
710
  var reXmlSpecial$1 = new RegExp(XMLSPECIAL$1, 'g');
710
711
  function replaceUnsafeChar$1(char) {
@@ -789,17 +790,21 @@ function escapeTextForLink(text) {
789
790
  });
790
791
  }
791
792
  function escape$1(text) {
792
- var replacer = function (matched) { return "\\" + matched; };
793
+ var aheadReplacer = function (matched) { return "\\" + matched; };
794
+ var behindReplacer = function (matched) { return matched + "\\"; };
793
795
  var escapedText = text.replace(reSpaceMoreThanOne, ' ');
794
796
  if (reEscapeBackSlash.test(escapedText)) {
795
- escapedText = escapedText.replace(reEscapeBackSlash, replacer);
797
+ escapedText = escapedText.replace(reEscapeBackSlash, aheadReplacer);
796
798
  }
797
- escapedText = escapedText.replace(reEscapePairedChars, replacer);
799
+ if (reEscapeBackSlashInSentence.test(escapedText)) {
800
+ escapedText = escapedText.replace(reEscapeBackSlashInSentence, behindReplacer);
801
+ }
802
+ escapedText = escapedText.replace(reEscapePairedChars, aheadReplacer);
798
803
  if (reEscapeHTML.test(escapedText)) {
799
- escapedText = escapedText.replace(reEscapeHTML, replacer);
804
+ escapedText = escapedText.replace(reEscapeHTML, aheadReplacer);
800
805
  }
801
806
  if (isNeedEscapeText(escapedText)) {
802
- escapedText = escapedText.replace(reEscapeChars$1, replacer);
807
+ escapedText = escapedText.replace(reEscapeChars$1, aheadReplacer);
803
808
  }
804
809
  return escapedText;
805
810
  }
@@ -909,6 +914,14 @@ function assign(targetObj, obj) {
909
914
  function getSortedNumPair(valueA, valueB) {
910
915
  return valueA > valueB ? [valueB, valueA] : [valueA, valueB];
911
916
  }
917
+ function isStartWithSpace(text) {
918
+ var reStartWithSpace = /^\s(\S*)/g;
919
+ return reStartWithSpace.test(text);
920
+ }
921
+ function isEndWithSpace(text) {
922
+ var reEndWithSpace = /(\S*)\s$/g;
923
+ return reEndWithSpace.test(text);
924
+ }
912
925
 
913
926
  /**
914
927
  * @fileoverview Transform the Array-like object to Array.
@@ -1360,6 +1373,7 @@ var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
1360
1373
  var reBR = /<br\s*\/*>/i;
1361
1374
  var reHTMLComment = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
1362
1375
  var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
1376
+ var DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE = 'a';
1363
1377
 
1364
1378
  function isPositionInBox(style, offsetX, offsetY) {
1365
1379
  var left = parseInt(style.left, 10);
@@ -11289,7 +11303,9 @@ var InlineParser = /** @class */ (function () {
11289
11303
  res = this.parseAutolink(block) || this.parseHtmlTag(block);
11290
11304
  break;
11291
11305
  case C_AMPERSAND:
11292
- res = this.parseEntity(block);
11306
+ if (!block.disabledEntityParse) {
11307
+ res = this.parseEntity(block);
11308
+ }
11293
11309
  break;
11294
11310
  default:
11295
11311
  res = this.parseString(block);
@@ -20787,6 +20803,12 @@ var nodeTypeWriters = {
20787
20803
  state.write('<br>\n');
20788
20804
  }
20789
20805
  else if (emptyNode && !prevEmptyNode && !firstChildNode) {
20806
+ if ((parent === null || parent === void 0 ? void 0 : parent.type.name) === 'listItem') {
20807
+ var prevDelim = state.getDelim();
20808
+ state.setDelim('');
20809
+ state.write('<br>');
20810
+ state.setDelim(prevDelim);
20811
+ }
20790
20812
  state.write('\n');
20791
20813
  }
20792
20814
  else {
@@ -21141,30 +21163,42 @@ var toMdConvertors = {
21141
21163
  text: node.textContent,
21142
21164
  };
21143
21165
  },
21144
- strong: function (_a, _b) {
21166
+ strong: function (_a, _b, betweenSpace) {
21145
21167
  var node = _a.node;
21146
21168
  var entering = _b.entering;
21147
21169
  var rawHTML = node.attrs.rawHTML;
21170
+ var delim = '**';
21171
+ if (!betweenSpace) {
21172
+ delim = entering ? '<strong>' : '</strong>';
21173
+ }
21148
21174
  return {
21149
- delim: '**',
21175
+ delim: delim,
21150
21176
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
21151
21177
  };
21152
21178
  },
21153
- emph: function (_a, _b) {
21179
+ emph: function (_a, _b, betweenSpace) {
21154
21180
  var node = _a.node;
21155
21181
  var entering = _b.entering;
21156
21182
  var rawHTML = node.attrs.rawHTML;
21183
+ var delim = '*';
21184
+ if (!betweenSpace) {
21185
+ delim = entering ? '<em>' : '</em>';
21186
+ }
21157
21187
  return {
21158
- delim: '*',
21188
+ delim: delim,
21159
21189
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
21160
21190
  };
21161
21191
  },
21162
- strike: function (_a, _b) {
21192
+ strike: function (_a, _b, betweenSpace) {
21163
21193
  var node = _a.node;
21164
21194
  var entering = _b.entering;
21165
21195
  var rawHTML = node.attrs.rawHTML;
21196
+ var delim = '~~';
21197
+ if (!betweenSpace) {
21198
+ delim = entering ? '<del>' : '</del>';
21199
+ }
21166
21200
  return {
21167
- delim: '~~',
21201
+ delim: delim,
21168
21202
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
21169
21203
  };
21170
21204
  },
@@ -21271,7 +21305,7 @@ function createMarkTypeConvertors(convertors) {
21271
21305
  var markTypeConvertors = {};
21272
21306
  var markTypes = Object.keys(markTypeOptions);
21273
21307
  markTypes.forEach(function (type) {
21274
- markTypeConvertors[type] = function (nodeInfo, entering) {
21308
+ markTypeConvertors[type] = function (nodeInfo, entering, betweenSpace) {
21275
21309
  var markOption = markTypeOptions[type];
21276
21310
  var convertor = convertors[type];
21277
21311
  // There are two ways to call the mark type converter
@@ -21279,7 +21313,9 @@ function createMarkTypeConvertors(convertors) {
21279
21313
  // When calling the converter without using `delim` and `rawHTML` values,
21280
21314
  // the converter is called without parameters.
21281
21315
  var runConvertor = convertor && nodeInfo && !isUndefined_1(entering);
21282
- var params = runConvertor ? convertor(nodeInfo, { entering: entering }) : {};
21316
+ var params = runConvertor
21317
+ ? convertor(nodeInfo, { entering: entering }, betweenSpace)
21318
+ : {};
21283
21319
  return __assign$1(__assign$1({}, params), markOption);
21284
21320
  };
21285
21321
  });
@@ -21340,14 +21376,30 @@ var ToMdConvertorState = /** @class */ (function () {
21340
21376
  ToMdConvertorState.prototype.isInBlank = function () {
21341
21377
  return /(^|\n)$/.test(this.result);
21342
21378
  };
21379
+ ToMdConvertorState.prototype.isBetweenSpaces = function (parent, index) {
21380
+ var _a, _b;
21381
+ var content = parent.content;
21382
+ var isFrontNodeEndWithSpace = index === 0 ||
21383
+ isEndWithSpace((_a = content.child(index - 1).text) !== null && _a !== void 0 ? _a : DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE);
21384
+ var isRearNodeStartWithSpace = index >= content.childCount - 1 ||
21385
+ isStartWithSpace((_b = content.child(index + 1).text) !== null && _b !== void 0 ? _b : DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE);
21386
+ return isFrontNodeEndWithSpace && isRearNodeStartWithSpace;
21387
+ };
21343
21388
  ToMdConvertorState.prototype.markText = function (mark, entering, parent, index) {
21344
21389
  var convertor = this.getMarkConvertor(mark);
21345
21390
  if (convertor) {
21346
- var _a = convertor({ node: mark, parent: parent, index: index }, entering), delim = _a.delim, rawHTML = _a.rawHTML;
21391
+ var betweenSpace = this.isBetweenSpaces(parent, entering ? index : index - 1);
21392
+ var _a = convertor({ node: mark, parent: parent, index: index }, entering, betweenSpace), delim = _a.delim, rawHTML = _a.rawHTML;
21347
21393
  return rawHTML || delim;
21348
21394
  }
21349
21395
  return '';
21350
21396
  };
21397
+ ToMdConvertorState.prototype.setDelim = function (delim) {
21398
+ this.delim = delim;
21399
+ };
21400
+ ToMdConvertorState.prototype.getDelim = function () {
21401
+ return this.delim;
21402
+ };
21351
21403
  ToMdConvertorState.prototype.flushClose = function (size) {
21352
21404
  if (!this.stopNewline && this.closed) {
21353
21405
  if (!this.isInBlank()) {
@@ -21370,11 +21422,11 @@ var ToMdConvertorState = /** @class */ (function () {
21370
21422
  }
21371
21423
  };
21372
21424
  ToMdConvertorState.prototype.wrapBlock = function (delim, firstDelim, node, fn) {
21373
- var old = this.delim;
21425
+ var old = this.getDelim();
21374
21426
  this.write(firstDelim || delim);
21375
- this.delim += delim;
21427
+ this.setDelim(this.getDelim() + delim);
21376
21428
  fn();
21377
- this.delim = old;
21429
+ this.setDelim(old);
21378
21430
  this.closeBlock(node);
21379
21431
  };
21380
21432
  ToMdConvertorState.prototype.ensureNewLine = function () {
@@ -22806,6 +22858,32 @@ var ToastUIEditorCore = /** @class */ (function () {
22806
22858
  wwEditor: this.wwEditor.getElement(),
22807
22859
  };
22808
22860
  };
22861
+ /**
22862
+ * Convert position to match editor mode
22863
+ * @param {number|Array.<number>} start - start position
22864
+ * @param {number|Array.<number>} end - end position
22865
+ * @param {string} mode - Editor mode name of want to match converted position to
22866
+ */
22867
+ ToastUIEditorCore.prototype.convertPosToMatchEditorMode = function (start, end, mode) {
22868
+ var _a, _b;
22869
+ if (end === void 0) { end = start; }
22870
+ if (mode === void 0) { mode = this.mode; }
22871
+ var doc = this.mdEditor.view.state.doc;
22872
+ var isFromArray = Array.isArray(start);
22873
+ var isToArray = Array.isArray(end);
22874
+ var convertedFrom = start;
22875
+ var convertedTo = end;
22876
+ if (isFromArray !== isToArray) {
22877
+ throw new Error('Types of arguments must be same');
22878
+ }
22879
+ if (mode === 'markdown' && !isFromArray && !isToArray) {
22880
+ _a = getEditorToMdPos(doc, start, end), convertedFrom = _a[0], convertedTo = _a[1];
22881
+ }
22882
+ else if (mode === 'wysiwyg' && isFromArray && isToArray) {
22883
+ _b = getMdToEditorPos(doc, start, end), convertedFrom = _b[0], convertedTo = _b[1];
22884
+ }
22885
+ return [convertedFrom, convertedTo];
22886
+ };
22809
22887
  return ToastUIEditorCore;
22810
22888
  }());
22811
22889
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @toast-ui/editor : viewer
3
- * @version 3.1.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -6635,7 +6635,9 @@ var InlineParser = /** @class */ (function () {
6635
6635
  res = this.parseAutolink(block) || this.parseHtmlTag(block);
6636
6636
  break;
6637
6637
  case C_AMPERSAND:
6638
- res = this.parseEntity(block);
6638
+ if (!block.disabledEntityParse) {
6639
+ res = this.parseEntity(block);
6640
+ }
6639
6641
  break;
6640
6642
  default:
6641
6643
  res = this.parseString(block);
package/dist/i18n/ar.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * TOAST UI Editor : i18n
3
- * @version 3.1.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6
3
+ * @version 3.1.9
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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -9619,7 +9619,9 @@ var InlineParser = /** @class */ (function () {
9619
9619
  res = this.parseAutolink(block) || this.parseHtmlTag(block);
9620
9620
  break;
9621
9621
  case C_AMPERSAND:
9622
- res = this.parseEntity(block);
9622
+ if (!block.disabledEntityParse) {
9623
+ res = this.parseEntity(block);
9624
+ }
9623
9625
  break;
9624
9626
  default:
9625
9627
  res = this.parseString(block);
@@ -12078,6 +12080,7 @@ var reHTMLTag = new RegExp("^" + constants_HTML_TAG, 'i');
12078
12080
  var constants_reBR = /<br\s*\/*>/i;
12079
12081
  var reHTMLComment = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
12080
12082
  var constants_ALTERNATIVE_TAG_FOR_BR = '</p><p>';
12083
+ var DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE = 'a';
12081
12084
 
12082
12085
  // EXTERNAL MODULE: ../../node_modules/tui-code-snippet/type/isNull.js
12083
12086
  var type_isNull = __webpack_require__(934);
@@ -12096,7 +12099,8 @@ var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_]
12096
12099
  var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
12097
12100
  var reEscapePairedChars = /[*_~`]/g;
12098
12101
  var reMdImageSyntax = /!\[.*\]\(.*\)/g;
12099
- var reEscapedCharInLinkSyntax = /[[\]]/g; //
12102
+ var reEscapedCharInLinkSyntax = /[[\]]/g;
12103
+ var reEscapeBackSlashInSentence = /(?:^|[^\\])\\(?!\\)/g;
12100
12104
  var common_XMLSPECIAL = '[&<>"]';
12101
12105
  var common_reXmlSpecial = new RegExp(common_XMLSPECIAL, 'g');
12102
12106
  function common_replaceUnsafeChar(char) {
@@ -12181,17 +12185,21 @@ function escapeTextForLink(text) {
12181
12185
  });
12182
12186
  }
12183
12187
  function common_escape(text) {
12184
- var replacer = function (matched) { return "\\" + matched; };
12188
+ var aheadReplacer = function (matched) { return "\\" + matched; };
12189
+ var behindReplacer = function (matched) { return matched + "\\"; };
12185
12190
  var escapedText = text.replace(reSpaceMoreThanOne, ' ');
12186
12191
  if (reEscapeBackSlash.test(escapedText)) {
12187
- escapedText = escapedText.replace(reEscapeBackSlash, replacer);
12192
+ escapedText = escapedText.replace(reEscapeBackSlash, aheadReplacer);
12193
+ }
12194
+ if (reEscapeBackSlashInSentence.test(escapedText)) {
12195
+ escapedText = escapedText.replace(reEscapeBackSlashInSentence, behindReplacer);
12188
12196
  }
12189
- escapedText = escapedText.replace(reEscapePairedChars, replacer);
12197
+ escapedText = escapedText.replace(reEscapePairedChars, aheadReplacer);
12190
12198
  if (reEscapeHTML.test(escapedText)) {
12191
- escapedText = escapedText.replace(reEscapeHTML, replacer);
12199
+ escapedText = escapedText.replace(reEscapeHTML, aheadReplacer);
12192
12200
  }
12193
12201
  if (isNeedEscapeText(escapedText)) {
12194
- escapedText = escapedText.replace(common_reEscapeChars, replacer);
12202
+ escapedText = escapedText.replace(common_reEscapeChars, aheadReplacer);
12195
12203
  }
12196
12204
  return escapedText;
12197
12205
  }
@@ -12301,6 +12309,14 @@ function common_assign(targetObj, obj) {
12301
12309
  function getSortedNumPair(valueA, valueB) {
12302
12310
  return valueA > valueB ? [valueB, valueA] : [valueA, valueB];
12303
12311
  }
12312
+ function isStartWithSpace(text) {
12313
+ var reStartWithSpace = /^\s(\S*)/g;
12314
+ return reStartWithSpace.test(text);
12315
+ }
12316
+ function isEndWithSpace(text) {
12317
+ var reEndWithSpace = /(\S*)\s$/g;
12318
+ return reEndWithSpace.test(text);
12319
+ }
12304
12320
 
12305
12321
  ;// CONCATENATED MODULE: ./src/utils/dom.ts
12306
12322
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @toast-ui/editor
3
- * @version 3.1.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 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.6 | Mon May 16 2022
3
+ * @version 3.1.9 | Tue Jul 26 2022
4
4
  * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
@@ -3392,7 +3392,8 @@ var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_]
3392
3392
  var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
3393
3393
  var reEscapePairedChars = /[*_~`]/g;
3394
3394
  var reMdImageSyntax = /!\[.*\]\(.*\)/g;
3395
- var reEscapedCharInLinkSyntax = /[[\]]/g; //
3395
+ var reEscapedCharInLinkSyntax = /[[\]]/g;
3396
+ var reEscapeBackSlashInSentence = /(?:^|[^\\])\\(?!\\)/g;
3396
3397
  var XMLSPECIAL = '[&<>"]';
3397
3398
  var reXmlSpecial = new RegExp(XMLSPECIAL, 'g');
3398
3399
  function replaceUnsafeChar(char) {
@@ -3477,17 +3478,21 @@ function escapeTextForLink(text) {
3477
3478
  });
3478
3479
  }
3479
3480
  function common_escape(text) {
3480
- var replacer = function (matched) { return "\\" + matched; };
3481
+ var aheadReplacer = function (matched) { return "\\" + matched; };
3482
+ var behindReplacer = function (matched) { return matched + "\\"; };
3481
3483
  var escapedText = text.replace(reSpaceMoreThanOne, ' ');
3482
3484
  if (reEscapeBackSlash.test(escapedText)) {
3483
- escapedText = escapedText.replace(reEscapeBackSlash, replacer);
3485
+ escapedText = escapedText.replace(reEscapeBackSlash, aheadReplacer);
3484
3486
  }
3485
- escapedText = escapedText.replace(reEscapePairedChars, replacer);
3487
+ if (reEscapeBackSlashInSentence.test(escapedText)) {
3488
+ escapedText = escapedText.replace(reEscapeBackSlashInSentence, behindReplacer);
3489
+ }
3490
+ escapedText = escapedText.replace(reEscapePairedChars, aheadReplacer);
3486
3491
  if (reEscapeHTML.test(escapedText)) {
3487
- escapedText = escapedText.replace(reEscapeHTML, replacer);
3492
+ escapedText = escapedText.replace(reEscapeHTML, aheadReplacer);
3488
3493
  }
3489
3494
  if (isNeedEscapeText(escapedText)) {
3490
- escapedText = escapedText.replace(reEscapeChars, replacer);
3495
+ escapedText = escapedText.replace(reEscapeChars, aheadReplacer);
3491
3496
  }
3492
3497
  return escapedText;
3493
3498
  }
@@ -3597,6 +3602,14 @@ function common_assign(targetObj, obj) {
3597
3602
  function getSortedNumPair(valueA, valueB) {
3598
3603
  return valueA > valueB ? [valueB, valueA] : [valueA, valueB];
3599
3604
  }
3605
+ function isStartWithSpace(text) {
3606
+ var reStartWithSpace = /^\s(\S*)/g;
3607
+ return reStartWithSpace.test(text);
3608
+ }
3609
+ function isEndWithSpace(text) {
3610
+ var reEndWithSpace = /(\S*)\s$/g;
3611
+ return reEndWithSpace.test(text);
3612
+ }
3600
3613
 
3601
3614
  // EXTERNAL MODULE: external {"commonjs":"prosemirror-view","commonjs2":"prosemirror-view","amd":"prosemirror-view"}
3602
3615
  var external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_ = __webpack_require__(311);
@@ -4001,6 +4014,7 @@ var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
4001
4014
  var reBR = /<br\s*\/*>/i;
4002
4015
  var reHTMLComment = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
4003
4016
  var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
4017
+ var DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE = 'a';
4004
4018
 
4005
4019
  ;// CONCATENATED MODULE: ./src/utils/dom.ts
4006
4020
 
@@ -13935,7 +13949,9 @@ var InlineParser = /** @class */ (function () {
13935
13949
  res = this.parseAutolink(block) || this.parseHtmlTag(block);
13936
13950
  break;
13937
13951
  case C_AMPERSAND:
13938
- res = this.parseEntity(block);
13952
+ if (!block.disabledEntityParse) {
13953
+ res = this.parseEntity(block);
13954
+ }
13939
13955
  break;
13940
13956
  default:
13941
13957
  res = this.parseString(block);
@@ -22349,6 +22365,12 @@ var nodeTypeWriters = {
22349
22365
  state.write('<br>\n');
22350
22366
  }
22351
22367
  else if (emptyNode && !prevEmptyNode && !firstChildNode) {
22368
+ if ((parent === null || parent === void 0 ? void 0 : parent.type.name) === 'listItem') {
22369
+ var prevDelim = state.getDelim();
22370
+ state.setDelim('');
22371
+ state.write('<br>');
22372
+ state.setDelim(prevDelim);
22373
+ }
22352
22374
  state.write('\n');
22353
22375
  }
22354
22376
  else {
@@ -22708,30 +22730,42 @@ var toMdConvertors = {
22708
22730
  text: node.textContent,
22709
22731
  };
22710
22732
  },
22711
- strong: function (_a, _b) {
22733
+ strong: function (_a, _b, betweenSpace) {
22712
22734
  var node = _a.node;
22713
22735
  var entering = _b.entering;
22714
22736
  var rawHTML = node.attrs.rawHTML;
22737
+ var delim = '**';
22738
+ if (!betweenSpace) {
22739
+ delim = entering ? '<strong>' : '</strong>';
22740
+ }
22715
22741
  return {
22716
- delim: '**',
22742
+ delim: delim,
22717
22743
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
22718
22744
  };
22719
22745
  },
22720
- emph: function (_a, _b) {
22746
+ emph: function (_a, _b, betweenSpace) {
22721
22747
  var node = _a.node;
22722
22748
  var entering = _b.entering;
22723
22749
  var rawHTML = node.attrs.rawHTML;
22750
+ var delim = '*';
22751
+ if (!betweenSpace) {
22752
+ delim = entering ? '<em>' : '</em>';
22753
+ }
22724
22754
  return {
22725
- delim: '*',
22755
+ delim: delim,
22726
22756
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
22727
22757
  };
22728
22758
  },
22729
- strike: function (_a, _b) {
22759
+ strike: function (_a, _b, betweenSpace) {
22730
22760
  var node = _a.node;
22731
22761
  var entering = _b.entering;
22732
22762
  var rawHTML = node.attrs.rawHTML;
22763
+ var delim = '~~';
22764
+ if (!betweenSpace) {
22765
+ delim = entering ? '<del>' : '</del>';
22766
+ }
22733
22767
  return {
22734
- delim: '~~',
22768
+ delim: delim,
22735
22769
  rawHTML: entering ? getOpenRawHTML(rawHTML) : getCloseRawHTML(rawHTML),
22736
22770
  };
22737
22771
  },
@@ -22838,7 +22872,7 @@ function createMarkTypeConvertors(convertors) {
22838
22872
  var markTypeConvertors = {};
22839
22873
  var markTypes = Object.keys(markTypeOptions);
22840
22874
  markTypes.forEach(function (type) {
22841
- markTypeConvertors[type] = function (nodeInfo, entering) {
22875
+ markTypeConvertors[type] = function (nodeInfo, entering, betweenSpace) {
22842
22876
  var markOption = markTypeOptions[type];
22843
22877
  var convertor = convertors[type];
22844
22878
  // There are two ways to call the mark type converter
@@ -22846,7 +22880,9 @@ function createMarkTypeConvertors(convertors) {
22846
22880
  // When calling the converter without using `delim` and `rawHTML` values,
22847
22881
  // the converter is called without parameters.
22848
22882
  var runConvertor = convertor && nodeInfo && !isUndefined_default()(entering);
22849
- var params = runConvertor ? convertor(nodeInfo, { entering: entering }) : {};
22883
+ var params = runConvertor
22884
+ ? convertor(nodeInfo, { entering: entering }, betweenSpace)
22885
+ : {};
22850
22886
  return __assign(__assign({}, params), markOption);
22851
22887
  };
22852
22888
  });
@@ -22890,6 +22926,7 @@ function createMdConvertors(customConvertors) {
22890
22926
 
22891
22927
  ;// CONCATENATED MODULE: ./src/convertors/toMarkdown/toMdConvertorState.ts
22892
22928
 
22929
+
22893
22930
  var ToMdConvertorState = /** @class */ (function () {
22894
22931
  function ToMdConvertorState(_a) {
22895
22932
  var nodeTypeConvertors = _a.nodeTypeConvertors, markTypeConvertors = _a.markTypeConvertors;
@@ -22909,14 +22946,30 @@ var ToMdConvertorState = /** @class */ (function () {
22909
22946
  ToMdConvertorState.prototype.isInBlank = function () {
22910
22947
  return /(^|\n)$/.test(this.result);
22911
22948
  };
22949
+ ToMdConvertorState.prototype.isBetweenSpaces = function (parent, index) {
22950
+ var _a, _b;
22951
+ var content = parent.content;
22952
+ var isFrontNodeEndWithSpace = index === 0 ||
22953
+ isEndWithSpace((_a = content.child(index - 1).text) !== null && _a !== void 0 ? _a : DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE);
22954
+ var isRearNodeStartWithSpace = index >= content.childCount - 1 ||
22955
+ isStartWithSpace((_b = content.child(index + 1).text) !== null && _b !== void 0 ? _b : DEFAULT_TEXT_NOT_START_OR_END_WITH_SPACE);
22956
+ return isFrontNodeEndWithSpace && isRearNodeStartWithSpace;
22957
+ };
22912
22958
  ToMdConvertorState.prototype.markText = function (mark, entering, parent, index) {
22913
22959
  var convertor = this.getMarkConvertor(mark);
22914
22960
  if (convertor) {
22915
- var _a = convertor({ node: mark, parent: parent, index: index }, entering), delim = _a.delim, rawHTML = _a.rawHTML;
22961
+ var betweenSpace = this.isBetweenSpaces(parent, entering ? index : index - 1);
22962
+ var _a = convertor({ node: mark, parent: parent, index: index }, entering, betweenSpace), delim = _a.delim, rawHTML = _a.rawHTML;
22916
22963
  return rawHTML || delim;
22917
22964
  }
22918
22965
  return '';
22919
22966
  };
22967
+ ToMdConvertorState.prototype.setDelim = function (delim) {
22968
+ this.delim = delim;
22969
+ };
22970
+ ToMdConvertorState.prototype.getDelim = function () {
22971
+ return this.delim;
22972
+ };
22920
22973
  ToMdConvertorState.prototype.flushClose = function (size) {
22921
22974
  if (!this.stopNewline && this.closed) {
22922
22975
  if (!this.isInBlank()) {
@@ -22939,11 +22992,11 @@ var ToMdConvertorState = /** @class */ (function () {
22939
22992
  }
22940
22993
  };
22941
22994
  ToMdConvertorState.prototype.wrapBlock = function (delim, firstDelim, node, fn) {
22942
- var old = this.delim;
22995
+ var old = this.getDelim();
22943
22996
  this.write(firstDelim || delim);
22944
- this.delim += delim;
22997
+ this.setDelim(this.getDelim() + delim);
22945
22998
  fn();
22946
- this.delim = old;
22999
+ this.setDelim(old);
22947
23000
  this.closeBlock(node);
22948
23001
  };
22949
23002
  ToMdConvertorState.prototype.ensureNewLine = function () {
@@ -23843,6 +23896,7 @@ function buildQuery(editor) {
23843
23896
 
23844
23897
 
23845
23898
 
23899
+
23846
23900
 
23847
23901
 
23848
23902
  /**
@@ -24457,6 +24511,32 @@ var ToastUIEditorCore = /** @class */ (function () {
24457
24511
  wwEditor: this.wwEditor.getElement(),
24458
24512
  };
24459
24513
  };
24514
+ /**
24515
+ * Convert position to match editor mode
24516
+ * @param {number|Array.<number>} start - start position
24517
+ * @param {number|Array.<number>} end - end position
24518
+ * @param {string} mode - Editor mode name of want to match converted position to
24519
+ */
24520
+ ToastUIEditorCore.prototype.convertPosToMatchEditorMode = function (start, end, mode) {
24521
+ var _a, _b;
24522
+ if (end === void 0) { end = start; }
24523
+ if (mode === void 0) { mode = this.mode; }
24524
+ var doc = this.mdEditor.view.state.doc;
24525
+ var isFromArray = Array.isArray(start);
24526
+ var isToArray = Array.isArray(end);
24527
+ var convertedFrom = start;
24528
+ var convertedTo = end;
24529
+ if (isFromArray !== isToArray) {
24530
+ throw new Error('Types of arguments must be same');
24531
+ }
24532
+ if (mode === 'markdown' && !isFromArray && !isToArray) {
24533
+ _a = getEditorToMdPos(doc, start, end), convertedFrom = _a[0], convertedTo = _a[1];
24534
+ }
24535
+ else if (mode === 'wysiwyg' && isFromArray && isToArray) {
24536
+ _b = getMdToEditorPos(doc, start, end), convertedFrom = _b[0], convertedTo = _b[1];
24537
+ }
24538
+ return [convertedFrom, convertedTo];
24539
+ };
24460
24540
  return ToastUIEditorCore;
24461
24541
  }());
24462
24542
  // // (Not an official API)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toast-ui/editor",
3
- "version": "3.1.6",
3
+ "version": "3.1.9",
4
4
  "description": "GFM Markdown Wysiwyg Editor - Productive and Extensible",
5
5
  "keywords": [
6
6
  "nhn",
@@ -45,6 +45,8 @@ export type FirstDelimFn = (index: number) => string;
45
45
  export interface ToMdConvertorState {
46
46
  stopNewline: boolean;
47
47
  inTable: boolean;
48
+ getDelim(): string;
49
+ setDelim(delim: string): void;
48
50
  flushClose(size?: number): void;
49
51
  wrapBlock(delim: string, firstDelim: string | null, node: ProsemirrorNode, fn: () => void): void;
50
52
  ensureNewLine(): void;
@@ -111,7 +113,8 @@ export type ToMdNodeTypeConvertorMap = Partial<Record<WwNodeType, ToMdNodeTypeCo
111
113
 
112
114
  type ToMdMarkTypeConvertor = (
113
115
  nodeInfo?: MarkInfo,
114
- entering?: boolean
116
+ entering?: boolean,
117
+ betweenSpace?: boolean
115
118
  ) => ToMdConvertorReturnValues & ToMdMarkTypeOption;
116
119
 
117
120
  export type ToMdMarkTypeConvertorMap = Partial<Record<WwMarkType, ToMdMarkTypeConvertor>>;
@@ -124,7 +127,8 @@ interface ToMdConvertorContext {
124
127
 
125
128
  type ToMdConvertor = (
126
129
  nodeInfo: NodeInfo | MarkInfo,
127
- context: ToMdConvertorContext
130
+ context: ToMdConvertorContext,
131
+ betweenSpace?: boolean
128
132
  ) => ToMdConvertorReturnValues;
129
133
 
130
134
  export type ToMdConvertorMap = Partial<Record<WwNodeType | MdNodeType, ToMdConvertor>>;
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for TOAST UI Editor v3.1.6
1
+ // Type definitions for TOAST UI Editor v3.1.9
2
2
  // TypeScript Version: 4.2.3
3
3
  import {
4
4
  EditorCore,