@toast-ui/editor 3.1.1 → 3.1.4

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 (58) hide show
  1. package/dist/esm/i18n/ar.js +2 -2
  2. package/dist/esm/i18n/cs-cz.js +2 -2
  3. package/dist/esm/i18n/de-de.js +4 -4
  4. package/dist/esm/i18n/en-us.js +3 -3
  5. package/dist/esm/i18n/es-es.js +2 -2
  6. package/dist/esm/i18n/fi-fi.js +2 -2
  7. package/dist/esm/i18n/fr-fr.js +2 -2
  8. package/dist/esm/i18n/gl-es.js +2 -2
  9. package/dist/esm/i18n/hr-hr.js +2 -2
  10. package/dist/esm/i18n/i18n.js +4 -5
  11. package/dist/esm/i18n/it-it.js +2 -2
  12. package/dist/esm/i18n/ja-jp.js +3 -3
  13. package/dist/esm/i18n/ko-kr.js +3 -3
  14. package/dist/esm/i18n/nb-no.js +2 -2
  15. package/dist/esm/i18n/nl-nl.js +3 -3
  16. package/dist/esm/i18n/pl-pl.js +2 -2
  17. package/dist/esm/i18n/pt-br.js +2 -2
  18. package/dist/esm/i18n/ru-ru.js +2 -2
  19. package/dist/esm/i18n/sv-se.js +2 -2
  20. package/dist/esm/i18n/tr-tr.js +2 -2
  21. package/dist/esm/i18n/uk-ua.js +2 -2
  22. package/dist/esm/i18n/zh-cn.js +3 -3
  23. package/dist/esm/i18n/zh-tw.js +2 -2
  24. package/dist/esm/index.js +990 -703
  25. package/dist/esm/indexViewer.js +34 -18
  26. package/dist/i18n/ar.js +6 -6
  27. package/dist/i18n/cs-cz.js +6 -6
  28. package/dist/i18n/de-de.js +8 -8
  29. package/dist/i18n/es-es.js +6 -6
  30. package/dist/i18n/fi-fi.js +6 -6
  31. package/dist/i18n/fr-fr.js +6 -6
  32. package/dist/i18n/gl-es.js +6 -6
  33. package/dist/i18n/hr-hr.js +6 -6
  34. package/dist/i18n/it-it.js +6 -6
  35. package/dist/i18n/ja-jp.js +7 -7
  36. package/dist/i18n/ko-kr.js +7 -7
  37. package/dist/i18n/nb-no.js +6 -6
  38. package/dist/i18n/nl-nl.js +7 -7
  39. package/dist/i18n/pl-pl.js +6 -6
  40. package/dist/i18n/pt-br.js +6 -6
  41. package/dist/i18n/ru-ru.js +6 -6
  42. package/dist/i18n/sv-se.js +6 -6
  43. package/dist/i18n/tr-tr.js +6 -6
  44. package/dist/i18n/uk-ua.js +6 -6
  45. package/dist/i18n/zh-cn.js +7 -7
  46. package/dist/i18n/zh-tw.js +6 -6
  47. package/dist/toastui-editor-only.css +2 -2
  48. package/dist/toastui-editor-viewer.css +7 -7
  49. package/dist/toastui-editor-viewer.js +98 -43
  50. package/dist/toastui-editor.css +7 -7
  51. package/dist/toastui-editor.js +1021 -726
  52. package/package.json +4 -3
  53. package/types/editor.d.ts +9 -1
  54. package/types/event.d.ts +2 -0
  55. package/types/index.d.ts +1 -1
  56. package/types/spec.d.ts +1 -1
  57. package/types/ui.d.ts +22 -20
  58. package/types/wysiwyg.d.ts +2 -1
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @toast-ui/editor
3
- * @version 3.1.1 | Wed Oct 27 2021
4
- * @author NHN FE Development Lab <dl_javascript@nhn.com>
3
+ * @version 3.1.4 | Thu Apr 14 2022
4
+ * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
5
  * @license MIT
6
6
  */
7
7
 
@@ -11,7 +11,7 @@ import { ReplaceAroundStep, liftTarget, canSplit, StepMap } from 'prosemirror-tr
11
11
  import { TextSelection, Plugin, PluginKey, EditorState, AllSelection, Selection, SelectionRange, NodeSelection } from 'prosemirror-state';
12
12
  import { keymap } from 'prosemirror-keymap';
13
13
  import { deleteSelection, selectAll, baseKeymap, chainCommands, joinForward, newlineInCode, setBlockType, wrapIn, toggleMark as toggleMark$1, exitCode } from 'prosemirror-commands';
14
- import { InputRule, inputRules } from 'prosemirror-inputrules';
14
+ import { InputRule, inputRules, undoInputRule } from 'prosemirror-inputrules';
15
15
  import { undo, redo, history, undoDepth } from 'prosemirror-history';
16
16
 
17
17
  /*! *****************************************************************************
@@ -700,9 +700,33 @@ var sendHostname_1 = sendHostname;
700
700
  /Mac/.test(navigator.platform);
701
701
  var reSpaceMoreThanOne = /[\u0020]+/g;
702
702
  var reEscapeChars$1 = /[>(){}[\]+-.!#|]/g;
703
- var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g;
703
+ var reEscapeHTML = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g;
704
704
  var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
705
705
  var reEscapePairedChars = /[*_~`]/g;
706
+ var reMdImageSyntax = /!\[.*\]\(.*\)/g;
707
+ var reEscapedCharInLinkSyntax = /[[\]]/g; //
708
+ var XMLSPECIAL$1 = '[&<>"]';
709
+ var reXmlSpecial$1 = new RegExp(XMLSPECIAL$1, 'g');
710
+ function replaceUnsafeChar$1(char) {
711
+ switch (char) {
712
+ case '&':
713
+ return '&amp;';
714
+ case '<':
715
+ return '&lt;';
716
+ case '>':
717
+ return '&gt;';
718
+ case '"':
719
+ return '&quot;';
720
+ default:
721
+ return char;
722
+ }
723
+ }
724
+ function escapeXml$1(text) {
725
+ if (reXmlSpecial$1.test(text)) {
726
+ return text.replace(reXmlSpecial$1, replaceUnsafeChar$1);
727
+ }
728
+ return text;
729
+ }
706
730
  function sendHostName() {
707
731
  sendHostname_1('editor', 'UA-129966929-1');
708
732
  }
@@ -752,6 +776,18 @@ function isNeedEscapeText(text) {
752
776
  });
753
777
  return needEscape;
754
778
  }
779
+ function escapeTextForLink(text) {
780
+ var imageSyntaxRanges = [];
781
+ var result = reMdImageSyntax.exec(text);
782
+ while (result) {
783
+ imageSyntaxRanges.push([result.index, result.index + result[0].length]);
784
+ result = reMdImageSyntax.exec(text);
785
+ }
786
+ return text.replace(reEscapedCharInLinkSyntax, function (matched, offset) {
787
+ var isDelimiter = imageSyntaxRanges.some(function (range) { return offset > range[0] && offset < range[1]; });
788
+ return isDelimiter ? matched : "\\" + matched;
789
+ });
790
+ }
755
791
  function escape$1(text) {
756
792
  var replacer = function (matched) { return "\\" + matched; };
757
793
  var escapedText = text.replace(reSpaceMoreThanOne, ' ');
@@ -874,6 +910,54 @@ function getSortedNumPair(valueA, valueB) {
874
910
  return valueA > valueB ? [valueB, valueA] : [valueA, valueB];
875
911
  }
876
912
 
913
+ /**
914
+ * @fileoverview Transform the Array-like object to Array.
915
+ * @author NHN FE Development Lab <dl_javascript@nhn.com>
916
+ */
917
+
918
+ var forEachArray = forEachArray_1;
919
+
920
+ /**
921
+ * Transform the Array-like object to Array.
922
+ * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used.
923
+ * @param {*} arrayLike Array-like object
924
+ * @returns {Array} Array
925
+ * @memberof module:collection
926
+ * @example
927
+ * // ES6
928
+ * import toArray from 'tui-code-snippet/collection/toArray';
929
+ *
930
+ * // CommonJS
931
+ * const toArray = require('tui-code-snippet/collection/toArray');
932
+ *
933
+ * const arrayLike = {
934
+ * 0: 'one',
935
+ * 1: 'two',
936
+ * 2: 'three',
937
+ * 3: 'four',
938
+ * length: 4
939
+ * };
940
+ * const result = toArray(arrayLike);
941
+ *
942
+ * alert(result instanceof Array); // true
943
+ * alert(result); // one,two,three,four
944
+ */
945
+ function toArray$1(arrayLike) {
946
+ var arr;
947
+ try {
948
+ arr = Array.prototype.slice.call(arrayLike);
949
+ } catch (e) {
950
+ arr = [];
951
+ forEachArray(arrayLike, function(value) {
952
+ arr.push(value);
953
+ });
954
+ }
955
+
956
+ return arr;
957
+ }
958
+
959
+ var toArray_1 = toArray$1;
960
+
877
961
  function createParagraph(schema, content) {
878
962
  var paragraph = schema.nodes.paragraph;
879
963
  if (!content) {
@@ -1197,186 +1281,387 @@ function placeholder(options) {
1197
1281
  });
1198
1282
  }
1199
1283
 
1200
- var pluginKey$1 = new PluginKey('widget');
1201
- var PopupWidget = /** @class */ (function () {
1202
- function PopupWidget(eventEmitter) {
1203
- var _this = this;
1204
- this.popup = null;
1205
- this.removeWidget = function () {
1206
- if (_this.popup) {
1207
- document.body.removeChild(_this.popup);
1208
- _this.popup = null;
1209
- }
1210
- };
1211
- this.eventEmitter = eventEmitter;
1212
- this.eventEmitter.listen('blur', this.removeWidget);
1213
- this.eventEmitter.listen('removePopupWidget', this.removeWidget);
1214
- }
1215
- PopupWidget.prototype.update = function (view) {
1216
- var widget = pluginKey$1.getState(view.state);
1217
- this.removeWidget();
1218
- if (widget) {
1219
- var node = widget.node, style = widget.style;
1220
- var _a = view.coordsAtPos(widget.pos), top_1 = _a.top, left = _a.left, bottom = _a.bottom;
1221
- var height = bottom - top_1;
1222
- css_1(node, { position: 'absolute', left: left + "px", opacity: '0' });
1223
- document.body.appendChild(node);
1224
- css_1(node, {
1225
- top: (style === 'bottom' ? top_1 + height : top_1 - node.clientHeight - height) + "px",
1226
- opacity: '1',
1227
- });
1228
- this.popup = node;
1229
- view.focus();
1230
- }
1231
- };
1232
- PopupWidget.prototype.destroy = function () {
1233
- this.eventEmitter.removeEventHandler('blur', this.removeWidget);
1234
- };
1235
- return PopupWidget;
1236
- }());
1237
- function addWidget(eventEmitter) {
1238
- return new Plugin({
1239
- key: pluginKey$1,
1240
- state: {
1241
- init: function () {
1242
- return null;
1243
- },
1244
- apply: function (tr) {
1245
- return tr.getMeta('widget');
1246
- },
1247
- },
1248
- view: function () {
1249
- return new PopupWidget(eventEmitter);
1250
- },
1251
- });
1252
- }
1253
-
1254
1284
  /**
1255
- * @fileoverview Transform the Array-like object to Array.
1285
+ * @fileoverview Check element has specific css class
1256
1286
  * @author NHN FE Development Lab <dl_javascript@nhn.com>
1257
1287
  */
1258
1288
 
1259
- var forEachArray = forEachArray_1;
1289
+ var inArray$1 = inArray_1;
1290
+ var getClass = getClass_1;
1260
1291
 
1261
1292
  /**
1262
- * Transform the Array-like object to Array.
1263
- * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used.
1264
- * @param {*} arrayLike Array-like object
1265
- * @returns {Array} Array
1266
- * @memberof module:collection
1267
- * @example
1268
- * // ES6
1269
- * import toArray from 'tui-code-snippet/collection/toArray';
1270
- *
1271
- * // CommonJS
1272
- * const toArray = require('tui-code-snippet/collection/toArray');
1273
- *
1274
- * const arrayLike = {
1275
- * 0: 'one',
1276
- * 1: 'two',
1277
- * 2: 'three',
1278
- * 3: 'four',
1279
- * length: 4
1280
- * };
1281
- * const result = toArray(arrayLike);
1282
- *
1283
- * alert(result instanceof Array); // true
1284
- * alert(result); // one,two,three,four
1293
+ * Check element has specific css class
1294
+ * @param {(HTMLElement|SVGElement)} element - target element
1295
+ * @param {string} cssClass - css class
1296
+ * @returns {boolean}
1297
+ * @memberof module:domUtil
1285
1298
  */
1286
- function toArray$1(arrayLike) {
1287
- var arr;
1288
- try {
1289
- arr = Array.prototype.slice.call(arrayLike);
1290
- } catch (e) {
1291
- arr = [];
1292
- forEachArray(arrayLike, function(value) {
1293
- arr.push(value);
1294
- });
1299
+ function hasClass(element, cssClass) {
1300
+ var origin;
1301
+
1302
+ if (element.classList) {
1303
+ return element.classList.contains(cssClass);
1295
1304
  }
1296
1305
 
1297
- return arr;
1306
+ origin = getClass(element).split(/\s+/);
1307
+
1308
+ return inArray$1(cssClass, origin) > -1;
1298
1309
  }
1299
1310
 
1300
- var toArray_1 = toArray$1;
1311
+ var hasClass_1 = hasClass;
1301
1312
 
1302
- function addDefaultImageBlobHook(eventEmitter) {
1303
- eventEmitter.listen('addImageBlobHook', function (blob, callback) {
1304
- var reader = new FileReader();
1305
- reader.onload = function (_a) {
1306
- var target = _a.target;
1307
- return callback(target.result);
1308
- };
1309
- reader.readAsDataURL(blob);
1310
- });
1311
- }
1312
- function emitImageBlobHook(eventEmitter, blob, type) {
1313
- var hook = function (imageUrl, altText) {
1314
- eventEmitter.emit('command', 'addImage', {
1315
- imageUrl: imageUrl,
1316
- altText: altText || blob.name || 'image',
1317
- });
1318
- };
1319
- eventEmitter.emit('addImageBlobHook', blob, hook, type);
1320
- }
1321
- function pasteImageOnly(items) {
1322
- var images = toArray_1(items).filter(function (_a) {
1323
- var type = _a.type;
1324
- return type.indexOf('image') !== -1;
1325
- });
1326
- if (images.length === 1) {
1327
- var item = images[0];
1328
- if (item) {
1329
- return item.getAsFile();
1330
- }
1331
- }
1332
- return null;
1333
- }
1313
+ /**
1314
+ * @fileoverview Check element match selector
1315
+ * @author NHN FE Development Lab <dl_javascript@nhn.com>
1316
+ */
1334
1317
 
1335
- function dropImage(_a) {
1336
- var eventEmitter = _a.eventEmitter;
1337
- return new Plugin({
1338
- props: {
1339
- handleDOMEvents: {
1340
- drop: function (_, ev) {
1341
- var _a;
1342
- var items = (_a = ev.dataTransfer) === null || _a === void 0 ? void 0 : _a.files;
1343
- if (items) {
1344
- forEachArray_1(items, function (item) {
1345
- if (item.type.indexOf('image') !== -1) {
1346
- ev.preventDefault();
1347
- ev.stopPropagation();
1348
- emitImageBlobHook(eventEmitter, item, ev.type);
1349
- return false;
1350
- }
1351
- return true;
1352
- });
1353
- }
1354
- return true;
1355
- },
1356
- },
1357
- },
1358
- });
1359
- }
1318
+ var inArray = inArray_1;
1319
+ var toArray = toArray_1;
1360
1320
 
1361
- var Node$2 = /** @class */ (function () {
1362
- function Node() {
1363
- }
1364
- Object.defineProperty(Node.prototype, "type", {
1365
- get: function () {
1366
- return 'node';
1367
- },
1368
- enumerable: false,
1369
- configurable: true
1370
- });
1371
- Node.prototype.setContext = function (context) {
1372
- this.context = context;
1321
+ var elProto = Element.prototype;
1322
+ var matchSelector = elProto.matches ||
1323
+ elProto.webkitMatchesSelector ||
1324
+ elProto.mozMatchesSelector ||
1325
+ elProto.msMatchesSelector ||
1326
+ function(selector) {
1327
+ var doc = this.document || this.ownerDocument;
1328
+
1329
+ return inArray(this, toArray(doc.querySelectorAll(selector))) > -1;
1373
1330
  };
1374
- return Node;
1375
- }());
1376
1331
 
1377
- function widgetNodeView(pmNode) {
1378
- var dom = document.createElement('span');
1379
- var node = widgetToDOM(pmNode.attrs.info, pmNode.textContent);
1332
+ /**
1333
+ * Check element match selector
1334
+ * @param {HTMLElement} element - element to check
1335
+ * @param {string} selector - selector to check
1336
+ * @returns {boolean} is selector matched to element?
1337
+ * @memberof module:domUtil
1338
+ */
1339
+ function matches(element, selector) {
1340
+ return matchSelector.call(element, selector);
1341
+ }
1342
+
1343
+ var matches_1 = matches;
1344
+
1345
+ var TAG_NAME = '[A-Za-z][A-Za-z0-9-]*';
1346
+ var ATTRIBUTE_NAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
1347
+ var UNQUOTED_VALUE = '[^"\'=<>`\\x00-\\x20]+';
1348
+ var SINGLE_QUOTED_VALUE = "'[^']*'";
1349
+ var DOUBLE_QUOTED_VALUE = '"[^"]*"';
1350
+ var ATTRIBUTE_VALUE = "(?:" + UNQUOTED_VALUE + "|" + SINGLE_QUOTED_VALUE + "|" + DOUBLE_QUOTED_VALUE + ")";
1351
+ var ATTRIBUTE_VALUE_SPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTE_VALUE + ")";
1352
+ var ATTRIBUTE$1 = "" + '(?:\\s+' + ATTRIBUTE_NAME + ATTRIBUTE_VALUE_SPEC + "?)";
1353
+ var OPEN_TAG = "<(" + TAG_NAME + ")(" + ATTRIBUTE$1 + ")*\\s*/?>";
1354
+ var CLOSE_TAG = "</(" + TAG_NAME + ")\\s*[>]";
1355
+ var HTML_TAG = "(?:" + OPEN_TAG + "|" + CLOSE_TAG + ")";
1356
+ var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
1357
+ var reBR = /<br\s*\/*>/i;
1358
+ var reHTMLComment = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
1359
+ var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
1360
+
1361
+ function isPositionInBox(style, offsetX, offsetY) {
1362
+ var left = parseInt(style.left, 10);
1363
+ var top = parseInt(style.top, 10);
1364
+ var width = parseInt(style.width, 10) + parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
1365
+ var height = parseInt(style.height, 10) + parseInt(style.paddingTop, 10) + parseInt(style.paddingBottom, 10);
1366
+ return offsetX >= left && offsetX <= left + width && offsetY >= top && offsetY <= top + height;
1367
+ }
1368
+ var CLS_PREFIX = 'toastui-editor-';
1369
+ function cls() {
1370
+ var names = [];
1371
+ for (var _i = 0; _i < arguments.length; _i++) {
1372
+ names[_i] = arguments[_i];
1373
+ }
1374
+ var result = [];
1375
+ for (var _a = 0, names_1 = names; _a < names_1.length; _a++) {
1376
+ var name_1 = names_1[_a];
1377
+ var className = void 0;
1378
+ if (Array.isArray(name_1)) {
1379
+ className = name_1[0] ? name_1[1] : null;
1380
+ }
1381
+ else {
1382
+ className = name_1;
1383
+ }
1384
+ if (className) {
1385
+ result.push("" + CLS_PREFIX + className);
1386
+ }
1387
+ }
1388
+ return result.join(' ');
1389
+ }
1390
+ function clsWithMdPrefix() {
1391
+ var names = [];
1392
+ for (var _i = 0; _i < arguments.length; _i++) {
1393
+ names[_i] = arguments[_i];
1394
+ }
1395
+ return names.map(function (className) { return CLS_PREFIX + "md-" + className; }).join(' ');
1396
+ }
1397
+ function isTextNode(node) {
1398
+ return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.TEXT_NODE;
1399
+ }
1400
+ function isElemNode(node) {
1401
+ return node && node.nodeType === Node.ELEMENT_NODE;
1402
+ }
1403
+ function findNodes(element, selector) {
1404
+ var nodeList = toArray_1(element.querySelectorAll(selector));
1405
+ if (nodeList.length) {
1406
+ return nodeList;
1407
+ }
1408
+ return [];
1409
+ }
1410
+ function appendNodes(node, nodesToAppend) {
1411
+ nodesToAppend = isArray_1(nodesToAppend) ? toArray_1(nodesToAppend) : [nodesToAppend];
1412
+ nodesToAppend.forEach(function (nodeToAppend) {
1413
+ node.appendChild(nodeToAppend);
1414
+ });
1415
+ }
1416
+ function insertBeforeNode(insertedNode, node) {
1417
+ if (node.parentNode) {
1418
+ node.parentNode.insertBefore(insertedNode, node);
1419
+ }
1420
+ }
1421
+ function removeNode$1(node) {
1422
+ if (node.parentNode) {
1423
+ node.parentNode.removeChild(node);
1424
+ }
1425
+ }
1426
+ function unwrapNode(node) {
1427
+ var result = [];
1428
+ while (node.firstChild) {
1429
+ result.push(node.firstChild);
1430
+ if (node.parentNode) {
1431
+ node.parentNode.insertBefore(node.firstChild, node);
1432
+ }
1433
+ }
1434
+ removeNode$1(node);
1435
+ return result;
1436
+ }
1437
+ function toggleClass(element, className, state) {
1438
+ if (isUndefined_1(state)) {
1439
+ state = !hasClass_1(element, className);
1440
+ }
1441
+ var toggleFn = state ? addClass_1 : removeClass_1;
1442
+ toggleFn(element, className);
1443
+ }
1444
+ function createElementWith(contents, target) {
1445
+ var container = document.createElement('div');
1446
+ if (isString_1(contents)) {
1447
+ container.innerHTML = contents;
1448
+ }
1449
+ else {
1450
+ container.appendChild(contents);
1451
+ }
1452
+ var firstChild = container.firstChild;
1453
+ if (target) {
1454
+ target.appendChild(firstChild);
1455
+ }
1456
+ return firstChild;
1457
+ }
1458
+ function getOuterWidth(el) {
1459
+ var computed = window.getComputedStyle(el);
1460
+ return (['margin-left', 'margin-right'].reduce(function (acc, type) { return acc + parseInt(computed.getPropertyValue(type), 10); }, 0) + el.offsetWidth);
1461
+ }
1462
+ function closest(node, found) {
1463
+ var condition;
1464
+ if (isString_1(found)) {
1465
+ condition = function (target) { return matches_1(target, found); };
1466
+ }
1467
+ else {
1468
+ condition = function (target) { return target === found; };
1469
+ }
1470
+ while (node && node !== document) {
1471
+ if (isElemNode(node) && condition(node)) {
1472
+ return node;
1473
+ }
1474
+ node = node.parentNode;
1475
+ }
1476
+ return null;
1477
+ }
1478
+ function getTotalOffset(el, root) {
1479
+ var offsetTop = 0;
1480
+ var offsetLeft = 0;
1481
+ while (el && el !== root) {
1482
+ var top_1 = el.offsetTop, left = el.offsetLeft, offsetParent = el.offsetParent;
1483
+ offsetTop += top_1;
1484
+ offsetLeft += left;
1485
+ if (offsetParent === root.offsetParent) {
1486
+ break;
1487
+ }
1488
+ el = el.offsetParent;
1489
+ }
1490
+ return { offsetTop: offsetTop, offsetLeft: offsetLeft };
1491
+ }
1492
+ function setAttributes(attributes, element) {
1493
+ Object.keys(attributes).forEach(function (attrName) {
1494
+ if (isNil(attributes[attrName])) {
1495
+ element.removeAttribute(attrName);
1496
+ }
1497
+ else {
1498
+ element.setAttribute(attrName, attributes[attrName]);
1499
+ }
1500
+ });
1501
+ }
1502
+ function replaceBRWithEmptyBlock(html) {
1503
+ // remove br in paragraph to compatible with markdown
1504
+ var replacedHTML = html.replace(/<p><br\s*\/*><\/p>/gi, '<p></p>');
1505
+ var reHTMLTag = new RegExp(HTML_TAG, 'ig');
1506
+ var htmlTagMatched = replacedHTML.match(reHTMLTag);
1507
+ htmlTagMatched === null || htmlTagMatched === void 0 ? void 0 : htmlTagMatched.forEach(function (htmlTag, index) {
1508
+ if (reBR.test(htmlTag)) {
1509
+ var alternativeTag = ALTERNATIVE_TAG_FOR_BR;
1510
+ if (index) {
1511
+ var prevTag = htmlTagMatched[index - 1];
1512
+ var openTagMatched = prevTag.match(OPEN_TAG);
1513
+ if (openTagMatched && !/br/i.test(openTagMatched[1])) {
1514
+ var tagName = openTagMatched[1];
1515
+ alternativeTag = "</" + tagName + "><" + tagName + ">";
1516
+ }
1517
+ }
1518
+ replacedHTML = replacedHTML.replace(reBR, alternativeTag);
1519
+ }
1520
+ });
1521
+ return replacedHTML;
1522
+ }
1523
+
1524
+ var pluginKey$1 = new PluginKey('widget');
1525
+ var MARGIN = 5;
1526
+ var PopupWidget = /** @class */ (function () {
1527
+ function PopupWidget(view, eventEmitter) {
1528
+ var _this = this;
1529
+ this.popup = null;
1530
+ this.removeWidget = function () {
1531
+ if (_this.popup) {
1532
+ _this.rootEl.removeChild(_this.popup);
1533
+ _this.popup = null;
1534
+ }
1535
+ };
1536
+ this.rootEl = view.dom.parentElement;
1537
+ this.eventEmitter = eventEmitter;
1538
+ this.eventEmitter.listen('blur', this.removeWidget);
1539
+ this.eventEmitter.listen('loadUI', function () {
1540
+ _this.rootEl = closest(view.dom.parentElement, "." + cls('defaultUI'));
1541
+ });
1542
+ this.eventEmitter.listen('removePopupWidget', this.removeWidget);
1543
+ }
1544
+ PopupWidget.prototype.update = function (view) {
1545
+ var widget = pluginKey$1.getState(view.state);
1546
+ this.removeWidget();
1547
+ if (widget) {
1548
+ var node = widget.node, style = widget.style;
1549
+ var _a = view.coordsAtPos(widget.pos), top_1 = _a.top, left = _a.left, bottom = _a.bottom;
1550
+ var height = bottom - top_1;
1551
+ var rect = this.rootEl.getBoundingClientRect();
1552
+ var relTopPos = top_1 - rect.top;
1553
+ css_1(node, { opacity: '0' });
1554
+ this.rootEl.appendChild(node);
1555
+ css_1(node, {
1556
+ position: 'absolute',
1557
+ left: left - rect.left + MARGIN + "px",
1558
+ top: (style === 'bottom' ? relTopPos + height - MARGIN : relTopPos - height) + "px",
1559
+ opacity: '1',
1560
+ });
1561
+ this.popup = node;
1562
+ view.focus();
1563
+ }
1564
+ };
1565
+ PopupWidget.prototype.destroy = function () {
1566
+ this.eventEmitter.removeEventHandler('blur', this.removeWidget);
1567
+ };
1568
+ return PopupWidget;
1569
+ }());
1570
+ function addWidget(eventEmitter) {
1571
+ return new Plugin({
1572
+ key: pluginKey$1,
1573
+ state: {
1574
+ init: function () {
1575
+ return null;
1576
+ },
1577
+ apply: function (tr) {
1578
+ return tr.getMeta('widget');
1579
+ },
1580
+ },
1581
+ view: function (editorView) {
1582
+ return new PopupWidget(editorView, eventEmitter);
1583
+ },
1584
+ });
1585
+ }
1586
+
1587
+ function addDefaultImageBlobHook(eventEmitter) {
1588
+ eventEmitter.listen('addImageBlobHook', function (blob, callback) {
1589
+ var reader = new FileReader();
1590
+ reader.onload = function (_a) {
1591
+ var target = _a.target;
1592
+ return callback(target.result);
1593
+ };
1594
+ reader.readAsDataURL(blob);
1595
+ });
1596
+ }
1597
+ function emitImageBlobHook(eventEmitter, blob, type) {
1598
+ var hook = function (imageUrl, altText) {
1599
+ eventEmitter.emit('command', 'addImage', {
1600
+ imageUrl: imageUrl,
1601
+ altText: altText || blob.name || 'image',
1602
+ });
1603
+ };
1604
+ eventEmitter.emit('addImageBlobHook', blob, hook, type);
1605
+ }
1606
+ function pasteImageOnly(items) {
1607
+ var images = toArray_1(items).filter(function (_a) {
1608
+ var type = _a.type;
1609
+ return type.indexOf('image') !== -1;
1610
+ });
1611
+ if (images.length === 1) {
1612
+ var item = images[0];
1613
+ if (item) {
1614
+ return item.getAsFile();
1615
+ }
1616
+ }
1617
+ return null;
1618
+ }
1619
+
1620
+ function dropImage(_a) {
1621
+ var eventEmitter = _a.eventEmitter;
1622
+ return new Plugin({
1623
+ props: {
1624
+ handleDOMEvents: {
1625
+ drop: function (_, ev) {
1626
+ var _a;
1627
+ var items = (_a = ev.dataTransfer) === null || _a === void 0 ? void 0 : _a.files;
1628
+ if (items) {
1629
+ forEachArray_1(items, function (item) {
1630
+ if (item.type.indexOf('image') !== -1) {
1631
+ ev.preventDefault();
1632
+ ev.stopPropagation();
1633
+ emitImageBlobHook(eventEmitter, item, ev.type);
1634
+ return false;
1635
+ }
1636
+ return true;
1637
+ });
1638
+ }
1639
+ return true;
1640
+ },
1641
+ },
1642
+ },
1643
+ });
1644
+ }
1645
+
1646
+ var Node$2 = /** @class */ (function () {
1647
+ function Node() {
1648
+ }
1649
+ Object.defineProperty(Node.prototype, "type", {
1650
+ get: function () {
1651
+ return 'node';
1652
+ },
1653
+ enumerable: false,
1654
+ configurable: true
1655
+ });
1656
+ Node.prototype.setContext = function (context) {
1657
+ this.context = context;
1658
+ };
1659
+ return Node;
1660
+ }());
1661
+
1662
+ function widgetNodeView(pmNode) {
1663
+ var dom = document.createElement('span');
1664
+ var node = widgetToDOM(pmNode.attrs.info, pmNode.textContent);
1380
1665
  dom.className = 'tui-widget';
1381
1666
  dom.appendChild(node);
1382
1667
  return { dom: dom };
@@ -1430,6 +1715,7 @@ var Widget = /** @class */ (function (_super) {
1430
1715
 
1431
1716
  var EditorBase = /** @class */ (function () {
1432
1717
  function EditorBase(eventEmitter) {
1718
+ this.timer = null;
1433
1719
  this.el = document.createElement('div');
1434
1720
  this.el.className = 'toastui-editor';
1435
1721
  this.eventEmitter = eventEmitter;
@@ -1454,10 +1740,9 @@ var EditorBase = /** @class */ (function () {
1454
1740
  };
1455
1741
  Object.defineProperty(EditorBase.prototype, "defaultPlugins", {
1456
1742
  get: function () {
1457
- var _a = getDefaultCommands(), undo = _a.undo, redo = _a.redo;
1458
1743
  var rules = this.createInputRules();
1459
1744
  var plugins = __spreadArray$1(__spreadArray$1([], this.keymaps), [
1460
- keymap(__assign$1({ 'Mod-z': undo(), 'Shift-Mod-z': redo(), 'Shift-Enter': baseKeymap.Enter }, baseKeymap)),
1745
+ keymap(__assign$1({ 'Shift-Enter': baseKeymap.Enter }, baseKeymap)),
1461
1746
  history(),
1462
1747
  placeholder(this.placeholder),
1463
1748
  addWidget(this.eventEmitter),
@@ -1494,6 +1779,12 @@ var EditorBase = /** @class */ (function () {
1494
1779
  });
1495
1780
  return rules.length ? inputRules({ rules: rules }) : null;
1496
1781
  };
1782
+ EditorBase.prototype.clearTimer = function () {
1783
+ if (this.timer) {
1784
+ clearTimeout(this.timer);
1785
+ this.timer = null;
1786
+ }
1787
+ };
1497
1788
  EditorBase.prototype.createSchema = function () {
1498
1789
  return new Schema({
1499
1790
  nodes: this.specs.nodes,
@@ -1501,7 +1792,13 @@ var EditorBase = /** @class */ (function () {
1501
1792
  });
1502
1793
  };
1503
1794
  EditorBase.prototype.createKeymaps = function (useCommandShortcut) {
1504
- return useCommandShortcut ? this.specs.keymaps() : [];
1795
+ var _a = getDefaultCommands(), undo = _a.undo, redo = _a.redo;
1796
+ var allKeymaps = this.specs.keymaps(useCommandShortcut);
1797
+ var historyKeymap = {
1798
+ 'Mod-z': undo(),
1799
+ 'Shift-Mod-z': redo(),
1800
+ };
1801
+ return useCommandShortcut ? allKeymaps.concat(keymap(historyKeymap)) : allKeymaps;
1505
1802
  };
1506
1803
  EditorBase.prototype.createCommands = function () {
1507
1804
  return this.specs.commands(this.view);
@@ -1512,8 +1809,9 @@ var EditorBase = /** @class */ (function () {
1512
1809
  };
1513
1810
  EditorBase.prototype.focus = function () {
1514
1811
  var _this = this;
1812
+ this.clearTimer();
1515
1813
  // prevent the error for IE11
1516
- setTimeout(function () {
1814
+ this.timer = setTimeout(function () {
1517
1815
  _this.view.focus();
1518
1816
  _this.view.dispatch(_this.view.state.tr.scrollIntoView());
1519
1817
  });
@@ -1521,381 +1819,171 @@ var EditorBase = /** @class */ (function () {
1521
1819
  EditorBase.prototype.blur = function () {
1522
1820
  this.view.dom.blur();
1523
1821
  };
1524
- EditorBase.prototype.destroy = function () {
1525
- var _this = this;
1526
- this.view.destroy();
1527
- Object.keys(this).forEach(function (prop) {
1528
- delete _this[prop];
1529
- });
1530
- };
1531
- EditorBase.prototype.moveCursorToStart = function (focus) {
1532
- var tr = this.view.state.tr;
1533
- this.view.dispatch(tr.setSelection(createTextSelection(tr, 1)).scrollIntoView());
1534
- if (focus) {
1535
- this.focus();
1536
- }
1537
- };
1538
- EditorBase.prototype.moveCursorToEnd = function (focus) {
1539
- var tr = this.view.state.tr;
1540
- this.view.dispatch(tr.setSelection(createTextSelection(tr, tr.doc.content.size - 1)).scrollIntoView());
1541
- if (focus) {
1542
- this.focus();
1543
- }
1544
- };
1545
- EditorBase.prototype.setScrollTop = function (top) {
1546
- this.view.dom.scrollTop = top;
1547
- };
1548
- EditorBase.prototype.getScrollTop = function () {
1549
- return this.view.dom.scrollTop;
1550
- };
1551
- EditorBase.prototype.setPlaceholder = function (text) {
1552
- this.placeholder.text = text;
1553
- this.view.dispatch(this.view.state.tr.scrollIntoView());
1554
- };
1555
- EditorBase.prototype.setHeight = function (height) {
1556
- css_1(this.el, { height: height + "px" });
1557
- };
1558
- EditorBase.prototype.setMinHeight = function (minHeight) {
1559
- css_1(this.el, { minHeight: minHeight + "px" });
1560
- };
1561
- EditorBase.prototype.getElement = function () {
1562
- return this.el;
1563
- };
1564
- return EditorBase;
1565
- }());
1566
-
1567
- /**
1568
- * @fileoverview Check whether the given variable is a function or not.
1569
- * @author NHN FE Development Lab <dl_javascript@nhn.com>
1570
- */
1571
-
1572
- /**
1573
- * Check whether the given variable is a function or not.
1574
- * If the given variable is a function, return true.
1575
- * @param {*} obj - Target for checking
1576
- * @returns {boolean} Is function?
1577
- * @memberof module:type
1578
- */
1579
- function isFunction(obj) {
1580
- return obj instanceof Function;
1581
- }
1582
-
1583
- var isFunction_1 = isFunction;
1584
-
1585
- function execCommand(view, command, payload) {
1586
- view.focus();
1587
- return command(payload)(view.state, view.dispatch, view);
1588
- }
1589
- var SpecManager = /** @class */ (function () {
1590
- function SpecManager(specs) {
1591
- this.specs = specs;
1592
- }
1593
- Object.defineProperty(SpecManager.prototype, "nodes", {
1594
- get: function () {
1595
- return this.specs
1596
- .filter(function (spec) { return spec.type === 'node'; })
1597
- .reduce(function (nodes, _a) {
1598
- var _b;
1599
- var name = _a.name, schema = _a.schema;
1600
- return __assign$1(__assign$1({}, nodes), (_b = {}, _b[name] = schema, _b));
1601
- }, {});
1602
- },
1603
- enumerable: false,
1604
- configurable: true
1605
- });
1606
- Object.defineProperty(SpecManager.prototype, "marks", {
1607
- get: function () {
1608
- return this.specs
1609
- .filter(function (spec) { return spec.type === 'mark'; })
1610
- .reduce(function (marks, _a) {
1611
- var _b;
1612
- var name = _a.name, schema = _a.schema;
1613
- return __assign$1(__assign$1({}, marks), (_b = {}, _b[name] = schema, _b));
1614
- }, {});
1615
- },
1616
- enumerable: false,
1617
- configurable: true
1618
- });
1619
- SpecManager.prototype.commands = function (view, addedCommands) {
1620
- var specCommands = this.specs
1621
- .filter(function (_a) {
1622
- var commands = _a.commands;
1623
- return commands;
1624
- })
1625
- .reduce(function (allCommands, spec) {
1626
- var commands = {};
1627
- var specCommand = spec.commands();
1628
- if (isFunction_1(specCommand)) {
1629
- commands[spec.name] = function (payload) { return execCommand(view, specCommand, payload); };
1630
- }
1631
- else {
1632
- Object.keys(specCommand).forEach(function (name) {
1633
- commands[name] = function (payload) { return execCommand(view, specCommand[name], payload); };
1634
- });
1635
- }
1636
- return __assign$1(__assign$1({}, allCommands), commands);
1637
- }, {});
1638
- var defaultCommands = getDefaultCommands();
1639
- Object.keys(defaultCommands).forEach(function (name) {
1640
- specCommands[name] = function (payload) { return execCommand(view, defaultCommands[name], payload); };
1822
+ EditorBase.prototype.destroy = function () {
1823
+ var _this = this;
1824
+ this.clearTimer();
1825
+ this.view.destroy();
1826
+ Object.keys(this).forEach(function (prop) {
1827
+ delete _this[prop];
1641
1828
  });
1642
- if (addedCommands) {
1643
- Object.keys(addedCommands).forEach(function (name) {
1644
- specCommands[name] = function (payload) { return execCommand(view, addedCommands[name], payload); };
1645
- });
1829
+ };
1830
+ EditorBase.prototype.moveCursorToStart = function (focus) {
1831
+ var tr = this.view.state.tr;
1832
+ this.view.dispatch(tr.setSelection(createTextSelection(tr, 1)).scrollIntoView());
1833
+ if (focus) {
1834
+ this.focus();
1646
1835
  }
1647
- return specCommands;
1648
1836
  };
1649
- SpecManager.prototype.keymaps = function () {
1650
- var specKeymaps = this.specs.filter(function (spec) { return spec.keymaps; }).map(function (spec) { return spec.keymaps(); });
1651
- return specKeymaps.map(function (keys) { return keymap(keys); });
1837
+ EditorBase.prototype.moveCursorToEnd = function (focus) {
1838
+ var tr = this.view.state.tr;
1839
+ this.view.dispatch(tr.setSelection(createTextSelection(tr, tr.doc.content.size - 1)).scrollIntoView());
1840
+ if (focus) {
1841
+ this.focus();
1842
+ }
1652
1843
  };
1653
- SpecManager.prototype.setContext = function (context) {
1654
- this.specs.forEach(function (spec) {
1655
- spec.setContext(context);
1656
- });
1844
+ EditorBase.prototype.setScrollTop = function (top) {
1845
+ this.view.dom.scrollTop = top;
1657
1846
  };
1658
- return SpecManager;
1847
+ EditorBase.prototype.getScrollTop = function () {
1848
+ return this.view.dom.scrollTop;
1849
+ };
1850
+ EditorBase.prototype.setPlaceholder = function (text) {
1851
+ this.placeholder.text = text;
1852
+ this.view.dispatch(this.view.state.tr.scrollIntoView());
1853
+ };
1854
+ EditorBase.prototype.setHeight = function (height) {
1855
+ css_1(this.el, { height: height + "px" });
1856
+ };
1857
+ EditorBase.prototype.setMinHeight = function (minHeight) {
1858
+ css_1(this.el, { minHeight: minHeight + "px" });
1859
+ };
1860
+ EditorBase.prototype.getElement = function () {
1861
+ return this.el;
1862
+ };
1863
+ return EditorBase;
1659
1864
  }());
1660
1865
 
1661
1866
  /**
1662
- * @fileoverview Check element has specific css class
1663
- * @author NHN FE Development Lab <dl_javascript@nhn.com>
1664
- */
1665
-
1666
- var inArray$1 = inArray_1;
1667
- var getClass = getClass_1;
1668
-
1669
- /**
1670
- * Check element has specific css class
1671
- * @param {(HTMLElement|SVGElement)} element - target element
1672
- * @param {string} cssClass - css class
1673
- * @returns {boolean}
1674
- * @memberof module:domUtil
1675
- */
1676
- function hasClass(element, cssClass) {
1677
- var origin;
1678
-
1679
- if (element.classList) {
1680
- return element.classList.contains(cssClass);
1681
- }
1682
-
1683
- origin = getClass(element).split(/\s+/);
1684
-
1685
- return inArray$1(cssClass, origin) > -1;
1686
- }
1687
-
1688
- var hasClass_1 = hasClass;
1689
-
1690
- /**
1691
- * @fileoverview Check element match selector
1867
+ * @fileoverview Check whether the given variable is a function or not.
1692
1868
  * @author NHN FE Development Lab <dl_javascript@nhn.com>
1693
1869
  */
1694
1870
 
1695
- var inArray = inArray_1;
1696
- var toArray = toArray_1;
1697
-
1698
- var elProto = Element.prototype;
1699
- var matchSelector = elProto.matches ||
1700
- elProto.webkitMatchesSelector ||
1701
- elProto.mozMatchesSelector ||
1702
- elProto.msMatchesSelector ||
1703
- function(selector) {
1704
- var doc = this.document || this.ownerDocument;
1705
-
1706
- return inArray(this, toArray(doc.querySelectorAll(selector))) > -1;
1707
- };
1708
-
1709
1871
  /**
1710
- * Check element match selector
1711
- * @param {HTMLElement} element - element to check
1712
- * @param {string} selector - selector to check
1713
- * @returns {boolean} is selector matched to element?
1714
- * @memberof module:domUtil
1872
+ * Check whether the given variable is a function or not.
1873
+ * If the given variable is a function, return true.
1874
+ * @param {*} obj - Target for checking
1875
+ * @returns {boolean} Is function?
1876
+ * @memberof module:type
1715
1877
  */
1716
- function matches(element, selector) {
1717
- return matchSelector.call(element, selector);
1878
+ function isFunction(obj) {
1879
+ return obj instanceof Function;
1718
1880
  }
1719
1881
 
1720
- var matches_1 = matches;
1721
-
1722
- var TAG_NAME = '[A-Za-z][A-Za-z0-9-]*';
1723
- var ATTRIBUTE_NAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
1724
- var UNQUOTED_VALUE = '[^"\'=<>`\\x00-\\x20]+';
1725
- var SINGLE_QUOTED_VALUE = "'[^']*'";
1726
- var DOUBLE_QUOTED_VALUE = '"[^"]*"';
1727
- var ATTRIBUTE_VALUE = "(?:" + UNQUOTED_VALUE + "|" + SINGLE_QUOTED_VALUE + "|" + DOUBLE_QUOTED_VALUE + ")";
1728
- var ATTRIBUTE_VALUE_SPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTE_VALUE + ")";
1729
- var ATTRIBUTE$1 = "" + '(?:\\s+' + ATTRIBUTE_NAME + ATTRIBUTE_VALUE_SPEC + "?)";
1730
- var OPEN_TAG = "<(" + TAG_NAME + ")(" + ATTRIBUTE$1 + ")*\\s*/?>";
1731
- var CLOSE_TAG = "</(" + TAG_NAME + ")\\s*[>]";
1732
- var HTML_TAG = "(?:" + OPEN_TAG + "|" + CLOSE_TAG + ")";
1733
- var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
1734
- var reBR = /<br\s*\/*>/i;
1735
- var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
1882
+ var isFunction_1 = isFunction;
1736
1883
 
1737
- function isPositionInBox(style, offsetX, offsetY) {
1738
- var left = parseInt(style.left, 10);
1739
- var top = parseInt(style.top, 10);
1740
- var width = parseInt(style.width, 10) + parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
1741
- var height = parseInt(style.height, 10) + parseInt(style.paddingTop, 10) + parseInt(style.paddingBottom, 10);
1742
- return offsetX >= left && offsetX <= left + width && offsetY >= top && offsetY <= top + height;
1743
- }
1744
- var CLS_PREFIX = 'toastui-editor-';
1745
- function cls() {
1746
- var names = [];
1747
- for (var _i = 0; _i < arguments.length; _i++) {
1748
- names[_i] = arguments[_i];
1749
- }
1750
- var result = [];
1751
- for (var _a = 0, names_1 = names; _a < names_1.length; _a++) {
1752
- var name_1 = names_1[_a];
1753
- var className = void 0;
1754
- if (Array.isArray(name_1)) {
1755
- className = name_1[0] ? name_1[1] : null;
1756
- }
1757
- else {
1758
- className = name_1;
1759
- }
1760
- if (className) {
1761
- result.push("" + CLS_PREFIX + className);
1762
- }
1763
- }
1764
- return result.join(' ');
1765
- }
1766
- function clsWithMdPrefix() {
1767
- var names = [];
1768
- for (var _i = 0; _i < arguments.length; _i++) {
1769
- names[_i] = arguments[_i];
1770
- }
1771
- return names.map(function (className) { return CLS_PREFIX + "md-" + className; }).join(' ');
1772
- }
1773
- function isTextNode(node) {
1774
- return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.TEXT_NODE;
1775
- }
1776
- function isElemNode(node) {
1777
- return node && node.nodeType === Node.ELEMENT_NODE;
1778
- }
1779
- function findNodes(element, selector) {
1780
- var nodeList = toArray_1(element.querySelectorAll(selector));
1781
- if (nodeList.length) {
1782
- return nodeList;
1783
- }
1784
- return [];
1785
- }
1786
- function appendNodes(node, nodesToAppend) {
1787
- nodesToAppend = isArray_1(nodesToAppend) ? toArray_1(nodesToAppend) : [nodesToAppend];
1788
- nodesToAppend.forEach(function (nodeToAppend) {
1789
- node.appendChild(nodeToAppend);
1790
- });
1791
- }
1792
- function insertBeforeNode(insertedNode, node) {
1793
- if (node.parentNode) {
1794
- node.parentNode.insertBefore(insertedNode, node);
1795
- }
1796
- }
1797
- function removeNode$1(node) {
1798
- if (node.parentNode) {
1799
- node.parentNode.removeChild(node);
1800
- }
1801
- }
1802
- function unwrapNode(node) {
1803
- var result = [];
1804
- while (node.firstChild) {
1805
- result.push(node.firstChild);
1806
- if (node.parentNode) {
1807
- node.parentNode.insertBefore(node.firstChild, node);
1808
- }
1809
- }
1810
- removeNode$1(node);
1811
- return result;
1812
- }
1813
- function toggleClass(element, className, state) {
1814
- if (isUndefined_1(state)) {
1815
- state = !hasClass_1(element, className);
1816
- }
1817
- var toggleFn = state ? addClass_1 : removeClass_1;
1818
- toggleFn(element, className);
1819
- }
1820
- function createElementWith(contents, target) {
1821
- var container = document.createElement('div');
1822
- if (isString_1(contents)) {
1823
- container.innerHTML = contents;
1824
- }
1825
- else {
1826
- container.appendChild(contents);
1827
- }
1828
- var firstChild = container.firstChild;
1829
- if (target) {
1830
- target.appendChild(firstChild);
1831
- }
1832
- return firstChild;
1833
- }
1834
- function getOuterWidth(el) {
1835
- var computed = window.getComputedStyle(el);
1836
- return (['margin-left', 'margin-right'].reduce(function (acc, type) { return acc + parseInt(computed.getPropertyValue(type), 10); }, 0) + el.offsetWidth);
1837
- }
1838
- function closest(node, found) {
1839
- var condition;
1840
- if (isString_1(found)) {
1841
- condition = function (target) { return matches_1(target, found); };
1842
- }
1843
- else {
1844
- condition = function (target) { return target === found; };
1845
- }
1846
- while (node && node !== document) {
1847
- if (isElemNode(node) && condition(node)) {
1848
- return node;
1849
- }
1850
- node = node.parentNode;
1851
- }
1852
- return null;
1884
+ var defaultCommandShortcuts = [
1885
+ 'Enter',
1886
+ 'Shift-Enter',
1887
+ 'Mod-Enter',
1888
+ 'Tab',
1889
+ 'Shift-Tab',
1890
+ 'Delete',
1891
+ 'Backspace',
1892
+ 'Mod-Delete',
1893
+ 'Mod-Backspace',
1894
+ 'ArrowUp',
1895
+ 'ArrowDown',
1896
+ 'ArrowLeft',
1897
+ 'ArrowRight',
1898
+ 'Mod-d',
1899
+ 'Mod-D',
1900
+ 'Alt-ArrowUp',
1901
+ 'Alt-ArrowDown',
1902
+ ];
1903
+ function execCommand(view, command, payload) {
1904
+ view.focus();
1905
+ return command(payload)(view.state, view.dispatch, view);
1853
1906
  }
1854
- function getTotalOffset(el, root) {
1855
- var offsetTop = 0;
1856
- var offsetLeft = 0;
1857
- while (el && el !== root) {
1858
- var top_1 = el.offsetTop, left = el.offsetLeft, offsetParent = el.offsetParent;
1859
- offsetTop += top_1;
1860
- offsetLeft += left;
1861
- if (offsetParent === root.offsetParent) {
1862
- break;
1863
- }
1864
- el = el.offsetParent;
1907
+ var SpecManager = /** @class */ (function () {
1908
+ function SpecManager(specs) {
1909
+ this.specs = specs;
1865
1910
  }
1866
- return { offsetTop: offsetTop, offsetLeft: offsetLeft };
1867
- }
1868
- function setAttributes(attributes, element) {
1869
- Object.keys(attributes).forEach(function (attrName) {
1870
- if (isNil(attributes[attrName])) {
1871
- element.removeAttribute(attrName);
1872
- }
1873
- else {
1874
- element.setAttribute(attrName, attributes[attrName]);
1875
- }
1911
+ Object.defineProperty(SpecManager.prototype, "nodes", {
1912
+ get: function () {
1913
+ return this.specs
1914
+ .filter(function (spec) { return spec.type === 'node'; })
1915
+ .reduce(function (nodes, _a) {
1916
+ var _b;
1917
+ var name = _a.name, schema = _a.schema;
1918
+ return __assign$1(__assign$1({}, nodes), (_b = {}, _b[name] = schema, _b));
1919
+ }, {});
1920
+ },
1921
+ enumerable: false,
1922
+ configurable: true
1876
1923
  });
1877
- }
1878
- function replaceBRWithEmptyBlock(html) {
1879
- // remove br in paragraph to compatible with markdown
1880
- var replacedHTML = html.replace(/<p><br\s*\/*><\/p>/gi, '<p></p>');
1881
- var reHTMLTag = new RegExp(HTML_TAG, 'ig');
1882
- var htmlTagMatched = replacedHTML.match(reHTMLTag);
1883
- htmlTagMatched === null || htmlTagMatched === void 0 ? void 0 : htmlTagMatched.forEach(function (htmlTag, index) {
1884
- if (reBR.test(htmlTag)) {
1885
- var alternativeTag = ALTERNATIVE_TAG_FOR_BR;
1886
- if (index) {
1887
- var prevTag = htmlTagMatched[index - 1];
1888
- var openTagMatched = prevTag.match(OPEN_TAG);
1889
- if (openTagMatched && !/br/i.test(openTagMatched[1])) {
1890
- var tagName = openTagMatched[1];
1891
- alternativeTag = "</" + tagName + "><" + tagName + ">";
1892
- }
1924
+ Object.defineProperty(SpecManager.prototype, "marks", {
1925
+ get: function () {
1926
+ return this.specs
1927
+ .filter(function (spec) { return spec.type === 'mark'; })
1928
+ .reduce(function (marks, _a) {
1929
+ var _b;
1930
+ var name = _a.name, schema = _a.schema;
1931
+ return __assign$1(__assign$1({}, marks), (_b = {}, _b[name] = schema, _b));
1932
+ }, {});
1933
+ },
1934
+ enumerable: false,
1935
+ configurable: true
1936
+ });
1937
+ SpecManager.prototype.commands = function (view, addedCommands) {
1938
+ var specCommands = this.specs
1939
+ .filter(function (_a) {
1940
+ var commands = _a.commands;
1941
+ return commands;
1942
+ })
1943
+ .reduce(function (allCommands, spec) {
1944
+ var commands = {};
1945
+ var specCommand = spec.commands();
1946
+ if (isFunction_1(specCommand)) {
1947
+ commands[spec.name] = function (payload) { return execCommand(view, specCommand, payload); };
1893
1948
  }
1894
- replacedHTML = replacedHTML.replace(reBR, alternativeTag);
1949
+ else {
1950
+ Object.keys(specCommand).forEach(function (name) {
1951
+ commands[name] = function (payload) { return execCommand(view, specCommand[name], payload); };
1952
+ });
1953
+ }
1954
+ return __assign$1(__assign$1({}, allCommands), commands);
1955
+ }, {});
1956
+ var defaultCommands = getDefaultCommands();
1957
+ Object.keys(defaultCommands).forEach(function (name) {
1958
+ specCommands[name] = function (payload) { return execCommand(view, defaultCommands[name], payload); };
1959
+ });
1960
+ if (addedCommands) {
1961
+ Object.keys(addedCommands).forEach(function (name) {
1962
+ specCommands[name] = function (payload) { return execCommand(view, addedCommands[name], payload); };
1963
+ });
1895
1964
  }
1896
- });
1897
- return replacedHTML;
1898
- }
1965
+ return specCommands;
1966
+ };
1967
+ SpecManager.prototype.keymaps = function (useCommandShortcut) {
1968
+ var specKeymaps = this.specs.filter(function (spec) { return spec.keymaps; }).map(function (spec) { return spec.keymaps(); });
1969
+ return specKeymaps.map(function (keys) {
1970
+ if (!useCommandShortcut) {
1971
+ Object.keys(keys).forEach(function (key) {
1972
+ if (!includes(defaultCommandShortcuts, key)) {
1973
+ delete keys[key];
1974
+ }
1975
+ });
1976
+ }
1977
+ return keymap(keys);
1978
+ });
1979
+ };
1980
+ SpecManager.prototype.setContext = function (context) {
1981
+ this.specs.forEach(function (spec) {
1982
+ spec.setContext(context);
1983
+ });
1984
+ };
1985
+ return SpecManager;
1986
+ }());
1899
1987
 
1900
1988
  function resolveSelectionPos(selection) {
1901
1989
  var from = selection.from, to = selection.to;
@@ -2356,34 +2444,60 @@ function getMarkForAdding(node, toastMark) {
2356
2444
  return markInfo !== null && markInfo !== void 0 ? markInfo : [];
2357
2445
  }
2358
2446
 
2447
+ var defaultToolbarStateKeys = [
2448
+ 'taskList',
2449
+ 'orderedList',
2450
+ 'bulletList',
2451
+ 'table',
2452
+ 'strong',
2453
+ 'emph',
2454
+ 'strike',
2455
+ 'heading',
2456
+ 'thematicBreak',
2457
+ 'blockQuote',
2458
+ 'code',
2459
+ 'codeBlock',
2460
+ 'indent',
2461
+ 'outdent',
2462
+ ];
2359
2463
  function getToolbarStateType$1(mdNode) {
2464
+ var type = mdNode.type;
2360
2465
  if (isListNode$1(mdNode)) {
2361
2466
  if (mdNode.listData.task) {
2362
2467
  return 'taskList';
2363
2468
  }
2364
2469
  return mdNode.listData.type === 'ordered' ? 'orderedList' : 'bulletList';
2365
2470
  }
2366
- if (mdNode.type.indexOf('table') !== -1) {
2471
+ if (type.indexOf('table') !== -1) {
2367
2472
  return 'table';
2368
2473
  }
2369
- return mdNode.type;
2474
+ if (!includes(defaultToolbarStateKeys, type)) {
2475
+ return null;
2476
+ }
2477
+ return type;
2370
2478
  }
2371
2479
  function getToolbarState$1(targetNode) {
2372
- var toolbarState = {};
2480
+ var toolbarState = {
2481
+ indent: { active: false, disabled: true },
2482
+ outdent: { active: false, disabled: true },
2483
+ };
2373
2484
  var listEnabled = true;
2374
2485
  traverseParentNodes(targetNode, function (mdNode) {
2375
2486
  var type = getToolbarStateType$1(mdNode);
2376
- if (type === 'customBlock' || type === 'image' || type === 'link') {
2487
+ if (!type) {
2377
2488
  return;
2378
2489
  }
2379
2490
  if (type === 'bulletList' || type === 'orderedList') {
2491
+ // to apply the nearlist list state in the nested list
2380
2492
  if (listEnabled) {
2381
- toolbarState[type] = true;
2493
+ toolbarState[type] = { active: true };
2494
+ toolbarState.indent.disabled = false;
2495
+ toolbarState.outdent.disabled = false;
2382
2496
  listEnabled = false;
2383
2497
  }
2384
2498
  }
2385
2499
  else {
2386
- toolbarState[type] = true;
2500
+ toolbarState[type] = { active: true };
2387
2501
  }
2388
2502
  });
2389
2503
  return toolbarState;
@@ -3346,9 +3460,11 @@ var ThematicBreak$1 = /** @class */ (function (_super) {
3346
3460
  return ThematicBreak;
3347
3461
  }(Mark));
3348
3462
 
3349
- function cannotBeListNode(_a) {
3350
- var type = _a.type;
3351
- return type === 'codeBlock' || type === 'heading' || type.indexOf('table') !== -1;
3463
+ function cannotBeListNode(_a, line) {
3464
+ var type = _a.type, sourcepos = _a.sourcepos;
3465
+ // eslint-disable-next-line prefer-destructuring
3466
+ var startLine = sourcepos[0][0];
3467
+ return line <= startLine && (type === 'codeBlock' || type === 'heading' || type.match('table'));
3352
3468
  }
3353
3469
  var ListItem$1 = /** @class */ (function (_super) {
3354
3470
  __extends$1(ListItem, _super);
@@ -3451,7 +3567,7 @@ var ListItem$1 = /** @class */ (function (_super) {
3451
3567
  var skipLines = [];
3452
3568
  for (var line = startLine; line <= endLine; line += 1) {
3453
3569
  var mdNode = toastMark.findFirstNodeAtLine(line);
3454
- if (mdNode && cannotBeListNode(mdNode)) {
3570
+ if (mdNode && cannotBeListNode(mdNode, line)) {
3455
3571
  break;
3456
3572
  }
3457
3573
  // to skip unnecessary processing
@@ -3742,56 +3858,6 @@ var Code$1 = /** @class */ (function (_super) {
3742
3858
  return Code;
3743
3859
  }(Mark));
3744
3860
 
3745
- var encoderList = [
3746
- {
3747
- regExp: /\(/g,
3748
- encoded: '%28',
3749
- escaped: '\\(',
3750
- },
3751
- {
3752
- regExp: /\)/g,
3753
- encoded: '%29',
3754
- escaped: '\\)',
3755
- },
3756
- {
3757
- regExp: /\[/g,
3758
- encoded: '%5B',
3759
- escaped: '\\[',
3760
- },
3761
- {
3762
- regExp: /\]/g,
3763
- encoded: '%5D',
3764
- escaped: '\\]',
3765
- },
3766
- {
3767
- regExp: /</g,
3768
- encoded: '%3C',
3769
- escaped: '\\<',
3770
- },
3771
- {
3772
- regExp: />/g,
3773
- encoded: '%3E',
3774
- escaped: '\\>',
3775
- },
3776
- {
3777
- regExp: / /g,
3778
- encoded: '%20',
3779
- escaped: ' ',
3780
- },
3781
- ];
3782
- function escapeMarkdownText(text) {
3783
- return encoderList.reduce(function (result, _a) {
3784
- var regExp = _a.regExp, escaped = _a.escaped;
3785
- return result.replace(regExp, escaped);
3786
- }, text);
3787
- }
3788
- function encodeMarkdownText(text) {
3789
- return encoderList.reduce(function (result, _a) {
3790
- var regExp = _a.regExp, encoded = _a.encoded;
3791
- return result.replace(regExp, encoded);
3792
- }, text);
3793
- }
3794
-
3795
3861
  var Link$1 = /** @class */ (function (_super) {
3796
3862
  __extends$1(Link, _super);
3797
3863
  function Link() {
@@ -3841,8 +3907,7 @@ var Link$1 = /** @class */ (function (_super) {
3841
3907
  url = imageUrl;
3842
3908
  syntax = '!';
3843
3909
  }
3844
- text = escapeMarkdownText(text);
3845
- url = encodeMarkdownText(url);
3910
+ text = escapeTextForLink(text);
3846
3911
  syntax += "[" + text + "](" + url + ")";
3847
3912
  dispatch(tr.replaceWith(from, to, createTextNode$1(schema, syntax)));
3848
3913
  return true;
@@ -4009,6 +4074,7 @@ var Html = /** @class */ (function (_super) {
4009
4074
  return Html;
4010
4075
  }(Mark));
4011
4076
 
4077
+ var customBlockSyntax = '$$';
4012
4078
  var CustomBlock$1 = /** @class */ (function (_super) {
4013
4079
  __extends$1(CustomBlock, _super);
4014
4080
  function CustomBlock() {
@@ -4032,6 +4098,22 @@ var CustomBlock$1 = /** @class */ (function (_super) {
4032
4098
  enumerable: false,
4033
4099
  configurable: true
4034
4100
  });
4101
+ CustomBlock.prototype.commands = function () {
4102
+ return function (payload) { return function (state, dispatch) {
4103
+ var selection = state.selection, schema = state.schema, tr = state.tr;
4104
+ var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset;
4105
+ if (!(payload === null || payload === void 0 ? void 0 : payload.info)) {
4106
+ return false;
4107
+ }
4108
+ var customBlock = "" + customBlockSyntax + payload.info;
4109
+ var startNode = createTextNode$1(schema, customBlock);
4110
+ var endNode = createTextNode$1(schema, customBlockSyntax);
4111
+ tr.insert(startFromOffset, startNode).split(startFromOffset + customBlock.length);
4112
+ tr.split(tr.mapping.map(endToOffset)).insert(tr.mapping.map(endToOffset), endNode);
4113
+ dispatch(tr.setSelection(createTextSelection(tr, tr.mapping.map(endToOffset) - (customBlockSyntax.length + 2))));
4114
+ return true;
4115
+ }; };
4116
+ };
4035
4117
  return CustomBlock;
4036
4118
  }(Mark));
4037
4119
 
@@ -4099,15 +4181,20 @@ var MdEditor = /** @class */ (function (_super) {
4099
4181
  _this.commands = _this.createCommands();
4100
4182
  _this.specs.setContext(__assign$1(__assign$1({}, _this.context), { view: _this.view }));
4101
4183
  _this.createClipboard();
4102
- _this.eventEmitter.listen('changePreviewTabWrite', function () { return _this.toggleActive(true); });
4184
+ // To prevent unnecessary focus setting during initial rendering
4185
+ _this.eventEmitter.listen('changePreviewTabWrite', function (isMarkdownTabMounted) {
4186
+ return _this.toggleActive(true, isMarkdownTabMounted);
4187
+ });
4103
4188
  _this.eventEmitter.listen('changePreviewTabPreview', function () { return _this.toggleActive(false); });
4104
4189
  _this.initEvent();
4105
4190
  return _this;
4106
4191
  }
4107
- MdEditor.prototype.toggleActive = function (active) {
4192
+ MdEditor.prototype.toggleActive = function (active, isMarkdownTabMounted) {
4108
4193
  toggleClass(this.el, 'active', active);
4109
4194
  if (active) {
4110
- this.focus();
4195
+ if (!isMarkdownTabMounted) {
4196
+ this.focus();
4197
+ }
4111
4198
  }
4112
4199
  else {
4113
4200
  this.blur();
@@ -4121,10 +4208,14 @@ var MdEditor = /** @class */ (function (_super) {
4121
4208
  var clipboardData = ev.clipboardData || window.clipboardData;
4122
4209
  var items = clipboardData && clipboardData.items;
4123
4210
  if (items) {
4124
- var imageBlob = pasteImageOnly(items);
4125
- if (imageBlob) {
4126
- ev.preventDefault();
4127
- emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
4211
+ var containRtfItem = toArray_1(items).some(function (item) { return item.kind === 'string' && item.type === 'text/rtf'; });
4212
+ // if it contains rtf, it's most likely copy paste from office -> no image
4213
+ if (!containRtfItem) {
4214
+ var imageBlob = pasteImageOnly(items);
4215
+ if (imageBlob) {
4216
+ ev.preventDefault();
4217
+ emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
4218
+ }
4128
4219
  }
4129
4220
  }
4130
4221
  });
@@ -10645,7 +10736,7 @@ var InlineParser = /** @class */ (function () {
10645
10736
  var literal = textNode.literal || '';
10646
10737
  var info = literal.split(/\s/)[0];
10647
10738
  newNode.info = info;
10648
- if (literal.length === info.length + 1) {
10739
+ if (literal.length <= info.length) {
10649
10740
  textNode.unlink();
10650
10741
  }
10651
10742
  else {
@@ -13089,7 +13180,6 @@ function filterDisallowedTags(str) {
13089
13180
  return str;
13090
13181
  }
13091
13182
 
13092
- var CUSTOM_SYNTAX_LENGTH = 4;
13093
13183
  var baseConvertors$1 = {
13094
13184
  heading: function (node, _a) {
13095
13185
  var entering = _a.entering;
@@ -13280,7 +13370,7 @@ var baseConvertors$1 = {
13280
13370
  ];
13281
13371
  },
13282
13372
  customInline: function (node, context, convertors) {
13283
- var _a = node, sourcepos = _a.sourcepos, info = _a.info;
13373
+ var _a = node, info = _a.info, firstChild = _a.firstChild;
13284
13374
  var nomalizedInfo = info.trim().toLowerCase();
13285
13375
  var customConvertor = convertors[nomalizedInfo];
13286
13376
  var entering = context.entering;
@@ -13292,13 +13382,10 @@ var baseConvertors$1 = {
13292
13382
  console.warn("[@toast-ui/editor] - The error occurred when " + nomalizedInfo + " inline node was parsed in markdown renderer: " + e);
13293
13383
  }
13294
13384
  }
13295
- var text = sourcepos[1][1] - sourcepos[0][1] + 1 === info.length + CUSTOM_SYNTAX_LENGTH
13296
- ? ''
13297
- : info + " ";
13298
13385
  return entering
13299
13386
  ? [
13300
13387
  { type: 'openTag', tagName: 'span' },
13301
- { type: 'text', content: "$$" + text },
13388
+ { type: 'text', content: "$$" + info + (firstChild ? ' ' : '') },
13302
13389
  ]
13303
13390
  : [
13304
13391
  { type: 'text', content: '$$' },
@@ -15028,7 +15115,7 @@ function sanitizeHTML(html, options) {
15028
15115
 
15029
15116
  function getChildrenHTML(node, typeName) {
15030
15117
  return node
15031
- .literal.replace(new RegExp("(<\\s*" + typeName + "[^>]+?>)|(</" + typeName + "\\s*[>])", 'ig'), '')
15118
+ .literal.replace(new RegExp("(<\\s*" + typeName + "[^>]*>)|(</" + typeName + "\\s*[>])", 'ig'), '')
15032
15119
  .trim();
15033
15120
  }
15034
15121
  function getHTMLAttrsByHTMLString(html) {
@@ -15343,11 +15430,11 @@ function getAdditionalPos(scrollTop, offsetTop, height, targetNodeHeight) {
15343
15430
  var ratio = Math.min((scrollTop - offsetTop) / height, 1);
15344
15431
  return ratio * targetNodeHeight;
15345
15432
  }
15346
- function getParentNodeObj(mdNode) {
15347
- var el = document.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
15433
+ function getParentNodeObj(previewContent, mdNode) {
15434
+ var el = previewContent.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
15348
15435
  while (!el || isStyledInlineNode(mdNode)) {
15349
15436
  mdNode = mdNode.parent;
15350
- el = document.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
15437
+ el = previewContent.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
15351
15438
  }
15352
15439
  return getNonNestableNodeObj({ mdNode: mdNode, el: el });
15353
15440
  }
@@ -15437,10 +15524,16 @@ var MarkdownPreview = /** @class */ (function () {
15437
15524
  this.sanitizer = sanitizer;
15438
15525
  this.initEvent(highlight);
15439
15526
  this.initContentSection();
15527
+ // To prevent overflowing contents in the viewer
15528
+ if (this.isViewer) {
15529
+ this.previewContent.style.overflowWrap = 'break-word';
15530
+ }
15440
15531
  }
15441
15532
  MarkdownPreview.prototype.initContentSection = function () {
15442
15533
  this.previewContent = createElementWith("<div class=\"" + cls('contents') + "\"></div>");
15443
- this.el.appendChild(this.previewContent);
15534
+ if (!this.isViewer) {
15535
+ this.el.appendChild(this.previewContent);
15536
+ }
15444
15537
  };
15445
15538
  MarkdownPreview.prototype.toggleActive = function (active) {
15446
15539
  toggleClass(this.el, 'active', active);
@@ -15448,6 +15541,9 @@ var MarkdownPreview = /** @class */ (function () {
15448
15541
  MarkdownPreview.prototype.initEvent = function (highlight) {
15449
15542
  var _this = this;
15450
15543
  this.eventEmitter.listen('updatePreview', this.update.bind(this));
15544
+ if (this.isViewer) {
15545
+ return;
15546
+ }
15451
15547
  if (highlight) {
15452
15548
  this.eventEmitter.listen('changeToolbarState', function (_a) {
15453
15549
  var mdNode = _a.mdNode, cursorPos = _a.cursorPos;
@@ -16038,7 +16134,10 @@ var TableOffsetMap = /** @class */ (function () {
16038
16134
  };
16039
16135
  TableOffsetMap.prototype.getNodeAndPos = function (rowIdx, colIdx) {
16040
16136
  var cellInfo = this.rowInfo[rowIdx][colIdx];
16041
- return { node: this.table.nodeAt(cellInfo.offset - 1), pos: cellInfo.offset };
16137
+ return {
16138
+ node: this.table.nodeAt(cellInfo.offset - this.tableStartOffset),
16139
+ pos: cellInfo.offset,
16140
+ };
16042
16141
  };
16043
16142
  TableOffsetMap.prototype.extendedRowspan = function (rowIdx, colIdx) {
16044
16143
  return false;
@@ -16518,7 +16617,7 @@ var Map$1 = /** @class */ (function () {
16518
16617
 
16519
16618
  /**
16520
16619
  * @fileoverview Implements i18n
16521
- * @author NHN FE Development Lab <dl_javascript@nhn.com>
16620
+ * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
16522
16621
  */
16523
16622
  var DEFAULT_CODE = 'en-US';
16524
16623
  /**
@@ -16699,47 +16798,49 @@ function getToolbarStateType(node, parentNode) {
16699
16798
  return type;
16700
16799
  }
16701
16800
  function setListNodeToolbarState(type, nodeTypeState) {
16702
- nodeTypeState[type] = true;
16801
+ nodeTypeState[type] = { active: true };
16703
16802
  LIST_TYPES.filter(function (listName) { return listName !== type; }).forEach(function (listType) {
16704
16803
  if (nodeTypeState[listType]) {
16705
16804
  delete nodeTypeState[listType];
16706
16805
  }
16707
16806
  });
16708
16807
  }
16709
- function getMarkTypeStates(from, to, schema) {
16710
- var markTypeState = {};
16808
+ function setMarkTypeStates(from, to, schema, toolbarState) {
16711
16809
  MARK_TYPES.forEach(function (type) {
16712
16810
  var mark = schema.marks[type];
16713
16811
  var marksAtPos = from.marksAcross(to) || [];
16714
16812
  var foundMark = !!mark.isInSet(marksAtPos);
16715
16813
  if (foundMark) {
16716
- markTypeState[type] = true;
16814
+ toolbarState[type] = { active: true };
16717
16815
  }
16718
16816
  });
16719
- return markTypeState;
16720
16817
  }
16721
16818
  function getToolbarState(selection, doc, schema) {
16722
16819
  var $from = selection.$from, $to = selection.$to, from = selection.from, to = selection.to;
16723
- var nodeTypeState = {};
16724
- var markTypeState = {};
16820
+ var toolbarState = {
16821
+ indent: { active: false, disabled: true },
16822
+ outdent: { active: false, disabled: true },
16823
+ };
16725
16824
  doc.nodesBetween(from, to, function (node, _, parentNode) {
16726
16825
  var type = getToolbarStateType(node, parentNode);
16727
16826
  if (includes(EXCEPT_TYPES, type)) {
16728
16827
  return;
16729
16828
  }
16730
16829
  if (includes(LIST_TYPES, type)) {
16731
- setListNodeToolbarState(type, nodeTypeState);
16830
+ setListNodeToolbarState(type, toolbarState);
16831
+ toolbarState.indent.disabled = false;
16832
+ toolbarState.outdent.disabled = false;
16732
16833
  }
16733
16834
  else if (type === 'paragraph' || type === 'text') {
16734
- markTypeState = getMarkTypeStates($from, $to, schema);
16835
+ setMarkTypeStates($from, $to, schema, toolbarState);
16735
16836
  }
16736
16837
  else {
16737
- nodeTypeState[type] = true;
16838
+ toolbarState[type] = { active: true };
16738
16839
  }
16739
16840
  });
16740
- return __assign$1(__assign$1({}, nodeTypeState), markTypeState);
16841
+ return toolbarState;
16741
16842
  }
16742
- function toolbarState(eventEmitter) {
16843
+ function toolbarStateHighlight(eventEmitter) {
16743
16844
  return new Plugin({
16744
16845
  view: function () {
16745
16846
  return {
@@ -16761,6 +16862,7 @@ var CustomBlockView = /** @class */ (function () {
16761
16862
  if (_this.innerEditorView) {
16762
16863
  throw new Error('The editor is already opened.');
16763
16864
  }
16865
+ _this.dom.draggable = false;
16764
16866
  _this.wrapper.style.display = 'none';
16765
16867
  _this.innerViewContainer.style.display = 'block';
16766
16868
  _this.innerEditorView = new EditorView(_this.innerViewContainer, {
@@ -17002,6 +17104,7 @@ var CodeBlockView = /** @class */ (function () {
17002
17104
  this.dom = null;
17003
17105
  this.contentDOM = null;
17004
17106
  this.input = null;
17107
+ this.timer = null;
17005
17108
  this.handleMousedown = function (ev) {
17006
17109
  var target = ev.target;
17007
17110
  var style = getComputedStyle(target, ':after');
@@ -17057,7 +17160,7 @@ var CodeBlockView = /** @class */ (function () {
17057
17160
  input.type = 'text';
17058
17161
  input.value = this.node.attrs.language;
17059
17162
  wrapper.appendChild(input);
17060
- document.querySelector('.toastui-editor.ww-mode').appendChild(wrapper);
17163
+ this.view.dom.parentElement.appendChild(wrapper);
17061
17164
  var wrpperWidth = wrapper.clientWidth;
17062
17165
  css_1(wrapper, {
17063
17166
  top: top + 10 + "px",
@@ -17067,7 +17170,10 @@ var CodeBlockView = /** @class */ (function () {
17067
17170
  this.input = input;
17068
17171
  this.input.addEventListener('blur', function () { return _this.changeLanguage(); });
17069
17172
  this.input.addEventListener('keydown', this.handleKeydown);
17070
- setTimeout(function () { return _this.input.focus(); });
17173
+ this.clearTimer();
17174
+ this.timer = setTimeout(function () {
17175
+ _this.input.focus();
17176
+ });
17071
17177
  };
17072
17178
  CodeBlockView.prototype.bindDOMEvent = function () {
17073
17179
  if (this.dom) {
@@ -17100,6 +17206,12 @@ var CodeBlockView = /** @class */ (function () {
17100
17206
  removeNode$1(parent_1);
17101
17207
  }
17102
17208
  };
17209
+ CodeBlockView.prototype.clearTimer = function () {
17210
+ if (this.timer) {
17211
+ clearTimeout(this.timer);
17212
+ this.timer = null;
17213
+ }
17214
+ };
17103
17215
  CodeBlockView.prototype.stopEvent = function () {
17104
17216
  return true;
17105
17217
  };
@@ -17112,6 +17224,7 @@ var CodeBlockView = /** @class */ (function () {
17112
17224
  };
17113
17225
  CodeBlockView.prototype.destroy = function () {
17114
17226
  this.reset();
17227
+ this.clearTimer();
17115
17228
  if (this.dom) {
17116
17229
  this.dom.removeEventListener('click', this.handleMousedown);
17117
17230
  }
@@ -17729,7 +17842,8 @@ var Heading = /** @class */ (function (_super) {
17729
17842
  });
17730
17843
  Heading.prototype.commands = function () {
17731
17844
  return function (payload) { return function (state, dispatch) {
17732
- return setBlockType(state.schema.nodes.heading, payload)(state, dispatch);
17845
+ var nodeType = state.schema.nodes[payload.level ? 'heading' : 'paragraph'];
17846
+ return setBlockType(nodeType, payload)(state, dispatch);
17733
17847
  }; };
17734
17848
  };
17735
17849
  return Heading;
@@ -18143,9 +18257,10 @@ function addParagraphBeforeTable(tr, map, schema) {
18143
18257
  }
18144
18258
  return tr.setSelection(Selection.near(tableStartPos, -1));
18145
18259
  }
18146
- function addParagraphAfterTable(tr, map, schema) {
18260
+ function addParagraphAfterTable(tr, map, schema, forcedAddtion) {
18261
+ if (forcedAddtion === void 0) { forcedAddtion = false; }
18147
18262
  var tableEndPos = tr.doc.resolve(map.tableEndOffset);
18148
- if (!tableEndPos.nodeAfter) {
18263
+ if (forcedAddtion || !tableEndPos.nodeAfter) {
18149
18264
  return addParagraph(tr, tableEndPos, schema);
18150
18265
  }
18151
18266
  return tr.setSelection(Selection.near(tableEndPos, 1));
@@ -18550,6 +18665,29 @@ var Table = /** @class */ (function (_super) {
18550
18665
  return false;
18551
18666
  };
18552
18667
  };
18668
+ Table.prototype.exitTable = function () {
18669
+ return function (state, dispatch) {
18670
+ var selection = state.selection, tr = state.tr, schema = state.schema;
18671
+ var $from = selection.$from;
18672
+ var cell = findNodeBy($from, function (_a) {
18673
+ var type = _a.type;
18674
+ return type.name === 'tableHeadCell' || type.name === 'tableBodyCell';
18675
+ });
18676
+ if (cell) {
18677
+ var para = findNodeBy($from, function (_a) {
18678
+ var type = _a.type;
18679
+ return type.name === 'paragraph';
18680
+ });
18681
+ if (para) {
18682
+ var anchor = getResolvedSelection(selection).anchor;
18683
+ var map = TableOffsetMap.create(anchor);
18684
+ dispatch(addParagraphAfterTable(tr, map, schema, true));
18685
+ return true;
18686
+ }
18687
+ }
18688
+ return false;
18689
+ };
18690
+ };
18553
18691
  Table.prototype.commands = function () {
18554
18692
  return {
18555
18693
  addTable: this.addTable(),
@@ -18576,6 +18714,7 @@ var Table = /** @class */ (function (_super) {
18576
18714
  'Mod-Backspace': deleteCellContent,
18577
18715
  Delete: deleteCellContent,
18578
18716
  'Mod-Delete': deleteCellContent,
18717
+ 'Mod-Enter': this.exitTable(),
18579
18718
  };
18580
18719
  };
18581
18720
  return Table;
@@ -18804,7 +18943,7 @@ var Image = /** @class */ (function (_super) {
18804
18943
  var attrs = _a.attrs;
18805
18944
  return [
18806
18945
  attrs.rawHTML || 'img',
18807
- __assign$1(__assign$1({ src: attrs.imageUrl }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs(attrs)),
18946
+ __assign$1(__assign$1({ src: escapeXml$1(attrs.imageUrl) }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs(attrs)),
18808
18947
  ];
18809
18948
  },
18810
18949
  };
@@ -18819,7 +18958,7 @@ var Image = /** @class */ (function (_super) {
18819
18958
  if (!imageUrl) {
18820
18959
  return false;
18821
18960
  }
18822
- var node = schema.nodes.image.createAndFill(__assign$1({ imageUrl: encodeMarkdownText(imageUrl) }, (altText && { altText: altText })));
18961
+ var node = schema.nodes.image.createAndFill(__assign$1({ imageUrl: imageUrl }, (altText && { altText: altText })));
18823
18962
  dispatch(tr.replaceSelectionWith(node).scrollIntoView());
18824
18963
  return true;
18825
18964
  }; };
@@ -19064,7 +19203,7 @@ var Link = /** @class */ (function (_super) {
19064
19203
  get: function () {
19065
19204
  var _this = this;
19066
19205
  return {
19067
- attrs: __assign$1({ linkUrl: { default: '' }, linkText: { default: null }, rawHTML: { default: null } }, getDefaultCustomAttrs()),
19206
+ attrs: __assign$1({ linkUrl: { default: '' }, title: { default: null }, rawHTML: { default: null } }, getDefaultCustomAttrs()),
19068
19207
  inclusive: false,
19069
19208
  parseDOM: [
19070
19209
  {
@@ -19073,8 +19212,9 @@ var Link = /** @class */ (function (_super) {
19073
19212
  var sanitizedDOM = sanitizeHTML(dom, { RETURN_DOM_FRAGMENT: true })
19074
19213
  .firstChild;
19075
19214
  var href = sanitizedDOM.getAttribute('href') || '';
19215
+ var title = sanitizedDOM.getAttribute('title') || '';
19076
19216
  var rawHTML = sanitizedDOM.getAttribute('data-raw-html');
19077
- return __assign$1({ linkUrl: href, linkText: sanitizedDOM.textContent }, (rawHTML && { rawHTML: rawHTML }));
19217
+ return __assign$1({ linkUrl: href, title: title }, (rawHTML && { rawHTML: rawHTML }));
19078
19218
  },
19079
19219
  },
19080
19220
  ],
@@ -19082,7 +19222,7 @@ var Link = /** @class */ (function (_super) {
19082
19222
  var attrs = _a.attrs;
19083
19223
  return [
19084
19224
  attrs.rawHTML || 'a',
19085
- __assign$1(__assign$1({ href: attrs.linkUrl }, _this.linkAttributes), getCustomAttrs(attrs)),
19225
+ __assign$1(__assign$1({ href: escapeXml$1(attrs.linkUrl) }, _this.linkAttributes), getCustomAttrs(attrs)),
19086
19226
  ];
19087
19227
  },
19088
19228
  };
@@ -19096,10 +19236,7 @@ var Link = /** @class */ (function (_super) {
19096
19236
  var schema = state.schema, tr = state.tr, selection = state.selection;
19097
19237
  var empty = selection.empty, from = selection.from, to = selection.to;
19098
19238
  if (from && to && linkUrl) {
19099
- var attrs = {
19100
- linkUrl: encodeMarkdownText(linkUrl),
19101
- linkText: escapeMarkdownText(linkText),
19102
- };
19239
+ var attrs = { linkUrl: linkUrl };
19103
19240
  var mark = schema.mark('link', attrs);
19104
19241
  if (empty && linkText) {
19105
19242
  var node = createTextNode$1(schema, linkText, mark);
@@ -19216,6 +19353,13 @@ var CustomBlock = /** @class */ (function (_super) {
19216
19353
  enumerable: false,
19217
19354
  configurable: true
19218
19355
  });
19356
+ CustomBlock.prototype.commands = function () {
19357
+ return function (payload) { return function (state, dispatch) {
19358
+ return (payload === null || payload === void 0 ? void 0 : payload.info)
19359
+ ? setBlockType(state.schema.nodes.customBlock, payload)(state, dispatch)
19360
+ : false;
19361
+ }; };
19362
+ };
19219
19363
  return CustomBlock;
19220
19364
  }(Node$2));
19221
19365
 
@@ -19237,8 +19381,10 @@ var FrontMatter = /** @class */ (function (_super) {
19237
19381
  content: 'text*',
19238
19382
  group: 'block',
19239
19383
  code: true,
19384
+ defining: true,
19240
19385
  parseDOM: [
19241
19386
  {
19387
+ preserveWhitespace: 'full',
19242
19388
  tag: 'div[data-front-matter]',
19243
19389
  },
19244
19390
  ],
@@ -19267,6 +19413,51 @@ var FrontMatter = /** @class */ (function (_super) {
19267
19413
  return FrontMatter;
19268
19414
  }(Node$2));
19269
19415
 
19416
+ var HTMLComment = /** @class */ (function (_super) {
19417
+ __extends$1(HTMLComment, _super);
19418
+ function HTMLComment() {
19419
+ return _super !== null && _super.apply(this, arguments) || this;
19420
+ }
19421
+ Object.defineProperty(HTMLComment.prototype, "name", {
19422
+ get: function () {
19423
+ return 'htmlComment';
19424
+ },
19425
+ enumerable: false,
19426
+ configurable: true
19427
+ });
19428
+ Object.defineProperty(HTMLComment.prototype, "schema", {
19429
+ get: function () {
19430
+ return {
19431
+ content: 'text*',
19432
+ group: 'block',
19433
+ code: true,
19434
+ defining: true,
19435
+ parseDOM: [{ preserveWhitespace: 'full', tag: 'div[data-html-comment]' }],
19436
+ toDOM: function () {
19437
+ return ['div', { 'data-html-comment': 'true' }, 0];
19438
+ },
19439
+ };
19440
+ },
19441
+ enumerable: false,
19442
+ configurable: true
19443
+ });
19444
+ HTMLComment.prototype.commands = function () {
19445
+ return function () { return function (state, dispatch, view) {
19446
+ var $from = state.selection.$from;
19447
+ if (view.endOfTextblock('down') && $from.node().type.name === 'htmlComment') {
19448
+ return exitCode(state, dispatch);
19449
+ }
19450
+ return false;
19451
+ }; };
19452
+ };
19453
+ HTMLComment.prototype.keymaps = function () {
19454
+ return {
19455
+ Enter: this.commands()(),
19456
+ };
19457
+ };
19458
+ return HTMLComment;
19459
+ }(Node$2));
19460
+
19270
19461
  function createSpecs(linkAttributes) {
19271
19462
  return new SpecManager([
19272
19463
  new Doc(),
@@ -19294,6 +19485,7 @@ function createSpecs(linkAttributes) {
19294
19485
  new CustomBlock(),
19295
19486
  new FrontMatter(),
19296
19487
  new Widget(),
19488
+ new HTMLComment(),
19297
19489
  ]);
19298
19490
  }
19299
19491
 
@@ -19339,7 +19531,7 @@ var WysiwygEditor = /** @class */ (function (_super) {
19339
19531
  tableSelection(),
19340
19532
  tableContextMenu(this.eventEmitter),
19341
19533
  task(),
19342
- toolbarState(this.eventEmitter)
19534
+ toolbarStateHighlight(this.eventEmitter)
19343
19535
  ], this.createPluginProps()));
19344
19536
  };
19345
19537
  WysiwygEditor.prototype.createPluginNodeViews = function () {
@@ -19390,11 +19582,15 @@ var WysiwygEditor = /** @class */ (function (_super) {
19390
19582
  paste: function (_, ev) {
19391
19583
  var clipboardData = ev.clipboardData || window.clipboardData;
19392
19584
  var items = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.items;
19393
- if ((items === null || items === void 0 ? void 0 : items.length) === 1) {
19394
- var imageBlob = pasteImageOnly(items);
19395
- if (imageBlob) {
19396
- ev.preventDefault();
19397
- emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
19585
+ if (items) {
19586
+ var containRtfItem = toArray_1(items).some(function (item) { return item.kind === 'string' && item.type === 'text/rtf'; });
19587
+ // if it contains rtf, it's most likely copy paste from office -> no image
19588
+ if (!containRtfItem) {
19589
+ var imageBlob = pasteImageOnly(items);
19590
+ if (imageBlob) {
19591
+ ev.preventDefault();
19592
+ emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
19593
+ }
19398
19594
  }
19399
19595
  }
19400
19596
  return false;
@@ -19601,6 +19797,7 @@ var eventTypeList = [
19601
19797
  'mixinTableOffsetMapPrototype',
19602
19798
  'setFocusedNode',
19603
19799
  'removePopupWidget',
19800
+ 'query',
19604
19801
  // provide event for user
19605
19802
  'openPopup',
19606
19803
  'closePopup',
@@ -19608,6 +19805,7 @@ var eventTypeList = [
19608
19805
  'beforePreviewRender',
19609
19806
  'beforeConvertWysiwygToMarkdown',
19610
19807
  'load',
19808
+ 'loadUI',
19611
19809
  'change',
19612
19810
  'caretChange',
19613
19811
  'destroy',
@@ -20170,7 +20368,7 @@ var toWwConvertors = {
20170
20368
  var link = state.schema.marks.link;
20171
20369
  var _b = node, destination = _b.destination, title = _b.title;
20172
20370
  if (entering) {
20173
- var attrs = __assign$1(__assign$1({ linkUrl: destination }, (title && { linkText: title })), customAttrs);
20371
+ var attrs = __assign$1({ linkUrl: destination, title: title }, customAttrs);
20174
20372
  state.openMark(link.create(attrs));
20175
20373
  }
20176
20374
  else {
@@ -20236,7 +20434,7 @@ var toWwConvertors = {
20236
20434
  var tablePart = node.parent.parent;
20237
20435
  var cell = tablePart.type === 'tableHead' ? tableHeadCell : tableBodyCell;
20238
20436
  var table = tablePart.parent;
20239
- var align = table.columns[node.startIdx].align;
20437
+ var align = (table.columns[node.startIdx] || {}).align;
20240
20438
  var attrs = __assign$1({}, node.attrs);
20241
20439
  if (align) {
20242
20440
  attrs.align = align;
@@ -20314,26 +20512,34 @@ var toWwConvertors = {
20314
20512
  htmlBlock: function (state, node) {
20315
20513
  var html = node.literal;
20316
20514
  var container = document.createElement('div');
20317
- var matched = html.match(reHTMLTag);
20318
- var openTagName = matched[1], closeTagName = matched[3];
20319
- var typeName = (openTagName || closeTagName).toLowerCase();
20320
- var nodeType = state.schema.nodes[typeName];
20321
- var sanitizedHTML = sanitizeHTML(html);
20322
- // for user defined html schema
20323
- if (nodeType === null || nodeType === void 0 ? void 0 : nodeType.spec.attrs.htmlBlock) {
20324
- var htmlAttrs = getHTMLAttrsByHTMLString(sanitizedHTML);
20325
- var childrenHTML = getChildrenHTML(node, typeName);
20326
- state.addNode(nodeType, { htmlAttrs: htmlAttrs, childrenHTML: childrenHTML });
20515
+ var isHTMLComment = reHTMLComment.test(html);
20516
+ if (isHTMLComment) {
20517
+ state.openNode(state.schema.nodes.htmlComment);
20518
+ state.addText(node.literal);
20519
+ state.closeNode();
20327
20520
  }
20328
20521
  else {
20329
- container.innerHTML = sanitizedHTML;
20330
- addRawHTMLAttributeToDOM(container);
20331
- state.convertByDOMParser(container);
20522
+ var matched = html.match(reHTMLTag);
20523
+ var openTagName = matched[1], closeTagName = matched[3];
20524
+ var typeName = (openTagName || closeTagName).toLowerCase();
20525
+ var nodeType = state.schema.nodes[typeName];
20526
+ var sanitizedHTML = sanitizeHTML(html);
20527
+ // for user defined html schema
20528
+ if (nodeType === null || nodeType === void 0 ? void 0 : nodeType.spec.attrs.htmlBlock) {
20529
+ var htmlAttrs = getHTMLAttrsByHTMLString(sanitizedHTML);
20530
+ var childrenHTML = getChildrenHTML(node, typeName);
20531
+ state.addNode(nodeType, { htmlAttrs: htmlAttrs, childrenHTML: childrenHTML });
20532
+ }
20533
+ else {
20534
+ container.innerHTML = sanitizedHTML;
20535
+ addRawHTMLAttributeToDOM(container);
20536
+ state.convertByDOMParser(container);
20537
+ }
20332
20538
  }
20333
20539
  },
20334
20540
  customInline: function (state, node, _a) {
20335
20541
  var entering = _a.entering, skipChildren = _a.skipChildren;
20336
- var info = node.info;
20542
+ var _b = node, info = _b.info, firstChild = _b.firstChild;
20337
20543
  var schema = state.schema;
20338
20544
  if (info.indexOf('widget') !== -1 && entering) {
20339
20545
  var content = getWidgetContent(node);
@@ -20342,6 +20548,13 @@ var toWwConvertors = {
20342
20548
  schema.text(createWidgetContent(info, content)),
20343
20549
  ]);
20344
20550
  }
20551
+ else {
20552
+ var text = '$$';
20553
+ if (entering) {
20554
+ text += firstChild ? info + " " : info;
20555
+ }
20556
+ state.addText(text);
20557
+ }
20345
20558
  },
20346
20559
  };
20347
20560
  function createWwConvertors(customConvertors) {
@@ -20357,7 +20570,7 @@ function createWwConvertors(customConvertors) {
20357
20570
  var wwConvertor = toWwConvertors[type];
20358
20571
  if (wwConvertor && !includes(['htmlBlock', 'htmlInline'], type)) {
20359
20572
  convertors[type] = function (state, node, context) {
20360
- context.origin = function () { return orgConvertors[type](node, context); };
20573
+ context.origin = function () { return orgConvertors[type](node, context, orgConvertors); };
20361
20574
  var tokens = customConvertors[type](node, context);
20362
20575
  var attrs;
20363
20576
  if (tokens) {
@@ -20547,7 +20760,13 @@ var nodeTypeWriters = {
20547
20760
  text: function (state, _a) {
20548
20761
  var _b;
20549
20762
  var node = _a.node;
20550
- state.text((_b = node.text) !== null && _b !== void 0 ? _b : '');
20763
+ var text = (_b = node.text) !== null && _b !== void 0 ? _b : '';
20764
+ if ((node.marks || []).some(function (mark) { return mark.type.name === 'link'; })) {
20765
+ state.text(escapeTextForLink(text), false);
20766
+ }
20767
+ else {
20768
+ state.text(text);
20769
+ }
20551
20770
  },
20552
20771
  paragraph: function (state, _a) {
20553
20772
  var node = _a.node, parent = _a.parent, _b = _a.index, index = _b === void 0 ? 0 : _b;
@@ -20712,9 +20931,19 @@ var nodeTypeWriters = {
20712
20931
  var text = _a.text;
20713
20932
  state.write(text);
20714
20933
  },
20715
- html: function (state, _, _a) {
20716
- var text = _a.text;
20934
+ html: function (state, _a, _b) {
20935
+ var node = _a.node;
20936
+ var text = _b.text;
20937
+ state.write(text);
20938
+ if (node.attrs.htmlBlock) {
20939
+ state.closeBlock(node);
20940
+ }
20941
+ },
20942
+ htmlComment: function (state, _a, _b) {
20943
+ var node = _a.node;
20944
+ var text = _b.text;
20717
20945
  state.write(text);
20946
+ state.closeBlock(node);
20718
20947
  },
20719
20948
  };
20720
20949
  function write(type, _a) {
@@ -20871,13 +21100,13 @@ var toMdConvertors = {
20871
21100
  image: function (_a) {
20872
21101
  var node = _a.node;
20873
21102
  var attrs = node.attrs;
20874
- var altText = escape$1(attrs.altText || '');
20875
- var imageUrl = escape$1(attrs.imageUrl);
20876
- var altAttr = altText ? " alt=\"" + altText + "\"" : '';
21103
+ var rawHTML = attrs.rawHTML, altText = attrs.altText;
21104
+ var imageUrl = attrs.imageUrl.replace(/&amp;/g, '&');
21105
+ var altAttr = altText ? " alt=\"" + escapeXml$1(altText) + "\"" : '';
20877
21106
  return {
20878
- rawHTML: attrs.rawHTML ? "<" + attrs.rawHTML + " src=\"" + imageUrl + "\"" + altAttr + ">" : null,
21107
+ rawHTML: rawHTML ? "<" + rawHTML + " src=\"" + escapeXml$1(imageUrl) + "\"" + altAttr + ">" : null,
20879
21108
  attrs: {
20880
- altText: altText,
21109
+ altText: escapeTextForLink(altText || ''),
20881
21110
  imageUrl: imageUrl,
20882
21111
  },
20883
21112
  };
@@ -20940,17 +21169,17 @@ var toMdConvertors = {
20940
21169
  var node = _a.node;
20941
21170
  var entering = _b.entering;
20942
21171
  var attrs = node.attrs;
20943
- var linkUrl = escape$1(attrs.linkUrl);
20944
- var rawHTML = attrs.rawHTML;
21172
+ var title = attrs.title, rawHTML = attrs.rawHTML;
21173
+ var linkUrl = attrs.linkUrl.replace(/&amp;/g, '&');
21174
+ var titleAttr = title ? " title=\"" + escapeXml$1(title) + "\"" : '';
20945
21175
  if (entering) {
20946
21176
  return {
20947
21177
  delim: '[',
20948
- rawHTML: rawHTML ? "<" + rawHTML + " href=\"" + linkUrl + "\">" : null,
21178
+ rawHTML: rawHTML ? "<" + rawHTML + " href=\"" + escapeXml$1(linkUrl) + "\"" + titleAttr + ">" : null,
20949
21179
  };
20950
21180
  }
20951
- var linkText = attrs.title ? " " + quote(attrs.linkText) : '';
20952
21181
  return {
20953
- delim: "](" + linkText + linkUrl + ")",
21182
+ delim: "](" + linkUrl + (title ? " " + quote(escapeTextForLink(title)) : '') + ")",
20954
21183
  rawHTML: getCloseRawHTML(rawHTML),
20955
21184
  };
20956
21185
  },
@@ -20968,6 +21197,12 @@ var toMdConvertors = {
20968
21197
  rawHTML: rawHTML,
20969
21198
  };
20970
21199
  },
21200
+ htmlComment: function (_a) {
21201
+ var node = _a.node;
21202
+ return {
21203
+ text: node.textContent,
21204
+ };
21205
+ },
20971
21206
  // html inline node, html block node
20972
21207
  html: function (_a, _b) {
20973
21208
  var node = _a.node;
@@ -20977,7 +21212,8 @@ var toMdConvertors = {
20977
21212
  var openTag = "<" + tagName;
20978
21213
  var closeTag = "</" + tagName + ">";
20979
21214
  Object.keys(attrs).forEach(function (attrName) {
20980
- openTag += " " + attrName + "=\"" + attrs[attrName] + "\"";
21215
+ // To prevent broken converting when attributes has double quote string
21216
+ openTag += " " + attrName + "=\"" + attrs[attrName].replace(/"/g, "'") + "\"";
20981
21217
  });
20982
21218
  openTag += '>';
20983
21219
  if (node.attrs.htmlInline) {
@@ -21379,10 +21615,11 @@ var Convertor = /** @class */ (function () {
21379
21615
  }());
21380
21616
 
21381
21617
  function execPlugin(plugin, eventEmitter, usageStatistics) {
21382
- var pmState = { Plugin: Plugin, Selection: Selection, TextSelection: TextSelection };
21618
+ var pmState = { Plugin: Plugin, PluginKey: PluginKey, Selection: Selection, TextSelection: TextSelection };
21383
21619
  var pmView = { Decoration: Decoration, DecorationSet: DecorationSet };
21384
21620
  var pmModel = { Fragment: Fragment };
21385
- var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, i18n: i18n };
21621
+ var pmRules = { InputRule: InputRule, inputRules: inputRules, undoInputRule: undoInputRule };
21622
+ var context = { eventEmitter: eventEmitter, usageStatistics: usageStatistics, pmState: pmState, pmView: pmView, pmModel: pmModel, pmRules: pmRules, i18n: i18n };
21386
21623
  if (isArray_1(plugin)) {
21387
21624
  var pluginFn = plugin[0], _a = plugin[1], options = _a === void 0 ? {} : _a;
21388
21625
  return pluginFn(context, options);
@@ -21515,7 +21752,7 @@ var ToastUIEditorViewer = /** @class */ (function () {
21515
21752
  customParser: markdownParsers,
21516
21753
  });
21517
21754
  this.preview = new MarkdownPreview(this.eventEmitter, __assign$1(__assign$1({}, rendererOptions), { isViewer: true }));
21518
- on_1(this.preview.el, 'mousedown', this.toggleTask.bind(this));
21755
+ on_1(this.preview.previewContent, 'mousedown', this.toggleTask.bind(this));
21519
21756
  if (initialValue) {
21520
21757
  this.setMarkdown(initialValue);
21521
21758
  }
@@ -21537,6 +21774,10 @@ var ToastUIEditorViewer = /** @class */ (function () {
21537
21774
  element.hasAttribute(TASK_ATTR_NAME) &&
21538
21775
  isPositionInBox(style, ev.offsetX, ev.offsetY)) {
21539
21776
  toggleClass(element, TASK_CHECKED_CLASS_NAME);
21777
+ this.eventEmitter.emit('change', {
21778
+ source: 'viewer',
21779
+ date: ev,
21780
+ });
21540
21781
  }
21541
21782
  };
21542
21783
  /**
@@ -21643,7 +21884,7 @@ function createMdLikeNode(node) {
21643
21884
  };
21644
21885
  var nodeTypeMap = {
21645
21886
  heading: { level: attrs.level },
21646
- link: { destination: attrs.linkUrl, title: attrs.linkText },
21887
+ link: { destination: attrs.linkUrl, title: attrs.title },
21647
21888
  image: { destination: attrs.imageUrl },
21648
21889
  codeBlock: { info: attrs.language },
21649
21890
  bulletList: { type: 'list', listData: { type: 'bullet' } },
@@ -21781,6 +22022,7 @@ var ScrollSync = /** @class */ (function () {
21781
22022
  this.latestPreviewScrollTop = null;
21782
22023
  this.blockedScroll = null;
21783
22024
  this.active = true;
22025
+ this.timer = null;
21784
22026
  var previewRoot = preview.previewContent, previewEl = preview.el;
21785
22027
  this.previewRoot = previewRoot;
21786
22028
  this.previewEl = previewEl;
@@ -21793,10 +22035,11 @@ var ScrollSync = /** @class */ (function () {
21793
22035
  ScrollSync.prototype.addScrollSyncEvent = function () {
21794
22036
  var _this = this;
21795
22037
  this.eventEmitter.listen('afterPreviewRender', function () {
22038
+ _this.clearTimer();
21796
22039
  // Immediately after the 'afterPreviewRender' event has occurred,
21797
22040
  // browser rendering is not yet complete.
21798
22041
  // So the size of elements can not be accurately measured.
21799
- setTimeout(function () {
22042
+ _this.timer = setTimeout(function () {
21800
22043
  _this.syncPreviewScrollTop(true);
21801
22044
  }, 200);
21802
22045
  });
@@ -21823,7 +22066,7 @@ var ScrollSync = /** @class */ (function () {
21823
22066
  var pos = this.mdEditor.getSelection();
21824
22067
  var firstMdNode = this.toastMark.findFirstNodeAtLine(pos[0][0]);
21825
22068
  var previewHeight = this.previewEl.clientHeight;
21826
- var el = getParentNodeObj(firstMdNode).el;
22069
+ var el = getParentNodeObj(this.previewRoot, firstMdNode).el;
21827
22070
  var totalOffsetTop = getTotalOffsetTop(el, this.previewRoot) || el.offsetTop;
21828
22071
  var nodeHeight = el.clientHeight;
21829
22072
  // multiply 0.5 for calculating the position in the middle of preview area
@@ -21855,7 +22098,7 @@ var ScrollSync = /** @class */ (function () {
21855
22098
  targetScrollTop = scrollTopByEditing;
21856
22099
  }
21857
22100
  else {
21858
- var _d = getParentNodeObj(firstMdNode), el = _d.el, mdNode = _d.mdNode;
22101
+ var _d = getParentNodeObj(this.previewRoot, firstMdNode), el = _d.el, mdNode = _d.mdNode;
21859
22102
  var _e = getEditorRangeHeightInfo(doc, mdNode, children), height = _e.height, rect = _e.rect;
21860
22103
  var totalOffsetTop = getTotalOffsetTop(el, previewRoot) || el.offsetTop;
21861
22104
  var nodeHeight = el.clientHeight;
@@ -21883,7 +22126,7 @@ var ScrollSync = /** @class */ (function () {
21883
22126
  }
21884
22127
  var children = dom.children;
21885
22128
  var mdNodeId = Number(targetNode.getAttribute('data-nodeid'));
21886
- var _b = getParentNodeObj(toastMark.findNodeById(mdNodeId)), mdNode = _b.mdNode, el = _b.el;
22129
+ var _b = getParentNodeObj(this.previewRoot, toastMark.findNodeById(mdNodeId)), mdNode = _b.mdNode, el = _b.el;
21887
22130
  var mdNodeStartLine = getMdStartLine(mdNode);
21888
22131
  targetScrollTop = children[mdNodeStartLine - 1].offsetTop;
21889
22132
  var height = getEditorRangeHeightInfo(state.doc, mdNode, children).height;
@@ -21922,13 +22165,32 @@ var ScrollSync = /** @class */ (function () {
21922
22165
  };
21923
22166
  animate(curScrollTop, targetScrollTop, syncCallbacks);
21924
22167
  };
22168
+ ScrollSync.prototype.clearTimer = function () {
22169
+ if (this.timer) {
22170
+ clearTimeout(this.timer);
22171
+ this.timer = null;
22172
+ }
22173
+ };
21925
22174
  ScrollSync.prototype.destroy = function () {
22175
+ this.clearTimer();
21926
22176
  this.eventEmitter.removeEventHandler('scroll');
21927
22177
  this.eventEmitter.removeEventHandler('afterPreviewRender');
21928
22178
  };
21929
22179
  return ScrollSync;
21930
22180
  }());
21931
22181
 
22182
+ var queryMap = {
22183
+ getPopupInitialValues: function (editor, payload) {
22184
+ var popupName = payload.popupName;
22185
+ return popupName === 'link' ? { linkText: editor.getSelectedText() } : {};
22186
+ },
22187
+ };
22188
+ function buildQuery(editor) {
22189
+ editor.eventEmitter.listen('query', function (query, payload) {
22190
+ return queryMap[query](editor, payload);
22191
+ });
22192
+ }
22193
+
21932
22194
  /**
21933
22195
  * ToastUIEditorCore
21934
22196
  * @param {Object} options Option object
@@ -22063,6 +22325,7 @@ var ToastUIEditorCore = /** @class */ (function () {
22063
22325
  this.scrollSync = new ScrollSync(this.mdEditor, this.preview, this.eventEmitter);
22064
22326
  this.addInitEvent();
22065
22327
  this.addInitCommand(mdCommands, wwCommands);
22328
+ buildQuery(this);
22066
22329
  if (this.options.hooks) {
22067
22330
  forEachOwnProperties_1(this.options.hooks, function (fn, key) { return _this.addHook(key, fn); });
22068
22331
  }
@@ -22073,7 +22336,15 @@ var ToastUIEditorCore = /** @class */ (function () {
22073
22336
  this.moveCursorToStart(this.options.autofocus);
22074
22337
  }
22075
22338
  ToastUIEditorCore.prototype.addInitEvent = function () {
22339
+ var _this = this;
22076
22340
  this.on('needChangeMode', this.changeMode.bind(this));
22341
+ this.on('loadUI', function () {
22342
+ if (_this.height !== 'auto') {
22343
+ // 75px equals default editor ui height - the editing area height
22344
+ var minHeight = Math.min(parseInt(_this.minHeight, 10), parseInt(_this.height, 10) - 75) + "px";
22345
+ _this.setMinHeight(minHeight);
22346
+ }
22347
+ });
22077
22348
  addDefaultImageBlobHook(this.eventEmitter);
22078
22349
  };
22079
22350
  ToastUIEditorCore.prototype.addInitCommand = function (mdCommands, wwCommands) {
@@ -22257,7 +22528,12 @@ var ToastUIEditorCore = /** @class */ (function () {
22257
22528
  _this.wwEditor.setModel(wwNode);
22258
22529
  }
22259
22530
  });
22260
- return this.wwEditor.view.dom.innerHTML;
22531
+ var html = this.wwEditor.view.dom.innerHTML;
22532
+ if (this.placeholder) {
22533
+ var rePlaceholder = new RegExp("<span class=\"placeholder[^>]+>" + this.placeholder + "</span>", 'i');
22534
+ return html.replace(rePlaceholder, '');
22535
+ }
22536
+ return html;
22261
22537
  };
22262
22538
  /**
22263
22539
  * Insert text
@@ -22345,12 +22621,11 @@ var ToastUIEditorCore = /** @class */ (function () {
22345
22621
  if (isString_1(height)) {
22346
22622
  if (height === 'auto') {
22347
22623
  addClass_1(el, 'auto-height');
22348
- this.setMinHeight(this.getMinHeight());
22349
22624
  }
22350
22625
  else {
22351
22626
  removeClass_1(el, 'auto-height');
22352
- this.setMinHeight(height);
22353
22627
  }
22628
+ this.setMinHeight(this.getMinHeight());
22354
22629
  }
22355
22630
  css_1(el, { height: height });
22356
22631
  this.height = height;
@@ -22367,16 +22642,18 @@ var ToastUIEditorCore = /** @class */ (function () {
22367
22642
  * @param {string} minHeight - min content height in pixel
22368
22643
  */
22369
22644
  ToastUIEditorCore.prototype.setMinHeight = function (minHeight) {
22370
- var _a;
22371
- this.minHeight = minHeight;
22372
- var editorHeight = this.options.el.clientHeight;
22373
- var editorSectionHeight = ((_a = document.querySelector("." + cls('main'))) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
22374
- var diffHeight = editorHeight - editorSectionHeight;
22375
- var minHeightNum = parseInt(minHeight, 10);
22376
- minHeightNum = Math.max(minHeightNum - diffHeight, 0);
22377
- this.wwEditor.setMinHeight(minHeightNum);
22378
- this.mdEditor.setMinHeight(minHeightNum);
22379
- this.preview.setMinHeight(minHeightNum);
22645
+ if (minHeight !== this.minHeight) {
22646
+ var height = this.height || this.options.height;
22647
+ if (height !== 'auto' && this.options.el.querySelector("." + cls('main'))) {
22648
+ // 75px equals default editor ui height - the editing area height
22649
+ minHeight = Math.min(parseInt(minHeight, 10), parseInt(height, 10) - 75) + "px";
22650
+ }
22651
+ var minHeightNum = parseInt(minHeight, 10);
22652
+ this.minHeight = minHeight;
22653
+ this.wwEditor.setMinHeight(minHeightNum);
22654
+ this.mdEditor.setMinHeight(minHeightNum);
22655
+ this.preview.setMinHeight(minHeightNum);
22656
+ }
22380
22657
  };
22381
22658
  /**
22382
22659
  * Get minimum height of editor content
@@ -22512,6 +22789,7 @@ var ToastUIEditorCore = /** @class */ (function () {
22512
22789
  * @param {string} placeholder - placeholder to set
22513
22790
  */
22514
22791
  ToastUIEditorCore.prototype.setPlaceholder = function (placeholder) {
22792
+ this.placeholder = placeholder;
22515
22793
  this.mdEditor.setPlaceholder(placeholder);
22516
22794
  this.wwEditor.setPlaceholder(placeholder);
22517
22795
  };
@@ -24425,6 +24703,10 @@ var CustomPopupBody = /** @class */ (function (_super) {
24425
24703
  // append the custom popup body element
24426
24704
  this.refs.el.appendChild(this.props.body);
24427
24705
  };
24706
+ CustomPopupBody.prototype.updated = function (prevProps) {
24707
+ // update custom popup element
24708
+ this.refs.el.replaceChild(this.props.body, prevProps.body);
24709
+ };
24428
24710
  CustomPopupBody.prototype.render = function () {
24429
24711
  var _this = this;
24430
24712
  return html(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["<div ref=", "></div>"], ["<div ref=", "></div>"])), function (el) { return (_this.refs.el = el); });
@@ -24593,6 +24875,7 @@ function createDefaultToolbarItemInfo(type) {
24593
24875
  className: 'indent',
24594
24876
  command: 'indent',
24595
24877
  tooltip: i18n.get('Indent'),
24878
+ state: 'indent',
24596
24879
  };
24597
24880
  break;
24598
24881
  case 'outdent':
@@ -24601,6 +24884,7 @@ function createDefaultToolbarItemInfo(type) {
24601
24884
  className: 'outdent',
24602
24885
  command: 'outdent',
24603
24886
  tooltip: i18n.get('Outdent'),
24887
+ state: 'outdent',
24604
24888
  };
24605
24889
  break;
24606
24890
  case 'scrollSync':
@@ -24751,7 +25035,7 @@ function connectHOC(WrappedComponent) {
24751
25035
  _this.hideTooltip = function () {
24752
25036
  css_1(_this.props.tooltipRef.current, 'display', 'none');
24753
25037
  };
24754
- _this.state = { active: false };
25038
+ _this.state = { active: false, disabled: props.disabled };
24755
25039
  _this.addEvent();
24756
25040
  return _this;
24757
25041
  }
@@ -24760,9 +25044,10 @@ function connectHOC(WrappedComponent) {
24760
25044
  var _a = this.props, item = _a.item, eventEmitter = _a.eventEmitter;
24761
25045
  if (item.state) {
24762
25046
  eventEmitter.listen('changeToolbarState', function (_a) {
25047
+ var _b;
24763
25048
  var toolbarState = _a.toolbarState;
24764
- var active = !!toolbarState[item.state];
24765
- _this.setState({ active: active });
25049
+ var _c = (_b = toolbarState[item.state]) !== null && _b !== void 0 ? _b : {}, active = _c.active, disabled = _c.disabled;
25050
+ _this.setState({ active: !!active, disabled: disabled !== null && disabled !== void 0 ? disabled : _this.props.disabled });
24766
25051
  });
24767
25052
  }
24768
25053
  };
@@ -24771,7 +25056,7 @@ function connectHOC(WrappedComponent) {
24771
25056
  return { left: offsetLeft, top: el.offsetHeight + offsetTop };
24772
25057
  };
24773
25058
  ButtonHOC.prototype.render = function () {
24774
- return html(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n />\n "], ["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n />\n "])), WrappedComponent, this.props, this.state.active, this.showTooltip, this.hideTooltip, this.getBound);
25059
+ return html(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n disabled=", "\n />\n "], ["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n disabled=", "\n />\n "])), WrappedComponent, this.props, this.state.active, this.showTooltip, this.hideTooltip, this.getBound, this.state.disabled || this.props.disabled);
24775
25060
  };
24776
25061
  return ButtonHOC;
24777
25062
  }(Component));
@@ -24787,17 +25072,19 @@ var ToolbarButtonComp = /** @class */ (function (_super) {
24787
25072
  _this.props.showTooltip(_this.refs.el);
24788
25073
  };
24789
25074
  _this.execCommand = function () {
24790
- var _a = _this.props, item = _a.item, execCommand = _a.execCommand, setPopupInfo = _a.setPopupInfo, getBound = _a.getBound;
25075
+ var _a = _this.props, item = _a.item, execCommand = _a.execCommand, setPopupInfo = _a.setPopupInfo, getBound = _a.getBound, eventEmitter = _a.eventEmitter;
24791
25076
  var command = item.command, name = item.name, popup = item.popup;
24792
25077
  if (command) {
24793
25078
  execCommand(command);
24794
25079
  }
24795
25080
  else {
24796
25081
  var popupName = popup ? 'customPopupBody' : name;
25082
+ var initialValues = eventEmitter.emit('query', 'getPopupInitialValues', { popupName: popupName })[0];
24797
25083
  var info = createPopupInfo(popupName, {
24798
25084
  el: _this.refs.el,
24799
25085
  pos: getBound(_this.refs.el),
24800
25086
  popup: popup,
25087
+ initialValues: initialValues,
24801
25088
  });
24802
25089
  if (info) {
24803
25090
  setPopupInfo(info);
@@ -24980,7 +25267,7 @@ var Toolbar = /** @class */ (function (_super) {
24980
25267
  };
24981
25268
  _this.openPopup = function (popupName, initialValues) {
24982
25269
  if (initialValues === void 0) { initialValues = {}; }
24983
- var el = document.querySelector("." + cls('toolbar-group') + " ." + popupName);
25270
+ var el = _this.refs.el.querySelector("." + cls('toolbar-group') + " ." + popupName);
24984
25271
  if (el) {
24985
25272
  var _a = getTotalOffset(el, closest(el, "." + cls('toolbar'))), offsetLeft = _a.offsetLeft, offsetTop = _a.offsetTop;
24986
25273
  var info = createPopupInfo(popupName, {
@@ -25128,7 +25415,7 @@ var Toolbar = /** @class */ (function (_super) {
25128
25415
  };
25129
25416
  Toolbar.prototype.mounted = function () {
25130
25417
  if (this.props.previewStyle === 'tab') {
25131
- this.props.eventEmitter.emit('changePreviewTabWrite');
25418
+ this.props.eventEmitter.emit('changePreviewTabWrite', true);
25132
25419
  }
25133
25420
  // classify toolbar and dropdown toolbar after DOM has been rendered
25134
25421
  this.setState(this.classifyToolbarItems());
@@ -25323,6 +25610,7 @@ var ToastUIEditor = /** @class */ (function (_super) {
25323
25610
  var groupIndex = toolbarItem.groupIndex, itemIndex = toolbarItem.itemIndex, item = toolbarItem.item;
25324
25611
  _this.defaultUI.insertToolbarItem({ groupIndex: groupIndex, itemIndex: itemIndex }, item);
25325
25612
  });
25613
+ _this.eventEmitter.emit('loadUI', _this);
25326
25614
  return _this;
25327
25615
  }
25328
25616
  /**
@@ -25361,7 +25649,7 @@ var templateObject_1;
25361
25649
 
25362
25650
  /**
25363
25651
  * @fileoverview I18N for English
25364
- * @author NHN FE Development Lab <dl_javascript@nhn.com>
25652
+ * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
25365
25653
  */
25366
25654
  ToastUIEditorCore.setLanguage(['en', 'en-US'], {
25367
25655
  Markdown: 'Markdown',
@@ -25414,5 +25702,4 @@ ToastUIEditorCore.setLanguage(['en', 'en-US'], {
25414
25702
  'Choose language': 'Choose language',
25415
25703
  });
25416
25704
 
25417
- export default ToastUIEditor;
25418
- export { ToastUIEditor as Editor, ToastUIEditorCore as EditorCore };
25705
+ export { ToastUIEditor as Editor, ToastUIEditorCore as EditorCore, ToastUIEditor as default };