tiny-markdown-editor 0.1.4 → 0.1.6

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/lib/grammar.js CHANGED
@@ -1,104 +1,20 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol");
4
-
5
- require("core-js/modules/es.symbol.description");
6
-
7
- require("core-js/modules/es.symbol.iterator");
8
-
9
- require("core-js/modules/es.symbol.replace");
10
-
11
- require("core-js/modules/es.array.from");
12
-
13
- require("core-js/modules/es.array.index-of");
14
-
15
- require("core-js/modules/es.array.iterator");
16
-
17
- require("core-js/modules/es.array.join");
18
-
19
- require("core-js/modules/es.array.reduce");
20
-
21
- require("core-js/modules/es.array.slice");
22
-
23
- require("core-js/modules/es.function.name");
24
-
25
- require("core-js/modules/es.map");
26
-
27
- require("core-js/modules/es.object.get-prototype-of");
28
-
29
- require("core-js/modules/es.object.keys");
30
-
31
- require("core-js/modules/es.object.to-string");
32
-
33
- require("core-js/modules/es.reflect.construct");
34
-
35
- require("core-js/modules/es.regexp.constructor");
36
-
37
- require("core-js/modules/es.regexp.exec");
38
-
39
- require("core-js/modules/es.regexp.flags");
40
-
41
- require("core-js/modules/es.regexp.to-string");
42
-
43
- require("core-js/modules/es.string.iterator");
44
-
45
- require("core-js/modules/es.string.match");
46
-
47
- require("core-js/modules/es.string.replace");
48
-
49
- require("core-js/modules/es.weak-map");
50
-
51
- require("core-js/modules/web.dom-collections.iterator");
52
-
53
3
  Object.defineProperty(exports, "__esModule", {
54
4
  value: true
55
5
  });
6
+ exports.htmlBlockGrammar = exports.commands = void 0;
56
7
  exports.htmlescape = htmlescape;
57
- exports.commands = exports.htmlBlockGrammar = exports.punctuationTrailing = exports.punctuationLeading = exports.inlineGrammar = exports.lineGrammar = void 0;
58
-
59
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
60
-
61
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
62
-
63
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
64
-
65
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
66
-
67
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
68
-
69
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
70
-
71
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
72
-
73
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
74
-
75
- function _wrapRegExp(re, groups) { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _RegExp = _wrapNativeSuper(RegExp); var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = _RegExp.call(this, re, flags); _groups.set(_this, groups || _groups.get(re)); return _this; } _inherits(BabelRegExp, _RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = []; args.push.apply(args, arguments); if (_typeof(args[args.length - 1]) !== "object") { args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
76
-
77
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
78
-
79
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
80
-
81
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
82
-
83
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
84
-
85
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
86
-
87
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
88
-
89
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
90
-
91
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
92
-
93
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
94
-
8
+ exports.punctuationTrailing = exports.punctuationLeading = exports.lineGrammar = exports.inlineGrammar = void 0;
9
+ require("core-js/modules/es.regexp.flags.js");
95
10
  // const replacements = {
96
11
  // ASCIIPunctuation: '!"#$%&\'()*+,\\-./:;<=>?@\\[\\]^_`{|}~',
97
12
  // TriggerChars: '`_\*\[\]\(\)',
98
13
  // Scheme: `[A-Za-z][A-Za-z0-9\+\.\-]{1,31}`,
99
14
  // Email: `[a-zA-Z0-9.!#$%&'*+/=?^_\`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*`, // From CommonMark spec
15
+
100
16
  // }
101
- var replacements = {
17
+ const replacements = {
102
18
  ASCIIPunctuation: /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,
103
19
  NotTriggerChar: /[^`_*[\]()<>!~]/,
104
20
  Scheme: /[A-Za-z][A-Za-z0-9+.-]{1,31}/,
@@ -114,18 +30,18 @@ var replacements = {
114
30
  HTMLAttribute: /\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,
115
31
  HTMLAttValue: /\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,
116
32
  KnownTag: /address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/
117
- }; // From CommonMark.js.
33
+ };
34
+
35
+ // From CommonMark.js.
36
+ const punctuationLeading = exports.punctuationLeading = new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/);
37
+ const punctuationTrailing = exports.punctuationTrailing = new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/);
118
38
 
119
- var punctuationLeading = new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/);
120
- exports.punctuationLeading = punctuationLeading;
121
- var punctuationTrailing = new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/); // export const inlineTriggerChars = new RegExp(`[${replacements.TriggerChars}]`);
39
+ // export const inlineTriggerChars = new RegExp(`[${replacements.TriggerChars}]`);
122
40
 
123
41
  /**
124
42
  * This is CommonMark's block grammar, but we're ignoring nested blocks here.
125
43
  */
126
-
127
- exports.punctuationTrailing = punctuationTrailing;
128
- var lineGrammar = {
44
+ const lineGrammar = exports.lineGrammar = {
129
45
  TMH1: {
130
46
  regexp: /^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,
131
47
  replacement: '<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'
@@ -155,27 +71,19 @@ var lineGrammar = {
155
71
  replacement: '<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'
156
72
  },
157
73
  TMCodeFenceBacktickOpen: {
158
- regexp: /*#__PURE__*/_wrapRegExp(/^( {0,3}(````*)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)([\0-_a-\uFFFF]*?)([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/, {
159
- seq: 2
160
- }),
74
+ regexp: /^( {0,3}(?<seq>````*)\s*)([^`]*?)(\s*)$/,
161
75
  replacement: '<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'
162
76
  },
163
77
  TMCodeFenceTildeOpen: {
164
- regexp: /*#__PURE__*/_wrapRegExp(/^( {0,3}(~~~~*)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)(.*?)([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/, {
165
- seq: 2
166
- }),
78
+ regexp: /^( {0,3}(?<seq>~~~~*)\s*)(.*?)(\s*)$/,
167
79
  replacement: '<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'
168
80
  },
169
81
  TMCodeFenceBacktickClose: {
170
- regexp: /*#__PURE__*/_wrapRegExp(/^( {0,3}(````*))([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/, {
171
- seq: 2
172
- }),
82
+ regexp: /^( {0,3}(?<seq>````*))(\s*)$/,
173
83
  replacement: '<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'
174
84
  },
175
85
  TMCodeFenceTildeClose: {
176
- regexp: /*#__PURE__*/_wrapRegExp(/^( {0,3}(~~~~*))([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/, {
177
- seq: 2
178
- }),
86
+ regexp: /^( {0,3}(?<seq>~~~~*))(\s*)$/,
179
87
  replacement: '<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'
180
88
  },
181
89
  TMBlankLine: {
@@ -212,15 +120,13 @@ var lineGrammar = {
212
120
  regexp: /^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,
213
121
  replacement: '<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',
214
122
  labelPlaceholder: 2 // this defines which placeholder in the above regex is the link "label"
215
-
216
123
  }
217
124
  };
125
+
218
126
  /**
219
127
  * HTML blocks have multiple different classes of opener and closer. This array defines all the cases
220
128
  */
221
-
222
- exports.lineGrammar = lineGrammar;
223
- var htmlBlockGrammar = [{
129
+ var htmlBlockGrammar = exports.htmlBlockGrammar = [{
224
130
  start: /^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i,
225
131
  end: /(?:<\/script>|<\/pre>|<\/style>)/i,
226
132
  paraInterrupt: true
@@ -249,14 +155,13 @@ var htmlBlockGrammar = [{
249
155
  end: false,
250
156
  paraInterrupt: false
251
157
  }];
158
+
252
159
  /**
253
160
  * Structure of the object:
254
161
  * Top level entries are rules, each consisting of a regular expressions (in string format) as well as a replacement.
255
162
  * In the regular expressions, replacements from the object 'replacements' will be processed before compiling into the property regexp.
256
163
  */
257
-
258
- exports.htmlBlockGrammar = htmlBlockGrammar;
259
- var inlineGrammar = {
164
+ var inlineGrammar = exports.inlineGrammar = {
260
165
  escape: {
261
166
  regexp: /^\\(ASCIIPunctuation)/,
262
167
  replacement: '<span class="TMMark TMMark_TMEscape">\\</span>$1'
@@ -290,55 +195,41 @@ var inlineGrammar = {
290
195
  regexp: /^(.|(?:NotTriggerChar+))/,
291
196
  replacement: '$1'
292
197
  }
293
- }; // Process replacements in regexps
294
-
295
- exports.inlineGrammar = inlineGrammar;
296
- var replacementRegexp = new RegExp(Object.keys(replacements).join('|')); // Inline
297
-
298
- var inlineRules = _toConsumableArray(Object.keys(inlineGrammar));
299
-
300
- var _iterator = _createForOfIteratorHelper(inlineRules),
301
- _step;
302
-
303
- try {
304
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
305
- var _rule = _step.value;
306
- var _re = inlineGrammar[_rule].regexp.source; // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
307
-
308
- while (_re.match(replacementRegexp)) {
309
- _re = _re.replace(replacementRegexp, function (string) {
310
- return replacements[string].source;
311
- });
312
- }
198
+ };
313
199
 
314
- inlineGrammar[_rule].regexp = new RegExp(_re, inlineGrammar[_rule].regexp.flags);
315
- } // HTML Block (only opening rule is processed currently)
200
+ // Process replacements in regexps
201
+ const replacementRegexp = new RegExp(Object.keys(replacements).join('|'));
316
202
 
317
- } catch (err) {
318
- _iterator.e(err);
319
- } finally {
320
- _iterator.f();
203
+ // Inline
204
+ const inlineRules = [...Object.keys(inlineGrammar)];
205
+ for (let rule of inlineRules) {
206
+ let re = inlineGrammar[rule].regexp.source;
207
+ // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
208
+ while (re.match(replacementRegexp)) {
209
+ re = re.replace(replacementRegexp, string => {
210
+ return replacements[string].source;
211
+ });
212
+ }
213
+ inlineGrammar[rule].regexp = new RegExp(re, inlineGrammar[rule].regexp.flags);
321
214
  }
322
215
 
323
- for (var _i = 0, _htmlBlockGrammar = htmlBlockGrammar; _i < _htmlBlockGrammar.length; _i++) {
324
- var rule = _htmlBlockGrammar[_i];
325
- var re = rule.start.source; // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
326
-
216
+ // HTML Block (only opening rule is processed currently)
217
+ for (let rule of htmlBlockGrammar) {
218
+ let re = rule.start.source;
219
+ // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
327
220
  while (re.match(replacementRegexp)) {
328
- re = re.replace(replacementRegexp, function (string) {
221
+ re = re.replace(replacementRegexp, string => {
329
222
  return replacements[string].source;
330
223
  });
331
224
  }
332
-
333
225
  rule.start = new RegExp(re, rule.start.flags);
334
226
  }
227
+
335
228
  /**
336
229
  * Escapes HTML special characters (<, >, and &) in the string.
337
230
  * @param {string} string The raw string to be escaped
338
231
  * @returns {string} The string, ready to be used in HTML
339
232
  */
340
-
341
-
342
233
  function htmlescape(string) {
343
234
  return (string ? string : '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
344
235
  }
@@ -354,9 +245,7 @@ function htmlescape(string) {
354
245
  * be inserted before and after the selection. The unset object contains a prePattern and a postPattern. Both should be regular expressions and
355
246
  * they will be applied to the portion of the line before and after the selection (using String.replace, with an empty replacement string).
356
247
  */
357
-
358
-
359
- var commands = {
248
+ const commands = exports.commands = {
360
249
  // Replacements for unset for inline commands are '' by default
361
250
  bold: {
362
251
  type: 'inline',
@@ -393,8 +282,8 @@ var commands = {
393
282
  prePattern: /`+$/,
394
283
  postPattern: /^`+/
395
284
  } // FIXME this doesn't ensure balanced backticks right now
396
-
397
285
  },
286
+
398
287
  strikethrough: {
399
288
  type: 'inline',
400
289
  className: 'TMStrikethrough',
@@ -431,6 +320,54 @@ var commands = {
431
320
  replacement: '$2'
432
321
  }
433
322
  },
323
+ h3: {
324
+ type: 'line',
325
+ className: 'TMH3',
326
+ set: {
327
+ pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,
328
+ replacement: '### $2'
329
+ },
330
+ unset: {
331
+ pattern: /^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/,
332
+ replacement: '$2'
333
+ }
334
+ },
335
+ h4: {
336
+ type: 'line',
337
+ className: 'TMH4',
338
+ set: {
339
+ pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,
340
+ replacement: '#### $2'
341
+ },
342
+ unset: {
343
+ pattern: /^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/,
344
+ replacement: '$2'
345
+ }
346
+ },
347
+ h5: {
348
+ type: 'line',
349
+ className: 'TMH5',
350
+ set: {
351
+ pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,
352
+ replacement: '##### $2'
353
+ },
354
+ unset: {
355
+ pattern: /^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/,
356
+ replacement: '$2'
357
+ }
358
+ },
359
+ h6: {
360
+ type: 'line',
361
+ className: 'TMH6',
362
+ set: {
363
+ pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,
364
+ replacement: '###### $2'
365
+ },
366
+ unset: {
367
+ pattern: /^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/,
368
+ replacement: '$2'
369
+ }
370
+ },
434
371
  ul: {
435
372
  type: 'line',
436
373
  className: 'TMUL',
@@ -467,5 +404,4 @@ var commands = {
467
404
  replacement: '$2'
468
405
  }
469
406
  }
470
- };
471
- exports.commands = commands;
407
+ };
package/lib/index.js CHANGED
@@ -5,19 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "CommandBar", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _TinyMDECommandBar.default;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "Editor", {
13
13
  enumerable: true,
14
- get: function get() {
14
+ get: function () {
15
15
  return _TinyMDE.default;
16
16
  }
17
17
  });
18
-
19
18
  var _TinyMDECommandBar = _interopRequireDefault(require("./TinyMDECommandBar"));
20
-
21
19
  var _TinyMDE = _interopRequireDefault(require("./TinyMDE"));
22
-
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/lib/svg/svg.js CHANGED
@@ -4,20 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var svg = {
8
- blockquote: "<svg height=\"18\" width=\"18\"><rect width=\"5\" height=\"5\" x=\"3\" y=\"4\" ry=\"1\"/><rect ry=\"1\" y=\"4\" x=\"10\" height=\"5\" width=\"5\"/><path d=\"M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z\"/></svg>",
9
- bold: "<svg height=\"18\" width=\"18\"><path d=\"M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z\"/></svg>",
10
- clear_formatting: "<svg height=\"18\" width=\"18\"><path d=\"M11.03 1a1 1 0 00-.74.3l-9 9a1 1 0 000 1.4l4 4A1 1 0 006 16h2a1 1 0 00.7-.3l8-8a1 1 0 000-1.4l-5-5a1 1 0 00-.67-.3zM8.7 5.7l3.58 3.6L7.6 14H6.4l-3-3 5.3-5.3z\"/><rect ry=\".8\" rx=\".8\" y=\"14\" x=\"16\" height=\"2\" width=\"2\"/><rect width=\"2\" height=\"2\" x=\"13\" y=\"14\" rx=\".8\" ry=\".8\"/><rect ry=\".8\" rx=\".8\" y=\"14\" x=\"10\" height=\"2\" width=\"2\"/></svg>",
11
- code: "<svg height=\"18\" width=\"18\"><path d=\"M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z\"/></svg>",
12
- h1: "<svg height=\"18\" width=\"18\"><path d=\"M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z\"/></svg>",
13
- h2: "<svg height=\"18\" width=\"18\"><path d=\"M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z\"/></svg>",
14
- hr: "<svg height=\"18\" width=\"18\"><rect ry=\"1\" y=\"8\" height=\"2\" width=\"18\" style=\"font-variation-settings:normal;marker:none\"/></svg>",
15
- image: "<svg height=\"18\" width=\"18\"><path d=\"M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z\"/><circle r=\"1.5\" cy=\"6.5\" cx=\"5.5\"/></svg>",
16
- italic: "<svg height=\"18\" width=\"18\"><path d=\"M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z\"/></svg>",
17
- link: "<svg height=\"18\" width=\"18\"><path d=\"M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z\"/><path d=\"M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z\"/></svg>",
18
- ol: "<svg height=\"18\" width=\"18\"><path d=\"M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z\"/><path d=\"M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z\"/><rect y=\"13\" x=\"6\" height=\"2\" width=\"12\" ry=\"1\"/><rect ry=\"1\" width=\"12\" height=\"2\" x=\"6\" y=\"8\"/><rect y=\"3\" x=\"6\" height=\"2\" width=\"12\" ry=\"1\"/><path d=\"M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z\"/></svg>",
19
- strikethrough: "<svg width=\"18\" height=\"18\"><path d=\"M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z\"/><rect ry=\"1\" y=\"8\" x=\"1\" height=\"2\" width=\"16\"/></svg>",
20
- ul: "<svg height=\"18\" width=\"18\"><circle cx=\"2\" cy=\"9\" r=\"2\"/><circle cy=\"4\" cx=\"2\" r=\"2\"/><rect y=\"3\" x=\"6\" height=\"2\" width=\"12\" ry=\"1\"/><circle cx=\"2\" cy=\"14\" r=\"2\"/><rect ry=\"1\" width=\"12\" height=\"2\" x=\"6\" y=\"8\"/><rect y=\"13\" x=\"6\" height=\"2\" width=\"12\" ry=\"1\"/></svg>"
7
+ const svg = {
8
+ blockquote: `<svg height="18" width="18"><rect width="5" height="5" x="3" y="4" ry="1"/><rect ry="1" y="4" x="10" height="5" width="5"/><path d="M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z"/></svg>`,
9
+ bold: `<svg height="18" width="18"><path d="M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z"/></svg>`,
10
+ clear_formatting: `<svg height="18" width="18"><path d="M11.03 1a1 1 0 00-.74.3l-9 9a1 1 0 000 1.4l4 4A1 1 0 006 16h2a1 1 0 00.7-.3l8-8a1 1 0 000-1.4l-5-5a1 1 0 00-.67-.3zM8.7 5.7l3.58 3.6L7.6 14H6.4l-3-3 5.3-5.3z"/><rect ry=".8" rx=".8" y="14" x="16" height="2" width="2"/><rect width="2" height="2" x="13" y="14" rx=".8" ry=".8"/><rect ry=".8" rx=".8" y="14" x="10" height="2" width="2"/></svg>`,
11
+ code: `<svg height="18" width="18"><path d="M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z"/></svg>`,
12
+ h1: `<svg height="18" width="18"><path d="M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z"/></svg>`,
13
+ h2: `<svg height="18" width="18"><path d="M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z"/></svg>`,
14
+ hr: `<svg height="18" width="18"><rect ry="1" y="8" height="2" width="18" style="font-variation-settings:normal;marker:none"/></svg>`,
15
+ image: `<svg height="18" width="18"><path d="M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z"/><circle r="1.5" cy="6.5" cx="5.5"/></svg>`,
16
+ italic: `<svg height="18" width="18"><path d="M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z"/></svg>`,
17
+ link: `<svg height="18" width="18"><path d="M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z"/><path d="M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z"/></svg>`,
18
+ ol: `<svg height="18" width="18"><path d="M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z"/><path d="M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z"/><rect y="13" x="6" height="2" width="12" ry="1"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="3" x="6" height="2" width="12" ry="1"/><path d="M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z"/></svg>`,
19
+ strikethrough: `<svg width="18" height="18"><path d="M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z"/><rect ry="1" y="8" x="1" height="2" width="16"/></svg>`,
20
+ ul: `<svg height="18" width="18"><circle cx="2" cy="9" r="2"/><circle cy="4" cx="2" r="2"/><rect y="3" x="6" height="2" width="12" ry="1"/><circle cx="2" cy="14" r="2"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="13" x="6" height="2" width="12" ry="1"/></svg>`
21
21
  };
22
- var _default = svg;
23
- exports.default = _default;
22
+ var _default = exports.default = svg;
package/lib/tiny.js CHANGED
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "Editor", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _TinyMDE.default;
10
10
  }
11
11
  });
12
-
13
12
  var _TinyMDE = _interopRequireDefault(require("./TinyMDE"));
14
-
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-markdown-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "TinyMDE: A tiny, ultra low dependency, embeddable HTML/JavaScript Markdown editor.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -34,28 +34,28 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.11.6",
37
- "@babel/preset-env": "^7.11.5",
38
- "@rollup/plugin-babel": "^5.2.1",
39
- "@rollup/plugin-commonjs": "^15.1.0",
40
- "@rollup/plugin-node-resolve": "^9.0.0",
41
- "@rollup/stream": "^1.1.0",
42
- "autoprefixer": "^9.8.6",
43
- "cssnano": "^4.1.10",
44
- "del": "^5.1.0",
45
- "eslint": "^7.10.0",
37
+ "@babel/preset-env": "^7.22.20",
38
+ "@rollup/plugin-babel": "^6.0.2",
39
+ "@rollup/plugin-commonjs": "^23.0.2",
40
+ "@rollup/plugin-node-resolve": "^15.0.1",
41
+ "@rollup/stream": "^2.0.0",
42
+ "autoprefixer": "^10.4.13",
43
+ "cssnano": "^5.1.14",
44
+ "del": "^7.0.0",
45
+ "eslint": "^8.26.0",
46
46
  "express": "^4.17.1",
47
47
  "gulp": "^4.0.2",
48
48
  "gulp-babel": "^8.0.0",
49
- "gulp-postcss": "^8.0.0",
49
+ "gulp-postcss": "^9.0.1",
50
50
  "gulp-rename": "^2.0.0",
51
51
  "gulp-size": "^3.0.0",
52
- "gulp-terser": "^1.4.0",
53
- "jest": "^26.4.2",
54
- "jest-cli": "^26.4.2",
55
- "jest-puppeteer": "^4.4.0",
56
- "postcss-import": "^12.0.1",
57
- "puppeteer": "^5.3.1",
58
- "rollup": "^2.28.2",
52
+ "gulp-terser": "^2.1.0",
53
+ "jest": "^29.2.2",
54
+ "jest-cli": "^29.2.2",
55
+ "jest-puppeteer": "^6.1.1",
56
+ "postcss-import": "^15.0.0",
57
+ "puppeteer": "^19.2.2",
58
+ "rollup": "^2.79.1",
59
59
  "rollup-plugin-eslint": "^7.0.0",
60
60
  "terser": "^5.3.3",
61
61
  "vinyl-buffer": "^1.0.1",