@uiw/react-md-editor 3.9.8 → 3.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mdeditor.js CHANGED
@@ -38128,22 +38128,7 @@ function _objectWithoutProperties(source, excluded) {
38128
38128
  // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
38129
38129
  var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(9787);
38130
38130
  var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
38131
- ;// CONCATENATED MODULE: ./node_modules/@uiw/react-markdown-preview/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
38132
- function objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(source, excluded) {
38133
- if (source == null) return {};
38134
- var target = {};
38135
- var sourceKeys = Object.keys(source);
38136
- var key, i;
38137
-
38138
- for (i = 0; i < sourceKeys.length; i++) {
38139
- key = sourceKeys[i];
38140
- if (excluded.indexOf(key) >= 0) continue;
38141
- target[key] = source[key];
38142
- }
38143
-
38144
- return target;
38145
- }
38146
- ;// CONCATENATED MODULE: ./node_modules/@uiw/react-markdown-preview/node_modules/@babel/runtime/helpers/esm/extends.js
38131
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
38147
38132
  function _extends() {
38148
38133
  _extends = Object.assign || function (target) {
38149
38134
  for (var i = 1; i < arguments.length; i++) {
@@ -49256,7 +49241,7 @@ function returnNode(h, node) {
49256
49241
  * @param {MdastNode} parent
49257
49242
  */
49258
49243
  function traverse_all(h, parent) {
49259
- /** @type {Array.<Content>} */
49244
+ /** @type {Array<Content>} */
49260
49245
  const values = []
49261
49246
 
49262
49247
  if ('children' in parent) {
@@ -49293,20 +49278,143 @@ function traverse_all(h, parent) {
49293
49278
  return values
49294
49279
  }
49295
49280
 
49296
- ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
49281
+ ;// CONCATENATED MODULE: ./node_modules/micromark-util-encode/index.js
49282
+ const characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'}
49283
+
49297
49284
  /**
49298
- * @typedef {import('mdast').ThematicBreak} ThematicBreak
49299
- * @typedef {import('hast').Element} Element
49300
- * @typedef {import('../index.js').Handler} Handler
49285
+ * Encode only the dangerous HTML characters.
49286
+ *
49287
+ * This ensures that certain characters which have special meaning in HTML are
49288
+ * dealt with.
49289
+ * Technically, we can skip `>` and `"` in many cases, but CM includes them.
49290
+ *
49291
+ * @param {string} value
49292
+ * @returns {string}
49301
49293
  */
49294
+ function encode(value) {
49295
+ return value.replace(/["&<>]/g, replace)
49296
+
49297
+ /**
49298
+ * @param {string} value
49299
+ * @returns {string}
49300
+ */
49301
+ function replace(value) {
49302
+ // @ts-expect-error Hush, it’s fine.
49303
+ return '&' + characterReferences[value] + ';'
49304
+ }
49305
+ }
49306
+
49307
+ ;// CONCATENATED MODULE: ./node_modules/micromark-util-sanitize-uri/index.js
49308
+
49309
+
49302
49310
 
49303
49311
  /**
49304
- * @type {Handler}
49305
- * @param {ThematicBreak} [node]
49306
- * @returns {Element}
49312
+ * Make a value safe for injection as a URL.
49313
+ *
49314
+ * This encodes unsafe characters with percent-encoding and skips already
49315
+ * encoded sequences (see `normalizeUri` below).
49316
+ * Further unsafe characters are encoded as character references (see
49317
+ * `micromark-util-encode`).
49318
+ *
49319
+ * Then, a regex of allowed protocols can be given, in which case the URL is
49320
+ * sanitized.
49321
+ * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`,
49322
+ * or `/^https?$/i` for `img[src]`.
49323
+ * If the URL includes an unknown protocol (one not matched by `protocol`, such
49324
+ * as a dangerous example, `javascript:`), the value is ignored.
49325
+ *
49326
+ * @param {string|undefined} url
49327
+ * @param {RegExp} [protocol]
49328
+ * @returns {string}
49307
49329
  */
49308
- function thematic_break_thematicBreak(h, node) {
49309
- return h(node, 'hr')
49330
+ function sanitizeUri(url, protocol) {
49331
+ const value = encode(normalizeUri(url || ''))
49332
+
49333
+ if (!protocol) {
49334
+ return value
49335
+ }
49336
+
49337
+ const colon = value.indexOf(':')
49338
+ const questionMark = value.indexOf('?')
49339
+ const numberSign = value.indexOf('#')
49340
+ const slash = value.indexOf('/')
49341
+
49342
+ if (
49343
+ // If there is no protocol, it’s relative.
49344
+ colon < 0 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
49345
+ (slash > -1 && colon > slash) ||
49346
+ (questionMark > -1 && colon > questionMark) ||
49347
+ (numberSign > -1 && colon > numberSign) || // It is a protocol, it should be allowed.
49348
+ protocol.test(value.slice(0, colon))
49349
+ ) {
49350
+ return value
49351
+ }
49352
+
49353
+ return ''
49354
+ }
49355
+ /**
49356
+ * Normalize a URL (such as used in definitions).
49357
+ *
49358
+ * Encode unsafe characters with percent-encoding, skipping already encoded
49359
+ * sequences.
49360
+ *
49361
+ * @param {string} value
49362
+ * @returns {string}
49363
+ */
49364
+
49365
+ function normalizeUri(value) {
49366
+ /** @type {string[]} */
49367
+ const result = []
49368
+ let index = -1
49369
+ let start = 0
49370
+ let skip = 0
49371
+
49372
+ while (++index < value.length) {
49373
+ const code = value.charCodeAt(index)
49374
+ /** @type {string} */
49375
+
49376
+ let replace = '' // A correct percent encoded value.
49377
+
49378
+ if (
49379
+ code === 37 &&
49380
+ asciiAlphanumeric(value.charCodeAt(index + 1)) &&
49381
+ asciiAlphanumeric(value.charCodeAt(index + 2))
49382
+ ) {
49383
+ skip = 2
49384
+ } // ASCII.
49385
+ else if (code < 128) {
49386
+ if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
49387
+ replace = String.fromCharCode(code)
49388
+ }
49389
+ } // Astral.
49390
+ else if (code > 55295 && code < 57344) {
49391
+ const next = value.charCodeAt(index + 1) // A correct surrogate pair.
49392
+
49393
+ if (code < 56320 && next > 56319 && next < 57344) {
49394
+ replace = String.fromCharCode(code, next)
49395
+ skip = 1
49396
+ } // Lone surrogate.
49397
+ else {
49398
+ replace = '\uFFFD'
49399
+ }
49400
+ } // Unicode.
49401
+ else {
49402
+ replace = String.fromCharCode(code)
49403
+ }
49404
+
49405
+ if (replace) {
49406
+ result.push(value.slice(start, index), encodeURIComponent(replace))
49407
+ start = index + skip + 1
49408
+ replace = ''
49409
+ }
49410
+
49411
+ if (skip) {
49412
+ index += skip
49413
+ skip = 0
49414
+ }
49415
+ }
49416
+
49417
+ return result.join('') + value.slice(start)
49310
49418
  }
49311
49419
 
49312
49420
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/wrap.js
@@ -49320,12 +49428,12 @@ function thematic_break_thematicBreak(h, node) {
49320
49428
  * Wrap `nodes` with line feeds between each entry.
49321
49429
  * Optionally adds line feeds at the start and end.
49322
49430
  *
49323
- * @param {Array.<Content>} nodes
49431
+ * @param {Array<Content>} nodes
49324
49432
  * @param {boolean} [loose=false]
49325
- * @returns {Array.<Content>}
49433
+ * @returns {Array<Content>}
49326
49434
  */
49327
49435
  function wrap_wrap(nodes, loose) {
49328
- /** @type {Array.<Content>} */
49436
+ /** @type {Array<Content>} */
49329
49437
  const result = []
49330
49438
  let index = -1
49331
49439
 
@@ -49345,59 +49453,12 @@ function wrap_wrap(nodes, loose) {
49345
49453
  return result
49346
49454
  }
49347
49455
 
49348
- ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/list.js
49349
- /**
49350
- * @typedef {import('mdast').List} List
49351
- * @typedef {import('hast').Element} Element
49352
- * @typedef {import('hast').Properties} Properties
49353
- * @typedef {import('../index.js').Handler} Handler
49354
- */
49355
-
49356
-
49357
-
49358
-
49359
- /**
49360
- * @type {Handler}
49361
- * @param {List} node
49362
- * @returns {Element}
49363
- */
49364
- function list_list(h, node) {
49365
- /** @type {Properties} */
49366
- const props = {}
49367
- const name = node.ordered ? 'ol' : 'ul'
49368
- const items = traverse_all(h, node)
49369
- let index = -1
49370
-
49371
- if (typeof node.start === 'number' && node.start !== 1) {
49372
- props.start = node.start
49373
- }
49374
-
49375
- // Like GitHub, add a class for custom styling.
49376
- while (++index < items.length) {
49377
- const item = items[index]
49378
-
49379
- if (
49380
- item.type === 'element' &&
49381
- item.tagName === 'li' &&
49382
- item.properties &&
49383
- Array.isArray(item.properties.className) &&
49384
- item.properties.className.includes('task-list-item')
49385
- ) {
49386
- props.className = ['contains-task-list']
49387
- break
49388
- }
49389
- }
49390
-
49391
- return h(node, name, props, wrap_wrap(items, true))
49392
- }
49393
-
49394
49456
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/footer.js
49395
49457
  /**
49396
49458
  * @typedef {import('mdast').BlockContent} BlockContent
49397
49459
  * @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition
49398
- * @typedef {import('mdast').Link} Link
49399
- * @typedef {import('mdast').ListItem} ListItem
49400
- * @typedef {import('mdast').Paragraph} Paragraph
49460
+ * @typedef {import('hast').Element} Element
49461
+ * @typedef {import('hast').ElementContent} ElementContent
49401
49462
  * @typedef {import('./index.js').H} H
49402
49463
  */
49403
49464
 
@@ -49405,67 +49466,118 @@ function list_list(h, node) {
49405
49466
 
49406
49467
 
49407
49468
 
49469
+
49408
49470
  /**
49409
49471
  * @param {H} h
49410
49472
  */
49411
49473
  function footer(h) {
49412
- const footnoteById = h.footnoteById
49413
- const footnoteOrder = h.footnoteOrder
49414
49474
  let index = -1
49415
- /** @type {Array.<ListItem>} */
49475
+ /** @type {Array<ElementContent>} */
49416
49476
  const listItems = []
49417
49477
 
49418
- while (++index < footnoteOrder.length) {
49419
- const def = footnoteById[footnoteOrder[index].toUpperCase()]
49478
+ while (++index < h.footnoteOrder.length) {
49479
+ const def = h.footnoteById[h.footnoteOrder[index].toUpperCase()]
49420
49480
 
49421
49481
  if (!def) {
49422
49482
  continue
49423
49483
  }
49424
49484
 
49425
- const marker = String(index + 1)
49426
- const content = [...def.children]
49427
- /** @type {Link} */
49428
- const backReference = {
49429
- type: 'link',
49430
- url: '#fnref' + marker,
49431
- data: {hProperties: {className: ['footnote-back'], role: 'doc-backlink'}},
49432
- children: [{type: 'text', value: '↩'}]
49485
+ const content = traverse_all(h, def)
49486
+ const id = String(def.identifier)
49487
+ const safeId = sanitizeUri(id.toLowerCase())
49488
+ let referenceIndex = 0
49489
+ /** @type {Array<ElementContent>} */
49490
+ const backReferences = []
49491
+
49492
+ while (++referenceIndex <= h.footnoteCounts[id]) {
49493
+ /** @type {Element} */
49494
+ const backReference = {
49495
+ type: 'element',
49496
+ tagName: 'a',
49497
+ properties: {
49498
+ href:
49499
+ '#' +
49500
+ h.clobberPrefix +
49501
+ 'fnref-' +
49502
+ safeId +
49503
+ (referenceIndex > 1 ? '-' + referenceIndex : ''),
49504
+ dataFootnoteBackref: true,
49505
+ className: ['data-footnote-backref'],
49506
+ ariaLabel: h.footnoteBackLabel
49507
+ },
49508
+ children: [{type: 'text', value: '↩'}]
49509
+ }
49510
+
49511
+ if (referenceIndex > 1) {
49512
+ backReference.children.push({
49513
+ type: 'element',
49514
+ tagName: 'sup',
49515
+ children: [{type: 'text', value: String(referenceIndex)}]
49516
+ })
49517
+ }
49518
+
49519
+ if (backReferences.length > 0) {
49520
+ backReferences.push({type: 'text', value: ' '})
49521
+ }
49522
+
49523
+ backReferences.push(backReference)
49433
49524
  }
49525
+
49434
49526
  const tail = content[content.length - 1]
49435
49527
 
49436
- if (tail && tail.type === 'paragraph') {
49437
- tail.children.push(backReference)
49528
+ if (tail && tail.type === 'element' && tail.tagName === 'p') {
49529
+ const tailTail = tail.children[tail.children.length - 1]
49530
+ if (tailTail && tailTail.type === 'text') {
49531
+ tailTail.value += ' '
49532
+ } else {
49533
+ tail.children.push({type: 'text', value: ' '})
49534
+ }
49535
+
49536
+ tail.children.push(...backReferences)
49438
49537
  } else {
49439
- // @ts-expect-error Indeed, link directly added in block content.
49440
- // Which we do because that way at least the handlers will be called
49441
- // for the other HTML we’re generating (as markdown).
49442
- content.push(backReference)
49538
+ content.push(...backReferences)
49443
49539
  }
49444
49540
 
49445
- listItems.push({
49446
- type: 'listItem',
49447
- data: {hProperties: {id: 'fn' + marker, role: 'doc-endnote'}},
49448
- children: content,
49449
- position: def.position
49450
- })
49541
+ /** @type {Element} */
49542
+ const listItem = {
49543
+ type: 'element',
49544
+ tagName: 'li',
49545
+ properties: {id: h.clobberPrefix + 'fn-' + safeId},
49546
+ children: wrap_wrap(content, true)
49547
+ }
49548
+
49549
+ if (def.position) {
49550
+ listItem.position = def.position
49551
+ }
49552
+
49553
+ listItems.push(listItem)
49451
49554
  }
49452
49555
 
49453
49556
  if (listItems.length === 0) {
49454
49557
  return null
49455
49558
  }
49456
49559
 
49457
- return h(
49458
- null,
49459
- 'section',
49460
- {className: ['footnotes'], role: 'doc-endnotes'},
49461
- wrap_wrap(
49462
- [
49463
- thematic_break_thematicBreak(h),
49464
- list_list(h, {type: 'list', ordered: true, children: listItems})
49465
- ],
49466
- true
49467
- )
49468
- )
49560
+ return {
49561
+ type: 'element',
49562
+ tagName: 'section',
49563
+ properties: {dataFootnotes: true, className: ['footnotes']},
49564
+ children: [
49565
+ {
49566
+ type: 'element',
49567
+ tagName: 'h2',
49568
+ properties: {id: 'footnote-label', className: ['sr-only']},
49569
+ children: [u('text', h.footnoteLabel)]
49570
+ },
49571
+ {type: 'text', value: '\n'},
49572
+ {
49573
+ type: 'element',
49574
+ tagName: 'ol',
49575
+ properties: {},
49576
+ children: wrap_wrap(listItems, true)
49577
+ },
49578
+ {type: 'text', value: '\n'}
49579
+ ]
49580
+ }
49469
49581
  }
49470
49582
 
49471
49583
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
@@ -49579,35 +49691,59 @@ function emphasis(h, node) {
49579
49691
 
49580
49692
 
49581
49693
 
49694
+
49582
49695
  /**
49583
49696
  * @type {Handler}
49584
49697
  * @param {FootnoteReference} node
49585
49698
  */
49586
49699
  function footnoteReference(h, node) {
49587
- const footnoteOrder = h.footnoteOrder
49588
- const identifier = String(node.identifier)
49589
- const index = footnoteOrder.indexOf(identifier)
49590
- const marker = String(
49591
- index === -1 ? footnoteOrder.push(identifier) : index + 1
49592
- )
49700
+ const id = String(node.identifier)
49701
+ const safeId = sanitizeUri(id.toLowerCase())
49702
+ const index = h.footnoteOrder.indexOf(id)
49703
+ /** @type {number} */
49704
+ let counter
49593
49705
 
49594
- return h(
49595
- node,
49596
- 'a',
49597
- {
49598
- href: '#fn' + marker,
49599
- className: ['footnote-ref'],
49600
- id: 'fnref' + marker,
49601
- role: 'doc-noteref'
49602
- },
49603
- [h(node.position, 'sup', [u('text', marker)])]
49604
- )
49706
+ if (index === -1) {
49707
+ h.footnoteOrder.push(id)
49708
+ h.footnoteCounts[id] = 1
49709
+ counter = h.footnoteOrder.length
49710
+ } else {
49711
+ h.footnoteCounts[id]++
49712
+ counter = index + 1
49713
+ }
49714
+
49715
+ const reuseCounter = h.footnoteCounts[id]
49716
+
49717
+ return h(node, 'sup', [
49718
+ h(
49719
+ node.position,
49720
+ 'a',
49721
+ {
49722
+ href: '#' + h.clobberPrefix + 'fn-' + safeId,
49723
+ id:
49724
+ h.clobberPrefix +
49725
+ 'fnref-' +
49726
+ safeId +
49727
+ (reuseCounter > 1 ? '-' + reuseCounter : ''),
49728
+ dataFootnoteRef: true,
49729
+ ariaDescribedBy: 'footnote-label'
49730
+ },
49731
+ [u('text', String(counter))]
49732
+ )
49733
+ ])
49605
49734
  }
49606
49735
 
49607
49736
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/footnote.js
49608
49737
  /**
49609
49738
  * @typedef {import('mdast').Footnote} Footnote
49610
49739
  * @typedef {import('../index.js').Handler} Handler
49740
+ *
49741
+ * @todo
49742
+ * `footnote` (or “inline note”) are a pandoc footnotes feature (`^[a note]`)
49743
+ * that does not exist in GFM.
49744
+ * We still have support for it, so that things remain working with
49745
+ * `micromark-extension-footnote` and `mdast-util-footnote`, but in the future
49746
+ * we might be able to remove it?
49611
49747
  */
49612
49748
 
49613
49749
 
@@ -49618,17 +49754,12 @@ function footnoteReference(h, node) {
49618
49754
  */
49619
49755
  function footnote(h, node) {
49620
49756
  const footnoteById = h.footnoteById
49621
- const footnoteOrder = h.footnoteOrder
49622
49757
  let no = 1
49623
49758
 
49624
49759
  while (no in footnoteById) no++
49625
49760
 
49626
49761
  const identifier = String(no)
49627
49762
 
49628
- // No need to check if `identifier` exists in `footnoteOrder`, it’s guaranteed
49629
- // to not exist because we just generated it.
49630
- footnoteOrder.push(identifier)
49631
-
49632
49763
  footnoteById[identifier] = {
49633
49764
  type: 'footnoteDefinition',
49634
49765
  identifier,
@@ -49678,7 +49809,7 @@ function html(h, node) {
49678
49809
  }
49679
49810
 
49680
49811
  // EXTERNAL MODULE: ./node_modules/mdurl/encode.js
49681
- var encode = __webpack_require__(4547);
49812
+ var mdurl_encode = __webpack_require__(4547);
49682
49813
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/revert.js
49683
49814
  /**
49684
49815
  * @typedef {import('mdast').LinkReference} LinkReference
@@ -49695,7 +49826,7 @@ var encode = __webpack_require__(4547);
49695
49826
  *
49696
49827
  * @type {Handler}
49697
49828
  * @param {ImageReference|LinkReference} node
49698
- * @returns {Content|Array.<Content>}
49829
+ * @returns {Content|Array<Content>}
49699
49830
  */
49700
49831
  function revert(h, node) {
49701
49832
  const subtype = node.referenceType
@@ -49753,7 +49884,7 @@ function imageReference(h, node) {
49753
49884
  }
49754
49885
 
49755
49886
  /** @type {Properties} */
49756
- const props = {src: encode(def.url || ''), alt: node.alt}
49887
+ const props = {src: mdurl_encode(def.url || ''), alt: node.alt}
49757
49888
 
49758
49889
  if (def.title !== null && def.title !== undefined) {
49759
49890
  props.title = def.title
@@ -49777,7 +49908,7 @@ function imageReference(h, node) {
49777
49908
  */
49778
49909
  function image_image(h, node) {
49779
49910
  /** @type {Properties} */
49780
- const props = {src: encode(node.url), alt: node.alt}
49911
+ const props = {src: mdurl_encode(node.url), alt: node.alt}
49781
49912
 
49782
49913
  if (node.title !== null && node.title !== undefined) {
49783
49914
  props.title = node.title
@@ -49825,7 +49956,7 @@ function linkReference(h, node) {
49825
49956
  }
49826
49957
 
49827
49958
  /** @type {Properties} */
49828
- const props = {href: encode(def.url || '')}
49959
+ const props = {href: mdurl_encode(def.url || '')}
49829
49960
 
49830
49961
  if (def.title !== null && def.title !== undefined) {
49831
49962
  props.title = def.title
@@ -49850,7 +49981,7 @@ function linkReference(h, node) {
49850
49981
  */
49851
49982
  function link_link(h, node) {
49852
49983
  /** @type {Properties} */
49853
- const props = {href: encode(node.url)}
49984
+ const props = {href: mdurl_encode(node.url)}
49854
49985
 
49855
49986
  if (node.title !== null && node.title !== undefined) {
49856
49987
  props.title = node.title
@@ -49882,7 +50013,7 @@ function listItem(h, node, parent) {
49882
50013
  const loose = parent ? listLoose(parent) : listItemLoose(node)
49883
50014
  /** @type {Properties} */
49884
50015
  const props = {}
49885
- /** @type {Array.<Content>} */
50016
+ /** @type {Array<Content>} */
49886
50017
  const wrapped = []
49887
50018
 
49888
50019
  if (typeof node.checked === 'boolean') {
@@ -49977,6 +50108,52 @@ function listItemLoose(node) {
49977
50108
  : spread
49978
50109
  }
49979
50110
 
50111
+ ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/list.js
50112
+ /**
50113
+ * @typedef {import('mdast').List} List
50114
+ * @typedef {import('hast').Element} Element
50115
+ * @typedef {import('hast').Properties} Properties
50116
+ * @typedef {import('../index.js').Handler} Handler
50117
+ */
50118
+
50119
+
50120
+
50121
+
50122
+ /**
50123
+ * @type {Handler}
50124
+ * @param {List} node
50125
+ * @returns {Element}
50126
+ */
50127
+ function list_list(h, node) {
50128
+ /** @type {Properties} */
50129
+ const props = {}
50130
+ const name = node.ordered ? 'ol' : 'ul'
50131
+ const items = traverse_all(h, node)
50132
+ let index = -1
50133
+
50134
+ if (typeof node.start === 'number' && node.start !== 1) {
50135
+ props.start = node.start
50136
+ }
50137
+
50138
+ // Like GitHub, add a class for custom styling.
50139
+ while (++index < items.length) {
50140
+ const item = items[index]
50141
+
50142
+ if (
50143
+ item.type === 'element' &&
50144
+ item.tagName === 'li' &&
50145
+ item.properties &&
50146
+ Array.isArray(item.properties.className) &&
50147
+ item.properties.className.includes('task-list-item')
50148
+ ) {
50149
+ props.className = ['contains-task-list']
50150
+ break
50151
+ }
50152
+ }
50153
+
50154
+ return h(node, name, props, wrap_wrap(items, true))
50155
+ }
50156
+
49980
50157
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
49981
50158
  /**
49982
50159
  * @typedef {import('mdast').Paragraph} Paragraph
@@ -50049,19 +50226,22 @@ function table(h, node) {
50049
50226
  const rows = node.children
50050
50227
  let index = -1
50051
50228
  const align = node.align || []
50052
- /** @type {Array.<Element>} */
50229
+ /** @type {Array<Element>} */
50053
50230
  const result = []
50054
50231
 
50055
50232
  while (++index < rows.length) {
50056
50233
  const row = rows[index].children
50057
50234
  const name = index === 0 ? 'th' : 'td'
50058
- let pos = node.align ? align.length : row.length
50059
- /** @type {Array.<Content>} */
50235
+ /** @type {Array<Content>} */
50060
50236
  const out = []
50237
+ let cellIndex = -1
50238
+ const length = node.align ? align.length : row.length
50061
50239
 
50062
- while (pos--) {
50063
- const cell = row[pos]
50064
- out[pos] = h(cell, name, {align: align[pos]}, cell ? traverse_all(h, cell) : [])
50240
+ while (++cellIndex < length) {
50241
+ const cell = row[cellIndex]
50242
+ out.push(
50243
+ h(cell, name, {align: align[cellIndex]}, cell ? traverse_all(h, cell) : [])
50244
+ )
50065
50245
  }
50066
50246
 
50067
50247
  result[index] = h(rows[index], 'tr', wrap_wrap(out, true))
@@ -50107,6 +50287,22 @@ function handlers_text_text(h, node) {
50107
50287
  )
50108
50288
  }
50109
50289
 
50290
+ ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
50291
+ /**
50292
+ * @typedef {import('mdast').ThematicBreak} ThematicBreak
50293
+ * @typedef {import('hast').Element} Element
50294
+ * @typedef {import('../index.js').Handler} Handler
50295
+ */
50296
+
50297
+ /**
50298
+ * @type {Handler}
50299
+ * @param {ThematicBreak} [node]
50300
+ * @returns {Element}
50301
+ */
50302
+ function thematic_break_thematicBreak(h, node) {
50303
+ return h(node, 'hr')
50304
+ }
50305
+
50110
50306
  ;// CONCATENATED MODULE: ./node_modules/mdast-util-to-hast/lib/handlers/index.js
50111
50307
 
50112
50308
 
@@ -50183,9 +50379,9 @@ function ignore() {
50183
50379
  * @typedef EmbeddedHastFields
50184
50380
  * @property {string} [hName] Defines the tag name of an element
50185
50381
  * @property {Properties} [hProperties] Defines the properties of an element
50186
- * @property {Array.<Content>} [hChildren] Defines the (hast) children of an element
50382
+ * @property {Array<Content>} [hChildren] Defines the (hast) children of an element
50187
50383
  *
50188
- * @typedef {Object.<string, unknown> & EmbeddedHastFields} Data unist data with embedded hast fields
50384
+ * @typedef {Record<string, unknown> & EmbeddedHastFields} Data unist data with embedded hast fields
50189
50385
  *
50190
50386
  * @typedef {MdastNode & {data?: Data}} NodeWithData unist node with embedded hast data
50191
50387
  *
@@ -50193,39 +50389,69 @@ function ignore() {
50193
50389
  * @param {H} h Handle context
50194
50390
  * @param {any} node mdast node to handle
50195
50391
  * @param {Parent|null} parent Parent of `node`
50196
- * @returns {Content|Array.<Content>|null|undefined} hast node
50392
+ * @returns {Content|Array<Content>|null|undefined} hast node
50197
50393
  *
50198
50394
  * @callback HFunctionProps
50199
50395
  * @param {MdastNode|PositionLike|null|undefined} node mdast node or unist position
50200
50396
  * @param {string} tagName HTML tag name
50201
50397
  * @param {Properties} props Properties
50202
- * @param {Array.<Content>?} [children] hast content
50398
+ * @param {Array<Content>?} [children] hast content
50203
50399
  * @returns {Element}
50204
50400
  *
50205
50401
  * @callback HFunctionNoProps
50206
50402
  * @param {MdastNode|PositionLike|null|undefined} node mdast node or unist position
50207
50403
  * @param {string} tagName HTML tag name
50208
- * @param {Array.<Content>?} [children] hast content
50404
+ * @param {Array<Content>?} [children] hast content
50209
50405
  * @returns {Element}
50210
50406
  *
50211
50407
  * @typedef HFields
50212
50408
  * @property {boolean} dangerous Whether HTML is allowed
50409
+ * @property {string} clobberPrefix Prefix to use to prevent DOM clobbering
50410
+ * @property {string} footnoteLabel Label to use to introduce the footnote section
50411
+ * @property {string} footnoteBackLabel Label to use to go back to a footnote call from the footnote section
50213
50412
  * @property {(identifier: string) => Definition|null} definition Definition cache
50214
- * @property {Object.<string, FootnoteDefinition>} footnoteById Footnote cache
50215
- * @property {Array.<string>} footnoteOrder Order in which footnotes occur
50413
+ * @property {Record<string, FootnoteDefinition>} footnoteById Footnote cache
50414
+ * @property {Array<string>} footnoteOrder Order in which footnotes occur
50415
+ * @property {Record<string, number>} footnoteCounts Counts the same footnote was used
50216
50416
  * @property {Handlers} handlers Applied handlers
50217
50417
  * @property {Handler} unknownHandler Handler for any none not in `passThrough` or otherwise handled
50218
50418
  * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment Like `h` but lower-level and usable on non-elements.
50219
- * @property {Array.<string>} passThrough List of node types to pass through untouched (except for their children).
50419
+ * @property {Array<string>} passThrough List of node types to pass through untouched (except for their children).
50220
50420
  *
50221
50421
  * @typedef Options
50222
- * @property {boolean} [allowDangerousHtml=false] Whether to allow `html` nodes and inject them as `raw` HTML
50223
- * @property {Handlers} [handlers] Object mapping mdast nodes to functions handling them
50224
- * @property {Array.<string>} [passThrough] List of custom mdast node types to pass through (keep) in hast
50225
- * @property {Handler} [unknownHandler] Handler for all unknown nodes.
50422
+ * @property {boolean} [allowDangerousHtml=false]
50423
+ * Whether to allow `html` nodes and inject them as `raw` HTML
50424
+ * @property {string} [clobberPrefix='user-content-']
50425
+ * Prefix to use before the `id` attribute to prevent it from *clobbering*.
50426
+ * attributes.
50427
+ * DOM clobbering is this:
50428
+ *
50429
+ * ```html
50430
+ * <p id=x></p>
50431
+ * <script>alert(x)</script>
50432
+ * ```
50433
+ *
50434
+ * Elements by their ID are made available in browsers on the `window` object.
50435
+ * Using a prefix prevents this from being a problem.
50436
+ * @property {string} [footnoteLabel='Footnotes']
50437
+ * Label to use for the footnotes section.
50438
+ * Affects screen reader users.
50439
+ * Change it if you’re authoring in a different language.
50440
+ * @property {string} [footnoteBackLabel='Back to content']
50441
+ * Label to use from backreferences back to their footnote call.
50442
+ * Affects screen reader users.
50443
+ * Change it if you’re authoring in a different language.
50444
+ * @property {Handlers} [handlers]
50445
+ * Object mapping mdast nodes to functions handling them
50446
+ * @property {Array<string>} [passThrough]
50447
+ * List of custom mdast node types to pass through (keep) in hast
50448
+ * @property {Handler} [unknownHandler]
50449
+ * Handler for all unknown nodes.
50226
50450
  *
50227
- * @typedef {Record.<string, Handler>} Handlers Map of node types to handlers
50228
- * @typedef {HFunctionProps & HFunctionNoProps & HFields} H Handle context
50451
+ * @typedef {Record<string, Handler>} Handlers
50452
+ * Map of node types to handlers
50453
+ * @typedef {HFunctionProps & HFunctionNoProps & HFields} H
50454
+ * Handle context
50229
50455
  */
50230
50456
 
50231
50457
 
@@ -50248,14 +50474,22 @@ const mdast_util_to_hast_lib_own = {}.hasOwnProperty
50248
50474
  function factory(tree, options) {
50249
50475
  const settings = options || {}
50250
50476
  const dangerous = settings.allowDangerousHtml || false
50251
- /** @type {Object.<string, FootnoteDefinition>} */
50477
+ /** @type {Record<string, FootnoteDefinition>} */
50252
50478
  const footnoteById = {}
50253
50479
 
50254
50480
  h.dangerous = dangerous
50481
+ h.clobberPrefix =
50482
+ settings.clobberPrefix === undefined || settings.clobberPrefix === null
50483
+ ? 'user-content-'
50484
+ : settings.clobberPrefix
50485
+ h.footnoteLabel = settings.footnoteLabel || 'Footnotes'
50486
+ h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'
50255
50487
  h.definition = definitions(tree)
50256
50488
  h.footnoteById = footnoteById
50257
- /** @type {Array.<string>} */
50489
+ /** @type {Array<string>} */
50258
50490
  h.footnoteOrder = []
50491
+ /** @type {Record<string, number>} */
50492
+ h.footnoteCounts = {}
50259
50493
  h.augment = augment
50260
50494
  h.handlers = {...handlers, ...settings.handlers}
50261
50495
  h.unknownHandler = settings.unknownHandler
@@ -50362,9 +50596,10 @@ function toHast(tree, options) {
50362
50596
  return Array.isArray(node) ? {type: 'root', children: node} : node
50363
50597
  }
50364
50598
 
50365
- ;// CONCATENATED MODULE: ./node_modules/remark-rehype/index.js
50599
+
50600
+
50601
+ ;// CONCATENATED MODULE: ./node_modules/remark-rehype/lib/index.js
50366
50602
  /**
50367
- * @typedef {import('unist').Node} Node
50368
50603
  * @typedef {import('hast').Root} HastRoot
50369
50604
  * @typedef {import('mdast').Root} MdastRoot
50370
50605
  * @typedef {import('mdast-util-to-hast').Options} Options
@@ -50378,12 +50613,21 @@ function toHast(tree, options) {
50378
50613
  // Note: the `<MdastRoot, HastRoot>` overload doesn’t seem to work :'(
50379
50614
 
50380
50615
  /**
50381
- * Plugin to bridge or mutate to rehype.
50616
+ * Plugin that turns markdown into HTML to support rehype.
50382
50617
  *
50383
- * If a destination is given, runs the destination with the new hast tree
50384
- * (bridge-mode).
50385
- * Without destination, returns the hast tree: further plugins run on that tree
50386
- * (mutate-mode).
50618
+ * * If a destination processor is given, that processor runs with a new HTML
50619
+ * (hast) tree (bridge-mode).
50620
+ * As the given processor runs with a hast tree, and rehype plugins support
50621
+ * hast, that means rehype plugins can be used with the given processor.
50622
+ * The hast tree is discarded in the end.
50623
+ * It’s highly unlikely that you want to do this.
50624
+ * * The common case is to not pass a destination processor, in which case the
50625
+ * current processor continues running with a new HTML (hast) tree
50626
+ * (mutate-mode).
50627
+ * As the current processor continues with a hast tree, and rehype plugins
50628
+ * support hast, that means rehype plugins can be used after
50629
+ * `remark-rehype`.
50630
+ * It’s likely that this is what you want to do.
50387
50631
  *
50388
50632
  * @param destination
50389
50633
  * Optional unified processor.
@@ -50391,16 +50635,16 @@ function toHast(tree, options) {
50391
50635
  * Options passed to `mdast-util-to-hast`.
50392
50636
  */
50393
50637
  const remarkRehype =
50394
- /** @type {(import('unified').Plugin<[Processor, Options?]|[Options]|[], MdastRoot>)} */
50638
+ /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */
50395
50639
  (
50396
50640
  function (destination, options) {
50397
50641
  return destination && 'run' in destination
50398
50642
  ? bridge(destination, options)
50399
- : mutate(destination)
50643
+ : mutate(destination || options)
50400
50644
  }
50401
50645
  )
50402
50646
 
50403
- /* harmony default export */ const remark_rehype = (remarkRehype);
50647
+ /* harmony default export */ const lib = (remarkRehype);
50404
50648
 
50405
50649
  /**
50406
50650
  * Bridge-mode.
@@ -50418,12 +50662,12 @@ function bridge(destination, options) {
50418
50662
 
50419
50663
  /**
50420
50664
  * Mutate-mode.
50421
- * Further transformers run on the nlcst tree.
50665
+ * Further plugins run on the hast tree.
50422
50666
  *
50423
50667
  * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}
50424
50668
  */
50425
50669
  function mutate(options) {
50426
- // @ts-expect-error: assume a corresponding node is returned for `toHast`.
50670
+ // @ts-expect-error: assume a corresponding node is returned by `toHast`.
50427
50671
  return (node) => toHast(node, options)
50428
50672
  }
50429
50673
 
@@ -52910,9 +53154,9 @@ function flattenPosition(pos) {
52910
53154
  * @property {string} children
52911
53155
  *
52912
53156
  * @typedef PluginOptions
52913
- * @property {PluggableList} [plugins=[]] **deprecated**: use `remarkPlugins` instead
52914
53157
  * @property {PluggableList} [remarkPlugins=[]]
52915
53158
  * @property {PluggableList} [rehypePlugins=[]]
53159
+ * @property {import('remark-rehype').Options} [remarkRehypeOptions={}]
52916
53160
  *
52917
53161
  * @typedef LayoutOptions
52918
53162
  * @property {string} [className]
@@ -52941,6 +53185,7 @@ const changelog =
52941
53185
 
52942
53186
  /** @type {Record<string, Deprecation>} */
52943
53187
  const deprecated = {
53188
+ plugins: {to: 'plugins', id: 'change-plugins-to-remarkplugins'},
52944
53189
  renderers: {to: 'components', id: 'change-renderers-to-components'},
52945
53190
  astPlugins: {id: 'remove-buggy-html-in-markdown-parser'},
52946
53191
  allowDangerousHtml: {id: 'remove-buggy-html-in-markdown-parser'},
@@ -52985,9 +53230,11 @@ function ReactMarkdown(options) {
52985
53230
 
52986
53231
  const processor = unified()
52987
53232
  .use(remark_parse)
52988
- // TODO: deprecate `plugins` in v8.0.0.
52989
- .use(options.remarkPlugins || options.plugins || [])
52990
- .use(remark_rehype, {allowDangerousHtml: true})
53233
+ .use(options.remarkPlugins || [])
53234
+ .use(lib, {
53235
+ ...options.remarkRehypeOptions,
53236
+ allowDangerousHtml: true
53237
+ })
52991
53238
  .use(options.rehypePlugins || [])
52992
53239
  .use(rehypeFilter, options)
52993
53240
 
@@ -66880,7 +67127,7 @@ const rehypeAttrs = (options) => {
66880
67127
  });
66881
67128
  };
66882
67129
  };
66883
- /* harmony default export */ const lib = (rehypeAttrs);
67130
+ /* harmony default export */ const rehype_attr_lib = (rehypeAttrs);
66884
67131
 
66885
67132
  // EXTERNAL MODULE: ./node_modules/@mapbox/rehype-prism/index.js
66886
67133
  var rehype_prism = __webpack_require__(7748);
@@ -71329,7 +71576,7 @@ var jsx_runtime = __webpack_require__(9724);
71329
71576
  ;// CONCATENATED MODULE: ./node_modules/@uiw/react-markdown-preview/esm/index.js
71330
71577
 
71331
71578
 
71332
- var _excluded = ["prefixCls", "className", "source", "style", "onScroll", "onMouseOver", "warpperElement"];
71579
+ var _excluded = ["prefixCls", "className", "source", "style", "onScroll", "onMouseOver", "pluginsFilter", "warpperElement"];
71333
71580
 
71334
71581
 
71335
71582
 
@@ -71391,15 +71638,24 @@ var getCodeStr = function getCodeStr(data, code) {
71391
71638
  style,
71392
71639
  onScroll,
71393
71640
  onMouseOver,
71641
+ pluginsFilter,
71394
71642
  warpperElement = {}
71395
71643
  } = props,
71396
- other = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(props, _excluded);
71644
+ other = _objectWithoutPropertiesLoose(props, _excluded);
71397
71645
 
71398
71646
  var mdp = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
71399
71647
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => _extends({}, props, {
71400
71648
  mdp
71401
71649
  }), [mdp, props]);
71402
71650
  var cls = (prefixCls || '') + " " + (className || '');
71651
+ var rehypePlugins = [[(rehype_prism_default()), {
71652
+ ignoreMissing: true
71653
+ }], rehypeRaw, rehypeSlug, rehypeAutolinkHeadings, [rehype_rewrite_lib, {
71654
+ rewrite: rehypeRewriteHandle
71655
+ }], [rehype_attr_lib, {
71656
+ properties: 'attr'
71657
+ }], ...(other.rehypePlugins || [])];
71658
+ var remarkPlugins = [...(other.remarkPlugins || []), remarkGfm];
71403
71659
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
71404
71660
  ref: mdp,
71405
71661
  onScroll: onScroll,
@@ -71408,14 +71664,8 @@ var getCodeStr = function getCodeStr(data, code) {
71408
71664
  className: cls,
71409
71665
  style: style,
71410
71666
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown, _extends({}, other, {
71411
- rehypePlugins: [[(rehype_prism_default()), {
71412
- ignoreMissing: true
71413
- }], rehypeRaw, rehypeSlug, rehypeAutolinkHeadings, [rehype_rewrite_lib, {
71414
- rewrite: rehypeRewriteHandle
71415
- }], [lib, {
71416
- properties: 'attr'
71417
- }], ...(other.rehypePlugins || [])],
71418
- remarkPlugins: [...(other.remarkPlugins || []), remarkGfm],
71667
+ rehypePlugins: pluginsFilter ? pluginsFilter('rehype', rehypePlugins) : rehypePlugins,
71668
+ remarkPlugins: pluginsFilter ? pluginsFilter('remark', remarkPlugins) : remarkPlugins,
71419
71669
  children: source || ''
71420
71670
  }))
71421
71671
  }));
@@ -75332,7 +75582,7 @@ function Child_Child(props){var _ref=props||{},prefixCls=_ref.prefixCls,groupNam
75332
75582
  function ToolbarItems(props){var prefixCls=props.prefixCls;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),fullscreen=_useContext.fullscreen,preview=_useContext.preview,_useContext$barPopup=_useContext.barPopup,barPopup=_useContext$barPopup===void 0?{}:_useContext$barPopup,commandOrchestrator=_useContext.commandOrchestrator,dispatch=_useContext.dispatch;var originalOverflow=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('');function handleClick(command,name){if(!dispatch)return;var state={barPopup:_objectSpread2({},barPopup)};if(command.keyCommand==='preview'){state.preview=command.value;}if(command.keyCommand==='fullscreen'){state.fullscreen=!fullscreen;}if(props.commands&&command.keyCommand==='group'){props.commands.forEach(function(item){if(name===item.groupName){state.barPopup[name]=true;}else if(item.keyCommand){state.barPopup[item.groupName]=false;}});}else if(name||command.parent){Object.keys(state.barPopup||{}).forEach(function(keyName){state.barPopup[keyName]=false;});}if(Object.keys(state).length){dispatch(_objectSpread2({},state));}commandOrchestrator&&commandOrchestrator.executeCommand(command);}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){if(fullscreen){// prevent scroll on fullscreen
75333
75583
  document.body.style.overflow='hidden';}else{// get the original overflow only the first time
75334
75584
  if(!originalOverflow.current){originalOverflow.current=window.getComputedStyle(document.body,null).overflow;}// reset to the original overflow
75335
- document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOverflow]);return/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:(props.commands||[]).map(function(item,idx){if(item.keyCommand==='divider'){return/*#__PURE__*/(0,jsx_runtime.jsx)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:"".concat(prefixCls,"-toolbar-divider")}),idx);}if(!item.keyCommand)return/*#__PURE__*/(0,jsx_runtime.jsx)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{},idx);var activeBtn=fullscreen&&item.keyCommand==='fullscreen'||item.keyCommand==='preview'&&preview===item.value;var childNode=item.children&&typeof item.children==='function'?item.children({getState:function getState(){return commandOrchestrator.getState();},textApi:commandOrchestrator?commandOrchestrator.textApi:undefined,close:function close(){return handleClick({},item.groupName);},execute:function execute(){return handleClick({execute:item.execute});}}):undefined;var disabled=barPopup&&preview&&preview==='preview'&&!/(preview|fullscreen)/.test(item.keyCommand);return/*#__PURE__*/(0,jsx_runtime.jsxs)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:activeBtn?"active":'',children:[!item.buttonProps&&item.icon,item.buttonProps&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('button',_objectSpread2(_objectSpread2({type:'button',disabled:disabled,'data-name':item.name},item.buttonProps),{},{onClick:function onClick(evn){evn.stopPropagation();handleClick(item,item.groupName);}}),item.icon),item.children&&/*#__PURE__*/(0,jsx_runtime.jsx)(Child_Child,{groupName:item.groupName,prefixCls:prefixCls,children:childNode,commands:Array.isArray(item.children)?item.children:undefined})]}),idx);})});}function Toolbar_Toolbar(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var prefixCls=props.prefixCls,_props$height=props.height,height=_props$height===void 0?29:_props$height,isChild=props.isChild;var _useContext2=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),commands=_useContext2.commands,extraCommands=_useContext2.extraCommands;return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-toolbar"),style:{height:height},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:props.commands||commands||[]})),!isChild&&/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:extraCommands||[]}))]});}
75585
+ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOverflow]);return/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:(props.commands||[]).map(function(item,idx){if(item.keyCommand==='divider'){return/*#__PURE__*/(0,jsx_runtime.jsx)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:"".concat(prefixCls,"-toolbar-divider")}),idx);}if(!item.keyCommand)return/*#__PURE__*/(0,jsx_runtime.jsx)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{},idx);var activeBtn=fullscreen&&item.keyCommand==='fullscreen'||item.keyCommand==='preview'&&preview===item.value;var childNode=item.children&&typeof item.children==='function'?item.children({getState:function getState(){return commandOrchestrator.getState();},textApi:commandOrchestrator?commandOrchestrator.textApi:undefined,close:function close(){return handleClick({},item.groupName);},execute:function execute(){return handleClick({execute:item.execute});}}):undefined;var disabled=barPopup&&preview&&preview==='preview'&&!/(preview|fullscreen)/.test(item.keyCommand);return/*#__PURE__*/(0,jsx_runtime.jsxs)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:activeBtn?"active":'',children:[!item.buttonProps&&item.icon,item.buttonProps&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('button',_objectSpread2(_objectSpread2({type:'button',key:idx,disabled:disabled,'data-name':item.name},item.buttonProps),{},{onClick:function onClick(evn){evn.stopPropagation();handleClick(item,item.groupName);}}),item.icon),item.children&&/*#__PURE__*/(0,jsx_runtime.jsx)(Child_Child,{groupName:item.groupName,prefixCls:prefixCls,children:childNode,commands:Array.isArray(item.children)?item.children:undefined})]}),idx);})});}function Toolbar_Toolbar(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var prefixCls=props.prefixCls,_props$height=props.height,height=_props$height===void 0?29:_props$height,isChild=props.isChild;var _useContext2=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),commands=_useContext2.commands,extraCommands=_useContext2.extraCommands;return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-toolbar"),style:{height:height},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:props.commands||commands||[]})),!isChild&&/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:extraCommands||[]}))]});}
75336
75586
  ;// CONCATENATED MODULE: ./src/components/DragBar/index.less
75337
75587
  // extracted by mini-css-extract-plugin
75338
75588
  /* harmony default export */ const DragBar = ({});