@uiw/react-md-editor 3.18.1 → 3.18.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.
Files changed (109) hide show
  1. package/README.md +75 -8
  2. package/dist/mdeditor.css +0 -1
  3. package/dist/mdeditor.js +182 -282
  4. package/dist/mdeditor.min.css +1 -1
  5. package/dist/mdeditor.min.js +1 -1
  6. package/esm/commands/bold.js +3 -2
  7. package/esm/commands/bold.js.map +3 -2
  8. package/esm/commands/code.js +6 -4
  9. package/esm/commands/code.js.map +3 -2
  10. package/esm/commands/comment.js +21 -1
  11. package/esm/commands/comment.js.map +7 -3
  12. package/esm/commands/fullscreen.js +4 -3
  13. package/esm/commands/fullscreen.js.map +3 -2
  14. package/esm/commands/hr.js +3 -2
  15. package/esm/commands/hr.js.map +3 -2
  16. package/esm/commands/image.js +4 -3
  17. package/esm/commands/image.js.map +3 -2
  18. package/esm/commands/index.d.ts +9 -9
  19. package/esm/commands/index.js +19 -13
  20. package/esm/commands/index.js.map +18 -15
  21. package/esm/commands/italic.js +3 -2
  22. package/esm/commands/italic.js.map +3 -2
  23. package/esm/commands/link.js +4 -3
  24. package/esm/commands/link.js.map +3 -2
  25. package/esm/commands/list.js +10 -7
  26. package/esm/commands/list.js.map +3 -2
  27. package/esm/commands/preview.js +9 -6
  28. package/esm/commands/preview.js.map +3 -2
  29. package/esm/commands/quote.js +2 -2
  30. package/esm/commands/quote.js.map +2 -2
  31. package/esm/commands/strikeThrough.js +3 -2
  32. package/esm/commands/strikeThrough.js.map +3 -2
  33. package/esm/commands/title.js +2 -2
  34. package/esm/commands/title.js.map +2 -2
  35. package/esm/commands/title1.js +3 -2
  36. package/esm/commands/title1.js.map +3 -2
  37. package/esm/commands/title2.js +3 -2
  38. package/esm/commands/title2.js.map +3 -2
  39. package/esm/commands/title3.js +3 -2
  40. package/esm/commands/title3.js.map +3 -2
  41. package/esm/commands/title4.js +3 -2
  42. package/esm/commands/title4.js.map +3 -2
  43. package/esm/commands/title5.js +3 -2
  44. package/esm/commands/title5.js.map +3 -2
  45. package/esm/commands/title6.js +3 -2
  46. package/esm/commands/title6.js.map +3 -2
  47. package/lib/commands/bold.js +3 -2
  48. package/lib/commands/bold.js.map +3 -2
  49. package/lib/commands/code.js +6 -4
  50. package/lib/commands/code.js.map +3 -2
  51. package/lib/commands/comment.js +21 -1
  52. package/lib/commands/comment.js.map +7 -3
  53. package/lib/commands/fullscreen.js +4 -3
  54. package/lib/commands/fullscreen.js.map +3 -2
  55. package/lib/commands/hr.js +3 -2
  56. package/lib/commands/hr.js.map +3 -2
  57. package/lib/commands/image.js +4 -3
  58. package/lib/commands/image.js.map +3 -2
  59. package/lib/commands/index.d.ts +9 -9
  60. package/lib/commands/index.js +25 -18
  61. package/lib/commands/index.js.map +12 -2
  62. package/lib/commands/italic.js +3 -2
  63. package/lib/commands/italic.js.map +3 -2
  64. package/lib/commands/link.js +4 -3
  65. package/lib/commands/link.js.map +3 -2
  66. package/lib/commands/list.js +10 -7
  67. package/lib/commands/list.js.map +3 -2
  68. package/lib/commands/preview.js +9 -6
  69. package/lib/commands/preview.js.map +3 -2
  70. package/lib/commands/quote.js +2 -2
  71. package/lib/commands/quote.js.map +2 -2
  72. package/lib/commands/strikeThrough.js +3 -2
  73. package/lib/commands/strikeThrough.js.map +3 -2
  74. package/lib/commands/title.js +2 -2
  75. package/lib/commands/title.js.map +2 -2
  76. package/lib/commands/title1.js +3 -2
  77. package/lib/commands/title1.js.map +3 -2
  78. package/lib/commands/title2.js +3 -2
  79. package/lib/commands/title2.js.map +3 -2
  80. package/lib/commands/title3.js +3 -2
  81. package/lib/commands/title3.js.map +3 -2
  82. package/lib/commands/title4.js +3 -2
  83. package/lib/commands/title4.js.map +3 -2
  84. package/lib/commands/title5.js +3 -2
  85. package/lib/commands/title5.js.map +3 -2
  86. package/lib/commands/title6.js +3 -2
  87. package/lib/commands/title6.js.map +3 -2
  88. package/package.json +1 -1
  89. package/src/__test__/commands.test.tsx +26 -26
  90. package/src/commands/bold.tsx +2 -1
  91. package/src/commands/code.tsx +4 -2
  92. package/src/commands/comment.tsx +8 -0
  93. package/src/commands/fullscreen.tsx +3 -2
  94. package/src/commands/hr.tsx +2 -1
  95. package/src/commands/image.tsx +3 -2
  96. package/src/commands/index.ts +17 -13
  97. package/src/commands/italic.tsx +2 -1
  98. package/src/commands/link.tsx +3 -2
  99. package/src/commands/list.tsx +10 -4
  100. package/src/commands/preview.tsx +6 -3
  101. package/src/commands/quote.tsx +1 -1
  102. package/src/commands/strikeThrough.tsx +5 -1
  103. package/src/commands/title.tsx +2 -2
  104. package/src/commands/title1.tsx +2 -1
  105. package/src/commands/title2.tsx +2 -1
  106. package/src/commands/title3.tsx +2 -1
  107. package/src/commands/title4.tsx +2 -1
  108. package/src/commands/title5.tsx +2 -1
  109. package/src/commands/title6.tsx +2 -1
package/dist/mdeditor.js CHANGED
@@ -1261,112 +1261,6 @@ module.exports = function isBuffer (obj) {
1261
1261
  }
1262
1262
 
1263
1263
 
1264
- /***/ }),
1265
-
1266
- /***/ 555:
1267
- /***/ ((module) => {
1268
-
1269
- "use strict";
1270
-
1271
-
1272
-
1273
-
1274
- var encodeCache = {};
1275
-
1276
-
1277
- // Create a lookup array where anything but characters in `chars` string
1278
- // and alphanumeric chars is percent-encoded.
1279
- //
1280
- function getEncodeCache(exclude) {
1281
- var i, ch, cache = encodeCache[exclude];
1282
- if (cache) { return cache; }
1283
-
1284
- cache = encodeCache[exclude] = [];
1285
-
1286
- for (i = 0; i < 128; i++) {
1287
- ch = String.fromCharCode(i);
1288
-
1289
- if (/^[0-9a-z]$/i.test(ch)) {
1290
- // always allow unencoded alphanumeric characters
1291
- cache.push(ch);
1292
- } else {
1293
- cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
1294
- }
1295
- }
1296
-
1297
- for (i = 0; i < exclude.length; i++) {
1298
- cache[exclude.charCodeAt(i)] = exclude[i];
1299
- }
1300
-
1301
- return cache;
1302
- }
1303
-
1304
-
1305
- // Encode unsafe characters with percent-encoding, skipping already
1306
- // encoded sequences.
1307
- //
1308
- // - string - string to encode
1309
- // - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
1310
- // - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
1311
- //
1312
- function encode(string, exclude, keepEscaped) {
1313
- var i, l, code, nextCode, cache,
1314
- result = '';
1315
-
1316
- if (typeof exclude !== 'string') {
1317
- // encode(string, keepEscaped)
1318
- keepEscaped = exclude;
1319
- exclude = encode.defaultChars;
1320
- }
1321
-
1322
- if (typeof keepEscaped === 'undefined') {
1323
- keepEscaped = true;
1324
- }
1325
-
1326
- cache = getEncodeCache(exclude);
1327
-
1328
- for (i = 0, l = string.length; i < l; i++) {
1329
- code = string.charCodeAt(i);
1330
-
1331
- if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
1332
- if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
1333
- result += string.slice(i, i + 3);
1334
- i += 2;
1335
- continue;
1336
- }
1337
- }
1338
-
1339
- if (code < 128) {
1340
- result += cache[code];
1341
- continue;
1342
- }
1343
-
1344
- if (code >= 0xD800 && code <= 0xDFFF) {
1345
- if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
1346
- nextCode = string.charCodeAt(i + 1);
1347
- if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
1348
- result += encodeURIComponent(string[i] + string[i + 1]);
1349
- i++;
1350
- continue;
1351
- }
1352
- }
1353
- result += '%EF%BF%BD';
1354
- continue;
1355
- }
1356
-
1357
- result += encodeURIComponent(string[i]);
1358
- }
1359
-
1360
- return result;
1361
- }
1362
-
1363
- encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
1364
- encode.componentChars = "-_.!~*'()";
1365
-
1366
-
1367
- module.exports = encode;
1368
-
1369
-
1370
1264
  /***/ }),
1371
1265
 
1372
1266
  /***/ 931:
@@ -12470,7 +12364,7 @@ const containerConstruct = {
12470
12364
 
12471
12365
  function initializeDocument(effects) {
12472
12366
  const self = this
12473
- /** @type {StackItem[]} */
12367
+ /** @type {Array<StackItem>} */
12474
12368
 
12475
12369
  const stack = []
12476
12370
  let continued = 0
@@ -13593,13 +13487,13 @@ function createTokenizer(parser, initialize, from) {
13593
13487
  /** @type {Record<string, number>} */
13594
13488
 
13595
13489
  const columnStart = {}
13596
- /** @type {Construct[]} */
13490
+ /** @type {Array<Construct>} */
13597
13491
 
13598
13492
  const resolveAllConstructs = []
13599
- /** @type {Chunk[]} */
13493
+ /** @type {Array<Chunk>} */
13600
13494
 
13601
13495
  let chunks = []
13602
- /** @type {Token[]} */
13496
+ /** @type {Array<Token>} */
13603
13497
 
13604
13498
  let stack = []
13605
13499
  /** @type {boolean|undefined} */
@@ -13830,14 +13724,14 @@ function createTokenizer(parser, initialize, from) {
13830
13724
  * Handle either an object mapping codes to constructs, a list of
13831
13725
  * constructs, or a single construct.
13832
13726
  *
13833
- * @param {Construct|Construct[]|ConstructRecord} constructs
13727
+ * @param {Construct|Array<Construct>|ConstructRecord} constructs
13834
13728
  * @param {State} returnState
13835
13729
  * @param {State} [bogusState]
13836
13730
  * @returns {State}
13837
13731
  */
13838
13732
 
13839
13733
  function hook(constructs, returnState, bogusState) {
13840
- /** @type {Construct[]} */
13734
+ /** @type {Array<Construct>} */
13841
13735
  let listOfConstructs
13842
13736
  /** @type {number} */
13843
13737
 
@@ -13881,7 +13775,7 @@ function createTokenizer(parser, initialize, from) {
13881
13775
  /**
13882
13776
  * Handle a list of construct.
13883
13777
  *
13884
- * @param {Construct[]} list
13778
+ * @param {Array<Construct>} list
13885
13779
  * @returns {State}
13886
13780
  */
13887
13781
 
@@ -14029,9 +13923,9 @@ function createTokenizer(parser, initialize, from) {
14029
13923
  /**
14030
13924
  * Get the chunks from a slice of chunks in the range of a token.
14031
13925
  *
14032
- * @param {Chunk[]} chunks
13926
+ * @param {Array<Chunk>} chunks
14033
13927
  * @param {Pick<Token, 'start'|'end'>} token
14034
- * @returns {Chunk[]}
13928
+ * @returns {Array<Chunk>}
14035
13929
  */
14036
13930
 
14037
13931
  function sliceChunks(chunks, token) {
@@ -14039,7 +13933,7 @@ function sliceChunks(chunks, token) {
14039
13933
  const startBufferIndex = token.start._bufferIndex
14040
13934
  const endIndex = token.end._index
14041
13935
  const endBufferIndex = token.end._bufferIndex
14042
- /** @type {Chunk[]} */
13936
+ /** @type {Array<Chunk>} */
14043
13937
 
14044
13938
  let view
14045
13939
 
@@ -14065,14 +13959,14 @@ function sliceChunks(chunks, token) {
14065
13959
  /**
14066
13960
  * Get the string value of a slice of chunks.
14067
13961
  *
14068
- * @param {Chunk[]} chunks
13962
+ * @param {Array<Chunk>} chunks
14069
13963
  * @param {boolean} [expandTabs=false]
14070
13964
  * @returns {string}
14071
13965
  */
14072
13966
 
14073
13967
  function serializeChunks(chunks, expandTabs) {
14074
13968
  let index = -1
14075
- /** @type {string[]} */
13969
+ /** @type {Array<string>} */
14076
13970
 
14077
13971
  const result = []
14078
13972
  /** @type {boolean|undefined} */
@@ -18289,7 +18183,7 @@ function parse_parse(options = {}) {
18289
18183
  * @param {Value} value
18290
18184
  * @param {Encoding} [encoding]
18291
18185
  * @param {boolean} [end=false]
18292
- * @returns {Chunk[]}
18186
+ * @returns {Array<Chunk>}
18293
18187
  */
18294
18188
  const search = /[\0\t\n\r]/g
18295
18189
  /**
@@ -18309,7 +18203,7 @@ function preprocess() {
18309
18203
  /** @type {Preprocessor} */
18310
18204
 
18311
18205
  function preprocessor(value, encoding, end) {
18312
- /** @type {Chunk[]} */
18206
+ /** @type {Array<Chunk>} */
18313
18207
  const chunks = []
18314
18208
  /** @type {RegExpMatchArray|null} */
18315
18209
 
@@ -18413,8 +18307,8 @@ function preprocess() {
18413
18307
  */
18414
18308
 
18415
18309
  /**
18416
- * @param {Event[]} events
18417
- * @returns {Event[]}
18310
+ * @param {Array<Event>} events
18311
+ * @returns {Array<Event>}
18418
18312
  */
18419
18313
 
18420
18314
  function postprocess(events) {
@@ -20560,32 +20454,6 @@ function traverse_all(h, parent) {
20560
20454
  return values
20561
20455
  }
20562
20456
 
20563
- ;// CONCATENATED MODULE: ../node_modules/micromark-util-encode/index.js
20564
- const characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'}
20565
-
20566
- /**
20567
- * Encode only the dangerous HTML characters.
20568
- *
20569
- * This ensures that certain characters which have special meaning in HTML are
20570
- * dealt with.
20571
- * Technically, we can skip `>` and `"` in many cases, but CM includes them.
20572
- *
20573
- * @param {string} value
20574
- * @returns {string}
20575
- */
20576
- function encode(value) {
20577
- return value.replace(/["&<>]/g, replace)
20578
-
20579
- /**
20580
- * @param {string} value
20581
- * @returns {string}
20582
- */
20583
- function replace(value) {
20584
- // @ts-expect-error Hush, it’s fine.
20585
- return '&' + characterReferences[value] + ';'
20586
- }
20587
- }
20588
-
20589
20457
  ;// CONCATENATED MODULE: ../node_modules/micromark-util-sanitize-uri/index.js
20590
20458
 
20591
20459
 
@@ -20645,7 +20513,7 @@ function sanitizeUri(url, protocol) {
20645
20513
  */
20646
20514
 
20647
20515
  function normalizeUri(value) {
20648
- /** @type {string[]} */
20516
+ /** @type {Array<string>} */
20649
20517
  const result = []
20650
20518
  let index = -1
20651
20519
  let start = 0
@@ -20737,8 +20605,6 @@ function wrap_wrap(nodes, loose) {
20737
20605
 
20738
20606
  ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/footer.js
20739
20607
  /**
20740
- * @typedef {import('mdast').BlockContent} BlockContent
20741
- * @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition
20742
20608
  * @typedef {import('hast').Element} Element
20743
20609
  * @typedef {import('hast').ElementContent} ElementContent
20744
20610
  * @typedef {import('./index.js').H} H
@@ -20767,7 +20633,7 @@ function footer(h) {
20767
20633
 
20768
20634
  const content = traverse_all(h, def)
20769
20635
  const id = String(def.identifier)
20770
- const safeId = sanitizeUri(id.toLowerCase())
20636
+ const safeId = normalizeUri(id.toLowerCase())
20771
20637
  let referenceIndex = 0
20772
20638
  /** @type {Array<ElementContent>} */
20773
20639
  const backReferences = []
@@ -20848,7 +20714,10 @@ function footer(h) {
20848
20714
  {
20849
20715
  type: 'element',
20850
20716
  tagName: h.footnoteLabelTagName,
20851
- properties: JSON.parse(JSON.stringify(h.footnoteLabelProperties)),
20717
+ properties: {
20718
+ ...JSON.parse(JSON.stringify(h.footnoteLabelProperties)),
20719
+ id: 'footnote-label'
20720
+ },
20852
20721
  children: [u('text', h.footnoteLabel)]
20853
20722
  },
20854
20723
  {type: 'text', value: '\n'},
@@ -20902,7 +20771,6 @@ function hardBreak(h, node) {
20902
20771
  ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/handlers/code.js
20903
20772
  /**
20904
20773
  * @typedef {import('mdast').Code} Code
20905
- * @typedef {import('hast').Element} Element
20906
20774
  * @typedef {import('hast').Properties} Properties
20907
20775
  * @typedef {import('../index.js').Handler} Handler
20908
20776
  */
@@ -20981,7 +20849,7 @@ function emphasis(h, node) {
20981
20849
  */
20982
20850
  function footnoteReference(h, node) {
20983
20851
  const id = String(node.identifier)
20984
- const safeId = sanitizeUri(id.toLowerCase())
20852
+ const safeId = normalizeUri(id.toLowerCase())
20985
20853
  const index = h.footnoteOrder.indexOf(id)
20986
20854
  /** @type {number} */
20987
20855
  let counter
@@ -21091,8 +20959,6 @@ function html(h, node) {
21091
20959
  return h.dangerous ? h.augment(node, u('raw', node.value)) : null
21092
20960
  }
21093
20961
 
21094
- // EXTERNAL MODULE: ../node_modules/mdurl/encode.js
21095
- var mdurl_encode = __webpack_require__(555);
21096
20962
  ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/revert.js
21097
20963
  /**
21098
20964
  * @typedef {import('mdast').LinkReference} LinkReference
@@ -21167,7 +21033,7 @@ function imageReference(h, node) {
21167
21033
  }
21168
21034
 
21169
21035
  /** @type {Properties} */
21170
- const props = {src: mdurl_encode(def.url || ''), alt: node.alt}
21036
+ const props = {src: normalizeUri(def.url || ''), alt: node.alt}
21171
21037
 
21172
21038
  if (def.title !== null && def.title !== undefined) {
21173
21039
  props.title = def.title
@@ -21191,7 +21057,7 @@ function imageReference(h, node) {
21191
21057
  */
21192
21058
  function image_image(h, node) {
21193
21059
  /** @type {Properties} */
21194
- const props = {src: mdurl_encode(node.url), alt: node.alt}
21060
+ const props = {src: normalizeUri(node.url), alt: node.alt}
21195
21061
 
21196
21062
  if (node.title !== null && node.title !== undefined) {
21197
21063
  props.title = node.title
@@ -21239,7 +21105,7 @@ function linkReference(h, node) {
21239
21105
  }
21240
21106
 
21241
21107
  /** @type {Properties} */
21242
- const props = {href: mdurl_encode(def.url || '')}
21108
+ const props = {href: normalizeUri(def.url || '')}
21243
21109
 
21244
21110
  if (def.title !== null && def.title !== undefined) {
21245
21111
  props.title = def.title
@@ -21264,7 +21130,7 @@ function linkReference(h, node) {
21264
21130
  */
21265
21131
  function link_link(h, node) {
21266
21132
  /** @type {Properties} */
21267
- const props = {href: mdurl_encode(node.url)}
21133
+ const props = {href: normalizeUri(node.url)}
21268
21134
 
21269
21135
  if (node.title !== null && node.title !== undefined) {
21270
21136
  props.title = node.title
@@ -21491,7 +21357,6 @@ function strong(h, node) {
21491
21357
  ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/handlers/table.js
21492
21358
  /**
21493
21359
  * @typedef {import('mdast').Table} Table
21494
- * @typedef {import('mdast').TableCell} TableCell
21495
21360
  * @typedef {import('hast').Element} Element
21496
21361
  * @typedef {import('../index.js').Handler} Handler
21497
21362
  * @typedef {import('../index.js').Content} Content
@@ -21721,60 +21586,91 @@ function ignore() {
21721
21586
  * @typedef {import('mdast').Definition} Definition
21722
21587
  * @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition
21723
21588
  * @typedef {import('hast').Properties} Properties
21724
- * @typedef {import('hast').Text} Text
21725
- * @typedef {import('hast').Comment} Comment
21726
21589
  * @typedef {import('hast').Element} Element
21727
- * @typedef {import('hast').Root} Root
21728
21590
  * @typedef {import('hast').ElementContent} Content
21729
21591
  * @typedef {import('unist-util-position').PositionLike} PositionLike
21730
21592
  *
21731
21593
  * @typedef EmbeddedHastFields
21732
- * @property {string} [hName] Defines the tag name of an element
21733
- * @property {Properties} [hProperties] Defines the properties of an element
21734
- * @property {Array<Content>} [hChildren] Defines the (hast) children of an element
21594
+ * @property {string} [hName]
21595
+ * Defines the tag name of an element.
21596
+ * @property {Properties} [hProperties]
21597
+ * Defines the properties of an element.
21598
+ * @property {Array<Content>} [hChildren]
21599
+ * Defines the (hast) children of an element.
21735
21600
  *
21736
- * @typedef {Record<string, unknown> & EmbeddedHastFields} Data unist data with embedded hast fields
21601
+ * @typedef {Record<string, unknown> & EmbeddedHastFields} Data
21602
+ * unist data with embedded hast fields.
21737
21603
  *
21738
- * @typedef {MdastNode & {data?: Data}} NodeWithData unist node with embedded hast data
21604
+ * @typedef {MdastNode & {data?: Data}} NodeWithData
21605
+ * unist node with embedded hast data.
21739
21606
  *
21740
21607
  * @callback Handler
21741
- * @param {H} h Handle context
21742
- * @param {any} node mdast node to handle
21743
- * @param {Parent|null} parent Parent of `node`
21744
- * @returns {Content|Array<Content>|null|undefined} hast node
21608
+ * Handle a node.
21609
+ * @param {H} h
21610
+ * Handle context.
21611
+ * @param {any} node
21612
+ * mdast node to handle.
21613
+ * @param {Parent|null} parent
21614
+ * Parent of `node`.
21615
+ * @returns {Content|Array<Content>|null|undefined}
21616
+ * hast node.
21745
21617
  *
21746
21618
  * @callback HFunctionProps
21747
- * @param {MdastNode|PositionLike|null|undefined} node mdast node or unist position
21748
- * @param {string} tagName HTML tag name
21749
- * @param {Properties} props Properties
21750
- * @param {Array<Content>?} [children] hast content
21619
+ * @param {MdastNode|PositionLike|null|undefined} node
21620
+ * mdast node or unist position.
21621
+ * @param {string} tagName
21622
+ * HTML tag name.
21623
+ * @param {Properties} props
21624
+ * Properties.
21625
+ * @param {Array<Content>?} [children]
21626
+ * hast content.
21751
21627
  * @returns {Element}
21628
+ * Compiled element.
21752
21629
  *
21753
21630
  * @callback HFunctionNoProps
21754
- * @param {MdastNode|PositionLike|null|undefined} node mdast node or unist position
21755
- * @param {string} tagName HTML tag name
21756
- * @param {Array<Content>?} [children] hast content
21631
+ * @param {MdastNode|PositionLike|null|undefined} node
21632
+ * mdast node or unist position.
21633
+ * @param {string} tagName
21634
+ * HTML tag name.
21635
+ * @param {Array<Content>?} [children]
21636
+ * hast content
21757
21637
  * @returns {Element}
21638
+ * Compiled element.
21758
21639
  *
21759
21640
  * @typedef HFields
21760
- * @property {boolean} dangerous Whether HTML is allowed
21761
- * @property {string} clobberPrefix Prefix to use to prevent DOM clobbering
21762
- * @property {string} footnoteLabel Label to use to introduce the footnote section
21763
- * @property {string} footnoteLabelTagName HTML used for the footnote label
21764
- * @property {Properties} footnoteLabelProperties properties on the HTML tag used for the footnote label
21765
- * @property {string} footnoteBackLabel Label to use to go back to a footnote call from the footnote section
21766
- * @property {(identifier: string) => Definition|null} definition Definition cache
21767
- * @property {Record<string, FootnoteDefinition>} footnoteById Footnote cache
21768
- * @property {Array<string>} footnoteOrder Order in which footnotes occur
21769
- * @property {Record<string, number>} footnoteCounts Counts the same footnote was used
21770
- * @property {Handlers} handlers Applied handlers
21771
- * @property {Handler} unknownHandler Handler for any none not in `passThrough` or otherwise handled
21772
- * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment Like `h` but lower-level and usable on non-elements.
21773
- * @property {Array<string>} passThrough List of node types to pass through untouched (except for their children).
21641
+ * @property {boolean} dangerous
21642
+ * Whether HTML is allowed.
21643
+ * @property {string} clobberPrefix
21644
+ * Prefix to use to prevent DOM clobbering.
21645
+ * @property {string} footnoteLabel
21646
+ * Label to use to introduce the footnote section.
21647
+ * @property {string} footnoteLabelTagName
21648
+ * HTML used for the footnote label.
21649
+ * @property {Properties} footnoteLabelProperties
21650
+ * Properties on the HTML tag used for the footnote label.
21651
+ * @property {string} footnoteBackLabel
21652
+ * Label to use to go back to a footnote call from the footnote section.
21653
+ * @property {(identifier: string) => Definition|null} definition
21654
+ * Definition cache.
21655
+ * @property {Record<string, FootnoteDefinition>} footnoteById
21656
+ * Footnote cache.
21657
+ * @property {Array<string>} footnoteOrder
21658
+ * Order in which footnotes occur.
21659
+ * @property {Record<string, number>} footnoteCounts
21660
+ * Counts the same footnote was used.
21661
+ * @property {Handlers} handlers
21662
+ * Applied handlers.
21663
+ * @property {Handler} unknownHandler
21664
+ * Handler for any none not in `passThrough` or otherwise handled.
21665
+ * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment
21666
+ * Like `h` but lower-level and usable on non-elements.
21667
+ * @property {Array<string>} passThrough
21668
+ * List of node types to pass through untouched (except for their children).
21774
21669
  *
21775
21670
  * @typedef Options
21671
+ * Configuration (optional).
21776
21672
  * @property {boolean} [allowDangerousHtml=false]
21777
- * Whether to allow `html` nodes and inject them as `raw` HTML
21673
+ * Whether to allow `html` nodes and inject them as `raw` HTML.
21778
21674
  * @property {string} [clobberPrefix='user-content-']
21779
21675
  * Prefix to use before the `id` attribute to prevent it from *clobbering*.
21780
21676
  * attributes.
@@ -21794,7 +21690,7 @@ function ignore() {
21794
21690
  * @property {string} [footnoteLabelTagName='h2']
21795
21691
  * HTML tag to use for the footnote label.
21796
21692
  * Can be changed to match your document structure and play well with your choice of css.
21797
- * @property {Properties} [footnoteLabelProperties={id: 'footnote-label', className: ['sr-only']}]
21693
+ * @property {Properties} [footnoteLabelProperties={className: ['sr-only']}]
21798
21694
  * Properties to use on the footnote label.
21799
21695
  * A 'sr-only' class is added by default to hide this from sighted users.
21800
21696
  * Change it to make the label visible, or add classes for other purposes.
@@ -21827,10 +21723,14 @@ function ignore() {
21827
21723
  const mdast_util_to_hast_lib_own = {}.hasOwnProperty
21828
21724
 
21829
21725
  /**
21830
- * Factory to transform.
21831
- * @param {MdastNode} tree mdast node
21832
- * @param {Options} [options] Configuration
21833
- * @returns {H} `h` function
21726
+ * Turn mdast into hast.
21727
+ *
21728
+ * @param {MdastNode} tree
21729
+ * mdast node.
21730
+ * @param {Options} [options]
21731
+ * Configuration (optional).
21732
+ * @returns {H}
21733
+ * `h` function.
21834
21734
  */
21835
21735
  function factory(tree, options) {
21836
21736
  const settings = options || {}
@@ -21846,7 +21746,6 @@ function factory(tree, options) {
21846
21746
  h.footnoteLabel = settings.footnoteLabel || 'Footnotes'
21847
21747
  h.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'
21848
21748
  h.footnoteLabelProperties = settings.footnoteLabelProperties || {
21849
- id: 'footnote-label',
21850
21749
  className: ['sr-only']
21851
21750
  }
21852
21751
  h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'
@@ -21876,6 +21775,7 @@ function factory(tree, options) {
21876
21775
 
21877
21776
  /**
21878
21777
  * Finalise the created `right`, a hast node, from `left`, an mdast node.
21778
+ *
21879
21779
  * @param {(NodeWithData|PositionLike)?} left
21880
21780
  * @param {Content} right
21881
21781
  * @returns {Content}
@@ -62653,6 +62553,44 @@ function _createClass(Constructor, protoProps, staticProps) {
62653
62553
  });
62654
62554
  return Constructor;
62655
62555
  }
62556
+ ;// CONCATENATED MODULE: ./src/utils/InsertTextAtPosition.ts
62557
+ /**
62558
+ * The MIT License
62559
+ * Copyright (c) 2018 Dmitriy Kubyshkin
62560
+ * Copied from https://github.com/grassator/insert-text-at-cursor
62561
+ */var browserSupportsTextareaTextNodes;/**
62562
+ * @param {HTMLElement} input
62563
+ * @return {boolean}
62564
+ */function canManipulateViaTextNodes(input){if(input.nodeName!=='TEXTAREA'){return false;}if(typeof browserSupportsTextareaTextNodes==='undefined'){var textarea=document.createElement('textarea');textarea.value='1';browserSupportsTextareaTextNodes=!!textarea.firstChild;}return browserSupportsTextareaTextNodes;}/**
62565
+ * @param {string} val
62566
+ * @param {number} cursorIdx
62567
+ * @param {HTMLTextAreaElement|HTMLInputElement} input
62568
+ * @return {void}
62569
+ */var insertAtLineStart=function insertAtLineStart(val,cursorIdx,input){var content=input.value;var startIdx=0;while(cursorIdx--){var _char=content[cursorIdx];if(_char==='\n'){startIdx=cursorIdx+1;break;}}input.focus();input.setRangeText(val,startIdx,startIdx);input.dispatchEvent(new Event('input',{bubbles:true}));};/**
62570
+ * @param {HTMLTextAreaElement|HTMLInputElement} input
62571
+ * @param {string} text
62572
+ * @returns {void}
62573
+ */function insertTextAtPosition(input,text){// Most of the used APIs only work with the field selected
62574
+ input.focus();// IE 8-10
62575
+ if(document.selection){var ieRange=document.selection.createRange();ieRange.text=text;// Move cursor after the inserted text
62576
+ ieRange.collapse(false/* to the end */);ieRange.select();return;}// Webkit + Edge
62577
+ var isSuccess=document.execCommand&&document.execCommand('insertText',false,text);if(!isSuccess){var start=input.selectionStart;var end=input.selectionEnd;// Firefox (non-standard method)
62578
+ if(typeof input.setRangeText==='function'){input.setRangeText(text);}else{// To make a change we just need a Range, not a Selection
62579
+ var range=document.createRange();var textNode=document.createTextNode(text);if(canManipulateViaTextNodes(input)){var node=input.firstChild;// If textarea is empty, just insert the text
62580
+ if(!node){input.appendChild(textNode);}else{// Otherwise we need to find a nodes for start and end
62581
+ var offset=0;var startNode=null;var endNode=null;while(node&&(startNode===null||endNode===null)){var nodeLength=node.nodeValue.length;// if start of the selection falls into current node
62582
+ if(start>=offset&&start<=offset+nodeLength){range.setStart(startNode=node,start-offset);}// if end of the selection falls into current node
62583
+ if(end>=offset&&end<=offset+nodeLength){range.setEnd(endNode=node,end-offset);}offset+=nodeLength;node=node.nextSibling;}// If there is some text selected, remove it as we should replace it
62584
+ if(start!==end){range.deleteContents();}}}// If the node is a textarea and the range doesn't span outside the element
62585
+ //
62586
+ // Get the commonAncestorContainer of the selected range and test its type
62587
+ // If the node is of type `#text` it means that we're still working with text nodes within our textarea element
62588
+ // otherwise, if it's of type `#document` for example it means our selection spans outside the textarea.
62589
+ if(canManipulateViaTextNodes(input)&&range.commonAncestorContainer.nodeName==='#text'){// Finally insert a new node. The browser will automatically split start and end nodes into two if necessary
62590
+ range.insertNode(textNode);}else{// If the node is not a textarea or the range spans outside a textarea the only way is to replace the whole value
62591
+ var value=input.value;input.value=value.slice(0,start)+text+value.slice(end);}}// Correct the cursor position to be at the end of the insertion
62592
+ input.setSelectionRange(start+text.length,start+text.length);// Notify any possible listeners of the change
62593
+ var e=document.createEvent('UIEvent');e.initEvent('input',true,false);input.dispatchEvent(e);}}
62656
62594
  ;// CONCATENATED MODULE: ./src/utils/markdownUtils.ts
62657
62595
  function selectWord(_ref){var text=_ref.text,selection=_ref.selection;if(text&&text.length&&selection.start===selection.end){// the user is pointing to a word
62658
62596
  return getSurroundingWord(text,selection.start);}return selection;}/**
@@ -62677,23 +62615,41 @@ var end=text.length;// iterate to the left
62677
62615
  for(var i=position;i-1>-1;i--){if(isWordDelimiter(text[i-1])){start=i;break;}}// iterate to the right
62678
62616
  for(var _i=position;_i<text.length;_i++){if(isWordDelimiter(text[_i])){end=_i;break;}}return{start:start,end:end};}
62679
62617
  ;// CONCATENATED MODULE: ./src/commands/bold.tsx
62680
- var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',buttonProps:{'aria-label':'Add bold text',title:'Add bold text'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62618
+ var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',value:'**',buttonProps:{'aria-label':'Add bold text (ctrl + b)',title:'Add bold text (ctrl + b)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62681
62619
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
62682
62620
  var state2=api.replaceSelection("**".concat(state1.selectedText,"**"));// Adjust the selection to not contain the **
62683
62621
  api.setSelectionRange({start:state2.selection.end-2-state1.selectedText.length,end:state2.selection.end-2});}};
62684
62622
  ;// CONCATENATED MODULE: ./src/commands/code.tsx
62685
- var code_code={name:'code',keyCommand:'code',shortcuts:'ctrlcmd+j',buttonProps:{'aria-label':'Insert code',title:'Insert code'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",role:"img",viewBox:"0 0 640 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"})}),execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
62623
+ var code_code={name:'code',keyCommand:'code',shortcuts:'ctrlcmd+j',value:'``',buttonProps:{'aria-label':'Insert code (ctrl + j)',title:'Insert code (ctrl + j)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",role:"img",viewBox:"0 0 640 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"})}),execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
62686
62624
  var newSelectionRange=selectWord({text:tate.text,selection:tate.selection});var state1=api.setSelectionRange(newSelectionRange);// when there's no breaking line
62687
62625
  if(state1.selectedText.indexOf('\n')===-1){api.replaceSelection("`".concat(state1.selectedText,"`"));// Adjust the selection to not contain the **
62688
- var _selectionStart=state1.selection.start+1;var _selectionEnd=_selectionStart+state1.selectedText.length;api.setSelectionRange({start:_selectionStart,end:_selectionEnd});return;}var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');api.replaceSelection("".concat(breaksBefore,"```\n").concat(state1.selectedText,"\n```").concat(breaksAfter));var selectionStart=state1.selection.start+breaksBeforeCount+4;var selectionEnd=selectionStart+state1.selectedText.length;api.setSelectionRange({start:selectionStart,end:selectionEnd});}};var codeBlock={name:'codeBlock',keyCommand:'codeBlock',shortcuts:'ctrlcmd+shift+j',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",role:"img",viewBox:"0 0 156 156",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M110.85 120.575 43.7 120.483333 43.7083334 110.091667 110.85 110.191667 110.841667 120.583333 110.85 120.575ZM85.1333334 87.1916666 43.625 86.7083332 43.7083334 76.3166666 85.2083334 76.7916666 85.1333334 87.1916666 85.1333334 87.1916666ZM110.841667 53.4166666 43.7 53.3166666 43.7083334 42.925 110.85 43.025 110.841667 53.4166666ZM36 138C27.2916666 138 20.75 136.216667 16.4 132.666667 12.1333334 129.2 10 124.308333 10 118L10 95.3333332C10 91.0666666 9.25 88.1333332 7.7333334 86.5333332 6.3166668 84.8416666 3.7333334 84 0 84L0 72C3.7333334 72 6.3083334 71.2 7.7333334 69.6 9.2416668 67.9083334 10 64.9333334 10 60.6666666L10 38C10 31.775 12.1333334 26.8833334 16.4 23.3333332 20.7583334 19.7749998 27.2916666 18 36 18L40.6666668 18 40.6666668 30 36 30C34.0212222 29.9719277 32.1263151 30.7979128 30.8 32.2666666 29.3605875 33.8216362 28.5938182 35.8823287 28.6666668 38L28.6666668 60.6666666C28.6666668 67.5083332 26.6666668 72.4 22.6666668 75.3333332 20.9317416 76.7274684 18.8640675 77.6464347 16.6666668 78 18.8916668 78.35 20.8916668 79.2416666 22.6666668 80.6666666 26.6666668 83.95 28.6666668 88.8416666 28.6666668 95.3333332L28.6666668 118C28.6666668 120.308333 29.3750002 122.216667 30.8 123.733333 32.2166666 125.241667 33.9583334 126 36 126L40.6666668 126 40.6666668 138 36 138 36 138ZM114.116667 126 118.783333 126C120.833333 126 122.566667 125.241667 123.983333 123.733333 125.422746 122.178364 126.189515 120.117671 126.116667 118L126.116667 95.3333332C126.116667 88.8333332 128.116667 83.9499998 132.116667 80.6666666 133.9 79.2416666 135.9 78.35 138.116667 78 135.919156 77.6468047 133.851391 76.7277979 132.116667 75.3333332 128.116667 72.3999998 126.116667 67.5 126.116667 60.6666666L126.116667 38C126.189515 35.8823287 125.422746 33.8216361 123.983333 32.2666666 122.657018 30.7979128 120.762111 29.9719277 118.783333 30L114.116667 30 114.116667 18 118.783333 18C127.5 18 133.983333 19.775 138.25 23.3333332 142.608333 26.8833332 144.783333 31.7749998 144.783333 38L144.783333 60.6666666C144.783333 64.9333332 145.5 67.9083332 146.916667 69.6 148.433333 71.2 151.05 72 154.783333 72L154.783333 84C151.05 84 148.433333 84.8333334 146.916667 86.5333332 145.5 88.1333332 144.783333 91.0666666 144.783333 95.3333332L144.783333 118C144.783333 124.308333 142.616667 129.2 138.25 132.666667 133.983333 136.216667 127.5 138 118.783333 138L114.116667 138 114.116667 126 114.116667 126Z"})}),buttonProps:{'aria-label':'Insert Code Block',title:'Insert Code Block'},execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
62626
+ var _selectionStart=state1.selection.start+1;var _selectionEnd=_selectionStart+state1.selectedText.length;api.setSelectionRange({start:_selectionStart,end:_selectionEnd});return;}var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');api.replaceSelection("".concat(breaksBefore,"```\n").concat(state1.selectedText,"\n```").concat(breaksAfter));var selectionStart=state1.selection.start+breaksBeforeCount+4;var selectionEnd=selectionStart+state1.selectedText.length;api.setSelectionRange({start:selectionStart,end:selectionEnd});}};var codeBlock={name:'codeBlock',keyCommand:'codeBlock',shortcuts:'ctrlcmd+shift+j',value:'```\n```',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",role:"img",viewBox:"0 0 156 156",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M110.85 120.575 43.7 120.483333 43.7083334 110.091667 110.85 110.191667 110.841667 120.583333 110.85 120.575ZM85.1333334 87.1916666 43.625 86.7083332 43.7083334 76.3166666 85.2083334 76.7916666 85.1333334 87.1916666 85.1333334 87.1916666ZM110.841667 53.4166666 43.7 53.3166666 43.7083334 42.925 110.85 43.025 110.841667 53.4166666ZM36 138C27.2916666 138 20.75 136.216667 16.4 132.666667 12.1333334 129.2 10 124.308333 10 118L10 95.3333332C10 91.0666666 9.25 88.1333332 7.7333334 86.5333332 6.3166668 84.8416666 3.7333334 84 0 84L0 72C3.7333334 72 6.3083334 71.2 7.7333334 69.6 9.2416668 67.9083334 10 64.9333334 10 60.6666666L10 38C10 31.775 12.1333334 26.8833334 16.4 23.3333332 20.7583334 19.7749998 27.2916666 18 36 18L40.6666668 18 40.6666668 30 36 30C34.0212222 29.9719277 32.1263151 30.7979128 30.8 32.2666666 29.3605875 33.8216362 28.5938182 35.8823287 28.6666668 38L28.6666668 60.6666666C28.6666668 67.5083332 26.6666668 72.4 22.6666668 75.3333332 20.9317416 76.7274684 18.8640675 77.6464347 16.6666668 78 18.8916668 78.35 20.8916668 79.2416666 22.6666668 80.6666666 26.6666668 83.95 28.6666668 88.8416666 28.6666668 95.3333332L28.6666668 118C28.6666668 120.308333 29.3750002 122.216667 30.8 123.733333 32.2166666 125.241667 33.9583334 126 36 126L40.6666668 126 40.6666668 138 36 138 36 138ZM114.116667 126 118.783333 126C120.833333 126 122.566667 125.241667 123.983333 123.733333 125.422746 122.178364 126.189515 120.117671 126.116667 118L126.116667 95.3333332C126.116667 88.8333332 128.116667 83.9499998 132.116667 80.6666666 133.9 79.2416666 135.9 78.35 138.116667 78 135.919156 77.6468047 133.851391 76.7277979 132.116667 75.3333332 128.116667 72.3999998 126.116667 67.5 126.116667 60.6666666L126.116667 38C126.189515 35.8823287 125.422746 33.8216361 123.983333 32.2666666 122.657018 30.7979128 120.762111 29.9719277 118.783333 30L114.116667 30 114.116667 18 118.783333 18C127.5 18 133.983333 19.775 138.25 23.3333332 142.608333 26.8833332 144.783333 31.7749998 144.783333 38L144.783333 60.6666666C144.783333 64.9333332 145.5 67.9083332 146.916667 69.6 148.433333 71.2 151.05 72 154.783333 72L154.783333 84C151.05 84 148.433333 84.8333334 146.916667 86.5333332 145.5 88.1333332 144.783333 91.0666666 144.783333 95.3333332L144.783333 118C144.783333 124.308333 142.616667 129.2 138.25 132.666667 133.983333 136.216667 127.5 138 118.783333 138L114.116667 138 114.116667 126 114.116667 126Z"})}),buttonProps:{'aria-label':'Insert Code Block (ctrl + shift + j)',title:'Insert Code Block (ctrl + shift +j)'},execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
62689
62627
  var newSelectionRange=selectWord({text:tate.text,selection:tate.selection});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');api.replaceSelection("".concat(breaksBefore,"```\n").concat(state1.selectedText,"\n```").concat(breaksAfter));var selectionStart=state1.selection.start+breaksBeforeCount+4;var selectionEnd=selectionStart+state1.selectedText.length;api.setSelectionRange({start:selectionStart,end:selectionEnd});}};
62628
+ ;// CONCATENATED MODULE: ./src/commands/comment.tsx
62629
+ var commands_comment_comment={name:'comment',keyCommand:'comment',shortcuts:'ctrlcmd+/',value:'<!-- -->',buttonProps:{'aria-label':'Insert comment (ctrl + /)',title:'Insert comment (ctrl + /)'},execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62630
+ var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
62631
+ var state2=api.replaceSelection("<!-- ".concat(state1.selectedText," -->"));// Adjust the selection to not contain the **
62632
+ api.setSelectionRange({start:state2.selection.end-4-state1.selectedText.length,end:state2.selection.end-4});},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{role:"img",viewBox:"0 0 512 512",width:"12",height:"12",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z"})]})};
62633
+ ;// CONCATENATED MODULE: ./src/commands/divider.tsx
62634
+ var divider={keyCommand:'divider'};
62635
+ ;// CONCATENATED MODULE: ./src/commands/fullscreen.tsx
62636
+ var fullscreen={name:'fullscreen',keyCommand:'fullscreen',shortcuts:'ctrlcmd+0',value:'fullscreen',buttonProps:{'aria-label':'Toggle fullscreen (ctrl + 0)',title:'Toggle fullscreen (ctrl+ 0)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z"})}),execute:function execute(state,api,dispatch,executeCommandState){api.textArea.focus();if(dispatch&&executeCommandState&&executeCommandState.fullscreen){dispatch({fullscreen:false});}}};
62637
+ ;// CONCATENATED MODULE: ./src/commands/group.tsx
62638
+ var group=function group(arr,options){var data=_objectSpread2(_objectSpread2({children:arr,icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})}),execute:function execute(){}},options),{},{keyCommand:'group'});if(Array.isArray(data.children)){data.children=data.children.map(function(_ref){var item=Object.assign({},_ref);item.parent=data;return _objectSpread2({},item);});}return data;};
62639
+ ;// CONCATENATED MODULE: ./src/commands/hr.tsx
62640
+ var hr={name:'hr',keyCommand:'hr',shortcuts:'ctrlcmd+h',value:'----------',buttonProps:{'aria-label':'Insert HR (ctrl + h)',title:'Insert HR (ctrl + h)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 175 175",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M0,129 L175,129 L175,154 L0,154 L0,129 Z M3,9 L28.2158203,9 L28.2158203,47.9824219 L55.7695313,47.9824219 L55.7695313,9 L81.0966797,9 L81.0966797,107.185547 L55.7695313,107.185547 L55.7695313,68.0214844 L28.2158203,68.0214844 L28.2158203,107.185547 L3,107.185547 L3,9 Z M93.1855469,100.603516 L93.1855469,19 L135.211914,19 C143.004922,19 148.960917,19.6679621 153.080078,21.0039063 C157.199239,22.3398504 160.520495,24.8168764 163.043945,28.4350586 C165.567395,32.0532407 166.829102,36.459935 166.829102,41.6552734 C166.829102,46.1826398 165.864267,50.0883625 163.93457,53.3725586 C162.004873,56.6567547 159.351579,59.3193257 155.974609,61.3603516 C153.822255,62.6591862 150.872089,63.7353473 147.124023,64.5888672 C150.129898,65.5908253 152.319329,66.5927684 153.692383,67.5947266 C154.620122,68.2626987 155.965323,69.6913953 157.728027,71.8808594 C159.490731,74.0703234 160.668942,75.7587831 161.262695,76.9462891 L173,100.603516 L144.953125,100.603516 L131.482422,75.6660156 C129.775382,72.4374839 128.253913,70.3408251 126.917969,69.3759766 C125.0996,68.1142515 123.040051,67.4833984 120.739258,67.4833984 L118.512695,67.4833984 L118.512695,100.603516 L93.1855469,100.603516 Z M118.512695,52.0644531 L129.144531,52.0644531 C130.294928,52.0644531 132.521468,51.6933631 135.824219,50.9511719 C137.494149,50.6171858 138.857905,49.7636787 139.915527,48.390625 C140.97315,47.0175713 141.501953,45.4404386 141.501953,43.6591797 C141.501953,41.0244009 140.667001,39.0019602 138.99707,37.5917969 C137.32714,36.1816336 134.191429,35.4765625 129.589844,35.4765625 L117.512695,35.4765625 L118.512695,52.0644531 Z",transform:"translate(0 9)"})}),execute:function execute(state,api){api.replaceSelection("".concat(state.selectedText,"\n\n----------\n\n"));}};
62641
+ ;// CONCATENATED MODULE: ./src/commands/image.tsx
62642
+ var commands_image_image={name:'image',keyCommand:'image',shortcuts:'ctrlcmd+k',value:'![image]()',buttonProps:{'aria-label':'Add image (ctrl + k)',title:'Add image (ctrl + k)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 20 20",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15 9c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4-7H1c-.55 0-1 .45-1 1v14c0 .55.45 1 1 1h18c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 13l-6-5-2 2-4-5-4 8V4h16v11z"})}),execute:function execute(state,api){// Select everything
62643
+ var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the image
62644
+ var imageTemplate=state1.selectedText||'https://example.com/your-image.png';api.replaceSelection("![](".concat(imageTemplate,")"));// Adjust the selection to not contain the **
62645
+ api.setSelectionRange({start:4+state1.selection.start,end:4+state1.selection.start+imageTemplate.length});}};
62690
62646
  ;// CONCATENATED MODULE: ./src/commands/italic.tsx
62691
- var italic={name:'italic',keyCommand:'italic',shortcuts:'ctrlcmd+i',buttonProps:{'aria-label':'Add italic text',title:'Add italic text'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 320 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M204.758 416h-33.849l62.092-320h40.725a16 16 0 0 0 15.704-12.937l6.242-32C297.599 41.184 290.034 32 279.968 32H120.235a16 16 0 0 0-15.704 12.937l-6.242 32C96.362 86.816 103.927 96 113.993 96h33.846l-62.09 320H46.278a16 16 0 0 0-15.704 12.935l-6.245 32C22.402 470.815 29.967 480 40.034 480h158.479a16 16 0 0 0 15.704-12.935l6.245-32c1.927-9.88-5.638-19.065-15.704-19.065z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62647
+ var italic={name:'italic',keyCommand:'italic',shortcuts:'ctrlcmd+i',value:'* *',buttonProps:{'aria-label':'Add italic text (ctrl + i)',title:'Add italic text (ctrl + i)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 320 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M204.758 416h-33.849l62.092-320h40.725a16 16 0 0 0 15.704-12.937l6.242-32C297.599 41.184 290.034 32 279.968 32H120.235a16 16 0 0 0-15.704 12.937l-6.242 32C96.362 86.816 103.927 96 113.993 96h33.846l-62.09 320H46.278a16 16 0 0 0-15.704 12.935l-6.245 32C22.402 470.815 29.967 480 40.034 480h158.479a16 16 0 0 0 15.704-12.935l6.245-32c1.927-9.88-5.638-19.065-15.704-19.065z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62692
62648
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the italic mark up
62693
62649
  var state2=api.replaceSelection("*".concat(state1.selectedText,"*"));// Adjust the selection to not contain the *
62694
62650
  api.setSelectionRange({start:state2.selection.end-1-state1.selectedText.length,end:state2.selection.end-1});}};
62695
62651
  ;// CONCATENATED MODULE: ./src/commands/link.tsx
62696
- var commands_link_link={name:'link',keyCommand:'link',shortcuts:'ctrlcmd+k',buttonProps:{'aria-label':'Add a link',title:'Add a link'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M331.751196,182.121107 C392.438214,241.974735 391.605313,337.935283 332.11686,396.871226 C332.005129,396.991316 331.873084,397.121413 331.751196,397.241503 L263.493918,464.491645 C203.291404,523.80587 105.345257,523.797864 45.151885,464.491645 C-15.0506283,405.187427 -15.0506283,308.675467 45.151885,249.371249 L82.8416853,212.237562 C92.836501,202.39022 110.049118,208.9351 110.56511,222.851476 C111.223305,240.5867 114.451306,258.404985 120.407566,275.611815 C122.424812,281.438159 120.983487,287.882964 116.565047,292.23621 L103.272145,305.332975 C74.8052033,333.379887 73.9123737,379.047937 102.098973,407.369054 C130.563883,435.969378 177.350591,436.139505 206.033884,407.879434 L274.291163,340.6393 C302.9257,312.427264 302.805844,266.827265 274.291163,238.733318 C270.531934,235.036561 266.74528,232.16442 263.787465,230.157924 C259.544542,227.2873 256.928256,222.609848 256.731165,217.542518 C256.328935,206.967633 260.13184,196.070508 268.613213,187.714278 L289.998463,166.643567 C295.606326,161.118448 304.403592,160.439942 310.906317,164.911276 C318.353355,170.034591 325.328531,175.793397 331.751196,182.121107 Z M240.704978,55.4828366 L172.447607,122.733236 C172.325719,122.853326 172.193674,122.983423 172.081943,123.103513 C117.703294,179.334654 129.953294,261.569283 185.365841,328.828764 C191.044403,335.721376 198.762988,340.914712 206.209732,346.037661 C212.712465,350.509012 221.510759,349.829503 227.117615,344.305363 L248.502893,323.234572 C256.984277,314.87831 260.787188,303.981143 260.384957,293.406218 C260.187865,288.338869 257.571576,283.661398 253.328648,280.790763 C250.370829,278.78426 246.58417,275.912107 242.824936,272.215337 C214.310216,244.121282 206.209732,204.825874 229.906702,179.334654 L298.164073,112.094263 C326.847404,83.8340838 373.633159,84.0042113 402.099123,112.604645 C430.285761,140.92587 429.393946,186.594095 400.92595,214.641114 L387.63303,227.737929 C383.214584,232.091191 381.773257,238.536021 383.790506,244.362388 C389.746774,261.569283 392.974779,279.387637 393.632975,297.122928 C394.149984,311.039357 411.361608,317.584262 421.356437,307.736882 L459.046288,270.603053 C519.249898,211.29961 519.249898,114.787281 459.047304,55.4828366 C398.853851,-3.82360914 300.907572,-3.83161514 240.704978,55.4828366 Z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62652
+ var commands_link_link={name:'link',keyCommand:'link',shortcuts:'ctrlcmd+l',value:'[](url)',buttonProps:{'aria-label':'Add a link (ctrl + l)',title:'Add a link (ctrl + l)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M331.751196,182.121107 C392.438214,241.974735 391.605313,337.935283 332.11686,396.871226 C332.005129,396.991316 331.873084,397.121413 331.751196,397.241503 L263.493918,464.491645 C203.291404,523.80587 105.345257,523.797864 45.151885,464.491645 C-15.0506283,405.187427 -15.0506283,308.675467 45.151885,249.371249 L82.8416853,212.237562 C92.836501,202.39022 110.049118,208.9351 110.56511,222.851476 C111.223305,240.5867 114.451306,258.404985 120.407566,275.611815 C122.424812,281.438159 120.983487,287.882964 116.565047,292.23621 L103.272145,305.332975 C74.8052033,333.379887 73.9123737,379.047937 102.098973,407.369054 C130.563883,435.969378 177.350591,436.139505 206.033884,407.879434 L274.291163,340.6393 C302.9257,312.427264 302.805844,266.827265 274.291163,238.733318 C270.531934,235.036561 266.74528,232.16442 263.787465,230.157924 C259.544542,227.2873 256.928256,222.609848 256.731165,217.542518 C256.328935,206.967633 260.13184,196.070508 268.613213,187.714278 L289.998463,166.643567 C295.606326,161.118448 304.403592,160.439942 310.906317,164.911276 C318.353355,170.034591 325.328531,175.793397 331.751196,182.121107 Z M240.704978,55.4828366 L172.447607,122.733236 C172.325719,122.853326 172.193674,122.983423 172.081943,123.103513 C117.703294,179.334654 129.953294,261.569283 185.365841,328.828764 C191.044403,335.721376 198.762988,340.914712 206.209732,346.037661 C212.712465,350.509012 221.510759,349.829503 227.117615,344.305363 L248.502893,323.234572 C256.984277,314.87831 260.787188,303.981143 260.384957,293.406218 C260.187865,288.338869 257.571576,283.661398 253.328648,280.790763 C250.370829,278.78426 246.58417,275.912107 242.824936,272.215337 C214.310216,244.121282 206.209732,204.825874 229.906702,179.334654 L298.164073,112.094263 C326.847404,83.8340838 373.633159,84.0042113 402.099123,112.604645 C430.285761,140.92587 429.393946,186.594095 400.92595,214.641114 L387.63303,227.737929 C383.214584,232.091191 381.773257,238.536021 383.790506,244.362388 C389.746774,261.569283 392.974779,279.387637 393.632975,297.122928 C394.149984,311.039357 411.361608,317.584262 421.356437,307.736882 L459.046288,270.603053 C519.249898,211.29961 519.249898,114.787281 459.047304,55.4828366 C398.853851,-3.82360914 300.907572,-3.83161514 240.704978,55.4828366 Z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62697
62653
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
62698
62654
  var state2=api.replaceSelection("[".concat(state1.selectedText,"](url)"));// Adjust the selection to not contain the **
62699
62655
  api.setSelectionRange({start:state2.selection.end-6-state1.selectedText.length,end:state2.selection.end-6});}};
@@ -62703,90 +62659,34 @@ api.setSelectionRange({start:state2.selection.end-6-state1.selectedText.length,e
62703
62659
  */function insertBeforeEachLine(selectedText,insertBefore){var lines=selectedText.split(/\n/);var insertionLength=0;var modifiedText=lines.map(function(item,index){if(typeof insertBefore==='string'){insertionLength+=insertBefore.length;return insertBefore+item;}else if(typeof insertBefore==='function'){var insertionResult=insertBefore(item,index);insertionLength+=insertionResult.length;return insertBefore(item,index)+item;}throw Error('insertion is expected to be either a string or a function');}).join('\n');return{modifiedText:modifiedText,insertionLength:insertionLength};}var makeList=function makeList(state,api,insertBefore){// Adjust the selection to encompass the whole word if the caret is inside one
62704
62660
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');var modifiedText=insertBeforeEachLine(state1.selectedText,insertBefore);api.replaceSelection("".concat(breaksBefore).concat(modifiedText.modifiedText).concat(breaksAfter));// Specifically when the text has only one line, we can exclude the "- ", for example, from the selection
62705
62661
  var oneLinerOffset=state1.selectedText.indexOf('\n')===-1?modifiedText.insertionLength:0;var selectionStart=state1.selection.start+breaksBeforeCount+oneLinerOffset;var selectionEnd=selectionStart+modifiedText.modifiedText.length-oneLinerOffset;// Adjust the selection to not contain the **
62706
- api.setSelectionRange({start:selectionStart,end:selectionEnd});};var unorderedListCommand={name:'unordered-list',keyCommand:'list',shortcuts:'ctrl+shift+l',buttonProps:{'aria-label':'Add unordered list',title:'Add unordered list'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"unordered-list",width:"12",height:"12",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M96 96c0 26.51-21.49 48-48 48S0 122.51 0 96s21.49-48 48-48 48 21.49 48 48zM48 208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm0 160c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm96-236h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,'- ');}};var orderedListCommand={name:'ordered-list',keyCommand:'list',shortcuts:'ctrl+shift+o',buttonProps:{'aria-label':'Add ordered list',title:'Add ordered list'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"ordered-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M3.263 139.527c0-7.477 3.917-11.572 11.573-11.572h15.131V88.078c0-5.163.534-10.503.534-10.503h-.356s-1.779 2.67-2.848 3.738c-4.451 4.273-10.504 4.451-15.666-1.068l-5.518-6.231c-5.342-5.341-4.984-11.216.534-16.379l21.72-19.938C32.815 33.602 36.732 32 42.785 32H54.89c7.656 0 11.749 3.916 11.749 11.572v84.384h15.488c7.655 0 11.572 4.094 11.572 11.572v8.901c0 7.477-3.917 11.572-11.572 11.572H14.836c-7.656 0-11.573-4.095-11.573-11.572v-8.902zM2.211 304.591c0-47.278 50.955-56.383 50.955-69.165 0-7.18-5.954-8.755-9.28-8.755-3.153 0-6.479 1.051-9.455 3.852-5.079 4.903-10.507 7.004-16.111 2.451l-8.579-6.829c-5.779-4.553-7.18-9.805-2.803-15.409C13.592 201.981 26.025 192 47.387 192c19.437 0 44.476 10.506 44.476 39.573 0 38.347-46.753 46.402-48.679 56.909h39.049c7.529 0 11.557 4.027 11.557 11.382v8.755c0 7.354-4.028 11.382-11.557 11.382h-67.94c-7.005 0-12.083-4.028-12.083-11.382v-4.028zM5.654 454.61l5.603-9.28c3.853-6.654 9.105-7.004 15.584-3.152 4.903 2.101 9.63 3.152 14.359 3.152 10.155 0 14.358-3.502 14.358-8.23 0-6.654-5.604-9.106-15.934-9.106h-4.728c-5.954 0-9.28-2.101-12.258-7.88l-1.05-1.926c-2.451-4.728-1.226-9.806 2.801-14.884l5.604-7.004c6.829-8.405 12.257-13.483 12.257-13.483v-.35s-4.203 1.051-12.608 1.051H16.685c-7.53 0-11.383-4.028-11.383-11.382v-8.755c0-7.53 3.853-11.382 11.383-11.382h58.484c7.529 0 11.382 4.027 11.382 11.382v3.327c0 5.778-1.401 9.806-5.079 14.183l-17.509 20.137c19.611 5.078 28.716 20.487 28.716 34.845 0 21.363-14.358 44.126-48.503 44.126-16.636 0-28.192-4.728-35.896-9.455-5.779-4.202-6.304-9.805-2.626-15.934zM144 132h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"".concat(index+1,". ");});}};var checkedListCommand={name:'checked-list',keyCommand:'list',shortcuts:'ctrl+shift+c',buttonProps:{'aria-label':'Add checked list',title:'Add checked list'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"checked-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M208 132h288c8.8 0 16-7.2 16-16V76c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zM64 368c-26.5 0-48.6 21.5-48.6 48s22.1 48 48.6 48 48-21.5 48-48-21.5-48-48-48zm92.5-299l-72.2 72.2-15.6 15.6c-4.7 4.7-12.9 4.7-17.6 0L3.5 109.4c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.3c4.7-4.7 12.3-4.7 17 0l17 16.5c4.6 4.7 4.6 12.3-.1 17zm0 159.6l-72.2 72.2-15.7 15.7c-4.7 4.7-12.9 4.7-17.6 0L3.5 269c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.7c4.7-4.7 12.3-4.7 17 0l17 17c4.6 4.6 4.6 12.2-.1 16.9z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"- [ ] ";});}};
62662
+ api.setSelectionRange({start:selectionStart,end:selectionEnd});};var unorderedListCommand={name:'unordered-list',keyCommand:'list',shortcuts:'ctrl+shift+u',value:'- ',buttonProps:{'aria-label':'Add unordered list (ctrl + shift + u)',title:'Add unordered list (ctrl + shift + u)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"unordered-list",width:"12",height:"12",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M96 96c0 26.51-21.49 48-48 48S0 122.51 0 96s21.49-48 48-48 48 21.49 48 48zM48 208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm0 160c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm96-236h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,'- ');}};var orderedListCommand={name:'ordered-list',keyCommand:'list',shortcuts:'ctrl+shift+o',value:'1. ',buttonProps:{'aria-label':'Add ordered list (ctrl + shift + o)',title:'Add ordered list (ctrl + shift + o)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"ordered-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M3.263 139.527c0-7.477 3.917-11.572 11.573-11.572h15.131V88.078c0-5.163.534-10.503.534-10.503h-.356s-1.779 2.67-2.848 3.738c-4.451 4.273-10.504 4.451-15.666-1.068l-5.518-6.231c-5.342-5.341-4.984-11.216.534-16.379l21.72-19.938C32.815 33.602 36.732 32 42.785 32H54.89c7.656 0 11.749 3.916 11.749 11.572v84.384h15.488c7.655 0 11.572 4.094 11.572 11.572v8.901c0 7.477-3.917 11.572-11.572 11.572H14.836c-7.656 0-11.573-4.095-11.573-11.572v-8.902zM2.211 304.591c0-47.278 50.955-56.383 50.955-69.165 0-7.18-5.954-8.755-9.28-8.755-3.153 0-6.479 1.051-9.455 3.852-5.079 4.903-10.507 7.004-16.111 2.451l-8.579-6.829c-5.779-4.553-7.18-9.805-2.803-15.409C13.592 201.981 26.025 192 47.387 192c19.437 0 44.476 10.506 44.476 39.573 0 38.347-46.753 46.402-48.679 56.909h39.049c7.529 0 11.557 4.027 11.557 11.382v8.755c0 7.354-4.028 11.382-11.557 11.382h-67.94c-7.005 0-12.083-4.028-12.083-11.382v-4.028zM5.654 454.61l5.603-9.28c3.853-6.654 9.105-7.004 15.584-3.152 4.903 2.101 9.63 3.152 14.359 3.152 10.155 0 14.358-3.502 14.358-8.23 0-6.654-5.604-9.106-15.934-9.106h-4.728c-5.954 0-9.28-2.101-12.258-7.88l-1.05-1.926c-2.451-4.728-1.226-9.806 2.801-14.884l5.604-7.004c6.829-8.405 12.257-13.483 12.257-13.483v-.35s-4.203 1.051-12.608 1.051H16.685c-7.53 0-11.383-4.028-11.383-11.382v-8.755c0-7.53 3.853-11.382 11.383-11.382h58.484c7.529 0 11.382 4.027 11.382 11.382v3.327c0 5.778-1.401 9.806-5.079 14.183l-17.509 20.137c19.611 5.078 28.716 20.487 28.716 34.845 0 21.363-14.358 44.126-48.503 44.126-16.636 0-28.192-4.728-35.896-9.455-5.779-4.202-6.304-9.805-2.626-15.934zM144 132h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"".concat(index+1,". ");});}};var checkedListCommand={name:'checked-list',keyCommand:'list',shortcuts:'ctrl+shift+c',value:'- [x] ',buttonProps:{'aria-label':'Add checked list (ctrl + shift + c)',title:'Add checked list (ctrl + shift + c)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"checked-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M208 132h288c8.8 0 16-7.2 16-16V76c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zM64 368c-26.5 0-48.6 21.5-48.6 48s22.1 48 48.6 48 48-21.5 48-48-21.5-48-48-48zm92.5-299l-72.2 72.2-15.6 15.6c-4.7 4.7-12.9 4.7-17.6 0L3.5 109.4c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.3c4.7-4.7 12.3-4.7 17 0l17 16.5c4.6 4.7 4.6 12.3-.1 17zm0 159.6l-72.2 72.2-15.7 15.7c-4.7 4.7-12.9 4.7-17.6 0L3.5 269c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.7c4.7-4.7 12.3-4.7 17 0l17 17c4.6 4.6 4.6 12.2-.1 16.9z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"- [ ] ";});}};
62663
+ ;// CONCATENATED MODULE: ./src/commands/preview.tsx
62664
+ var codePreview={name:'preview',keyCommand:'preview',value:'preview',shortcuts:'ctrlcmd+9',buttonProps:{'aria-label':'Preview code (ctrl + 9)',title:'Preview code (ctrl + 9)'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413"})]}),execute:function execute(){}};var codeEdit={name:'edit',keyCommand:'preview',value:'edit',shortcuts:'ctrlcmd+7',buttonProps:{'aria-label':'Edit code (ctrl + 7)',title:'Edit code (ctrl + 7)'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413"})]}),execute:function execute(){}};var codeLive={name:'live',keyCommand:'preview',value:'live',shortcuts:'ctrlcmd+8',buttonProps:{'aria-label':'Live code (ctrl + 8)',title:'Live code (ctrl + 8)'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413"})]}),execute:function execute(){}};
62707
62665
  ;// CONCATENATED MODULE: ./src/commands/quote.tsx
62708
- var quote={name:'quote',keyCommand:'quote',shortcuts:'ctrlcmd+q',buttonProps:{'aria-label':'Insert a quote',title:'Insert a quote'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M520,95.75 L520,225.75 C520,364.908906 457.127578,437.050625 325.040469,472.443125 C309.577578,476.586875 294.396016,464.889922 294.396016,448.881641 L294.396016,414.457031 C294.396016,404.242891 300.721328,395.025078 310.328125,391.554687 C377.356328,367.342187 414.375,349.711094 414.375,274.5 L341.25,274.5 C314.325781,274.5 292.5,252.674219 292.5,225.75 L292.5,95.75 C292.5,68.8257812 314.325781,47 341.25,47 L471.25,47 C498.174219,47 520,68.8257812 520,95.75 Z M178.75,47 L48.75,47 C21.8257813,47 0,68.8257812 0,95.75 L0,225.75 C0,252.674219 21.8257813,274.5 48.75,274.5 L121.875,274.5 C121.875,349.711094 84.8563281,367.342187 17.828125,391.554687 C8.22132813,395.025078 1.89601563,404.242891 1.89601563,414.457031 L1.89601563,448.881641 C1.89601563,464.889922 17.0775781,476.586875 32.5404687,472.443125 C164.627578,437.050625 227.5,364.908906 227.5,225.75 L227.5,95.75 C227.5,68.8257812 205.674219,47 178.75,47 Z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62666
+ var quote={name:'quote',keyCommand:'quote',shortcuts:'ctrlcmd+q',buttonProps:{'aria-label':'Insert a quote (ctrl + q)',title:'Insert a quote (ctrl + q)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M520,95.75 L520,225.75 C520,364.908906 457.127578,437.050625 325.040469,472.443125 C309.577578,476.586875 294.396016,464.889922 294.396016,448.881641 L294.396016,414.457031 C294.396016,404.242891 300.721328,395.025078 310.328125,391.554687 C377.356328,367.342187 414.375,349.711094 414.375,274.5 L341.25,274.5 C314.325781,274.5 292.5,252.674219 292.5,225.75 L292.5,95.75 C292.5,68.8257812 314.325781,47 341.25,47 L471.25,47 C498.174219,47 520,68.8257812 520,95.75 Z M178.75,47 L48.75,47 C21.8257813,47 0,68.8257812 0,95.75 L0,225.75 C0,252.674219 21.8257813,274.5 48.75,274.5 L121.875,274.5 C121.875,349.711094 84.8563281,367.342187 17.828125,391.554687 C8.22132813,395.025078 1.89601563,404.242891 1.89601563,414.457031 L1.89601563,448.881641 C1.89601563,464.889922 17.0775781,476.586875 32.5404687,472.443125 C164.627578,437.050625 227.5,364.908906 227.5,225.75 L227.5,95.75 C227.5,68.8257812 205.674219,47 178.75,47 Z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62709
62667
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');// Replaces the current selection with the quote mark up
62710
62668
  api.replaceSelection("".concat(breaksBefore,"> ").concat(state1.selectedText).concat(breaksAfter));var selectionStart=state1.selection.start+breaksBeforeCount+2;var selectionEnd=selectionStart+state1.selectedText.length;api.setSelectionRange({start:selectionStart,end:selectionEnd});}};
62711
- ;// CONCATENATED MODULE: ./src/commands/hr.tsx
62712
- var hr={name:'hr',keyCommand:'hr',shortcuts:'ctrlcmd+h',buttonProps:{'aria-label':'Insert HR',title:'Insert HR'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 175 175",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M0,129 L175,129 L175,154 L0,154 L0,129 Z M3,9 L28.2158203,9 L28.2158203,47.9824219 L55.7695313,47.9824219 L55.7695313,9 L81.0966797,9 L81.0966797,107.185547 L55.7695313,107.185547 L55.7695313,68.0214844 L28.2158203,68.0214844 L28.2158203,107.185547 L3,107.185547 L3,9 Z M93.1855469,100.603516 L93.1855469,19 L135.211914,19 C143.004922,19 148.960917,19.6679621 153.080078,21.0039063 C157.199239,22.3398504 160.520495,24.8168764 163.043945,28.4350586 C165.567395,32.0532407 166.829102,36.459935 166.829102,41.6552734 C166.829102,46.1826398 165.864267,50.0883625 163.93457,53.3725586 C162.004873,56.6567547 159.351579,59.3193257 155.974609,61.3603516 C153.822255,62.6591862 150.872089,63.7353473 147.124023,64.5888672 C150.129898,65.5908253 152.319329,66.5927684 153.692383,67.5947266 C154.620122,68.2626987 155.965323,69.6913953 157.728027,71.8808594 C159.490731,74.0703234 160.668942,75.7587831 161.262695,76.9462891 L173,100.603516 L144.953125,100.603516 L131.482422,75.6660156 C129.775382,72.4374839 128.253913,70.3408251 126.917969,69.3759766 C125.0996,68.1142515 123.040051,67.4833984 120.739258,67.4833984 L118.512695,67.4833984 L118.512695,100.603516 L93.1855469,100.603516 Z M118.512695,52.0644531 L129.144531,52.0644531 C130.294928,52.0644531 132.521468,51.6933631 135.824219,50.9511719 C137.494149,50.6171858 138.857905,49.7636787 139.915527,48.390625 C140.97315,47.0175713 141.501953,45.4404386 141.501953,43.6591797 C141.501953,41.0244009 140.667001,39.0019602 138.99707,37.5917969 C137.32714,36.1816336 134.191429,35.4765625 129.589844,35.4765625 L117.512695,35.4765625 L118.512695,52.0644531 Z",transform:"translate(0 9)"})}),execute:function execute(state,api){api.replaceSelection("".concat(state.selectedText,"\n\n----------\n\n"));}};
62713
- ;// CONCATENATED MODULE: ./src/utils/InsertTextAtPosition.ts
62714
- /**
62715
- * The MIT License
62716
- * Copyright (c) 2018 Dmitriy Kubyshkin
62717
- * Copied from https://github.com/grassator/insert-text-at-cursor
62718
- */var browserSupportsTextareaTextNodes;/**
62719
- * @param {HTMLElement} input
62720
- * @return {boolean}
62721
- */function canManipulateViaTextNodes(input){if(input.nodeName!=='TEXTAREA'){return false;}if(typeof browserSupportsTextareaTextNodes==='undefined'){var textarea=document.createElement('textarea');textarea.value='1';browserSupportsTextareaTextNodes=!!textarea.firstChild;}return browserSupportsTextareaTextNodes;}/**
62722
- * @param {string} val
62723
- * @param {number} cursorIdx
62724
- * @param {HTMLTextAreaElement|HTMLInputElement} input
62725
- * @return {void}
62726
- */var insertAtLineStart=function insertAtLineStart(val,cursorIdx,input){var content=input.value;var startIdx=0;while(cursorIdx--){var _char=content[cursorIdx];if(_char==='\n'){startIdx=cursorIdx+1;break;}}input.focus();input.setRangeText(val,startIdx,startIdx);input.dispatchEvent(new Event('input',{bubbles:true}));};/**
62727
- * @param {HTMLTextAreaElement|HTMLInputElement} input
62728
- * @param {string} text
62729
- * @returns {void}
62730
- */function insertTextAtPosition(input,text){// Most of the used APIs only work with the field selected
62731
- input.focus();// IE 8-10
62732
- if(document.selection){var ieRange=document.selection.createRange();ieRange.text=text;// Move cursor after the inserted text
62733
- ieRange.collapse(false/* to the end */);ieRange.select();return;}// Webkit + Edge
62734
- var isSuccess=document.execCommand&&document.execCommand('insertText',false,text);if(!isSuccess){var start=input.selectionStart;var end=input.selectionEnd;// Firefox (non-standard method)
62735
- if(typeof input.setRangeText==='function'){input.setRangeText(text);}else{// To make a change we just need a Range, not a Selection
62736
- var range=document.createRange();var textNode=document.createTextNode(text);if(canManipulateViaTextNodes(input)){var node=input.firstChild;// If textarea is empty, just insert the text
62737
- if(!node){input.appendChild(textNode);}else{// Otherwise we need to find a nodes for start and end
62738
- var offset=0;var startNode=null;var endNode=null;while(node&&(startNode===null||endNode===null)){var nodeLength=node.nodeValue.length;// if start of the selection falls into current node
62739
- if(start>=offset&&start<=offset+nodeLength){range.setStart(startNode=node,start-offset);}// if end of the selection falls into current node
62740
- if(end>=offset&&end<=offset+nodeLength){range.setEnd(endNode=node,end-offset);}offset+=nodeLength;node=node.nextSibling;}// If there is some text selected, remove it as we should replace it
62741
- if(start!==end){range.deleteContents();}}}// If the node is a textarea and the range doesn't span outside the element
62742
- //
62743
- // Get the commonAncestorContainer of the selected range and test its type
62744
- // If the node is of type `#text` it means that we're still working with text nodes within our textarea element
62745
- // otherwise, if it's of type `#document` for example it means our selection spans outside the textarea.
62746
- if(canManipulateViaTextNodes(input)&&range.commonAncestorContainer.nodeName==='#text'){// Finally insert a new node. The browser will automatically split start and end nodes into two if necessary
62747
- range.insertNode(textNode);}else{// If the node is not a textarea or the range spans outside a textarea the only way is to replace the whole value
62748
- var value=input.value;input.value=value.slice(0,start)+text+value.slice(end);}}// Correct the cursor position to be at the end of the insertion
62749
- input.setSelectionRange(start+text.length,start+text.length);// Notify any possible listeners of the change
62750
- var e=document.createEvent('UIEvent');e.initEvent('input',true,false);input.dispatchEvent(e);}}
62751
- ;// CONCATENATED MODULE: ./src/commands/title2.tsx
62752
- var title2={name:'title2',keyCommand:'title2',shortcuts:'ctrlcmd+2',buttonProps:{'aria-label':'Insert title2',title:'Insert title 2'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:16,textAlign:'left'},children:"Title 2"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('## ');}else{insertAtLineStart('## ',state.selection.start,api.textArea);}}};
62753
- ;// CONCATENATED MODULE: ./src/commands/title.tsx
62754
- var title=_objectSpread2(_objectSpread2({},title2),{},{icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})})});
62669
+ ;// CONCATENATED MODULE: ./src/commands/strikeThrough.tsx
62670
+ var strikeThrough_strikethrough={name:'strikethrough',keyCommand:'strikethrough',shortcuts:'ctrl+shift+x',buttonProps:{'aria-label':'Add strikethrough text (ctrl + shift + x)',title:'Add strikethrough text (ctrl + shift + x)'},value:'~~',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62671
+ var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the strikethrough mark up
62672
+ var state2=api.replaceSelection("~~".concat(state1.selectedText,"~~"));// Adjust the selection to not contain the ~~
62673
+ api.setSelectionRange({start:state2.selection.end-2-state1.selectedText.length,end:state2.selection.end-2});}};
62755
62674
  ;// CONCATENATED MODULE: ./src/commands/title1.tsx
62756
- var title1={name:'title1',keyCommand:'title1',shortcuts:'ctrlcmd+1',buttonProps:{'aria-label':'Insert title 1',title:'Insert title 1'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:18,textAlign:'left'},children:"Title 1"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('# ');}else{insertAtLineStart('# ',state.selection.start,api.textArea);}}};
62675
+ var title1={name:'title1',keyCommand:'title1',shortcuts:'ctrlcmd+1',value:'title1',buttonProps:{'aria-label':'Insert title1 (ctrl + 1)',title:'Insert title1 (ctrl + 1)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:18,textAlign:'left'},children:"Title 1"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('# ');}else{insertAtLineStart('# ',state.selection.start,api.textArea);}}};
62676
+ ;// CONCATENATED MODULE: ./src/commands/title.tsx
62677
+ var title=_objectSpread2(_objectSpread2({},title1),{},{icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})})});
62678
+ ;// CONCATENATED MODULE: ./src/commands/title2.tsx
62679
+ var title2={name:'title2',keyCommand:'title2',shortcuts:'ctrlcmd+2',value:'title2',buttonProps:{'aria-label':'Insert title2 (ctrl + 2)',title:'Insert title2 (ctrl + 2)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:16,textAlign:'left'},children:"Title 2"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('## ');}else{insertAtLineStart('## ',state.selection.start,api.textArea);}}};
62757
62680
  ;// CONCATENATED MODULE: ./src/commands/title3.tsx
62758
- var title3={name:'title3',keyCommand:'title3',shortcuts:'ctrlcmd+3',buttonProps:{'aria-label':'Insert title3',title:'Insert title 3'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:15,textAlign:'left'},children:"Title 3"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('### ');}else{insertAtLineStart('### ',state.selection.start,api.textArea);}}};
62681
+ var title3={name:'title3',keyCommand:'title3',shortcuts:'ctrlcmd+3',value:'title3',buttonProps:{'aria-label':'Insert title3 (ctrl + 3)',title:'Insert title3 (ctrl + 3)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:15,textAlign:'left'},children:"Title 3"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('### ');}else{insertAtLineStart('### ',state.selection.start,api.textArea);}}};
62759
62682
  ;// CONCATENATED MODULE: ./src/commands/title4.tsx
62760
- var title4={name:'title4',keyCommand:'title4',shortcuts:'ctrlcmd+4',buttonProps:{'aria-label':'Insert title4',title:'Insert title 4'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:14,textAlign:'left'},children:"Title 4"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('#### ');}else{insertAtLineStart('#### ',state.selection.start,api.textArea);}}};
62683
+ var title4={name:'title4',keyCommand:'title4',shortcuts:'ctrlcmd+4',value:'title4',buttonProps:{'aria-label':'Insert title4 (ctrl + 4)',title:'Insert title4 (ctrl + 4)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:14,textAlign:'left'},children:"Title 4"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('#### ');}else{insertAtLineStart('#### ',state.selection.start,api.textArea);}}};
62761
62684
  ;// CONCATENATED MODULE: ./src/commands/title5.tsx
62762
- var title5={name:'title5',keyCommand:'title5',shortcuts:'ctrlcmd+5',buttonProps:{'aria-label':'Insert title5',title:'Insert title 5'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 5"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('##### ');}else{insertAtLineStart('##### ',state.selection.start,api.textArea);}}};
62685
+ var title5={name:'title5',keyCommand:'title5',shortcuts:'ctrlcmd+5',value:'title5',buttonProps:{'aria-label':'Insert title5 (ctrl + 5)',title:'Insert title5 (ctrl + 5)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 5"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('##### ');}else{insertAtLineStart('##### ',state.selection.start,api.textArea);}}};
62763
62686
  ;// CONCATENATED MODULE: ./src/commands/title6.tsx
62764
- var title6={name:'title6',keyCommand:'title6',shortcuts:'ctrlcmd+6',buttonProps:{'aria-label':'Insert title6',title:'Insert title 6'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 6"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('###### ');}else{insertAtLineStart('###### ',state.selection.start,api.textArea);}}};
62765
- ;// CONCATENATED MODULE: ./src/commands/comment.tsx
62766
- var commands_comment_comment={name:'comment',keyCommand:'comment',shortcuts:'ctrlcmd+/',execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62767
- var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
62768
- var state2=api.replaceSelection("<!-- ".concat(state1.selectedText," -->"));// Adjust the selection to not contain the **
62769
- api.setSelectionRange({start:state2.selection.end-4-state1.selectedText.length,end:state2.selection.end-4});}};
62770
- ;// CONCATENATED MODULE: ./src/commands/group.tsx
62771
- var group=function group(arr,options){var data=_objectSpread2(_objectSpread2({children:arr,icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})}),execute:function execute(){}},options),{},{keyCommand:'group'});if(Array.isArray(data.children)){data.children=data.children.map(function(_ref){var item=Object.assign({},_ref);item.parent=data;return _objectSpread2({},item);});}return data;};
62772
- ;// CONCATENATED MODULE: ./src/commands/divider.tsx
62773
- var divider={keyCommand:'divider'};
62774
- ;// CONCATENATED MODULE: ./src/commands/preview.tsx
62775
- var codePreview={name:'preview',keyCommand:'preview',value:'preview',buttonProps:{'aria-label':'Preview code',title:'Preview code'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413"})]}),execute:function execute(){}};var codeEdit={name:'edit',keyCommand:'preview',value:'edit',buttonProps:{'aria-label':'Edit code',title:'Edit code'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413"})]}),execute:function execute(){}};var codeLive={name:'live',keyCommand:'preview',value:'live',buttonProps:{'aria-label':'Live code',title:'Live code'},icon:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293"}),/*#__PURE__*/(0,jsx_runtime.jsx)("polygon",{fill:"currentColor",points:"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413"})]}),execute:function execute(){}};
62776
- ;// CONCATENATED MODULE: ./src/commands/fullscreen.tsx
62777
- var fullscreen={name:'fullscreen',keyCommand:'fullscreen',shortcuts:'escape',buttonProps:{'aria-label':'fullscreen',title:'fullscreen'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z"})}),execute:function execute(state,api,dispatch,executeCommandState){api.textArea.focus();if(dispatch&&executeCommandState&&executeCommandState.fullscreen){dispatch({fullscreen:false});}}};
62778
- ;// CONCATENATED MODULE: ./src/commands/image.tsx
62779
- var commands_image_image={name:'image',keyCommand:'image',shortcuts:'ctrlcmd+i',buttonProps:{'aria-label':'Add image',title:'Add image'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 20 20",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15 9c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4-7H1c-.55 0-1 .45-1 1v14c0 .55.45 1 1 1h18c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 13l-6-5-2 2-4-5-4 8V4h16v11z"})}),execute:function execute(state,api){// Select everything
62780
- var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the image
62781
- var imageTemplate=state1.selectedText||'https://example.com/your-image.png';api.replaceSelection("![](".concat(imageTemplate,")"));// Adjust the selection to not contain the **
62782
- api.setSelectionRange({start:4+state1.selection.start,end:4+state1.selection.start+imageTemplate.length});}};
62783
- ;// CONCATENATED MODULE: ./src/commands/strikeThrough.tsx
62784
- var strikeThrough_strikethrough={name:'strikethrough',keyCommand:'strikethrough',shortcuts:'ctrl+shift+x',buttonProps:{'aria-label':'Add strikethrough text',title:'Add strikethrough text'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
62785
- var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the strikethrough mark up
62786
- var state2=api.replaceSelection("~~".concat(state1.selectedText,"~~"));// Adjust the selection to not contain the ~~
62787
- api.setSelectionRange({start:state2.selection.end-2-state1.selectedText.length,end:state2.selection.end-2});}};
62687
+ var title6={name:'title6',keyCommand:'title6',shortcuts:'ctrlcmd+6',value:'title6',buttonProps:{'aria-label':'Insert title6 (ctrl + 6)',title:'Insert title6 (ctrl + 6)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 6"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('###### ');}else{insertAtLineStart('###### ',state.selection.start,api.textArea);}}};
62788
62688
  ;// CONCATENATED MODULE: ./src/commands/index.ts
62789
- var commands_getCommands=function getCommands(){return[commands_comment_comment,bold,italic,strikeThrough_strikethrough,hr,title,divider,commands_link_link,quote,code_code,codeBlock,commands_image_image,divider,unorderedListCommand,orderedListCommand,checkedListCommand];};var getExtraCommands=function getExtraCommands(){return[codeEdit,codeLive,codePreview,divider,fullscreen];};function getStateFromTextArea(textArea){return{selection:{start:textArea.selectionStart,end:textArea.selectionEnd},text:textArea.value,selectedText:textArea.value.slice(textArea.selectionStart,textArea.selectionEnd)};}var TextAreaTextApi=/*#__PURE__*/function(){function TextAreaTextApi(textArea){_classCallCheck(this,TextAreaTextApi);this.textArea=void 0;this.textArea=textArea;}/**
62689
+ var commands_getCommands=function getCommands(){return[commands_comment_comment,bold,italic,strikeThrough_strikethrough,hr,group([title1,title2,title3,title4,title5,title6],{name:"title",groupName:"title",buttonProps:{"aria-label":"Insert title",title:"Insert title"}}),divider,commands_link_link,quote,code_code,codeBlock,commands_image_image,divider,unorderedListCommand,orderedListCommand,checkedListCommand];};var getExtraCommands=function getExtraCommands(){return[codeEdit,codeLive,codePreview,divider,fullscreen];};function getStateFromTextArea(textArea){return{selection:{start:textArea.selectionStart,end:textArea.selectionEnd},text:textArea.value,selectedText:textArea.value.slice(textArea.selectionStart,textArea.selectionEnd)};}var TextAreaTextApi=/*#__PURE__*/function(){function TextAreaTextApi(textArea){_classCallCheck(this,TextAreaTextApi);this.textArea=void 0;this.textArea=textArea;}/**
62790
62690
  * Replaces the current selection with the new text. This will make the new selectedText to be empty, the
62791
62691
  * selection start and selection end will be the same and will both point to the end
62792
62692
  * @param text Text that should replace the current selection