@toast-ui/editor 3.1.2 → 3.1.3
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.
- package/dist/esm/i18n/ar.js +1 -1
- package/dist/esm/i18n/cs-cz.js +1 -1
- package/dist/esm/i18n/de-de.js +1 -1
- package/dist/esm/i18n/en-us.js +1 -1
- package/dist/esm/i18n/es-es.js +1 -1
- package/dist/esm/i18n/fi-fi.js +1 -1
- package/dist/esm/i18n/fr-fr.js +1 -1
- package/dist/esm/i18n/gl-es.js +1 -1
- package/dist/esm/i18n/hr-hr.js +1 -1
- package/dist/esm/i18n/i18n.js +2 -3
- package/dist/esm/i18n/it-it.js +1 -1
- package/dist/esm/i18n/ja-jp.js +1 -1
- package/dist/esm/i18n/ko-kr.js +1 -1
- package/dist/esm/i18n/nb-no.js +1 -1
- package/dist/esm/i18n/nl-nl.js +1 -1
- package/dist/esm/i18n/pl-pl.js +1 -1
- package/dist/esm/i18n/pt-br.js +1 -1
- package/dist/esm/i18n/ru-ru.js +1 -1
- package/dist/esm/i18n/sv-se.js +1 -1
- package/dist/esm/i18n/tr-tr.js +1 -1
- package/dist/esm/i18n/uk-ua.js +1 -1
- package/dist/esm/i18n/zh-cn.js +1 -1
- package/dist/esm/i18n/zh-tw.js +1 -1
- package/dist/esm/index.js +924 -714
- package/dist/esm/indexViewer.js +11 -11
- package/dist/i18n/ar.js +5 -5
- package/dist/i18n/cs-cz.js +5 -5
- package/dist/i18n/de-de.js +5 -5
- package/dist/i18n/es-es.js +5 -5
- package/dist/i18n/fi-fi.js +5 -5
- package/dist/i18n/fr-fr.js +5 -5
- package/dist/i18n/gl-es.js +5 -5
- package/dist/i18n/hr-hr.js +5 -5
- package/dist/i18n/it-it.js +5 -5
- package/dist/i18n/ja-jp.js +5 -5
- package/dist/i18n/ko-kr.js +5 -5
- package/dist/i18n/nb-no.js +5 -5
- package/dist/i18n/nl-nl.js +5 -5
- package/dist/i18n/pl-pl.js +5 -5
- package/dist/i18n/pt-br.js +5 -5
- package/dist/i18n/ru-ru.js +5 -5
- package/dist/i18n/sv-se.js +5 -5
- package/dist/i18n/tr-tr.js +5 -5
- package/dist/i18n/uk-ua.js +5 -5
- package/dist/i18n/zh-cn.js +5 -5
- package/dist/i18n/zh-tw.js +5 -5
- package/dist/toastui-editor-only.css +1 -1
- package/dist/toastui-editor-viewer.css +6 -6
- package/dist/toastui-editor-viewer.js +39 -32
- package/dist/toastui-editor.css +6 -6
- package/dist/toastui-editor.js +755 -541
- package/package.json +2 -2
- package/types/event.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/spec.d.ts +1 -1
- package/types/ui.d.ts +22 -20
- package/types/wysiwyg.d.ts +2 -1
package/dist/toastui-editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @toast-ui/editor
|
|
3
|
-
* @version 3.1.
|
|
3
|
+
* @version 3.1.3 | Thu Feb 10 2022
|
|
4
4
|
* @author NHN FE Development Lab <dl_javascript@nhn.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
exports["toastui"] = factory(require("prosemirror-commands"), require("prosemirror-history"), require("prosemirror-inputrules"), require("prosemirror-keymap"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-transform"), require("prosemirror-view"));
|
|
14
14
|
else
|
|
15
15
|
root["toastui"] = root["toastui"] || {}, root["toastui"]["Editor"] = factory(root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined]);
|
|
16
|
-
})(self, function(
|
|
16
|
+
})(self, function(__WEBPACK_EXTERNAL_MODULE__695__, __WEBPACK_EXTERNAL_MODULE__412__, __WEBPACK_EXTERNAL_MODULE__479__, __WEBPACK_EXTERNAL_MODULE__481__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__814__, __WEBPACK_EXTERNAL_MODULE__785__, __WEBPACK_EXTERNAL_MODULE__311__) {
|
|
17
17
|
return /******/ (function() { // webpackBootstrap
|
|
18
18
|
/******/ var __webpack_modules__ = ({
|
|
19
19
|
|
|
@@ -2961,67 +2961,67 @@ module.exports = isUndefined;
|
|
|
2961
2961
|
|
|
2962
2962
|
/***/ }),
|
|
2963
2963
|
|
|
2964
|
-
/***/
|
|
2964
|
+
/***/ 695:
|
|
2965
2965
|
/***/ (function(module) {
|
|
2966
2966
|
|
|
2967
2967
|
"use strict";
|
|
2968
|
-
module.exports =
|
|
2968
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__695__;
|
|
2969
2969
|
|
|
2970
2970
|
/***/ }),
|
|
2971
2971
|
|
|
2972
|
-
/***/
|
|
2972
|
+
/***/ 412:
|
|
2973
2973
|
/***/ (function(module) {
|
|
2974
2974
|
|
|
2975
2975
|
"use strict";
|
|
2976
|
-
module.exports =
|
|
2976
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__412__;
|
|
2977
2977
|
|
|
2978
2978
|
/***/ }),
|
|
2979
2979
|
|
|
2980
|
-
/***/
|
|
2980
|
+
/***/ 479:
|
|
2981
2981
|
/***/ (function(module) {
|
|
2982
2982
|
|
|
2983
2983
|
"use strict";
|
|
2984
|
-
module.exports =
|
|
2984
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__479__;
|
|
2985
2985
|
|
|
2986
2986
|
/***/ }),
|
|
2987
2987
|
|
|
2988
|
-
/***/
|
|
2988
|
+
/***/ 481:
|
|
2989
2989
|
/***/ (function(module) {
|
|
2990
2990
|
|
|
2991
2991
|
"use strict";
|
|
2992
|
-
module.exports =
|
|
2992
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__481__;
|
|
2993
2993
|
|
|
2994
2994
|
/***/ }),
|
|
2995
2995
|
|
|
2996
|
-
/***/
|
|
2996
|
+
/***/ 43:
|
|
2997
2997
|
/***/ (function(module) {
|
|
2998
2998
|
|
|
2999
2999
|
"use strict";
|
|
3000
|
-
module.exports =
|
|
3000
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__43__;
|
|
3001
3001
|
|
|
3002
3002
|
/***/ }),
|
|
3003
3003
|
|
|
3004
|
-
/***/
|
|
3004
|
+
/***/ 814:
|
|
3005
3005
|
/***/ (function(module) {
|
|
3006
3006
|
|
|
3007
3007
|
"use strict";
|
|
3008
|
-
module.exports =
|
|
3008
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__814__;
|
|
3009
3009
|
|
|
3010
3010
|
/***/ }),
|
|
3011
3011
|
|
|
3012
|
-
/***/
|
|
3012
|
+
/***/ 785:
|
|
3013
3013
|
/***/ (function(module) {
|
|
3014
3014
|
|
|
3015
3015
|
"use strict";
|
|
3016
|
-
module.exports =
|
|
3016
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__785__;
|
|
3017
3017
|
|
|
3018
3018
|
/***/ }),
|
|
3019
3019
|
|
|
3020
|
-
/***/
|
|
3020
|
+
/***/ 311:
|
|
3021
3021
|
/***/ (function(module) {
|
|
3022
3022
|
|
|
3023
3023
|
"use strict";
|
|
3024
|
-
module.exports =
|
|
3024
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__311__;
|
|
3025
3025
|
|
|
3026
3026
|
/***/ })
|
|
3027
3027
|
|
|
@@ -3348,7 +3348,7 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
|
3348
3348
|
}
|
|
3349
3349
|
|
|
3350
3350
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-model","commonjs2":"prosemirror-model","amd":"prosemirror-model"}
|
|
3351
|
-
var external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_ = __webpack_require__(
|
|
3351
|
+
var external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_ = __webpack_require__(43);
|
|
3352
3352
|
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/collection/forEachOwnProperties.js
|
|
3353
3353
|
var forEachOwnProperties = __webpack_require__(956);
|
|
3354
3354
|
var forEachOwnProperties_default = /*#__PURE__*/__webpack_require__.n(forEachOwnProperties);
|
|
@@ -3391,6 +3391,8 @@ var reEscapeChars = /[>(){}[\]+-.!#|]/g;
|
|
|
3391
3391
|
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;
|
|
3392
3392
|
var reEscapeBackSlash = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g;
|
|
3393
3393
|
var reEscapePairedChars = /[*_~`]/g;
|
|
3394
|
+
var reMdImageSyntax = /!\[.*\]\(.*\)/g;
|
|
3395
|
+
var reEscapedCharInLinkSyntax = /[[\]]/g; //
|
|
3394
3396
|
var XMLSPECIAL = '[&<>"]';
|
|
3395
3397
|
var reXmlSpecial = new RegExp(XMLSPECIAL, 'g');
|
|
3396
3398
|
function replaceUnsafeChar(char) {
|
|
@@ -3462,6 +3464,18 @@ function isNeedEscapeText(text) {
|
|
|
3462
3464
|
});
|
|
3463
3465
|
return needEscape;
|
|
3464
3466
|
}
|
|
3467
|
+
function escapeTextForLink(text) {
|
|
3468
|
+
var imageSyntaxRanges = [];
|
|
3469
|
+
var result = reMdImageSyntax.exec(text);
|
|
3470
|
+
while (result) {
|
|
3471
|
+
imageSyntaxRanges.push([result.index, result.index + result[0].length]);
|
|
3472
|
+
result = reMdImageSyntax.exec(text);
|
|
3473
|
+
}
|
|
3474
|
+
return text.replace(reEscapedCharInLinkSyntax, function (matched, offset) {
|
|
3475
|
+
var isDelimiter = imageSyntaxRanges.some(function (range) { return offset > range[0] && offset < range[1]; });
|
|
3476
|
+
return isDelimiter ? matched : "\\" + matched;
|
|
3477
|
+
});
|
|
3478
|
+
}
|
|
3465
3479
|
function common_escape(text) {
|
|
3466
3480
|
var replacer = function (matched) { return "\\" + matched; };
|
|
3467
3481
|
var escapedText = text.replace(reSpaceMoreThanOne, ' ');
|
|
@@ -3585,19 +3599,22 @@ function getSortedNumPair(valueA, valueB) {
|
|
|
3585
3599
|
}
|
|
3586
3600
|
|
|
3587
3601
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-view","commonjs2":"prosemirror-view","amd":"prosemirror-view"}
|
|
3588
|
-
var external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_ = __webpack_require__(
|
|
3602
|
+
var external_commonjs_prosemirror_view_commonjs2_prosemirror_view_amd_prosemirror_view_ = __webpack_require__(311);
|
|
3589
3603
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-transform","commonjs2":"prosemirror-transform","amd":"prosemirror-transform"}
|
|
3590
|
-
var external_commonjs_prosemirror_transform_commonjs2_prosemirror_transform_amd_prosemirror_transform_ = __webpack_require__(
|
|
3604
|
+
var external_commonjs_prosemirror_transform_commonjs2_prosemirror_transform_amd_prosemirror_transform_ = __webpack_require__(785);
|
|
3605
|
+
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/collection/toArray.js
|
|
3606
|
+
var collection_toArray = __webpack_require__(990);
|
|
3607
|
+
var toArray_default = /*#__PURE__*/__webpack_require__.n(collection_toArray);
|
|
3591
3608
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-state","commonjs2":"prosemirror-state","amd":"prosemirror-state"}
|
|
3592
|
-
var external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_ = __webpack_require__(
|
|
3609
|
+
var external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_ = __webpack_require__(814);
|
|
3593
3610
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-keymap","commonjs2":"prosemirror-keymap","amd":"prosemirror-keymap"}
|
|
3594
|
-
var external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_ = __webpack_require__(
|
|
3611
|
+
var external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_ = __webpack_require__(481);
|
|
3595
3612
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-commands","commonjs2":"prosemirror-commands","amd":"prosemirror-commands"}
|
|
3596
|
-
var external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_ = __webpack_require__(
|
|
3613
|
+
var external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_ = __webpack_require__(695);
|
|
3597
3614
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-inputrules","commonjs2":"prosemirror-inputrules","amd":"prosemirror-inputrules"}
|
|
3598
|
-
var external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_ = __webpack_require__(
|
|
3615
|
+
var external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_ = __webpack_require__(479);
|
|
3599
3616
|
// EXTERNAL MODULE: external {"commonjs":"prosemirror-history","commonjs2":"prosemirror-history","amd":"prosemirror-history"}
|
|
3600
|
-
var external_commonjs_prosemirror_history_commonjs2_prosemirror_history_amd_prosemirror_history_ = __webpack_require__(
|
|
3617
|
+
var external_commonjs_prosemirror_history_commonjs2_prosemirror_history_amd_prosemirror_history_ = __webpack_require__(412);
|
|
3601
3618
|
;// CONCATENATED MODULE: ./src/helper/manipulation.ts
|
|
3602
3619
|
|
|
3603
3620
|
|
|
@@ -3956,22 +3973,275 @@ function placeholder(options) {
|
|
|
3956
3973
|
});
|
|
3957
3974
|
}
|
|
3958
3975
|
|
|
3976
|
+
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/type/isArray.js
|
|
3977
|
+
var isArray = __webpack_require__(322);
|
|
3978
|
+
var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
|
|
3979
|
+
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/domUtil/hasClass.js
|
|
3980
|
+
var hasClass = __webpack_require__(714);
|
|
3981
|
+
var hasClass_default = /*#__PURE__*/__webpack_require__.n(hasClass);
|
|
3982
|
+
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/domUtil/matches.js
|
|
3983
|
+
var matches = __webpack_require__(471);
|
|
3984
|
+
var matches_default = /*#__PURE__*/__webpack_require__.n(matches);
|
|
3985
|
+
;// CONCATENATED MODULE: ./src/utils/constants.ts
|
|
3986
|
+
var TAG_NAME = '[A-Za-z][A-Za-z0-9-]*';
|
|
3987
|
+
var ATTRIBUTE_NAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
3988
|
+
var UNQUOTED_VALUE = '[^"\'=<>`\\x00-\\x20]+';
|
|
3989
|
+
var SINGLE_QUOTED_VALUE = "'[^']*'";
|
|
3990
|
+
var DOUBLE_QUOTED_VALUE = '"[^"]*"';
|
|
3991
|
+
var ATTRIBUTE_VALUE = "(?:" + UNQUOTED_VALUE + "|" + SINGLE_QUOTED_VALUE + "|" + DOUBLE_QUOTED_VALUE + ")";
|
|
3992
|
+
var ATTRIBUTE_VALUE_SPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTE_VALUE + ")";
|
|
3993
|
+
var ATTRIBUTE = "" + '(?:\\s+' + ATTRIBUTE_NAME + ATTRIBUTE_VALUE_SPEC + "?)";
|
|
3994
|
+
var OPEN_TAG = "<(" + TAG_NAME + ")(" + ATTRIBUTE + ")*\\s*/?>";
|
|
3995
|
+
var CLOSE_TAG = "</(" + TAG_NAME + ")\\s*[>]";
|
|
3996
|
+
var HTML_TAG = "(?:" + OPEN_TAG + "|" + CLOSE_TAG + ")";
|
|
3997
|
+
var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
|
|
3998
|
+
var reBR = /<br\s*\/*>/i;
|
|
3999
|
+
var reHTMLComment = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
|
|
4000
|
+
var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
|
|
4001
|
+
|
|
4002
|
+
;// CONCATENATED MODULE: ./src/utils/dom.ts
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
|
|
4006
|
+
|
|
4007
|
+
|
|
4008
|
+
|
|
4009
|
+
|
|
4010
|
+
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
function isPositionInBox(style, offsetX, offsetY) {
|
|
4014
|
+
var left = parseInt(style.left, 10);
|
|
4015
|
+
var top = parseInt(style.top, 10);
|
|
4016
|
+
var width = parseInt(style.width, 10) + parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
|
|
4017
|
+
var height = parseInt(style.height, 10) + parseInt(style.paddingTop, 10) + parseInt(style.paddingBottom, 10);
|
|
4018
|
+
return offsetX >= left && offsetX <= left + width && offsetY >= top && offsetY <= top + height;
|
|
4019
|
+
}
|
|
4020
|
+
var CLS_PREFIX = 'toastui-editor-';
|
|
4021
|
+
function cls() {
|
|
4022
|
+
var names = [];
|
|
4023
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4024
|
+
names[_i] = arguments[_i];
|
|
4025
|
+
}
|
|
4026
|
+
var result = [];
|
|
4027
|
+
for (var _a = 0, names_1 = names; _a < names_1.length; _a++) {
|
|
4028
|
+
var name = names_1[_a];
|
|
4029
|
+
var className = void 0;
|
|
4030
|
+
if (Array.isArray(name)) {
|
|
4031
|
+
className = name[0] ? name[1] : null;
|
|
4032
|
+
}
|
|
4033
|
+
else {
|
|
4034
|
+
className = name;
|
|
4035
|
+
}
|
|
4036
|
+
if (className) {
|
|
4037
|
+
result.push("" + CLS_PREFIX + className);
|
|
4038
|
+
}
|
|
4039
|
+
}
|
|
4040
|
+
return result.join(' ');
|
|
4041
|
+
}
|
|
4042
|
+
function clsWithMdPrefix() {
|
|
4043
|
+
var names = [];
|
|
4044
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4045
|
+
names[_i] = arguments[_i];
|
|
4046
|
+
}
|
|
4047
|
+
return names.map(function (className) { return CLS_PREFIX + "md-" + className; }).join(' ');
|
|
4048
|
+
}
|
|
4049
|
+
function isTextNode(node) {
|
|
4050
|
+
return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.TEXT_NODE;
|
|
4051
|
+
}
|
|
4052
|
+
function isElemNode(node) {
|
|
4053
|
+
return node && node.nodeType === Node.ELEMENT_NODE;
|
|
4054
|
+
}
|
|
4055
|
+
function findNodes(element, selector) {
|
|
4056
|
+
var nodeList = toArray_default()(element.querySelectorAll(selector));
|
|
4057
|
+
if (nodeList.length) {
|
|
4058
|
+
return nodeList;
|
|
4059
|
+
}
|
|
4060
|
+
return [];
|
|
4061
|
+
}
|
|
4062
|
+
function appendNodes(node, nodesToAppend) {
|
|
4063
|
+
nodesToAppend = isArray_default()(nodesToAppend) ? toArray_default()(nodesToAppend) : [nodesToAppend];
|
|
4064
|
+
nodesToAppend.forEach(function (nodeToAppend) {
|
|
4065
|
+
node.appendChild(nodeToAppend);
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
function insertBeforeNode(insertedNode, node) {
|
|
4069
|
+
if (node.parentNode) {
|
|
4070
|
+
node.parentNode.insertBefore(insertedNode, node);
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
function removeNode(node) {
|
|
4074
|
+
if (node.parentNode) {
|
|
4075
|
+
node.parentNode.removeChild(node);
|
|
4076
|
+
}
|
|
4077
|
+
}
|
|
4078
|
+
function unwrapNode(node) {
|
|
4079
|
+
var result = [];
|
|
4080
|
+
while (node.firstChild) {
|
|
4081
|
+
result.push(node.firstChild);
|
|
4082
|
+
if (node.parentNode) {
|
|
4083
|
+
node.parentNode.insertBefore(node.firstChild, node);
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
removeNode(node);
|
|
4087
|
+
return result;
|
|
4088
|
+
}
|
|
4089
|
+
function toggleClass(element, className, state) {
|
|
4090
|
+
if (isUndefined_default()(state)) {
|
|
4091
|
+
state = !hasClass_default()(element, className);
|
|
4092
|
+
}
|
|
4093
|
+
var toggleFn = state ? (addClass_default()) : (removeClass_default());
|
|
4094
|
+
toggleFn(element, className);
|
|
4095
|
+
}
|
|
4096
|
+
function createElementWith(contents, target) {
|
|
4097
|
+
var container = document.createElement('div');
|
|
4098
|
+
if (isString_default()(contents)) {
|
|
4099
|
+
container.innerHTML = contents;
|
|
4100
|
+
}
|
|
4101
|
+
else {
|
|
4102
|
+
container.appendChild(contents);
|
|
4103
|
+
}
|
|
4104
|
+
var firstChild = container.firstChild;
|
|
4105
|
+
if (target) {
|
|
4106
|
+
target.appendChild(firstChild);
|
|
4107
|
+
}
|
|
4108
|
+
return firstChild;
|
|
4109
|
+
}
|
|
4110
|
+
function getOuterWidth(el) {
|
|
4111
|
+
var computed = window.getComputedStyle(el);
|
|
4112
|
+
return (['margin-left', 'margin-right'].reduce(function (acc, type) { return acc + parseInt(computed.getPropertyValue(type), 10); }, 0) + el.offsetWidth);
|
|
4113
|
+
}
|
|
4114
|
+
function closest(node, found) {
|
|
4115
|
+
var condition;
|
|
4116
|
+
if (isString_default()(found)) {
|
|
4117
|
+
condition = function (target) { return matches_default()(target, found); };
|
|
4118
|
+
}
|
|
4119
|
+
else {
|
|
4120
|
+
condition = function (target) { return target === found; };
|
|
4121
|
+
}
|
|
4122
|
+
while (node && node !== document) {
|
|
4123
|
+
if (isElemNode(node) && condition(node)) {
|
|
4124
|
+
return node;
|
|
4125
|
+
}
|
|
4126
|
+
node = node.parentNode;
|
|
4127
|
+
}
|
|
4128
|
+
return null;
|
|
4129
|
+
}
|
|
4130
|
+
function getTotalOffset(el, root) {
|
|
4131
|
+
var offsetTop = 0;
|
|
4132
|
+
var offsetLeft = 0;
|
|
4133
|
+
while (el && el !== root) {
|
|
4134
|
+
var top = el.offsetTop, left = el.offsetLeft, offsetParent = el.offsetParent;
|
|
4135
|
+
offsetTop += top;
|
|
4136
|
+
offsetLeft += left;
|
|
4137
|
+
if (offsetParent === root.offsetParent) {
|
|
4138
|
+
break;
|
|
4139
|
+
}
|
|
4140
|
+
el = el.offsetParent;
|
|
4141
|
+
}
|
|
4142
|
+
return { offsetTop: offsetTop, offsetLeft: offsetLeft };
|
|
4143
|
+
}
|
|
4144
|
+
function finalizeHtml(html, needHtmlText) {
|
|
4145
|
+
var result;
|
|
4146
|
+
if (needHtmlText) {
|
|
4147
|
+
result = html.innerHTML;
|
|
4148
|
+
}
|
|
4149
|
+
else {
|
|
4150
|
+
var frag = document.createDocumentFragment();
|
|
4151
|
+
var childNodes = toArray(html.childNodes);
|
|
4152
|
+
var length = childNodes.length;
|
|
4153
|
+
for (var i = 0; i < length; i += 1) {
|
|
4154
|
+
frag.appendChild(childNodes[i]);
|
|
4155
|
+
}
|
|
4156
|
+
result = frag;
|
|
4157
|
+
}
|
|
4158
|
+
return result;
|
|
4159
|
+
}
|
|
4160
|
+
function empty(node) {
|
|
4161
|
+
while (node.firstChild) {
|
|
4162
|
+
node.removeChild(node.firstChild);
|
|
4163
|
+
}
|
|
4164
|
+
}
|
|
4165
|
+
function appendNode(node, appended) {
|
|
4166
|
+
if (isString(appended)) {
|
|
4167
|
+
node.insertAdjacentHTML('beforeend', appended);
|
|
4168
|
+
}
|
|
4169
|
+
else {
|
|
4170
|
+
var nodes = appended.length
|
|
4171
|
+
? toArray(appended)
|
|
4172
|
+
: [appended];
|
|
4173
|
+
for (var i = 0, len = nodes.length; i < len; i += 1) {
|
|
4174
|
+
node.appendChild(nodes[i]);
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
function prependNode(node, appended) {
|
|
4179
|
+
if (isString(appended)) {
|
|
4180
|
+
node.insertAdjacentHTML('afterbegin', appended);
|
|
4181
|
+
}
|
|
4182
|
+
else {
|
|
4183
|
+
var nodes = appended.length
|
|
4184
|
+
? toArray(appended)
|
|
4185
|
+
: [appended];
|
|
4186
|
+
for (var i = nodes.length - 1, len = 0; i >= len; i -= 1) {
|
|
4187
|
+
node.insertBefore(nodes[i], node.firstChild);
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
function setAttributes(attributes, element) {
|
|
4192
|
+
Object.keys(attributes).forEach(function (attrName) {
|
|
4193
|
+
if (isNil(attributes[attrName])) {
|
|
4194
|
+
element.removeAttribute(attrName);
|
|
4195
|
+
}
|
|
4196
|
+
else {
|
|
4197
|
+
element.setAttribute(attrName, attributes[attrName]);
|
|
4198
|
+
}
|
|
4199
|
+
});
|
|
4200
|
+
}
|
|
4201
|
+
function replaceBRWithEmptyBlock(html) {
|
|
4202
|
+
// remove br in paragraph to compatible with markdown
|
|
4203
|
+
var replacedHTML = html.replace(/<p><br\s*\/*><\/p>/gi, '<p></p>');
|
|
4204
|
+
var reHTMLTag = new RegExp(HTML_TAG, 'ig');
|
|
4205
|
+
var htmlTagMatched = replacedHTML.match(reHTMLTag);
|
|
4206
|
+
htmlTagMatched === null || htmlTagMatched === void 0 ? void 0 : htmlTagMatched.forEach(function (htmlTag, index) {
|
|
4207
|
+
if (reBR.test(htmlTag)) {
|
|
4208
|
+
var alternativeTag = ALTERNATIVE_TAG_FOR_BR;
|
|
4209
|
+
if (index) {
|
|
4210
|
+
var prevTag = htmlTagMatched[index - 1];
|
|
4211
|
+
var openTagMatched = prevTag.match(OPEN_TAG);
|
|
4212
|
+
if (openTagMatched && !/br/i.test(openTagMatched[1])) {
|
|
4213
|
+
var tagName = openTagMatched[1];
|
|
4214
|
+
alternativeTag = "</" + tagName + "><" + tagName + ">";
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
replacedHTML = replacedHTML.replace(reBR, alternativeTag);
|
|
4218
|
+
}
|
|
4219
|
+
});
|
|
4220
|
+
return replacedHTML;
|
|
4221
|
+
}
|
|
4222
|
+
|
|
3959
4223
|
;// CONCATENATED MODULE: ./src/plugins/popupWidget.ts
|
|
3960
4224
|
|
|
3961
4225
|
|
|
4226
|
+
|
|
3962
4227
|
var pluginKey = new external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.PluginKey('widget');
|
|
4228
|
+
var MARGIN = 5;
|
|
3963
4229
|
var PopupWidget = /** @class */ (function () {
|
|
3964
|
-
function PopupWidget(eventEmitter) {
|
|
4230
|
+
function PopupWidget(view, eventEmitter) {
|
|
3965
4231
|
var _this = this;
|
|
3966
4232
|
this.popup = null;
|
|
3967
4233
|
this.removeWidget = function () {
|
|
3968
4234
|
if (_this.popup) {
|
|
3969
|
-
|
|
4235
|
+
_this.rootEl.removeChild(_this.popup);
|
|
3970
4236
|
_this.popup = null;
|
|
3971
4237
|
}
|
|
3972
4238
|
};
|
|
4239
|
+
this.rootEl = view.dom.parentElement;
|
|
3973
4240
|
this.eventEmitter = eventEmitter;
|
|
3974
4241
|
this.eventEmitter.listen('blur', this.removeWidget);
|
|
4242
|
+
this.eventEmitter.listen('loadUI', function () {
|
|
4243
|
+
_this.rootEl = closest(view.dom.parentElement, "." + cls('defaultUI'));
|
|
4244
|
+
});
|
|
3975
4245
|
this.eventEmitter.listen('removePopupWidget', this.removeWidget);
|
|
3976
4246
|
}
|
|
3977
4247
|
PopupWidget.prototype.update = function (view) {
|
|
@@ -3981,10 +4251,14 @@ var PopupWidget = /** @class */ (function () {
|
|
|
3981
4251
|
var node = widget.node, style = widget.style;
|
|
3982
4252
|
var _a = view.coordsAtPos(widget.pos), top = _a.top, left = _a.left, bottom = _a.bottom;
|
|
3983
4253
|
var height = bottom - top;
|
|
3984
|
-
|
|
3985
|
-
|
|
4254
|
+
var rect = this.rootEl.getBoundingClientRect();
|
|
4255
|
+
var relTopPos = top - rect.top;
|
|
4256
|
+
css_default()(node, { opacity: '0' });
|
|
4257
|
+
this.rootEl.appendChild(node);
|
|
3986
4258
|
css_default()(node, {
|
|
3987
|
-
|
|
4259
|
+
position: 'absolute',
|
|
4260
|
+
left: left - rect.left + MARGIN + "px",
|
|
4261
|
+
top: (style === 'bottom' ? relTopPos + height - MARGIN : relTopPos - height) + "px",
|
|
3988
4262
|
opacity: '1',
|
|
3989
4263
|
});
|
|
3990
4264
|
this.popup = node;
|
|
@@ -4007,8 +4281,8 @@ function addWidget(eventEmitter) {
|
|
|
4007
4281
|
return tr.getMeta('widget');
|
|
4008
4282
|
},
|
|
4009
4283
|
},
|
|
4010
|
-
view: function () {
|
|
4011
|
-
return new PopupWidget(eventEmitter);
|
|
4284
|
+
view: function (editorView) {
|
|
4285
|
+
return new PopupWidget(editorView, eventEmitter);
|
|
4012
4286
|
},
|
|
4013
4287
|
});
|
|
4014
4288
|
}
|
|
@@ -4016,9 +4290,6 @@ function addWidget(eventEmitter) {
|
|
|
4016
4290
|
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/collection/forEachArray.js
|
|
4017
4291
|
var forEachArray = __webpack_require__(893);
|
|
4018
4292
|
var forEachArray_default = /*#__PURE__*/__webpack_require__.n(forEachArray);
|
|
4019
|
-
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/collection/toArray.js
|
|
4020
|
-
var collection_toArray = __webpack_require__(990);
|
|
4021
|
-
var toArray_default = /*#__PURE__*/__webpack_require__.n(collection_toArray);
|
|
4022
4293
|
;// CONCATENATED MODULE: ./src/helper/image.ts
|
|
4023
4294
|
|
|
4024
4295
|
function addDefaultImageBlobHook(eventEmitter) {
|
|
@@ -4180,6 +4451,7 @@ var Widget = /** @class */ (function (_super) {
|
|
|
4180
4451
|
|
|
4181
4452
|
var EditorBase = /** @class */ (function () {
|
|
4182
4453
|
function EditorBase(eventEmitter) {
|
|
4454
|
+
this.timer = null;
|
|
4183
4455
|
this.el = document.createElement('div');
|
|
4184
4456
|
this.el.className = 'toastui-editor';
|
|
4185
4457
|
this.eventEmitter = eventEmitter;
|
|
@@ -4204,10 +4476,9 @@ var EditorBase = /** @class */ (function () {
|
|
|
4204
4476
|
};
|
|
4205
4477
|
Object.defineProperty(EditorBase.prototype, "defaultPlugins", {
|
|
4206
4478
|
get: function () {
|
|
4207
|
-
var _a = getDefaultCommands(), undo = _a.undo, redo = _a.redo;
|
|
4208
4479
|
var rules = this.createInputRules();
|
|
4209
4480
|
var plugins = __spreadArray(__spreadArray([], this.keymaps), [
|
|
4210
|
-
(0,external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap)(__assign({ '
|
|
4481
|
+
(0,external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap)(__assign({ 'Shift-Enter': external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_.baseKeymap.Enter }, external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_.baseKeymap)),
|
|
4211
4482
|
(0,external_commonjs_prosemirror_history_commonjs2_prosemirror_history_amd_prosemirror_history_.history)(),
|
|
4212
4483
|
placeholder(this.placeholder),
|
|
4213
4484
|
addWidget(this.eventEmitter),
|
|
@@ -4244,6 +4515,12 @@ var EditorBase = /** @class */ (function () {
|
|
|
4244
4515
|
});
|
|
4245
4516
|
return rules.length ? (0,external_commonjs_prosemirror_inputrules_commonjs2_prosemirror_inputrules_amd_prosemirror_inputrules_.inputRules)({ rules: rules }) : null;
|
|
4246
4517
|
};
|
|
4518
|
+
EditorBase.prototype.clearTimer = function () {
|
|
4519
|
+
if (this.timer) {
|
|
4520
|
+
clearTimeout(this.timer);
|
|
4521
|
+
this.timer = null;
|
|
4522
|
+
}
|
|
4523
|
+
};
|
|
4247
4524
|
EditorBase.prototype.createSchema = function () {
|
|
4248
4525
|
return new external_commonjs_prosemirror_model_commonjs2_prosemirror_model_amd_prosemirror_model_.Schema({
|
|
4249
4526
|
nodes: this.specs.nodes,
|
|
@@ -4251,7 +4528,13 @@ var EditorBase = /** @class */ (function () {
|
|
|
4251
4528
|
});
|
|
4252
4529
|
};
|
|
4253
4530
|
EditorBase.prototype.createKeymaps = function (useCommandShortcut) {
|
|
4254
|
-
|
|
4531
|
+
var _a = getDefaultCommands(), undo = _a.undo, redo = _a.redo;
|
|
4532
|
+
var allKeymaps = this.specs.keymaps(useCommandShortcut);
|
|
4533
|
+
var historyKeymap = {
|
|
4534
|
+
'Mod-z': undo(),
|
|
4535
|
+
'Shift-Mod-z': redo(),
|
|
4536
|
+
};
|
|
4537
|
+
return useCommandShortcut ? allKeymaps.concat((0,external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap)(historyKeymap)) : allKeymaps;
|
|
4255
4538
|
};
|
|
4256
4539
|
EditorBase.prototype.createCommands = function () {
|
|
4257
4540
|
return this.specs.commands(this.view);
|
|
@@ -4262,8 +4545,9 @@ var EditorBase = /** @class */ (function () {
|
|
|
4262
4545
|
};
|
|
4263
4546
|
EditorBase.prototype.focus = function () {
|
|
4264
4547
|
var _this = this;
|
|
4548
|
+
this.clearTimer();
|
|
4265
4549
|
// prevent the error for IE11
|
|
4266
|
-
setTimeout(function () {
|
|
4550
|
+
this.timer = setTimeout(function () {
|
|
4267
4551
|
_this.view.focus();
|
|
4268
4552
|
_this.view.dispatch(_this.view.state.tr.scrollIntoView());
|
|
4269
4553
|
});
|
|
@@ -4273,6 +4557,7 @@ var EditorBase = /** @class */ (function () {
|
|
|
4273
4557
|
};
|
|
4274
4558
|
EditorBase.prototype.destroy = function () {
|
|
4275
4559
|
var _this = this;
|
|
4560
|
+
this.clearTimer();
|
|
4276
4561
|
this.view.destroy();
|
|
4277
4562
|
Object.keys(this).forEach(function (prop) {
|
|
4278
4563
|
delete _this[prop];
|
|
@@ -4323,6 +4608,26 @@ var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction);
|
|
|
4323
4608
|
|
|
4324
4609
|
|
|
4325
4610
|
|
|
4611
|
+
|
|
4612
|
+
var defaultCommandShortcuts = [
|
|
4613
|
+
'Enter',
|
|
4614
|
+
'Shift-Enter',
|
|
4615
|
+
'Mod-Enter',
|
|
4616
|
+
'Tab',
|
|
4617
|
+
'Shift-Tab',
|
|
4618
|
+
'Delete',
|
|
4619
|
+
'Backspace',
|
|
4620
|
+
'Mod-Delete',
|
|
4621
|
+
'Mod-Backspace',
|
|
4622
|
+
'ArrowUp',
|
|
4623
|
+
'ArrowDown',
|
|
4624
|
+
'ArrowLeft',
|
|
4625
|
+
'ArrowRight',
|
|
4626
|
+
'Mod-d',
|
|
4627
|
+
'Mod-D',
|
|
4628
|
+
'Alt-ArrowUp',
|
|
4629
|
+
'Alt-ArrowDown',
|
|
4630
|
+
];
|
|
4326
4631
|
function execCommand(view, command, payload) {
|
|
4327
4632
|
view.focus();
|
|
4328
4633
|
return command(payload)(view.state, view.dispatch, view);
|
|
@@ -4334,317 +4639,80 @@ var SpecManager = /** @class */ (function () {
|
|
|
4334
4639
|
Object.defineProperty(SpecManager.prototype, "nodes", {
|
|
4335
4640
|
get: function () {
|
|
4336
4641
|
return this.specs
|
|
4337
|
-
.filter(function (spec) { return spec.type === 'node'; })
|
|
4338
|
-
.reduce(function (nodes, _a) {
|
|
4339
|
-
var _b;
|
|
4340
|
-
var name = _a.name, schema = _a.schema;
|
|
4341
|
-
return __assign(__assign({}, nodes), (_b = {}, _b[name] = schema, _b));
|
|
4342
|
-
}, {});
|
|
4343
|
-
},
|
|
4344
|
-
enumerable: false,
|
|
4345
|
-
configurable: true
|
|
4346
|
-
});
|
|
4347
|
-
Object.defineProperty(SpecManager.prototype, "marks", {
|
|
4348
|
-
get: function () {
|
|
4349
|
-
return this.specs
|
|
4350
|
-
.filter(function (spec) { return spec.type === 'mark'; })
|
|
4351
|
-
.reduce(function (marks, _a) {
|
|
4352
|
-
var _b;
|
|
4353
|
-
var name = _a.name, schema = _a.schema;
|
|
4354
|
-
return __assign(__assign({}, marks), (_b = {}, _b[name] = schema, _b));
|
|
4355
|
-
}, {});
|
|
4356
|
-
},
|
|
4357
|
-
enumerable: false,
|
|
4358
|
-
configurable: true
|
|
4359
|
-
});
|
|
4360
|
-
SpecManager.prototype.commands = function (view, addedCommands) {
|
|
4361
|
-
var specCommands = this.specs
|
|
4362
|
-
.filter(function (_a) {
|
|
4363
|
-
var commands = _a.commands;
|
|
4364
|
-
return commands;
|
|
4365
|
-
})
|
|
4366
|
-
.reduce(function (allCommands, spec) {
|
|
4367
|
-
var commands = {};
|
|
4368
|
-
var specCommand = spec.commands();
|
|
4369
|
-
if (isFunction_default()(specCommand)) {
|
|
4370
|
-
commands[spec.name] = function (payload) { return execCommand(view, specCommand, payload); };
|
|
4371
|
-
}
|
|
4372
|
-
else {
|
|
4373
|
-
Object.keys(specCommand).forEach(function (name) {
|
|
4374
|
-
commands[name] = function (payload) { return execCommand(view, specCommand[name], payload); };
|
|
4375
|
-
});
|
|
4376
|
-
}
|
|
4377
|
-
return __assign(__assign({}, allCommands), commands);
|
|
4378
|
-
}, {});
|
|
4379
|
-
var defaultCommands = getDefaultCommands();
|
|
4380
|
-
Object.keys(defaultCommands).forEach(function (name) {
|
|
4381
|
-
specCommands[name] = function (payload) { return execCommand(view, defaultCommands[name], payload); };
|
|
4382
|
-
});
|
|
4383
|
-
if (addedCommands) {
|
|
4384
|
-
Object.keys(addedCommands).forEach(function (name) {
|
|
4385
|
-
specCommands[name] = function (payload) { return execCommand(view, addedCommands[name], payload); };
|
|
4386
|
-
});
|
|
4387
|
-
}
|
|
4388
|
-
return specCommands;
|
|
4389
|
-
};
|
|
4390
|
-
SpecManager.prototype.keymaps = function () {
|
|
4391
|
-
var specKeymaps = this.specs.filter(function (spec) { return spec.keymaps; }).map(function (spec) { return spec.keymaps(); });
|
|
4392
|
-
return specKeymaps.map(function (keys) { return (0,external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap)(keys); });
|
|
4393
|
-
};
|
|
4394
|
-
SpecManager.prototype.setContext = function (context) {
|
|
4395
|
-
this.specs.forEach(function (spec) {
|
|
4396
|
-
spec.setContext(context);
|
|
4397
|
-
});
|
|
4398
|
-
};
|
|
4399
|
-
return SpecManager;
|
|
4400
|
-
}());
|
|
4401
|
-
/* harmony default export */ var specManager = (SpecManager);
|
|
4402
|
-
|
|
4403
|
-
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/type/isArray.js
|
|
4404
|
-
var isArray = __webpack_require__(322);
|
|
4405
|
-
var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
|
|
4406
|
-
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/domUtil/hasClass.js
|
|
4407
|
-
var hasClass = __webpack_require__(714);
|
|
4408
|
-
var hasClass_default = /*#__PURE__*/__webpack_require__.n(hasClass);
|
|
4409
|
-
// EXTERNAL MODULE: ../../node_modules/tui-code-snippet/domUtil/matches.js
|
|
4410
|
-
var matches = __webpack_require__(471);
|
|
4411
|
-
var matches_default = /*#__PURE__*/__webpack_require__.n(matches);
|
|
4412
|
-
;// CONCATENATED MODULE: ./src/utils/constants.ts
|
|
4413
|
-
var TAG_NAME = '[A-Za-z][A-Za-z0-9-]*';
|
|
4414
|
-
var ATTRIBUTE_NAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
4415
|
-
var UNQUOTED_VALUE = '[^"\'=<>`\\x00-\\x20]+';
|
|
4416
|
-
var SINGLE_QUOTED_VALUE = "'[^']*'";
|
|
4417
|
-
var DOUBLE_QUOTED_VALUE = '"[^"]*"';
|
|
4418
|
-
var ATTRIBUTE_VALUE = "(?:" + UNQUOTED_VALUE + "|" + SINGLE_QUOTED_VALUE + "|" + DOUBLE_QUOTED_VALUE + ")";
|
|
4419
|
-
var ATTRIBUTE_VALUE_SPEC = "" + '(?:\\s*=\\s*' + ATTRIBUTE_VALUE + ")";
|
|
4420
|
-
var ATTRIBUTE = "" + '(?:\\s+' + ATTRIBUTE_NAME + ATTRIBUTE_VALUE_SPEC + "?)";
|
|
4421
|
-
var OPEN_TAG = "<(" + TAG_NAME + ")(" + ATTRIBUTE + ")*\\s*/?>";
|
|
4422
|
-
var CLOSE_TAG = "</(" + TAG_NAME + ")\\s*[>]";
|
|
4423
|
-
var HTML_TAG = "(?:" + OPEN_TAG + "|" + CLOSE_TAG + ")";
|
|
4424
|
-
var reHTMLTag = new RegExp("^" + HTML_TAG, 'i');
|
|
4425
|
-
var reBR = /<br\s*\/*>/i;
|
|
4426
|
-
var ALTERNATIVE_TAG_FOR_BR = '</p><p>';
|
|
4427
|
-
|
|
4428
|
-
;// CONCATENATED MODULE: ./src/utils/dom.ts
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
function isPositionInBox(style, offsetX, offsetY) {
|
|
4440
|
-
var left = parseInt(style.left, 10);
|
|
4441
|
-
var top = parseInt(style.top, 10);
|
|
4442
|
-
var width = parseInt(style.width, 10) + parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
|
|
4443
|
-
var height = parseInt(style.height, 10) + parseInt(style.paddingTop, 10) + parseInt(style.paddingBottom, 10);
|
|
4444
|
-
return offsetX >= left && offsetX <= left + width && offsetY >= top && offsetY <= top + height;
|
|
4445
|
-
}
|
|
4446
|
-
var CLS_PREFIX = 'toastui-editor-';
|
|
4447
|
-
function cls() {
|
|
4448
|
-
var names = [];
|
|
4449
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4450
|
-
names[_i] = arguments[_i];
|
|
4451
|
-
}
|
|
4452
|
-
var result = [];
|
|
4453
|
-
for (var _a = 0, names_1 = names; _a < names_1.length; _a++) {
|
|
4454
|
-
var name = names_1[_a];
|
|
4455
|
-
var className = void 0;
|
|
4456
|
-
if (Array.isArray(name)) {
|
|
4457
|
-
className = name[0] ? name[1] : null;
|
|
4458
|
-
}
|
|
4459
|
-
else {
|
|
4460
|
-
className = name;
|
|
4461
|
-
}
|
|
4462
|
-
if (className) {
|
|
4463
|
-
result.push("" + CLS_PREFIX + className);
|
|
4464
|
-
}
|
|
4465
|
-
}
|
|
4466
|
-
return result.join(' ');
|
|
4467
|
-
}
|
|
4468
|
-
function clsWithMdPrefix() {
|
|
4469
|
-
var names = [];
|
|
4470
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4471
|
-
names[_i] = arguments[_i];
|
|
4472
|
-
}
|
|
4473
|
-
return names.map(function (className) { return CLS_PREFIX + "md-" + className; }).join(' ');
|
|
4474
|
-
}
|
|
4475
|
-
function isTextNode(node) {
|
|
4476
|
-
return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.TEXT_NODE;
|
|
4477
|
-
}
|
|
4478
|
-
function isElemNode(node) {
|
|
4479
|
-
return node && node.nodeType === Node.ELEMENT_NODE;
|
|
4480
|
-
}
|
|
4481
|
-
function findNodes(element, selector) {
|
|
4482
|
-
var nodeList = toArray_default()(element.querySelectorAll(selector));
|
|
4483
|
-
if (nodeList.length) {
|
|
4484
|
-
return nodeList;
|
|
4485
|
-
}
|
|
4486
|
-
return [];
|
|
4487
|
-
}
|
|
4488
|
-
function appendNodes(node, nodesToAppend) {
|
|
4489
|
-
nodesToAppend = isArray_default()(nodesToAppend) ? toArray_default()(nodesToAppend) : [nodesToAppend];
|
|
4490
|
-
nodesToAppend.forEach(function (nodeToAppend) {
|
|
4491
|
-
node.appendChild(nodeToAppend);
|
|
4492
|
-
});
|
|
4493
|
-
}
|
|
4494
|
-
function insertBeforeNode(insertedNode, node) {
|
|
4495
|
-
if (node.parentNode) {
|
|
4496
|
-
node.parentNode.insertBefore(insertedNode, node);
|
|
4497
|
-
}
|
|
4498
|
-
}
|
|
4499
|
-
function removeNode(node) {
|
|
4500
|
-
if (node.parentNode) {
|
|
4501
|
-
node.parentNode.removeChild(node);
|
|
4502
|
-
}
|
|
4503
|
-
}
|
|
4504
|
-
function unwrapNode(node) {
|
|
4505
|
-
var result = [];
|
|
4506
|
-
while (node.firstChild) {
|
|
4507
|
-
result.push(node.firstChild);
|
|
4508
|
-
if (node.parentNode) {
|
|
4509
|
-
node.parentNode.insertBefore(node.firstChild, node);
|
|
4510
|
-
}
|
|
4511
|
-
}
|
|
4512
|
-
removeNode(node);
|
|
4513
|
-
return result;
|
|
4514
|
-
}
|
|
4515
|
-
function toggleClass(element, className, state) {
|
|
4516
|
-
if (isUndefined_default()(state)) {
|
|
4517
|
-
state = !hasClass_default()(element, className);
|
|
4518
|
-
}
|
|
4519
|
-
var toggleFn = state ? (addClass_default()) : (removeClass_default());
|
|
4520
|
-
toggleFn(element, className);
|
|
4521
|
-
}
|
|
4522
|
-
function createElementWith(contents, target) {
|
|
4523
|
-
var container = document.createElement('div');
|
|
4524
|
-
if (isString_default()(contents)) {
|
|
4525
|
-
container.innerHTML = contents;
|
|
4526
|
-
}
|
|
4527
|
-
else {
|
|
4528
|
-
container.appendChild(contents);
|
|
4529
|
-
}
|
|
4530
|
-
var firstChild = container.firstChild;
|
|
4531
|
-
if (target) {
|
|
4532
|
-
target.appendChild(firstChild);
|
|
4533
|
-
}
|
|
4534
|
-
return firstChild;
|
|
4535
|
-
}
|
|
4536
|
-
function getOuterWidth(el) {
|
|
4537
|
-
var computed = window.getComputedStyle(el);
|
|
4538
|
-
return (['margin-left', 'margin-right'].reduce(function (acc, type) { return acc + parseInt(computed.getPropertyValue(type), 10); }, 0) + el.offsetWidth);
|
|
4539
|
-
}
|
|
4540
|
-
function closest(node, found) {
|
|
4541
|
-
var condition;
|
|
4542
|
-
if (isString_default()(found)) {
|
|
4543
|
-
condition = function (target) { return matches_default()(target, found); };
|
|
4544
|
-
}
|
|
4545
|
-
else {
|
|
4546
|
-
condition = function (target) { return target === found; };
|
|
4547
|
-
}
|
|
4548
|
-
while (node && node !== document) {
|
|
4549
|
-
if (isElemNode(node) && condition(node)) {
|
|
4550
|
-
return node;
|
|
4551
|
-
}
|
|
4552
|
-
node = node.parentNode;
|
|
4553
|
-
}
|
|
4554
|
-
return null;
|
|
4555
|
-
}
|
|
4556
|
-
function getTotalOffset(el, root) {
|
|
4557
|
-
var offsetTop = 0;
|
|
4558
|
-
var offsetLeft = 0;
|
|
4559
|
-
while (el && el !== root) {
|
|
4560
|
-
var top = el.offsetTop, left = el.offsetLeft, offsetParent = el.offsetParent;
|
|
4561
|
-
offsetTop += top;
|
|
4562
|
-
offsetLeft += left;
|
|
4563
|
-
if (offsetParent === root.offsetParent) {
|
|
4564
|
-
break;
|
|
4565
|
-
}
|
|
4566
|
-
el = el.offsetParent;
|
|
4567
|
-
}
|
|
4568
|
-
return { offsetTop: offsetTop, offsetLeft: offsetLeft };
|
|
4569
|
-
}
|
|
4570
|
-
function finalizeHtml(html, needHtmlText) {
|
|
4571
|
-
var result;
|
|
4572
|
-
if (needHtmlText) {
|
|
4573
|
-
result = html.innerHTML;
|
|
4574
|
-
}
|
|
4575
|
-
else {
|
|
4576
|
-
var frag = document.createDocumentFragment();
|
|
4577
|
-
var childNodes = toArray(html.childNodes);
|
|
4578
|
-
var length = childNodes.length;
|
|
4579
|
-
for (var i = 0; i < length; i += 1) {
|
|
4580
|
-
frag.appendChild(childNodes[i]);
|
|
4581
|
-
}
|
|
4582
|
-
result = frag;
|
|
4583
|
-
}
|
|
4584
|
-
return result;
|
|
4585
|
-
}
|
|
4586
|
-
function empty(node) {
|
|
4587
|
-
while (node.firstChild) {
|
|
4588
|
-
node.removeChild(node.firstChild);
|
|
4589
|
-
}
|
|
4590
|
-
}
|
|
4591
|
-
function appendNode(node, appended) {
|
|
4592
|
-
if (isString(appended)) {
|
|
4593
|
-
node.insertAdjacentHTML('beforeend', appended);
|
|
4594
|
-
}
|
|
4595
|
-
else {
|
|
4596
|
-
var nodes = appended.length
|
|
4597
|
-
? toArray(appended)
|
|
4598
|
-
: [appended];
|
|
4599
|
-
for (var i = 0, len = nodes.length; i < len; i += 1) {
|
|
4600
|
-
node.appendChild(nodes[i]);
|
|
4601
|
-
}
|
|
4602
|
-
}
|
|
4603
|
-
}
|
|
4604
|
-
function prependNode(node, appended) {
|
|
4605
|
-
if (isString(appended)) {
|
|
4606
|
-
node.insertAdjacentHTML('afterbegin', appended);
|
|
4607
|
-
}
|
|
4608
|
-
else {
|
|
4609
|
-
var nodes = appended.length
|
|
4610
|
-
? toArray(appended)
|
|
4611
|
-
: [appended];
|
|
4612
|
-
for (var i = nodes.length - 1, len = 0; i >= len; i -= 1) {
|
|
4613
|
-
node.insertBefore(nodes[i], node.firstChild);
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
function setAttributes(attributes, element) {
|
|
4618
|
-
Object.keys(attributes).forEach(function (attrName) {
|
|
4619
|
-
if (isNil(attributes[attrName])) {
|
|
4620
|
-
element.removeAttribute(attrName);
|
|
4621
|
-
}
|
|
4622
|
-
else {
|
|
4623
|
-
element.setAttribute(attrName, attributes[attrName]);
|
|
4624
|
-
}
|
|
4642
|
+
.filter(function (spec) { return spec.type === 'node'; })
|
|
4643
|
+
.reduce(function (nodes, _a) {
|
|
4644
|
+
var _b;
|
|
4645
|
+
var name = _a.name, schema = _a.schema;
|
|
4646
|
+
return __assign(__assign({}, nodes), (_b = {}, _b[name] = schema, _b));
|
|
4647
|
+
}, {});
|
|
4648
|
+
},
|
|
4649
|
+
enumerable: false,
|
|
4650
|
+
configurable: true
|
|
4625
4651
|
});
|
|
4626
|
-
|
|
4627
|
-
function
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4652
|
+
Object.defineProperty(SpecManager.prototype, "marks", {
|
|
4653
|
+
get: function () {
|
|
4654
|
+
return this.specs
|
|
4655
|
+
.filter(function (spec) { return spec.type === 'mark'; })
|
|
4656
|
+
.reduce(function (marks, _a) {
|
|
4657
|
+
var _b;
|
|
4658
|
+
var name = _a.name, schema = _a.schema;
|
|
4659
|
+
return __assign(__assign({}, marks), (_b = {}, _b[name] = schema, _b));
|
|
4660
|
+
}, {});
|
|
4661
|
+
},
|
|
4662
|
+
enumerable: false,
|
|
4663
|
+
configurable: true
|
|
4664
|
+
});
|
|
4665
|
+
SpecManager.prototype.commands = function (view, addedCommands) {
|
|
4666
|
+
var specCommands = this.specs
|
|
4667
|
+
.filter(function (_a) {
|
|
4668
|
+
var commands = _a.commands;
|
|
4669
|
+
return commands;
|
|
4670
|
+
})
|
|
4671
|
+
.reduce(function (allCommands, spec) {
|
|
4672
|
+
var commands = {};
|
|
4673
|
+
var specCommand = spec.commands();
|
|
4674
|
+
if (isFunction_default()(specCommand)) {
|
|
4675
|
+
commands[spec.name] = function (payload) { return execCommand(view, specCommand, payload); };
|
|
4642
4676
|
}
|
|
4643
|
-
|
|
4677
|
+
else {
|
|
4678
|
+
Object.keys(specCommand).forEach(function (name) {
|
|
4679
|
+
commands[name] = function (payload) { return execCommand(view, specCommand[name], payload); };
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4682
|
+
return __assign(__assign({}, allCommands), commands);
|
|
4683
|
+
}, {});
|
|
4684
|
+
var defaultCommands = getDefaultCommands();
|
|
4685
|
+
Object.keys(defaultCommands).forEach(function (name) {
|
|
4686
|
+
specCommands[name] = function (payload) { return execCommand(view, defaultCommands[name], payload); };
|
|
4687
|
+
});
|
|
4688
|
+
if (addedCommands) {
|
|
4689
|
+
Object.keys(addedCommands).forEach(function (name) {
|
|
4690
|
+
specCommands[name] = function (payload) { return execCommand(view, addedCommands[name], payload); };
|
|
4691
|
+
});
|
|
4644
4692
|
}
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4693
|
+
return specCommands;
|
|
4694
|
+
};
|
|
4695
|
+
SpecManager.prototype.keymaps = function (useCommandShortcut) {
|
|
4696
|
+
var specKeymaps = this.specs.filter(function (spec) { return spec.keymaps; }).map(function (spec) { return spec.keymaps(); });
|
|
4697
|
+
return specKeymaps.map(function (keys) {
|
|
4698
|
+
if (!useCommandShortcut) {
|
|
4699
|
+
Object.keys(keys).forEach(function (key) {
|
|
4700
|
+
if (!common_includes(defaultCommandShortcuts, key)) {
|
|
4701
|
+
delete keys[key];
|
|
4702
|
+
}
|
|
4703
|
+
});
|
|
4704
|
+
}
|
|
4705
|
+
return (0,external_commonjs_prosemirror_keymap_commonjs2_prosemirror_keymap_amd_prosemirror_keymap_.keymap)(keys);
|
|
4706
|
+
});
|
|
4707
|
+
};
|
|
4708
|
+
SpecManager.prototype.setContext = function (context) {
|
|
4709
|
+
this.specs.forEach(function (spec) {
|
|
4710
|
+
spec.setContext(context);
|
|
4711
|
+
});
|
|
4712
|
+
};
|
|
4713
|
+
return SpecManager;
|
|
4714
|
+
}());
|
|
4715
|
+
/* harmony default export */ var specManager = (SpecManager);
|
|
4648
4716
|
|
|
4649
4717
|
;// CONCATENATED MODULE: ./src/markdown/helper/pos.ts
|
|
4650
4718
|
|
|
@@ -5121,34 +5189,61 @@ function getMarkForAdding(node, toastMark) {
|
|
|
5121
5189
|
;// CONCATENATED MODULE: ./src/markdown/plugins/previewHighlight.ts
|
|
5122
5190
|
|
|
5123
5191
|
|
|
5192
|
+
|
|
5193
|
+
var defaultToolbarStateKeys = [
|
|
5194
|
+
'taskList',
|
|
5195
|
+
'orderedList',
|
|
5196
|
+
'bulletList',
|
|
5197
|
+
'table',
|
|
5198
|
+
'strong',
|
|
5199
|
+
'emph',
|
|
5200
|
+
'strike',
|
|
5201
|
+
'heading',
|
|
5202
|
+
'thematicBreak',
|
|
5203
|
+
'blockQuote',
|
|
5204
|
+
'code',
|
|
5205
|
+
'codeBlock',
|
|
5206
|
+
'indent',
|
|
5207
|
+
'outdent',
|
|
5208
|
+
];
|
|
5124
5209
|
function getToolbarStateType(mdNode) {
|
|
5210
|
+
var type = mdNode.type;
|
|
5125
5211
|
if (isListNode(mdNode)) {
|
|
5126
5212
|
if (mdNode.listData.task) {
|
|
5127
5213
|
return 'taskList';
|
|
5128
5214
|
}
|
|
5129
5215
|
return mdNode.listData.type === 'ordered' ? 'orderedList' : 'bulletList';
|
|
5130
5216
|
}
|
|
5131
|
-
if (
|
|
5217
|
+
if (type.indexOf('table') !== -1) {
|
|
5132
5218
|
return 'table';
|
|
5133
5219
|
}
|
|
5134
|
-
|
|
5220
|
+
if (!common_includes(defaultToolbarStateKeys, type)) {
|
|
5221
|
+
return null;
|
|
5222
|
+
}
|
|
5223
|
+
return type;
|
|
5135
5224
|
}
|
|
5136
5225
|
function getToolbarState(targetNode) {
|
|
5137
|
-
var toolbarState = {
|
|
5226
|
+
var toolbarState = {
|
|
5227
|
+
indent: { active: false, disabled: true },
|
|
5228
|
+
outdent: { active: false, disabled: true },
|
|
5229
|
+
};
|
|
5138
5230
|
var listEnabled = true;
|
|
5139
5231
|
traverseParentNodes(targetNode, function (mdNode) {
|
|
5140
5232
|
var type = getToolbarStateType(mdNode);
|
|
5141
|
-
if (type
|
|
5233
|
+
if (!type) {
|
|
5142
5234
|
return;
|
|
5143
5235
|
}
|
|
5144
5236
|
if (type === 'bulletList' || type === 'orderedList') {
|
|
5237
|
+
// to apply the nearlist list state in the nested list
|
|
5145
5238
|
if (listEnabled) {
|
|
5146
|
-
toolbarState[type] = true;
|
|
5239
|
+
toolbarState[type] = { active: true };
|
|
5240
|
+
toolbarState.indent.disabled = false;
|
|
5241
|
+
toolbarState.outdent.disabled = false;
|
|
5147
5242
|
listEnabled = false;
|
|
5148
5243
|
}
|
|
5149
5244
|
}
|
|
5150
5245
|
else {
|
|
5151
|
-
toolbarState[type] = true;
|
|
5246
|
+
toolbarState[type] = { active: true };
|
|
5152
5247
|
}
|
|
5153
5248
|
});
|
|
5154
5249
|
return toolbarState;
|
|
@@ -6616,57 +6711,6 @@ var Code = /** @class */ (function (_super) {
|
|
|
6616
6711
|
}(mark));
|
|
6617
6712
|
|
|
6618
6713
|
|
|
6619
|
-
;// CONCATENATED MODULE: ./src/utils/encoder.ts
|
|
6620
|
-
var encoderList = [
|
|
6621
|
-
{
|
|
6622
|
-
regExp: /\(/g,
|
|
6623
|
-
encoded: '%28',
|
|
6624
|
-
escaped: '\\(',
|
|
6625
|
-
},
|
|
6626
|
-
{
|
|
6627
|
-
regExp: /\)/g,
|
|
6628
|
-
encoded: '%29',
|
|
6629
|
-
escaped: '\\)',
|
|
6630
|
-
},
|
|
6631
|
-
{
|
|
6632
|
-
regExp: /\[/g,
|
|
6633
|
-
encoded: '%5B',
|
|
6634
|
-
escaped: '\\[',
|
|
6635
|
-
},
|
|
6636
|
-
{
|
|
6637
|
-
regExp: /\]/g,
|
|
6638
|
-
encoded: '%5D',
|
|
6639
|
-
escaped: '\\]',
|
|
6640
|
-
},
|
|
6641
|
-
{
|
|
6642
|
-
regExp: /</g,
|
|
6643
|
-
encoded: '%3C',
|
|
6644
|
-
escaped: '\\<',
|
|
6645
|
-
},
|
|
6646
|
-
{
|
|
6647
|
-
regExp: />/g,
|
|
6648
|
-
encoded: '%3E',
|
|
6649
|
-
escaped: '\\>',
|
|
6650
|
-
},
|
|
6651
|
-
{
|
|
6652
|
-
regExp: / /g,
|
|
6653
|
-
encoded: '%20',
|
|
6654
|
-
escaped: ' ',
|
|
6655
|
-
},
|
|
6656
|
-
];
|
|
6657
|
-
function escapeMarkdownText(text) {
|
|
6658
|
-
return encoderList.reduce(function (result, _a) {
|
|
6659
|
-
var regExp = _a.regExp, escaped = _a.escaped;
|
|
6660
|
-
return result.replace(regExp, escaped);
|
|
6661
|
-
}, text);
|
|
6662
|
-
}
|
|
6663
|
-
function encodeMarkdownText(text) {
|
|
6664
|
-
return encoderList.reduce(function (result, _a) {
|
|
6665
|
-
var regExp = _a.regExp, encoded = _a.encoded;
|
|
6666
|
-
return result.replace(regExp, encoded);
|
|
6667
|
-
}, text);
|
|
6668
|
-
}
|
|
6669
|
-
|
|
6670
6714
|
;// CONCATENATED MODULE: ./src/markdown/marks/link.ts
|
|
6671
6715
|
|
|
6672
6716
|
|
|
@@ -6723,8 +6767,7 @@ var Link = /** @class */ (function (_super) {
|
|
|
6723
6767
|
url = imageUrl;
|
|
6724
6768
|
syntax = '!';
|
|
6725
6769
|
}
|
|
6726
|
-
text =
|
|
6727
|
-
url = encodeMarkdownText(url);
|
|
6770
|
+
text = escapeTextForLink(text);
|
|
6728
6771
|
syntax += "[" + text + "](" + url + ")";
|
|
6729
6772
|
dispatch(tr.replaceWith(from, to, createTextNode(schema, syntax)));
|
|
6730
6773
|
return true;
|
|
@@ -6910,6 +6953,9 @@ var Html = /** @class */ (function (_super) {
|
|
|
6910
6953
|
|
|
6911
6954
|
|
|
6912
6955
|
|
|
6956
|
+
|
|
6957
|
+
|
|
6958
|
+
var customBlockSyntax = '$$';
|
|
6913
6959
|
var CustomBlock = /** @class */ (function (_super) {
|
|
6914
6960
|
__extends(CustomBlock, _super);
|
|
6915
6961
|
function CustomBlock() {
|
|
@@ -6933,6 +6979,22 @@ var CustomBlock = /** @class */ (function (_super) {
|
|
|
6933
6979
|
enumerable: false,
|
|
6934
6980
|
configurable: true
|
|
6935
6981
|
});
|
|
6982
|
+
CustomBlock.prototype.commands = function () {
|
|
6983
|
+
return function (payload) { return function (state, dispatch) {
|
|
6984
|
+
var selection = state.selection, schema = state.schema, tr = state.tr;
|
|
6985
|
+
var _a = getRangeInfo(selection), startFromOffset = _a.startFromOffset, endToOffset = _a.endToOffset;
|
|
6986
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.info)) {
|
|
6987
|
+
return false;
|
|
6988
|
+
}
|
|
6989
|
+
var customBlock = "" + customBlockSyntax + payload.info;
|
|
6990
|
+
var startNode = createTextNode(schema, customBlock);
|
|
6991
|
+
var endNode = createTextNode(schema, customBlockSyntax);
|
|
6992
|
+
tr.insert(startFromOffset, startNode).split(startFromOffset + customBlock.length);
|
|
6993
|
+
tr.split(tr.mapping.map(endToOffset)).insert(tr.mapping.map(endToOffset), endNode);
|
|
6994
|
+
dispatch(tr.setSelection(createTextSelection(tr, tr.mapping.map(endToOffset) - (customBlockSyntax.length + 2))));
|
|
6995
|
+
return true;
|
|
6996
|
+
}; };
|
|
6997
|
+
};
|
|
6936
6998
|
return CustomBlock;
|
|
6937
6999
|
}(mark));
|
|
6938
7000
|
|
|
@@ -7017,6 +7079,7 @@ function smartTask(_a) {
|
|
|
7017
7079
|
|
|
7018
7080
|
|
|
7019
7081
|
|
|
7082
|
+
|
|
7020
7083
|
|
|
7021
7084
|
|
|
7022
7085
|
var EVENT_TYPE = 'cut';
|
|
@@ -7065,10 +7128,14 @@ var MdEditor = /** @class */ (function (_super) {
|
|
|
7065
7128
|
var clipboardData = ev.clipboardData || window.clipboardData;
|
|
7066
7129
|
var items = clipboardData && clipboardData.items;
|
|
7067
7130
|
if (items) {
|
|
7068
|
-
var
|
|
7069
|
-
if
|
|
7070
|
-
|
|
7071
|
-
|
|
7131
|
+
var containRtfItem = toArray_default()(items).some(function (item) { return item.kind === 'string' && item.type === 'text/rtf'; });
|
|
7132
|
+
// if it contains rtf, it's most likely copy paste from office -> no image
|
|
7133
|
+
if (!containRtfItem) {
|
|
7134
|
+
var imageBlob = pasteImageOnly(items);
|
|
7135
|
+
if (imageBlob) {
|
|
7136
|
+
ev.preventDefault();
|
|
7137
|
+
emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
|
|
7138
|
+
}
|
|
7072
7139
|
}
|
|
7073
7140
|
}
|
|
7074
7141
|
});
|
|
@@ -13315,7 +13382,7 @@ var InlineParser = /** @class */ (function () {
|
|
|
13315
13382
|
var literal = textNode.literal || '';
|
|
13316
13383
|
var info = literal.split(/\s/)[0];
|
|
13317
13384
|
newNode.info = info;
|
|
13318
|
-
if (literal.length
|
|
13385
|
+
if (literal.length <= info.length) {
|
|
13319
13386
|
textNode.unlink();
|
|
13320
13387
|
}
|
|
13321
13388
|
else {
|
|
@@ -15750,7 +15817,6 @@ function filterDisallowedTags(str) {
|
|
|
15750
15817
|
}
|
|
15751
15818
|
return str;
|
|
15752
15819
|
}
|
|
15753
|
-
var CUSTOM_SYNTAX_LENGTH = 4;
|
|
15754
15820
|
var baseConvertors = {
|
|
15755
15821
|
heading: function (node, _a) {
|
|
15756
15822
|
var entering = _a.entering;
|
|
@@ -15941,7 +16007,7 @@ var baseConvertors = {
|
|
|
15941
16007
|
];
|
|
15942
16008
|
},
|
|
15943
16009
|
customInline: function (node, context, convertors) {
|
|
15944
|
-
var _a = node,
|
|
16010
|
+
var _a = node, info = _a.info, firstChild = _a.firstChild;
|
|
15945
16011
|
var nomalizedInfo = info.trim().toLowerCase();
|
|
15946
16012
|
var customConvertor = convertors[nomalizedInfo];
|
|
15947
16013
|
var entering = context.entering;
|
|
@@ -15953,13 +16019,10 @@ var baseConvertors = {
|
|
|
15953
16019
|
console.warn("[@toast-ui/editor] - The error occurred when " + nomalizedInfo + " inline node was parsed in markdown renderer: " + e);
|
|
15954
16020
|
}
|
|
15955
16021
|
}
|
|
15956
|
-
var text = sourcepos[1][1] - sourcepos[0][1] + 1 === info.length + CUSTOM_SYNTAX_LENGTH
|
|
15957
|
-
? ''
|
|
15958
|
-
: info + " ";
|
|
15959
16022
|
return entering
|
|
15960
16023
|
? [
|
|
15961
16024
|
{ type: 'openTag', tagName: 'span' },
|
|
15962
|
-
{ type: 'text', content: "$$" +
|
|
16025
|
+
{ type: 'text', content: "$$" + info + (firstChild ? ' ' : '') },
|
|
15963
16026
|
]
|
|
15964
16027
|
: [
|
|
15965
16028
|
{ type: 'text', content: '$$' },
|
|
@@ -16312,7 +16375,7 @@ function sanitizeHTML(html, options) {
|
|
|
16312
16375
|
|
|
16313
16376
|
function getChildrenHTML(node, typeName) {
|
|
16314
16377
|
return node
|
|
16315
|
-
.literal.replace(new RegExp("(<\\s*" + typeName + "[^>]
|
|
16378
|
+
.literal.replace(new RegExp("(<\\s*" + typeName + "[^>]*>)|(</" + typeName + "\\s*[>])", 'ig'), '')
|
|
16316
16379
|
.trim();
|
|
16317
16380
|
}
|
|
16318
16381
|
function getHTMLAttrsByHTMLString(html) {
|
|
@@ -16570,14 +16633,6 @@ function isBlankLine(doc, index) {
|
|
|
16570
16633
|
var pmNode = doc.child(index);
|
|
16571
16634
|
return !pmNode.childCount || (pmNode.childCount === 1 && !((_a = pmNode.firstChild.text) === null || _a === void 0 ? void 0 : _a.trim()));
|
|
16572
16635
|
}
|
|
16573
|
-
function getNextNonBlankElement(mdNode) {
|
|
16574
|
-
var next = mdNode.next, parent = mdNode.parent;
|
|
16575
|
-
while (!next && parent) {
|
|
16576
|
-
next = parent.next;
|
|
16577
|
-
parent = parent.parent;
|
|
16578
|
-
}
|
|
16579
|
-
return next ? document.querySelector("[data-nodeid=\"" + next.id + "\"]") : null;
|
|
16580
|
-
}
|
|
16581
16636
|
function getEditorRangeHeightInfo(doc, mdNode, children) {
|
|
16582
16637
|
var start = getMdStartLine(mdNode) - 1;
|
|
16583
16638
|
var end = getMdEndLine(mdNode) - 1;
|
|
@@ -16645,11 +16700,11 @@ function getAdditionalPos(scrollTop, offsetTop, height, targetNodeHeight) {
|
|
|
16645
16700
|
var ratio = Math.min((scrollTop - offsetTop) / height, 1);
|
|
16646
16701
|
return ratio * targetNodeHeight;
|
|
16647
16702
|
}
|
|
16648
|
-
function getParentNodeObj(mdNode) {
|
|
16649
|
-
var el =
|
|
16703
|
+
function getParentNodeObj(previewContent, mdNode) {
|
|
16704
|
+
var el = previewContent.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
|
|
16650
16705
|
while (!el || isStyledInlineNode(mdNode)) {
|
|
16651
16706
|
mdNode = mdNode.parent;
|
|
16652
|
-
el =
|
|
16707
|
+
el = previewContent.querySelector("[data-nodeid=\"" + mdNode.id + "\"]");
|
|
16653
16708
|
}
|
|
16654
16709
|
return getNonNestableNodeObj({ mdNode: mdNode, el: el });
|
|
16655
16710
|
}
|
|
@@ -17383,7 +17438,10 @@ var TableOffsetMap = /** @class */ (function () {
|
|
|
17383
17438
|
};
|
|
17384
17439
|
TableOffsetMap.prototype.getNodeAndPos = function (rowIdx, colIdx) {
|
|
17385
17440
|
var cellInfo = this.rowInfo[rowIdx][colIdx];
|
|
17386
|
-
return {
|
|
17441
|
+
return {
|
|
17442
|
+
node: this.table.nodeAt(cellInfo.offset - this.tableStartOffset),
|
|
17443
|
+
pos: cellInfo.offset,
|
|
17444
|
+
};
|
|
17387
17445
|
};
|
|
17388
17446
|
TableOffsetMap.prototype.extendedRowspan = function (rowIdx, colIdx) {
|
|
17389
17447
|
return false;
|
|
@@ -18075,7 +18133,6 @@ function task() {
|
|
|
18075
18133
|
;// CONCATENATED MODULE: ./src/wysiwyg/plugins/toolbarState.ts
|
|
18076
18134
|
|
|
18077
18135
|
|
|
18078
|
-
|
|
18079
18136
|
var EXCEPT_TYPES = ['image', 'link', 'customBlock', 'frontMatter'];
|
|
18080
18137
|
var MARK_TYPES = ['strong', 'strike', 'emph', 'code'];
|
|
18081
18138
|
var LIST_TYPES = ['bulletList', 'orderedList', 'taskList'];
|
|
@@ -18090,47 +18147,49 @@ function toolbarState_getToolbarStateType(node, parentNode) {
|
|
|
18090
18147
|
return type;
|
|
18091
18148
|
}
|
|
18092
18149
|
function setListNodeToolbarState(type, nodeTypeState) {
|
|
18093
|
-
nodeTypeState[type] = true;
|
|
18150
|
+
nodeTypeState[type] = { active: true };
|
|
18094
18151
|
LIST_TYPES.filter(function (listName) { return listName !== type; }).forEach(function (listType) {
|
|
18095
18152
|
if (nodeTypeState[listType]) {
|
|
18096
18153
|
delete nodeTypeState[listType];
|
|
18097
18154
|
}
|
|
18098
18155
|
});
|
|
18099
18156
|
}
|
|
18100
|
-
function
|
|
18101
|
-
var markTypeState = {};
|
|
18157
|
+
function setMarkTypeStates(from, to, schema, toolbarState) {
|
|
18102
18158
|
MARK_TYPES.forEach(function (type) {
|
|
18103
18159
|
var mark = schema.marks[type];
|
|
18104
18160
|
var marksAtPos = from.marksAcross(to) || [];
|
|
18105
18161
|
var foundMark = !!mark.isInSet(marksAtPos);
|
|
18106
18162
|
if (foundMark) {
|
|
18107
|
-
|
|
18163
|
+
toolbarState[type] = { active: true };
|
|
18108
18164
|
}
|
|
18109
18165
|
});
|
|
18110
|
-
return markTypeState;
|
|
18111
18166
|
}
|
|
18112
18167
|
function toolbarState_getToolbarState(selection, doc, schema) {
|
|
18113
18168
|
var $from = selection.$from, $to = selection.$to, from = selection.from, to = selection.to;
|
|
18114
|
-
var
|
|
18115
|
-
|
|
18169
|
+
var toolbarState = {
|
|
18170
|
+
indent: { active: false, disabled: true },
|
|
18171
|
+
outdent: { active: false, disabled: true },
|
|
18172
|
+
};
|
|
18116
18173
|
doc.nodesBetween(from, to, function (node, _, parentNode) {
|
|
18117
18174
|
var type = toolbarState_getToolbarStateType(node, parentNode);
|
|
18118
18175
|
if (common_includes(EXCEPT_TYPES, type)) {
|
|
18119
18176
|
return;
|
|
18120
18177
|
}
|
|
18121
18178
|
if (common_includes(LIST_TYPES, type)) {
|
|
18122
|
-
setListNodeToolbarState(type,
|
|
18179
|
+
setListNodeToolbarState(type, toolbarState);
|
|
18180
|
+
toolbarState.indent.disabled = false;
|
|
18181
|
+
toolbarState.outdent.disabled = false;
|
|
18123
18182
|
}
|
|
18124
18183
|
else if (type === 'paragraph' || type === 'text') {
|
|
18125
|
-
|
|
18184
|
+
setMarkTypeStates($from, $to, schema, toolbarState);
|
|
18126
18185
|
}
|
|
18127
18186
|
else {
|
|
18128
|
-
|
|
18187
|
+
toolbarState[type] = { active: true };
|
|
18129
18188
|
}
|
|
18130
18189
|
});
|
|
18131
|
-
return
|
|
18190
|
+
return toolbarState;
|
|
18132
18191
|
}
|
|
18133
|
-
function
|
|
18192
|
+
function toolbarStateHighlight(eventEmitter) {
|
|
18134
18193
|
return new external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Plugin({
|
|
18135
18194
|
view: function () {
|
|
18136
18195
|
return {
|
|
@@ -18417,6 +18476,7 @@ var CodeBlockView = /** @class */ (function () {
|
|
|
18417
18476
|
this.dom = null;
|
|
18418
18477
|
this.contentDOM = null;
|
|
18419
18478
|
this.input = null;
|
|
18479
|
+
this.timer = null;
|
|
18420
18480
|
this.handleMousedown = function (ev) {
|
|
18421
18481
|
var target = ev.target;
|
|
18422
18482
|
var style = getComputedStyle(target, ':after');
|
|
@@ -18472,7 +18532,7 @@ var CodeBlockView = /** @class */ (function () {
|
|
|
18472
18532
|
input.type = 'text';
|
|
18473
18533
|
input.value = this.node.attrs.language;
|
|
18474
18534
|
wrapper.appendChild(input);
|
|
18475
|
-
|
|
18535
|
+
this.view.dom.parentElement.appendChild(wrapper);
|
|
18476
18536
|
var wrpperWidth = wrapper.clientWidth;
|
|
18477
18537
|
css_default()(wrapper, {
|
|
18478
18538
|
top: top + 10 + "px",
|
|
@@ -18482,7 +18542,10 @@ var CodeBlockView = /** @class */ (function () {
|
|
|
18482
18542
|
this.input = input;
|
|
18483
18543
|
this.input.addEventListener('blur', function () { return _this.changeLanguage(); });
|
|
18484
18544
|
this.input.addEventListener('keydown', this.handleKeydown);
|
|
18485
|
-
|
|
18545
|
+
this.clearTimer();
|
|
18546
|
+
this.timer = setTimeout(function () {
|
|
18547
|
+
_this.input.focus();
|
|
18548
|
+
});
|
|
18486
18549
|
};
|
|
18487
18550
|
CodeBlockView.prototype.bindDOMEvent = function () {
|
|
18488
18551
|
if (this.dom) {
|
|
@@ -18515,6 +18578,12 @@ var CodeBlockView = /** @class */ (function () {
|
|
|
18515
18578
|
removeNode(parent);
|
|
18516
18579
|
}
|
|
18517
18580
|
};
|
|
18581
|
+
CodeBlockView.prototype.clearTimer = function () {
|
|
18582
|
+
if (this.timer) {
|
|
18583
|
+
clearTimeout(this.timer);
|
|
18584
|
+
this.timer = null;
|
|
18585
|
+
}
|
|
18586
|
+
};
|
|
18518
18587
|
CodeBlockView.prototype.stopEvent = function () {
|
|
18519
18588
|
return true;
|
|
18520
18589
|
};
|
|
@@ -18527,6 +18596,7 @@ var CodeBlockView = /** @class */ (function () {
|
|
|
18527
18596
|
};
|
|
18528
18597
|
CodeBlockView.prototype.destroy = function () {
|
|
18529
18598
|
this.reset();
|
|
18599
|
+
this.clearTimer();
|
|
18530
18600
|
if (this.dom) {
|
|
18531
18601
|
this.dom.removeEventListener('click', this.handleMousedown);
|
|
18532
18602
|
}
|
|
@@ -19632,9 +19702,10 @@ function addParagraphBeforeTable(tr, map, schema) {
|
|
|
19632
19702
|
}
|
|
19633
19703
|
return tr.setSelection(external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Selection.near(tableStartPos, -1));
|
|
19634
19704
|
}
|
|
19635
|
-
function addParagraphAfterTable(tr, map, schema) {
|
|
19705
|
+
function addParagraphAfterTable(tr, map, schema, forcedAddtion) {
|
|
19706
|
+
if (forcedAddtion === void 0) { forcedAddtion = false; }
|
|
19636
19707
|
var tableEndPos = tr.doc.resolve(map.tableEndOffset);
|
|
19637
|
-
if (!tableEndPos.nodeAfter) {
|
|
19708
|
+
if (forcedAddtion || !tableEndPos.nodeAfter) {
|
|
19638
19709
|
return addParagraph(tr, tableEndPos, schema);
|
|
19639
19710
|
}
|
|
19640
19711
|
return tr.setSelection(external_commonjs_prosemirror_state_commonjs2_prosemirror_state_amd_prosemirror_state_.Selection.near(tableEndPos, 1));
|
|
@@ -20056,6 +20127,29 @@ var table_Table = /** @class */ (function (_super) {
|
|
|
20056
20127
|
return false;
|
|
20057
20128
|
};
|
|
20058
20129
|
};
|
|
20130
|
+
Table.prototype.exitTable = function () {
|
|
20131
|
+
return function (state, dispatch) {
|
|
20132
|
+
var selection = state.selection, tr = state.tr, schema = state.schema;
|
|
20133
|
+
var $from = selection.$from;
|
|
20134
|
+
var cell = findNodeBy($from, function (_a) {
|
|
20135
|
+
var type = _a.type;
|
|
20136
|
+
return type.name === 'tableHeadCell' || type.name === 'tableBodyCell';
|
|
20137
|
+
});
|
|
20138
|
+
if (cell) {
|
|
20139
|
+
var para = findNodeBy($from, function (_a) {
|
|
20140
|
+
var type = _a.type;
|
|
20141
|
+
return type.name === 'paragraph';
|
|
20142
|
+
});
|
|
20143
|
+
if (para) {
|
|
20144
|
+
var anchor = getResolvedSelection(selection).anchor;
|
|
20145
|
+
var map = TableOffsetMap.create(anchor);
|
|
20146
|
+
dispatch(addParagraphAfterTable(tr, map, schema, true));
|
|
20147
|
+
return true;
|
|
20148
|
+
}
|
|
20149
|
+
}
|
|
20150
|
+
return false;
|
|
20151
|
+
};
|
|
20152
|
+
};
|
|
20059
20153
|
Table.prototype.commands = function () {
|
|
20060
20154
|
return {
|
|
20061
20155
|
addTable: this.addTable(),
|
|
@@ -20082,6 +20176,7 @@ var table_Table = /** @class */ (function (_super) {
|
|
|
20082
20176
|
'Mod-Backspace': deleteCellContent,
|
|
20083
20177
|
Delete: deleteCellContent,
|
|
20084
20178
|
'Mod-Delete': deleteCellContent,
|
|
20179
|
+
'Mod-Enter': this.exitTable(),
|
|
20085
20180
|
};
|
|
20086
20181
|
};
|
|
20087
20182
|
return Table;
|
|
@@ -20342,7 +20437,7 @@ var Image = /** @class */ (function (_super) {
|
|
|
20342
20437
|
var attrs = _a.attrs;
|
|
20343
20438
|
return [
|
|
20344
20439
|
attrs.rawHTML || 'img',
|
|
20345
|
-
__assign(__assign({ src: attrs.imageUrl }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs(attrs)),
|
|
20440
|
+
__assign(__assign({ src: escapeXml(attrs.imageUrl) }, (attrs.altText && { alt: attrs.altText })), getCustomAttrs(attrs)),
|
|
20346
20441
|
];
|
|
20347
20442
|
},
|
|
20348
20443
|
};
|
|
@@ -20357,7 +20452,7 @@ var Image = /** @class */ (function (_super) {
|
|
|
20357
20452
|
if (!imageUrl) {
|
|
20358
20453
|
return false;
|
|
20359
20454
|
}
|
|
20360
|
-
var node = schema.nodes.image.createAndFill(__assign({ imageUrl:
|
|
20455
|
+
var node = schema.nodes.image.createAndFill(__assign({ imageUrl: imageUrl }, (altText && { altText: altText })));
|
|
20361
20456
|
dispatch(tr.replaceSelectionWith(node).scrollIntoView());
|
|
20362
20457
|
return true;
|
|
20363
20458
|
}; };
|
|
@@ -20616,7 +20711,6 @@ var strike_Strike = /** @class */ (function (_super) {
|
|
|
20616
20711
|
|
|
20617
20712
|
|
|
20618
20713
|
|
|
20619
|
-
|
|
20620
20714
|
var link_Link = /** @class */ (function (_super) {
|
|
20621
20715
|
__extends(Link, _super);
|
|
20622
20716
|
function Link(linkAttributes) {
|
|
@@ -20635,7 +20729,7 @@ var link_Link = /** @class */ (function (_super) {
|
|
|
20635
20729
|
get: function () {
|
|
20636
20730
|
var _this = this;
|
|
20637
20731
|
return {
|
|
20638
|
-
attrs: __assign({ linkUrl: { default: '' },
|
|
20732
|
+
attrs: __assign({ linkUrl: { default: '' }, title: { default: null }, rawHTML: { default: null } }, getDefaultCustomAttrs()),
|
|
20639
20733
|
inclusive: false,
|
|
20640
20734
|
parseDOM: [
|
|
20641
20735
|
{
|
|
@@ -20644,8 +20738,9 @@ var link_Link = /** @class */ (function (_super) {
|
|
|
20644
20738
|
var sanitizedDOM = sanitizeHTML(dom, { RETURN_DOM_FRAGMENT: true })
|
|
20645
20739
|
.firstChild;
|
|
20646
20740
|
var href = sanitizedDOM.getAttribute('href') || '';
|
|
20741
|
+
var title = sanitizedDOM.getAttribute('title') || '';
|
|
20647
20742
|
var rawHTML = sanitizedDOM.getAttribute('data-raw-html');
|
|
20648
|
-
return __assign({ linkUrl: href,
|
|
20743
|
+
return __assign({ linkUrl: href, title: title }, (rawHTML && { rawHTML: rawHTML }));
|
|
20649
20744
|
},
|
|
20650
20745
|
},
|
|
20651
20746
|
],
|
|
@@ -20653,7 +20748,7 @@ var link_Link = /** @class */ (function (_super) {
|
|
|
20653
20748
|
var attrs = _a.attrs;
|
|
20654
20749
|
return [
|
|
20655
20750
|
attrs.rawHTML || 'a',
|
|
20656
|
-
__assign(__assign({ href: attrs.linkUrl }, _this.linkAttributes), getCustomAttrs(attrs)),
|
|
20751
|
+
__assign(__assign({ href: escapeXml(attrs.linkUrl) }, _this.linkAttributes), getCustomAttrs(attrs)),
|
|
20657
20752
|
];
|
|
20658
20753
|
},
|
|
20659
20754
|
};
|
|
@@ -20667,10 +20762,7 @@ var link_Link = /** @class */ (function (_super) {
|
|
|
20667
20762
|
var schema = state.schema, tr = state.tr, selection = state.selection;
|
|
20668
20763
|
var empty = selection.empty, from = selection.from, to = selection.to;
|
|
20669
20764
|
if (from && to && linkUrl) {
|
|
20670
|
-
var attrs = {
|
|
20671
|
-
linkUrl: escapeXml(linkUrl),
|
|
20672
|
-
linkText: escapeMarkdownText(linkText),
|
|
20673
|
-
};
|
|
20765
|
+
var attrs = { linkUrl: linkUrl };
|
|
20674
20766
|
var mark = schema.mark('link', attrs);
|
|
20675
20767
|
if (empty && linkText) {
|
|
20676
20768
|
var node = createTextNode(schema, linkText, mark);
|
|
@@ -20756,6 +20848,7 @@ var code_Code = /** @class */ (function (_super) {
|
|
|
20756
20848
|
;// CONCATENATED MODULE: ./src/wysiwyg/nodes/customBlock.ts
|
|
20757
20849
|
|
|
20758
20850
|
|
|
20851
|
+
|
|
20759
20852
|
var customBlock_CustomBlock = /** @class */ (function (_super) {
|
|
20760
20853
|
__extends(CustomBlock, _super);
|
|
20761
20854
|
function CustomBlock() {
|
|
@@ -20797,6 +20890,13 @@ var customBlock_CustomBlock = /** @class */ (function (_super) {
|
|
|
20797
20890
|
enumerable: false,
|
|
20798
20891
|
configurable: true
|
|
20799
20892
|
});
|
|
20893
|
+
CustomBlock.prototype.commands = function () {
|
|
20894
|
+
return function (payload) { return function (state, dispatch) {
|
|
20895
|
+
return (payload === null || payload === void 0 ? void 0 : payload.info)
|
|
20896
|
+
? (0,external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_.setBlockType)(state.schema.nodes.customBlock, payload)(state, dispatch)
|
|
20897
|
+
: false;
|
|
20898
|
+
}; };
|
|
20899
|
+
};
|
|
20800
20900
|
return CustomBlock;
|
|
20801
20901
|
}(node));
|
|
20802
20902
|
|
|
@@ -20823,8 +20923,10 @@ var FrontMatter = /** @class */ (function (_super) {
|
|
|
20823
20923
|
content: 'text*',
|
|
20824
20924
|
group: 'block',
|
|
20825
20925
|
code: true,
|
|
20926
|
+
defining: true,
|
|
20826
20927
|
parseDOM: [
|
|
20827
20928
|
{
|
|
20929
|
+
preserveWhitespace: 'full',
|
|
20828
20930
|
tag: 'div[data-front-matter]',
|
|
20829
20931
|
},
|
|
20830
20932
|
],
|
|
@@ -20854,6 +20956,56 @@ var FrontMatter = /** @class */ (function (_super) {
|
|
|
20854
20956
|
}(node));
|
|
20855
20957
|
|
|
20856
20958
|
|
|
20959
|
+
;// CONCATENATED MODULE: ./src/wysiwyg/nodes/htmlComment.ts
|
|
20960
|
+
|
|
20961
|
+
|
|
20962
|
+
|
|
20963
|
+
var HTMLComment = /** @class */ (function (_super) {
|
|
20964
|
+
__extends(HTMLComment, _super);
|
|
20965
|
+
function HTMLComment() {
|
|
20966
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
20967
|
+
}
|
|
20968
|
+
Object.defineProperty(HTMLComment.prototype, "name", {
|
|
20969
|
+
get: function () {
|
|
20970
|
+
return 'htmlComment';
|
|
20971
|
+
},
|
|
20972
|
+
enumerable: false,
|
|
20973
|
+
configurable: true
|
|
20974
|
+
});
|
|
20975
|
+
Object.defineProperty(HTMLComment.prototype, "schema", {
|
|
20976
|
+
get: function () {
|
|
20977
|
+
return {
|
|
20978
|
+
content: 'text*',
|
|
20979
|
+
group: 'block',
|
|
20980
|
+
code: true,
|
|
20981
|
+
defining: true,
|
|
20982
|
+
parseDOM: [{ preserveWhitespace: 'full', tag: 'div[data-html-comment]' }],
|
|
20983
|
+
toDOM: function () {
|
|
20984
|
+
return ['div', { 'data-html-comment': 'true' }, 0];
|
|
20985
|
+
},
|
|
20986
|
+
};
|
|
20987
|
+
},
|
|
20988
|
+
enumerable: false,
|
|
20989
|
+
configurable: true
|
|
20990
|
+
});
|
|
20991
|
+
HTMLComment.prototype.commands = function () {
|
|
20992
|
+
return function () { return function (state, dispatch, view) {
|
|
20993
|
+
var $from = state.selection.$from;
|
|
20994
|
+
if (view.endOfTextblock('down') && $from.node().type.name === 'htmlComment') {
|
|
20995
|
+
return (0,external_commonjs_prosemirror_commands_commonjs2_prosemirror_commands_amd_prosemirror_commands_.exitCode)(state, dispatch);
|
|
20996
|
+
}
|
|
20997
|
+
return false;
|
|
20998
|
+
}; };
|
|
20999
|
+
};
|
|
21000
|
+
HTMLComment.prototype.keymaps = function () {
|
|
21001
|
+
return {
|
|
21002
|
+
Enter: this.commands()(),
|
|
21003
|
+
};
|
|
21004
|
+
};
|
|
21005
|
+
return HTMLComment;
|
|
21006
|
+
}(node));
|
|
21007
|
+
|
|
21008
|
+
|
|
20857
21009
|
;// CONCATENATED MODULE: ./src/wysiwyg/specCreator.ts
|
|
20858
21010
|
|
|
20859
21011
|
|
|
@@ -20879,6 +21031,7 @@ var FrontMatter = /** @class */ (function (_super) {
|
|
|
20879
21031
|
|
|
20880
21032
|
|
|
20881
21033
|
|
|
21034
|
+
|
|
20882
21035
|
|
|
20883
21036
|
|
|
20884
21037
|
function createSpecs(linkAttributes) {
|
|
@@ -20908,6 +21061,7 @@ function createSpecs(linkAttributes) {
|
|
|
20908
21061
|
new customBlock_CustomBlock(),
|
|
20909
21062
|
new FrontMatter(),
|
|
20910
21063
|
new Widget(),
|
|
21064
|
+
new HTMLComment(),
|
|
20911
21065
|
]);
|
|
20912
21066
|
}
|
|
20913
21067
|
|
|
@@ -20933,6 +21087,7 @@ function createSpecs(linkAttributes) {
|
|
|
20933
21087
|
|
|
20934
21088
|
|
|
20935
21089
|
|
|
21090
|
+
|
|
20936
21091
|
|
|
20937
21092
|
|
|
20938
21093
|
var CONTENTS_CLASS_NAME = cls('contents');
|
|
@@ -20977,7 +21132,7 @@ var WysiwygEditor = /** @class */ (function (_super) {
|
|
|
20977
21132
|
tableSelection(),
|
|
20978
21133
|
tableContextMenu(this.eventEmitter),
|
|
20979
21134
|
task(),
|
|
20980
|
-
|
|
21135
|
+
toolbarStateHighlight(this.eventEmitter)
|
|
20981
21136
|
], this.createPluginProps()));
|
|
20982
21137
|
};
|
|
20983
21138
|
WysiwygEditor.prototype.createPluginNodeViews = function () {
|
|
@@ -21028,11 +21183,15 @@ var WysiwygEditor = /** @class */ (function (_super) {
|
|
|
21028
21183
|
paste: function (_, ev) {
|
|
21029
21184
|
var clipboardData = ev.clipboardData || window.clipboardData;
|
|
21030
21185
|
var items = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.items;
|
|
21031
|
-
if (
|
|
21032
|
-
var
|
|
21033
|
-
if
|
|
21034
|
-
|
|
21035
|
-
|
|
21186
|
+
if (items) {
|
|
21187
|
+
var containRtfItem = toArray_default()(items).some(function (item) { return item.kind === 'string' && item.type === 'text/rtf'; });
|
|
21188
|
+
// if it contains rtf, it's most likely copy paste from office -> no image
|
|
21189
|
+
if (!containRtfItem) {
|
|
21190
|
+
var imageBlob = pasteImageOnly(items);
|
|
21191
|
+
if (imageBlob) {
|
|
21192
|
+
ev.preventDefault();
|
|
21193
|
+
emitImageBlobHook(_this.eventEmitter, imageBlob, ev.type);
|
|
21194
|
+
}
|
|
21036
21195
|
}
|
|
21037
21196
|
}
|
|
21038
21197
|
return false;
|
|
@@ -21181,6 +21340,7 @@ var eventTypeList = [
|
|
|
21181
21340
|
'beforePreviewRender',
|
|
21182
21341
|
'beforeConvertWysiwygToMarkdown',
|
|
21183
21342
|
'load',
|
|
21343
|
+
'loadUI',
|
|
21184
21344
|
'change',
|
|
21185
21345
|
'caretChange',
|
|
21186
21346
|
'destroy',
|
|
@@ -21762,7 +21922,7 @@ var toWwConvertors = {
|
|
|
21762
21922
|
var link = state.schema.marks.link;
|
|
21763
21923
|
var _b = node, destination = _b.destination, title = _b.title;
|
|
21764
21924
|
if (entering) {
|
|
21765
|
-
var attrs = __assign(
|
|
21925
|
+
var attrs = __assign({ linkUrl: destination, title: title }, customAttrs);
|
|
21766
21926
|
state.openMark(link.create(attrs));
|
|
21767
21927
|
}
|
|
21768
21928
|
else {
|
|
@@ -21818,37 +21978,32 @@ var toWwConvertors = {
|
|
|
21818
21978
|
}
|
|
21819
21979
|
},
|
|
21820
21980
|
tableCell: function (state, node, _a) {
|
|
21821
|
-
var _b;
|
|
21822
21981
|
var entering = _a.entering;
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
if (!node.ignored) {
|
|
21982
|
+
if (!node.ignored) {
|
|
21983
|
+
var hasParaNode = function (childNode) {
|
|
21984
|
+
return childNode && (htmlToWwConvertors_isInlineNode(childNode) || isCustomHTMLInlineNode(state, childNode));
|
|
21985
|
+
};
|
|
21986
|
+
if (entering) {
|
|
21987
|
+
var _b = state.schema.nodes, tableHeadCell = _b.tableHeadCell, tableBodyCell = _b.tableBodyCell, paragraph = _b.paragraph;
|
|
21988
|
+
var tablePart = node.parent.parent;
|
|
21989
|
+
var cell = tablePart.type === 'tableHead' ? tableHeadCell : tableBodyCell;
|
|
21832
21990
|
var table = tablePart.parent;
|
|
21833
|
-
var
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
attrs =
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21991
|
+
var align = (table.columns[node.startIdx] || {}).align;
|
|
21992
|
+
var attrs = __assign({}, node.attrs);
|
|
21993
|
+
if (align) {
|
|
21994
|
+
attrs.align = align;
|
|
21995
|
+
}
|
|
21996
|
+
state.openNode(cell, attrs);
|
|
21997
|
+
if (hasParaNode(node.firstChild)) {
|
|
21998
|
+
state.openNode(paragraph);
|
|
21840
21999
|
}
|
|
21841
22000
|
}
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
}
|
|
21847
|
-
else {
|
|
21848
|
-
if (hasParaNode(node.lastChild)) {
|
|
22001
|
+
else {
|
|
22002
|
+
if (hasParaNode(node.lastChild)) {
|
|
22003
|
+
state.closeNode();
|
|
22004
|
+
}
|
|
21849
22005
|
state.closeNode();
|
|
21850
22006
|
}
|
|
21851
|
-
state.closeNode();
|
|
21852
22007
|
}
|
|
21853
22008
|
},
|
|
21854
22009
|
strike: function (state, _, _a, customAttrs) {
|
|
@@ -21911,26 +22066,34 @@ var toWwConvertors = {
|
|
|
21911
22066
|
htmlBlock: function (state, node) {
|
|
21912
22067
|
var html = node.literal;
|
|
21913
22068
|
var container = document.createElement('div');
|
|
21914
|
-
var
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
// for user defined html schema
|
|
21920
|
-
if (nodeType === null || nodeType === void 0 ? void 0 : nodeType.spec.attrs.htmlBlock) {
|
|
21921
|
-
var htmlAttrs = getHTMLAttrsByHTMLString(sanitizedHTML);
|
|
21922
|
-
var childrenHTML = getChildrenHTML(node, typeName);
|
|
21923
|
-
state.addNode(nodeType, { htmlAttrs: htmlAttrs, childrenHTML: childrenHTML });
|
|
22069
|
+
var isHTMLComment = reHTMLComment.test(html);
|
|
22070
|
+
if (isHTMLComment) {
|
|
22071
|
+
state.openNode(state.schema.nodes.htmlComment);
|
|
22072
|
+
state.addText(node.literal);
|
|
22073
|
+
state.closeNode();
|
|
21924
22074
|
}
|
|
21925
22075
|
else {
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
22076
|
+
var matched = html.match(reHTMLTag);
|
|
22077
|
+
var openTagName = matched[1], closeTagName = matched[3];
|
|
22078
|
+
var typeName = (openTagName || closeTagName).toLowerCase();
|
|
22079
|
+
var nodeType = state.schema.nodes[typeName];
|
|
22080
|
+
var sanitizedHTML = sanitizeHTML(html);
|
|
22081
|
+
// for user defined html schema
|
|
22082
|
+
if (nodeType === null || nodeType === void 0 ? void 0 : nodeType.spec.attrs.htmlBlock) {
|
|
22083
|
+
var htmlAttrs = getHTMLAttrsByHTMLString(sanitizedHTML);
|
|
22084
|
+
var childrenHTML = getChildrenHTML(node, typeName);
|
|
22085
|
+
state.addNode(nodeType, { htmlAttrs: htmlAttrs, childrenHTML: childrenHTML });
|
|
22086
|
+
}
|
|
22087
|
+
else {
|
|
22088
|
+
container.innerHTML = sanitizedHTML;
|
|
22089
|
+
addRawHTMLAttributeToDOM(container);
|
|
22090
|
+
state.convertByDOMParser(container);
|
|
22091
|
+
}
|
|
21929
22092
|
}
|
|
21930
22093
|
},
|
|
21931
22094
|
customInline: function (state, node, _a) {
|
|
21932
22095
|
var entering = _a.entering, skipChildren = _a.skipChildren;
|
|
21933
|
-
var info =
|
|
22096
|
+
var _b = node, info = _b.info, firstChild = _b.firstChild;
|
|
21934
22097
|
var schema = state.schema;
|
|
21935
22098
|
if (info.indexOf('widget') !== -1 && entering) {
|
|
21936
22099
|
var content = getWidgetContent(node);
|
|
@@ -21939,6 +22102,13 @@ var toWwConvertors = {
|
|
|
21939
22102
|
schema.text(createWidgetContent(info, content)),
|
|
21940
22103
|
]);
|
|
21941
22104
|
}
|
|
22105
|
+
else {
|
|
22106
|
+
var text = '$$';
|
|
22107
|
+
if (entering) {
|
|
22108
|
+
text += firstChild ? info + " " : info;
|
|
22109
|
+
}
|
|
22110
|
+
state.addText(text);
|
|
22111
|
+
}
|
|
21942
22112
|
},
|
|
21943
22113
|
};
|
|
21944
22114
|
function createWwConvertors(customConvertors) {
|
|
@@ -21954,7 +22124,7 @@ function createWwConvertors(customConvertors) {
|
|
|
21954
22124
|
var wwConvertor = toWwConvertors[type];
|
|
21955
22125
|
if (wwConvertor && !common_includes(['htmlBlock', 'htmlInline'], type)) {
|
|
21956
22126
|
convertors[type] = function (state, node, context) {
|
|
21957
|
-
context.origin = function () { return orgConvertors[type](node, context); };
|
|
22127
|
+
context.origin = function () { return orgConvertors[type](node, context, orgConvertors); };
|
|
21958
22128
|
var tokens = customConvertors[type](node, context);
|
|
21959
22129
|
var attrs;
|
|
21960
22130
|
if (tokens) {
|
|
@@ -22152,7 +22322,13 @@ var nodeTypeWriters = {
|
|
|
22152
22322
|
text: function (state, _a) {
|
|
22153
22323
|
var _b;
|
|
22154
22324
|
var node = _a.node;
|
|
22155
|
-
|
|
22325
|
+
var text = (_b = node.text) !== null && _b !== void 0 ? _b : '';
|
|
22326
|
+
if ((node.marks || []).some(function (mark) { return mark.type.name === 'link'; })) {
|
|
22327
|
+
state.text(escapeTextForLink(text), false);
|
|
22328
|
+
}
|
|
22329
|
+
else {
|
|
22330
|
+
state.text(text);
|
|
22331
|
+
}
|
|
22156
22332
|
},
|
|
22157
22333
|
paragraph: function (state, _a) {
|
|
22158
22334
|
var node = _a.node, parent = _a.parent, _b = _a.index, index = _b === void 0 ? 0 : _b;
|
|
@@ -22317,9 +22493,19 @@ var nodeTypeWriters = {
|
|
|
22317
22493
|
var text = _a.text;
|
|
22318
22494
|
state.write(text);
|
|
22319
22495
|
},
|
|
22320
|
-
html: function (state,
|
|
22321
|
-
var
|
|
22496
|
+
html: function (state, _a, _b) {
|
|
22497
|
+
var node = _a.node;
|
|
22498
|
+
var text = _b.text;
|
|
22499
|
+
state.write(text);
|
|
22500
|
+
if (node.attrs.htmlBlock) {
|
|
22501
|
+
state.closeBlock(node);
|
|
22502
|
+
}
|
|
22503
|
+
},
|
|
22504
|
+
htmlComment: function (state, _a, _b) {
|
|
22505
|
+
var node = _a.node;
|
|
22506
|
+
var text = _b.text;
|
|
22322
22507
|
state.write(text);
|
|
22508
|
+
state.closeBlock(node);
|
|
22323
22509
|
},
|
|
22324
22510
|
};
|
|
22325
22511
|
function write(type, _a) {
|
|
@@ -22481,13 +22667,13 @@ var toMdConvertors = {
|
|
|
22481
22667
|
image: function (_a) {
|
|
22482
22668
|
var node = _a.node;
|
|
22483
22669
|
var attrs = node.attrs;
|
|
22484
|
-
var
|
|
22485
|
-
var imageUrl =
|
|
22486
|
-
var altAttr = altText ? " alt=\"" + altText + "\"" : '';
|
|
22670
|
+
var rawHTML = attrs.rawHTML, altText = attrs.altText;
|
|
22671
|
+
var imageUrl = attrs.imageUrl.replace(/&/g, '&');
|
|
22672
|
+
var altAttr = altText ? " alt=\"" + escapeXml(altText) + "\"" : '';
|
|
22487
22673
|
return {
|
|
22488
|
-
rawHTML:
|
|
22674
|
+
rawHTML: rawHTML ? "<" + rawHTML + " src=\"" + escapeXml(imageUrl) + "\"" + altAttr + ">" : null,
|
|
22489
22675
|
attrs: {
|
|
22490
|
-
altText: altText,
|
|
22676
|
+
altText: escapeTextForLink(altText || ''),
|
|
22491
22677
|
imageUrl: imageUrl,
|
|
22492
22678
|
},
|
|
22493
22679
|
};
|
|
@@ -22550,17 +22736,17 @@ var toMdConvertors = {
|
|
|
22550
22736
|
var node = _a.node;
|
|
22551
22737
|
var entering = _b.entering;
|
|
22552
22738
|
var attrs = node.attrs;
|
|
22553
|
-
var
|
|
22554
|
-
var
|
|
22739
|
+
var title = attrs.title, rawHTML = attrs.rawHTML;
|
|
22740
|
+
var linkUrl = attrs.linkUrl.replace(/&/g, '&');
|
|
22741
|
+
var titleAttr = title ? " title=\"" + escapeXml(title) + "\"" : '';
|
|
22555
22742
|
if (entering) {
|
|
22556
22743
|
return {
|
|
22557
22744
|
delim: '[',
|
|
22558
|
-
rawHTML: rawHTML ? "<" + rawHTML + " href=\"" + linkUrl + "\">" : null,
|
|
22745
|
+
rawHTML: rawHTML ? "<" + rawHTML + " href=\"" + escapeXml(linkUrl) + "\"" + titleAttr + ">" : null,
|
|
22559
22746
|
};
|
|
22560
22747
|
}
|
|
22561
|
-
var linkText = attrs.title ? " " + quote(attrs.linkText) : '';
|
|
22562
22748
|
return {
|
|
22563
|
-
delim: "](" +
|
|
22749
|
+
delim: "](" + linkUrl + (title ? " " + quote(escapeTextForLink(title)) : '') + ")",
|
|
22564
22750
|
rawHTML: getCloseRawHTML(rawHTML),
|
|
22565
22751
|
};
|
|
22566
22752
|
},
|
|
@@ -22578,6 +22764,12 @@ var toMdConvertors = {
|
|
|
22578
22764
|
rawHTML: rawHTML,
|
|
22579
22765
|
};
|
|
22580
22766
|
},
|
|
22767
|
+
htmlComment: function (_a) {
|
|
22768
|
+
var node = _a.node;
|
|
22769
|
+
return {
|
|
22770
|
+
text: node.textContent,
|
|
22771
|
+
};
|
|
22772
|
+
},
|
|
22581
22773
|
// html inline node, html block node
|
|
22582
22774
|
html: function (_a, _b) {
|
|
22583
22775
|
var node = _a.node;
|
|
@@ -23290,7 +23482,7 @@ function createMdLikeNode(node) {
|
|
|
23290
23482
|
};
|
|
23291
23483
|
var nodeTypeMap = {
|
|
23292
23484
|
heading: { level: attrs.level },
|
|
23293
|
-
link: { destination: attrs.linkUrl, title: attrs.
|
|
23485
|
+
link: { destination: attrs.linkUrl, title: attrs.title },
|
|
23294
23486
|
image: { destination: attrs.imageUrl },
|
|
23295
23487
|
codeBlock: { info: attrs.language },
|
|
23296
23488
|
bulletList: { type: 'list', listData: { type: 'bullet' } },
|
|
@@ -23443,6 +23635,7 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23443
23635
|
this.latestPreviewScrollTop = null;
|
|
23444
23636
|
this.blockedScroll = null;
|
|
23445
23637
|
this.active = true;
|
|
23638
|
+
this.timer = null;
|
|
23446
23639
|
var previewRoot = preview.previewContent, previewEl = preview.el;
|
|
23447
23640
|
this.previewRoot = previewRoot;
|
|
23448
23641
|
this.previewEl = previewEl;
|
|
@@ -23455,10 +23648,11 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23455
23648
|
ScrollSync.prototype.addScrollSyncEvent = function () {
|
|
23456
23649
|
var _this = this;
|
|
23457
23650
|
this.eventEmitter.listen('afterPreviewRender', function () {
|
|
23651
|
+
_this.clearTimer();
|
|
23458
23652
|
// Immediately after the 'afterPreviewRender' event has occurred,
|
|
23459
23653
|
// browser rendering is not yet complete.
|
|
23460
23654
|
// So the size of elements can not be accurately measured.
|
|
23461
|
-
setTimeout(function () {
|
|
23655
|
+
_this.timer = setTimeout(function () {
|
|
23462
23656
|
_this.syncPreviewScrollTop(true);
|
|
23463
23657
|
}, 200);
|
|
23464
23658
|
});
|
|
@@ -23485,7 +23679,7 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23485
23679
|
var pos = this.mdEditor.getSelection();
|
|
23486
23680
|
var firstMdNode = this.toastMark.findFirstNodeAtLine(pos[0][0]);
|
|
23487
23681
|
var previewHeight = this.previewEl.clientHeight;
|
|
23488
|
-
var el = getParentNodeObj(firstMdNode).el;
|
|
23682
|
+
var el = getParentNodeObj(this.previewRoot, firstMdNode).el;
|
|
23489
23683
|
var totalOffsetTop = getTotalOffsetTop(el, this.previewRoot) || el.offsetTop;
|
|
23490
23684
|
var nodeHeight = el.clientHeight;
|
|
23491
23685
|
// multiply 0.5 for calculating the position in the middle of preview area
|
|
@@ -23517,7 +23711,7 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23517
23711
|
targetScrollTop = scrollTopByEditing;
|
|
23518
23712
|
}
|
|
23519
23713
|
else {
|
|
23520
|
-
var _d = getParentNodeObj(firstMdNode), el = _d.el, mdNode = _d.mdNode;
|
|
23714
|
+
var _d = getParentNodeObj(this.previewRoot, firstMdNode), el = _d.el, mdNode = _d.mdNode;
|
|
23521
23715
|
var _e = getEditorRangeHeightInfo(doc, mdNode, children), height = _e.height, rect = _e.rect;
|
|
23522
23716
|
var totalOffsetTop = getTotalOffsetTop(el, previewRoot) || el.offsetTop;
|
|
23523
23717
|
var nodeHeight = el.clientHeight;
|
|
@@ -23545,7 +23739,7 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23545
23739
|
}
|
|
23546
23740
|
var children = dom.children;
|
|
23547
23741
|
var mdNodeId = Number(targetNode.getAttribute('data-nodeid'));
|
|
23548
|
-
var _b = getParentNodeObj(toastMark.findNodeById(mdNodeId)), mdNode = _b.mdNode, el = _b.el;
|
|
23742
|
+
var _b = getParentNodeObj(this.previewRoot, toastMark.findNodeById(mdNodeId)), mdNode = _b.mdNode, el = _b.el;
|
|
23549
23743
|
var mdNodeStartLine = getMdStartLine(mdNode);
|
|
23550
23744
|
targetScrollTop = children[mdNodeStartLine - 1].offsetTop;
|
|
23551
23745
|
var height = getEditorRangeHeightInfo(state.doc, mdNode, children).height;
|
|
@@ -23584,7 +23778,14 @@ var ScrollSync = /** @class */ (function () {
|
|
|
23584
23778
|
};
|
|
23585
23779
|
animate(curScrollTop, targetScrollTop, syncCallbacks);
|
|
23586
23780
|
};
|
|
23781
|
+
ScrollSync.prototype.clearTimer = function () {
|
|
23782
|
+
if (this.timer) {
|
|
23783
|
+
clearTimeout(this.timer);
|
|
23784
|
+
this.timer = null;
|
|
23785
|
+
}
|
|
23786
|
+
};
|
|
23587
23787
|
ScrollSync.prototype.destroy = function () {
|
|
23788
|
+
this.clearTimer();
|
|
23588
23789
|
this.eventEmitter.removeEventHandler('scroll');
|
|
23589
23790
|
this.eventEmitter.removeEventHandler('afterPreviewRender');
|
|
23590
23791
|
};
|
|
@@ -23780,7 +23981,15 @@ var ToastUIEditorCore = /** @class */ (function () {
|
|
|
23780
23981
|
this.moveCursorToStart(this.options.autofocus);
|
|
23781
23982
|
}
|
|
23782
23983
|
ToastUIEditorCore.prototype.addInitEvent = function () {
|
|
23984
|
+
var _this = this;
|
|
23783
23985
|
this.on('needChangeMode', this.changeMode.bind(this));
|
|
23986
|
+
this.on('loadUI', function () {
|
|
23987
|
+
if (_this.height !== 'auto') {
|
|
23988
|
+
// 75px equals default editor ui height - the editing area height
|
|
23989
|
+
var minHeight = Math.min(parseInt(_this.minHeight, 10), parseInt(_this.height, 10) - 75) + "px";
|
|
23990
|
+
_this.setMinHeight(minHeight);
|
|
23991
|
+
}
|
|
23992
|
+
});
|
|
23784
23993
|
addDefaultImageBlobHook(this.eventEmitter);
|
|
23785
23994
|
};
|
|
23786
23995
|
ToastUIEditorCore.prototype.addInitCommand = function (mdCommands, wwCommands) {
|
|
@@ -24052,12 +24261,11 @@ var ToastUIEditorCore = /** @class */ (function () {
|
|
|
24052
24261
|
if (isString_default()(height)) {
|
|
24053
24262
|
if (height === 'auto') {
|
|
24054
24263
|
addClass_default()(el, 'auto-height');
|
|
24055
|
-
this.setMinHeight(this.getMinHeight());
|
|
24056
24264
|
}
|
|
24057
24265
|
else {
|
|
24058
24266
|
removeClass_default()(el, 'auto-height');
|
|
24059
|
-
this.setMinHeight(height);
|
|
24060
24267
|
}
|
|
24268
|
+
this.setMinHeight(this.getMinHeight());
|
|
24061
24269
|
}
|
|
24062
24270
|
css_default()(el, { height: height });
|
|
24063
24271
|
this.height = height;
|
|
@@ -24074,16 +24282,18 @@ var ToastUIEditorCore = /** @class */ (function () {
|
|
|
24074
24282
|
* @param {string} minHeight - min content height in pixel
|
|
24075
24283
|
*/
|
|
24076
24284
|
ToastUIEditorCore.prototype.setMinHeight = function (minHeight) {
|
|
24077
|
-
|
|
24078
|
-
|
|
24079
|
-
|
|
24080
|
-
|
|
24081
|
-
|
|
24082
|
-
|
|
24083
|
-
|
|
24084
|
-
|
|
24085
|
-
|
|
24086
|
-
|
|
24285
|
+
if (minHeight !== this.minHeight) {
|
|
24286
|
+
var height = this.height || this.options.height;
|
|
24287
|
+
if (height !== 'auto' && this.options.el.querySelector("." + cls('main'))) {
|
|
24288
|
+
// 75px equals default editor ui height - the editing area height
|
|
24289
|
+
minHeight = Math.min(parseInt(minHeight, 10), parseInt(height, 10) - 75) + "px";
|
|
24290
|
+
}
|
|
24291
|
+
var minHeightNum = parseInt(minHeight, 10);
|
|
24292
|
+
this.minHeight = minHeight;
|
|
24293
|
+
this.wwEditor.setMinHeight(minHeightNum);
|
|
24294
|
+
this.mdEditor.setMinHeight(minHeightNum);
|
|
24295
|
+
this.preview.setMinHeight(minHeightNum);
|
|
24296
|
+
}
|
|
24087
24297
|
};
|
|
24088
24298
|
/**
|
|
24089
24299
|
* Get minimum height of editor content
|
|
@@ -26223,6 +26433,7 @@ function createDefaultToolbarItemInfo(type) {
|
|
|
26223
26433
|
className: 'indent',
|
|
26224
26434
|
command: 'indent',
|
|
26225
26435
|
tooltip: i18n.get('Indent'),
|
|
26436
|
+
state: 'indent',
|
|
26226
26437
|
};
|
|
26227
26438
|
break;
|
|
26228
26439
|
case 'outdent':
|
|
@@ -26231,6 +26442,7 @@ function createDefaultToolbarItemInfo(type) {
|
|
|
26231
26442
|
className: 'outdent',
|
|
26232
26443
|
command: 'outdent',
|
|
26233
26444
|
tooltip: i18n.get('Outdent'),
|
|
26445
|
+
state: 'outdent',
|
|
26234
26446
|
};
|
|
26235
26447
|
break;
|
|
26236
26448
|
case 'scrollSync':
|
|
@@ -26395,7 +26607,7 @@ function connectHOC(WrappedComponent) {
|
|
|
26395
26607
|
_this.hideTooltip = function () {
|
|
26396
26608
|
css_default()(_this.props.tooltipRef.current, 'display', 'none');
|
|
26397
26609
|
};
|
|
26398
|
-
_this.state = { active: false };
|
|
26610
|
+
_this.state = { active: false, disabled: props.disabled };
|
|
26399
26611
|
_this.addEvent();
|
|
26400
26612
|
return _this;
|
|
26401
26613
|
}
|
|
@@ -26404,9 +26616,10 @@ function connectHOC(WrappedComponent) {
|
|
|
26404
26616
|
var _a = this.props, item = _a.item, eventEmitter = _a.eventEmitter;
|
|
26405
26617
|
if (item.state) {
|
|
26406
26618
|
eventEmitter.listen('changeToolbarState', function (_a) {
|
|
26619
|
+
var _b;
|
|
26407
26620
|
var toolbarState = _a.toolbarState;
|
|
26408
|
-
var
|
|
26409
|
-
_this.setState({ active: active });
|
|
26621
|
+
var _c = (_b = toolbarState[item.state]) !== null && _b !== void 0 ? _b : {}, active = _c.active, disabled = _c.disabled;
|
|
26622
|
+
_this.setState({ active: !!active, disabled: disabled !== null && disabled !== void 0 ? disabled : _this.props.disabled });
|
|
26410
26623
|
});
|
|
26411
26624
|
}
|
|
26412
26625
|
};
|
|
@@ -26415,7 +26628,7 @@ function connectHOC(WrappedComponent) {
|
|
|
26415
26628
|
return { left: offsetLeft, top: el.offsetHeight + offsetTop };
|
|
26416
26629
|
};
|
|
26417
26630
|
ButtonHOC.prototype.render = function () {
|
|
26418
|
-
return template(buttonHoc_templateObject_1 || (buttonHoc_templateObject_1 = __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);
|
|
26631
|
+
return template(buttonHoc_templateObject_1 || (buttonHoc_templateObject_1 = __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);
|
|
26419
26632
|
};
|
|
26420
26633
|
return ButtonHOC;
|
|
26421
26634
|
}(Component));
|
|
@@ -26670,7 +26883,7 @@ var Toolbar = /** @class */ (function (_super) {
|
|
|
26670
26883
|
};
|
|
26671
26884
|
_this.openPopup = function (popupName, initialValues) {
|
|
26672
26885
|
if (initialValues === void 0) { initialValues = {}; }
|
|
26673
|
-
var el =
|
|
26886
|
+
var el = _this.refs.el.querySelector("." + cls('toolbar-group') + " ." + popupName);
|
|
26674
26887
|
if (el) {
|
|
26675
26888
|
var _a = getTotalOffset(el, closest(el, "." + cls('toolbar'))), offsetLeft = _a.offsetLeft, offsetTop = _a.offsetTop;
|
|
26676
26889
|
var info = createPopupInfo(popupName, {
|
|
@@ -27036,6 +27249,7 @@ var ToastUIEditor = /** @class */ (function (_super) {
|
|
|
27036
27249
|
var groupIndex = toolbarItem.groupIndex, itemIndex = toolbarItem.itemIndex, item = toolbarItem.item;
|
|
27037
27250
|
_this.defaultUI.insertToolbarItem({ groupIndex: groupIndex, itemIndex: itemIndex }, item);
|
|
27038
27251
|
});
|
|
27252
|
+
_this.eventEmitter.emit('loadUI', _this);
|
|
27039
27253
|
return _this;
|
|
27040
27254
|
}
|
|
27041
27255
|
/**
|
|
@@ -27143,7 +27357,7 @@ editorCore.setLanguage(['en', 'en-US'], {
|
|
|
27143
27357
|
|
|
27144
27358
|
|
|
27145
27359
|
}();
|
|
27146
|
-
__webpack_exports__ = __webpack_exports__
|
|
27360
|
+
__webpack_exports__ = __webpack_exports__["default"];
|
|
27147
27361
|
/******/ return __webpack_exports__;
|
|
27148
27362
|
/******/ })()
|
|
27149
27363
|
;
|