@uiw/react-md-editor 3.16.0 → 3.17.2

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 (48) hide show
  1. package/README.md +56 -2
  2. package/dist/mdeditor.css +20 -5
  3. package/dist/mdeditor.js +70 -653
  4. package/dist/mdeditor.min.css +1 -1
  5. package/dist/mdeditor.min.js +1 -1
  6. package/esm/Context.d.ts +15 -0
  7. package/esm/Context.js.map +2 -2
  8. package/esm/Editor.d.ts +19 -1
  9. package/esm/Editor.js +4 -8
  10. package/esm/Editor.js.map +4 -3
  11. package/esm/commands/index.d.ts +1 -1
  12. package/esm/commands/index.js.map +1 -1
  13. package/esm/components/DragBar/index.css +1 -0
  14. package/esm/components/DragBar/index.less +1 -0
  15. package/esm/components/Toolbar/Child.js +0 -1
  16. package/esm/components/Toolbar/Child.js.map +2 -2
  17. package/esm/components/Toolbar/index.css +6 -1
  18. package/esm/components/Toolbar/index.d.ts +0 -2
  19. package/esm/components/Toolbar/index.js +4 -5
  20. package/esm/components/Toolbar/index.js.map +6 -3
  21. package/esm/components/Toolbar/index.less +6 -1
  22. package/esm/index.css +10 -3
  23. package/esm/index.less +9 -3
  24. package/lib/Context.d.ts +15 -0
  25. package/lib/Context.js.map +2 -2
  26. package/lib/Editor.d.ts +19 -1
  27. package/lib/Editor.js +4 -9
  28. package/lib/Editor.js.map +4 -3
  29. package/lib/commands/index.d.ts +1 -1
  30. package/lib/commands/index.js.map +1 -1
  31. package/lib/components/DragBar/index.less +1 -0
  32. package/lib/components/Toolbar/Child.js +0 -1
  33. package/lib/components/Toolbar/Child.js.map +2 -2
  34. package/lib/components/Toolbar/index.d.ts +0 -2
  35. package/lib/components/Toolbar/index.js +4 -6
  36. package/lib/components/Toolbar/index.js.map +7 -4
  37. package/lib/components/Toolbar/index.less +6 -1
  38. package/lib/index.less +9 -3
  39. package/markdown-editor.css +17 -4
  40. package/package.json +2 -2
  41. package/src/Context.tsx +2 -0
  42. package/src/Editor.tsx +25 -11
  43. package/src/commands/index.ts +1 -1
  44. package/src/components/DragBar/index.less +1 -0
  45. package/src/components/Toolbar/Child.tsx +1 -1
  46. package/src/components/Toolbar/index.less +6 -1
  47. package/src/components/Toolbar/index.tsx +10 -7
  48. package/src/index.less +9 -3
package/dist/mdeditor.js CHANGED
@@ -9671,7 +9671,7 @@ __webpack_require__.d(__webpack_exports__, {
9671
9671
  "unorderedListCommand": () => (/* reexport */ unorderedListCommand)
9672
9672
  });
9673
9673
 
9674
- // NAMESPACE OBJECT: ../node_modules/react-markdown/node_modules/micromark/lib/constructs.js
9674
+ // NAMESPACE OBJECT: ../node_modules/micromark/lib/constructs.js
9675
9675
  var constructs_namespaceObject = {};
9676
9676
  __webpack_require__.r(constructs_namespaceObject);
9677
9677
  __webpack_require__.d(constructs_namespaceObject, {
@@ -9911,7 +9911,7 @@ function _extends() {
9911
9911
  }
9912
9912
  // EXTERNAL MODULE: ../node_modules/is-buffer/index.js
9913
9913
  var is_buffer = __webpack_require__(372);
9914
- ;// CONCATENATED MODULE: ../node_modules/vfile-message/node_modules/unist-util-stringify-position/index.js
9914
+ ;// CONCATENATED MODULE: ../node_modules/unist-util-stringify-position/index.js
9915
9915
  /**
9916
9916
  * @typedef {import('unist').Point} Point
9917
9917
  * @typedef {import('unist').Node} Node
@@ -11855,7 +11855,7 @@ function looksLikeAVFileValue(value) {
11855
11855
  return typeof value === 'string' || is_buffer(value)
11856
11856
  }
11857
11857
 
11858
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/mdast-util-to-string/index.js
11858
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-string/index.js
11859
11859
  /**
11860
11860
  * @typedef Options
11861
11861
  * @property {boolean} [includeImageAlt=true]
@@ -12356,7 +12356,7 @@ function factorySpace(effects, ok, type, max) {
12356
12356
  }
12357
12357
  }
12358
12358
 
12359
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/content.js
12359
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/content.js
12360
12360
  /**
12361
12361
  * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
12362
12362
  * @typedef {import('micromark-util-types').Initializer} Initializer
@@ -12437,7 +12437,7 @@ function initializeContent(effects) {
12437
12437
  }
12438
12438
  }
12439
12439
 
12440
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/document.js
12440
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/document.js
12441
12441
  /**
12442
12442
  * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
12443
12443
  * @typedef {import('micromark-util-types').Initializer} Initializer
@@ -13212,7 +13212,7 @@ function tokenizeContinuation(effects, ok, nok) {
13212
13212
  }
13213
13213
  }
13214
13214
 
13215
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/flow.js
13215
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/flow.js
13216
13216
  /**
13217
13217
  * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
13218
13218
  * @typedef {import('micromark-util-types').Initializer} Initializer
@@ -13279,7 +13279,7 @@ function initializeFlow(effects) {
13279
13279
  }
13280
13280
  }
13281
13281
 
13282
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/text.js
13282
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/text.js
13283
13283
  /**
13284
13284
  * @typedef {import('micromark-util-types').Resolver} Resolver
13285
13285
  * @typedef {import('micromark-util-types').Initializer} Initializer
@@ -13531,7 +13531,7 @@ function resolveAll(constructs, events, context) {
13531
13531
  return events
13532
13532
  }
13533
13533
 
13534
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/create-tokenizer.js
13534
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/create-tokenizer.js
13535
13535
  /**
13536
13536
  * @typedef {import('micromark-util-types').Code} Code
13537
13537
  * @typedef {import('micromark-util-types').Chunk} Chunk
@@ -18136,7 +18136,7 @@ function tokenizeCodeText(effects, ok, nok) {
18136
18136
  }
18137
18137
  }
18138
18138
 
18139
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/constructs.js
18139
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/constructs.js
18140
18140
  /**
18141
18141
  * @typedef {import('micromark-util-types').Extension} Extension
18142
18142
  */
@@ -18222,7 +18222,7 @@ const disable = {
18222
18222
  null: []
18223
18223
  }
18224
18224
 
18225
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/parse.js
18225
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/parse.js
18226
18226
  /**
18227
18227
  * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
18228
18228
  * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
@@ -18276,7 +18276,7 @@ function parse_parse(options = {}) {
18276
18276
  }
18277
18277
  }
18278
18278
 
18279
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/preprocess.js
18279
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/preprocess.js
18280
18280
  /**
18281
18281
  * @typedef {import('micromark-util-types').Encoding} Encoding
18282
18282
  * @typedef {import('micromark-util-types').Value} Value
@@ -18407,7 +18407,7 @@ function preprocess() {
18407
18407
  }
18408
18408
  }
18409
18409
 
18410
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/postprocess.js
18410
+ ;// CONCATENATED MODULE: ../node_modules/micromark/lib/postprocess.js
18411
18411
  /**
18412
18412
  * @typedef {import('micromark-util-types').Event} Event
18413
18413
  */
@@ -18499,71 +18499,7 @@ function decode($0, $1, $2) {
18499
18499
  return decodeNamedCharacterReference($2) || $0
18500
18500
  }
18501
18501
 
18502
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/unist-util-stringify-position/index.js
18503
- /**
18504
- * @typedef {import('unist').Point} Point
18505
- * @typedef {import('unist').Node} Node
18506
- * @typedef {import('unist').Position} Position
18507
- * @typedef {object & {type: string, position?: Position|undefined}} NodeLike
18508
- */
18509
-
18510
- /**
18511
- * Stringify one point, a position (start and end points), or a node’s
18512
- * positional information.
18513
- *
18514
- * @param {Node|NodeLike|Position|Point|null} [value]
18515
- * @returns {string}
18516
- */
18517
- function unist_util_stringify_position_stringifyPosition(value) {
18518
- // Nothing.
18519
- if (!value || typeof value !== 'object') {
18520
- return ''
18521
- }
18522
-
18523
- // Node.
18524
- if ('position' in value || 'type' in value) {
18525
- return unist_util_stringify_position_position(value.position)
18526
- }
18527
-
18528
- // Position.
18529
- if ('start' in value || 'end' in value) {
18530
- return unist_util_stringify_position_position(value)
18531
- }
18532
-
18533
- // Point.
18534
- if ('line' in value || 'column' in value) {
18535
- return unist_util_stringify_position_point(value)
18536
- }
18537
-
18538
- // ?
18539
- return ''
18540
- }
18541
-
18542
- /**
18543
- * @param {Point|undefined} point
18544
- * @returns {string}
18545
- */
18546
- function unist_util_stringify_position_point(point) {
18547
- return unist_util_stringify_position_index(point && point.line) + ':' + unist_util_stringify_position_index(point && point.column)
18548
- }
18549
-
18550
- /**
18551
- * @param {Position|undefined} pos
18552
- * @returns {string}
18553
- */
18554
- function unist_util_stringify_position_position(pos) {
18555
- return unist_util_stringify_position_point(pos && pos.start) + '-' + unist_util_stringify_position_point(pos && pos.end)
18556
- }
18557
-
18558
- /**
18559
- * @param {number|undefined} value
18560
- * @returns {number}
18561
- */
18562
- function unist_util_stringify_position_index(value) {
18563
- return value && typeof value === 'number' ? value : 1
18564
- }
18565
-
18566
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/mdast-util-from-markdown/lib/index.js
18502
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-from-markdown/lib/index.js
18567
18503
  /**
18568
18504
  * @typedef {import('micromark-util-types').Encoding} Encoding
18569
18505
  * @typedef {import('micromark-util-types').Event} Event
@@ -19168,7 +19104,7 @@ function compiler(options = {}) {
19168
19104
  'Cannot close `' +
19169
19105
  token.type +
19170
19106
  '` (' +
19171
- unist_util_stringify_position_stringifyPosition({
19107
+ stringifyPosition({
19172
19108
  start: token.start,
19173
19109
  end: token.end
19174
19110
  }) +
@@ -19781,14 +19717,14 @@ function defaultOnError(left, right) {
19781
19717
  'Cannot close `' +
19782
19718
  left.type +
19783
19719
  '` (' +
19784
- unist_util_stringify_position_stringifyPosition({
19720
+ stringifyPosition({
19785
19721
  start: left.start,
19786
19722
  end: left.end
19787
19723
  }) +
19788
19724
  '): a different token (`' +
19789
19725
  right.type +
19790
19726
  '`, ' +
19791
- unist_util_stringify_position_stringifyPosition({
19727
+ stringifyPosition({
19792
19728
  start: right.start,
19793
19729
  end: right.end
19794
19730
  }) +
@@ -19799,7 +19735,7 @@ function defaultOnError(left, right) {
19799
19735
  'Cannot close document, a token (`' +
19800
19736
  right.type +
19801
19737
  '`, ' +
19802
- unist_util_stringify_position_stringifyPosition({
19738
+ stringifyPosition({
19803
19739
  start: right.start,
19804
19740
  end: right.end
19805
19741
  }) +
@@ -19808,7 +19744,7 @@ function defaultOnError(left, right) {
19808
19744
  }
19809
19745
  }
19810
19746
 
19811
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/lib/index.js
19747
+ ;// CONCATENATED MODULE: ../node_modules/remark-parse/lib/index.js
19812
19748
  /**
19813
19749
  * @typedef {import('mdast').Root} Root
19814
19750
  * @typedef {import('mdast-util-from-markdown').Options} Options
@@ -19838,7 +19774,7 @@ function remarkParse(options) {
19838
19774
  Object.assign(this, {Parser: parser})
19839
19775
  }
19840
19776
 
19841
- ;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/index.js
19777
+ ;// CONCATENATED MODULE: ../node_modules/remark-parse/index.js
19842
19778
 
19843
19779
 
19844
19780
  /* harmony default export */ const remark_parse = (remarkParse);
@@ -20807,6 +20743,7 @@ function wrap_wrap(nodes, loose) {
20807
20743
 
20808
20744
  /**
20809
20745
  * @param {H} h
20746
+ * @returns {Element|null}
20810
20747
  */
20811
20748
  function footer(h) {
20812
20749
  let index = -1
@@ -20902,8 +20839,8 @@ function footer(h) {
20902
20839
  children: [
20903
20840
  {
20904
20841
  type: 'element',
20905
- tagName: 'h2',
20906
- properties: {id: 'footnote-label', className: ['sr-only']},
20842
+ tagName: h.footnoteLabelTagName,
20843
+ properties: JSON.parse(JSON.stringify(h.footnoteLabelProperties)),
20907
20844
  children: [u('text', h.footnoteLabel)]
20908
20845
  },
20909
20846
  {type: 'text', value: '\n'},
@@ -21815,6 +21752,8 @@ function ignore() {
21815
21752
  * @property {boolean} dangerous Whether HTML is allowed
21816
21753
  * @property {string} clobberPrefix Prefix to use to prevent DOM clobbering
21817
21754
  * @property {string} footnoteLabel Label to use to introduce the footnote section
21755
+ * @property {string} footnoteLabelTagName HTML used for the footnote label
21756
+ * @property {Properties} footnoteLabelProperties properties on the HTML tag used for the footnote label
21818
21757
  * @property {string} footnoteBackLabel Label to use to go back to a footnote call from the footnote section
21819
21758
  * @property {(identifier: string) => Definition|null} definition Definition cache
21820
21759
  * @property {Record<string, FootnoteDefinition>} footnoteById Footnote cache
@@ -21844,6 +21783,13 @@ function ignore() {
21844
21783
  * Label to use for the footnotes section.
21845
21784
  * Affects screen reader users.
21846
21785
  * Change it if you’re authoring in a different language.
21786
+ * @property {string} [footnoteLabelTagName='h2']
21787
+ * HTML tag to use for the footnote label.
21788
+ * Can be changed to match your document structure and play well with your choice of css.
21789
+ * @property {Properties} [footnoteLabelProperties={id: 'footnote-label', className: ['sr-only']}]
21790
+ * Properties to use on the footnote label.
21791
+ * A 'sr-only' class is added by default to hide this from sighted users.
21792
+ * Change it to make the label visible, or add classes for other purposes.
21847
21793
  * @property {string} [footnoteBackLabel='Back to content']
21848
21794
  * Label to use from backreferences back to their footnote call.
21849
21795
  * Affects screen reader users.
@@ -21890,6 +21836,11 @@ function factory(tree, options) {
21890
21836
  ? 'user-content-'
21891
21837
  : settings.clobberPrefix
21892
21838
  h.footnoteLabel = settings.footnoteLabel || 'Footnotes'
21839
+ h.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'
21840
+ h.footnoteLabelProperties = settings.footnoteLabelProperties || {
21841
+ id: 'footnote-label',
21842
+ className: ['sr-only']
21843
+ }
21893
21844
  h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'
21894
21845
  h.definition = definitions(tree)
21895
21846
  h.footnoteById = footnoteById
@@ -26788,7 +26739,7 @@ function mdast_util_gfm_autolink_literal_previous(match, email) {
26788
26739
  )
26789
26740
  }
26790
26741
 
26791
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/association.js
26742
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/association.js
26792
26743
  /**
26793
26744
  * @typedef {import('mdast').Association} Association
26794
26745
  */
@@ -26818,7 +26769,7 @@ function association(node) {
26818
26769
  return decodeString(node.identifier)
26819
26770
  }
26820
26771
 
26821
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/track.js
26772
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/track.js
26822
26773
  /**
26823
26774
  * @typedef {import('unist').Point} Point
26824
26775
  * @typedef {import('../types.js').TrackFields} TrackFields
@@ -26877,7 +26828,7 @@ function track(options_) {
26877
26828
  }
26878
26829
  }
26879
26830
 
26880
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
26831
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
26881
26832
  /**
26882
26833
  * @typedef {import('../types.js').Node} Node
26883
26834
  * @typedef {import('../types.js').Parent} Parent
@@ -26960,7 +26911,7 @@ function containerFlow(parent, context, safeOptions) {
26960
26911
  }
26961
26912
  }
26962
26913
 
26963
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
26914
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
26964
26915
  /**
26965
26916
  * @callback Map
26966
26917
  * @param {string} value
@@ -27003,7 +26954,7 @@ function indentLines(value, map) {
27003
26954
  }
27004
26955
  }
27005
26956
 
27006
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
26957
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
27007
26958
  /**
27008
26959
  * @typedef {import('../types.js').Unsafe} Unsafe
27009
26960
  */
@@ -27030,7 +26981,7 @@ function patternCompile(pattern) {
27030
26981
  return pattern._compiled
27031
26982
  }
27032
26983
 
27033
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
26984
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
27034
26985
  /**
27035
26986
  * @typedef {import('../types.js').Unsafe} Unsafe
27036
26987
  */
@@ -27073,7 +27024,7 @@ function listInScope(stack, list, none) {
27073
27024
  return false
27074
27025
  }
27075
27026
 
27076
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/safe.js
27027
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/safe.js
27077
27028
  /**
27078
27029
  * @typedef {import('../types.js').Context} Context
27079
27030
  * @typedef {import('../types.js').SafeOptions} SafeOptions
@@ -27406,66 +27357,7 @@ function gfmFootnoteToMarkdown() {
27406
27357
  }
27407
27358
  }
27408
27359
 
27409
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/node_modules/mdast-util-to-markdown/lib/util/track.js
27410
- /**
27411
- * @typedef {import('unist').Point} Point
27412
- * @typedef {import('../types.js').TrackFields} TrackFields
27413
- */
27414
-
27415
- /**
27416
- * Functions to track output positions.
27417
- * This info isn’t used yet but suchs functionality allows line wrapping,
27418
- * and theoretically source maps (though, is there practical use in that?).
27419
- *
27420
- * @param {TrackFields} options_
27421
- */
27422
- function track_track(options_) {
27423
- // Defaults are used to prevent crashes when older utilities somehow activate
27424
- // this code.
27425
- /* c8 ignore next 5 */
27426
- const options = options_ || {}
27427
- const now = options.now || {}
27428
- let lineShift = options.lineShift || 0
27429
- let line = now.line || 1
27430
- let column = now.column || 1
27431
-
27432
- return {move, current, shift}
27433
-
27434
- /**
27435
- * Get the current tracked info.
27436
- *
27437
- * @returns {{now: Point, lineShift: number}}
27438
- */
27439
- function current() {
27440
- return {now: {line, column}, lineShift}
27441
- }
27442
-
27443
- /**
27444
- * Define an increased line shift (the typical indent for lines).
27445
- *
27446
- * @param {number} value
27447
- */
27448
- function shift(value) {
27449
- lineShift += value
27450
- }
27451
-
27452
- /**
27453
- * Move past a string.
27454
- *
27455
- * @param {string} value
27456
- * @returns {string}
27457
- */
27458
- function move(value = '') {
27459
- const chunks = value.split(/\r?\n|\r/g)
27460
- const tail = chunks[chunks.length - 1]
27461
- line += chunks.length - 1
27462
- column =
27463
- chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift
27464
- return value
27465
- }
27466
- }
27467
-
27468
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
27360
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
27469
27361
  /**
27470
27362
  * @typedef {import('../types.js').Node} Node
27471
27363
  * @typedef {import('../types.js').Parent} Parent
@@ -27490,7 +27382,7 @@ function containerPhrasing(parent, context, safeOptions) {
27490
27382
  let before = safeOptions.before
27491
27383
 
27492
27384
  indexStack.push(-1)
27493
- let tracker = track_track(safeOptions)
27385
+ let tracker = track(safeOptions)
27494
27386
 
27495
27387
  while (++index < children.length) {
27496
27388
  const child = children[index]
@@ -27532,7 +27424,7 @@ function containerPhrasing(parent, context, safeOptions) {
27532
27424
  before = ' '
27533
27425
 
27534
27426
  // To do: does this work to reset tracker?
27535
- tracker = track_track(safeOptions)
27427
+ tracker = track(safeOptions)
27536
27428
  tracker.move(results.join(''))
27537
27429
  }
27538
27430
 
@@ -27596,7 +27488,7 @@ function exitStrikethrough(token) {
27596
27488
  * @param {Delete} node
27597
27489
  */
27598
27490
  function handleDelete(node, _, context, safeOptions) {
27599
- const tracker = track_track(safeOptions)
27491
+ const tracker = track(safeOptions)
27600
27492
  const exit = context.enter('emphasis')
27601
27493
  let value = tracker.move('~~')
27602
27494
  value += containerPhrasing(node, context, {
@@ -27614,182 +27506,7 @@ function peekDelete() {
27614
27506
  return '~'
27615
27507
  }
27616
27508
 
27617
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/util/track.js
27618
- /**
27619
- * @typedef {import('unist').Point} Point
27620
- * @typedef {import('../types.js').TrackFields} TrackFields
27621
- */
27622
-
27623
- /**
27624
- * Functions to track output positions.
27625
- * This info isn’t used yet but suchs functionality allows line wrapping,
27626
- * and theoretically source maps (though, is there practical use in that?).
27627
- *
27628
- * @param {TrackFields} options_
27629
- */
27630
- function util_track_track(options_) {
27631
- // Defaults are used to prevent crashes when older utilities somehow activate
27632
- // this code.
27633
- /* c8 ignore next 5 */
27634
- const options = options_ || {}
27635
- const now = options.now || {}
27636
- let lineShift = options.lineShift || 0
27637
- let line = now.line || 1
27638
- let column = now.column || 1
27639
-
27640
- return {move, current, shift}
27641
-
27642
- /**
27643
- * Get the current tracked info.
27644
- *
27645
- * @returns {{now: Point, lineShift: number}}
27646
- */
27647
- function current() {
27648
- return {now: {line, column}, lineShift}
27649
- }
27650
-
27651
- /**
27652
- * Define an increased line shift (the typical indent for lines).
27653
- *
27654
- * @param {number} value
27655
- */
27656
- function shift(value) {
27657
- lineShift += value
27658
- }
27659
-
27660
- /**
27661
- * Move past a string.
27662
- *
27663
- * @param {string} value
27664
- * @returns {string}
27665
- */
27666
- function move(value = '') {
27667
- const chunks = value.split(/\r?\n|\r/g)
27668
- const tail = chunks[chunks.length - 1]
27669
- line += chunks.length - 1
27670
- column =
27671
- chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift
27672
- return value
27673
- }
27674
- }
27675
-
27676
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
27677
- /**
27678
- * @typedef {import('../types.js').Node} Node
27679
- * @typedef {import('../types.js').Parent} Parent
27680
- * @typedef {import('../types.js').SafeOptions} SafeOptions
27681
- * @typedef {import('../types.js').Context} Context
27682
- */
27683
-
27684
-
27685
-
27686
- /**
27687
- * @param {Parent} parent
27688
- * @param {Context} context
27689
- * @param {SafeOptions} safeOptions
27690
- * @returns {string}
27691
- */
27692
- function container_phrasing_containerPhrasing(parent, context, safeOptions) {
27693
- const indexStack = context.indexStack
27694
- const children = parent.children || []
27695
- /** @type {Array<string>} */
27696
- const results = []
27697
- let index = -1
27698
- let before = safeOptions.before
27699
-
27700
- indexStack.push(-1)
27701
- let tracker = util_track_track(safeOptions)
27702
-
27703
- while (++index < children.length) {
27704
- const child = children[index]
27705
- /** @type {string} */
27706
- let after
27707
-
27708
- indexStack[indexStack.length - 1] = index
27709
-
27710
- if (index + 1 < children.length) {
27711
- // @ts-expect-error: hush, it’s actually a `zwitch`.
27712
- let handle = context.handle.handlers[children[index + 1].type]
27713
- if (handle && handle.peek) handle = handle.peek
27714
- after = handle
27715
- ? handle(children[index + 1], parent, context, {
27716
- before: '',
27717
- after: '',
27718
- ...tracker.current()
27719
- }).charAt(0)
27720
- : ''
27721
- } else {
27722
- after = safeOptions.after
27723
- }
27724
-
27725
- // In some cases, html (text) can be found in phrasing right after an eol.
27726
- // When we’d serialize that, in most cases that would be seen as html
27727
- // (flow).
27728
- // As we can’t escape or so to prevent it from happening, we take a somewhat
27729
- // reasonable approach: replace that eol with a space.
27730
- // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>
27731
- if (
27732
- results.length > 0 &&
27733
- (before === '\r' || before === '\n') &&
27734
- child.type === 'html'
27735
- ) {
27736
- results[results.length - 1] = results[results.length - 1].replace(
27737
- /(\r?\n|\r)$/,
27738
- ' '
27739
- )
27740
- before = ' '
27741
-
27742
- // To do: does this work to reset tracker?
27743
- tracker = util_track_track(safeOptions)
27744
- tracker.move(results.join(''))
27745
- }
27746
-
27747
- results.push(
27748
- tracker.move(
27749
- context.handle(child, parent, context, {
27750
- ...tracker.current(),
27751
- before,
27752
- after
27753
- })
27754
- )
27755
- )
27756
-
27757
- before = results[results.length - 1].slice(-1)
27758
- }
27759
-
27760
- indexStack.pop()
27761
-
27762
- return results.join('')
27763
- }
27764
-
27765
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
27766
- /**
27767
- * @typedef {import('../types.js').Unsafe} Unsafe
27768
- */
27769
-
27770
- /**
27771
- * @param {Unsafe} pattern
27772
- * @returns {RegExp}
27773
- */
27774
- function pattern_compile_patternCompile(pattern) {
27775
- if (!pattern._compiled) {
27776
- const before =
27777
- (pattern.atBreak ? '[\\r\\n][\\t ]*' : '') +
27778
- (pattern.before ? '(?:' + pattern.before + ')' : '')
27779
-
27780
- pattern._compiled = new RegExp(
27781
- (before ? '(' + before + ')' : '') +
27782
- (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') +
27783
- pattern.character +
27784
- (pattern.after ? '(?:' + pattern.after + ')' : ''),
27785
- 'g'
27786
- )
27787
- }
27788
-
27789
- return pattern._compiled
27790
- }
27791
-
27792
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
27509
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
27793
27510
  /**
27794
27511
  * @typedef {import('mdast').InlineCode} InlineCode
27795
27512
  * @typedef {import('../types.js').Handle} Handle
@@ -27833,7 +27550,7 @@ function inline_code_inlineCode(node, _, context) {
27833
27550
  // them out.
27834
27551
  while (++index < context.unsafe.length) {
27835
27552
  const pattern = context.unsafe[index]
27836
- const expression = pattern_compile_patternCompile(pattern)
27553
+ const expression = patternCompile(pattern)
27837
27554
  /** @type {RegExpExecArray|null} */
27838
27555
  let match
27839
27556
 
@@ -28425,7 +28142,7 @@ function gfmTableToMarkdown(options) {
28425
28142
  function handleTableCell(node, _, context, safeOptions) {
28426
28143
  const exit = context.enter('tableCell')
28427
28144
  const subexit = context.enter('phrasing')
28428
- const value = container_phrasing_containerPhrasing(node, context, {
28145
+ const value = containerPhrasing(node, context, {
28429
28146
  ...safeOptions,
28430
28147
  before: around,
28431
28148
  after: around
@@ -28517,7 +28234,7 @@ function gfmTableToMarkdown(options) {
28517
28234
  }
28518
28235
  }
28519
28236
 
28520
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
28237
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
28521
28238
  /**
28522
28239
  * @typedef {import('../types.js').Context} Context
28523
28240
  * @typedef {import('../types.js').Options} Options
@@ -28541,7 +28258,7 @@ function checkBullet(context) {
28541
28258
  return marker
28542
28259
  }
28543
28260
 
28544
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
28261
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
28545
28262
  /**
28546
28263
  * @typedef {import('../types.js').Context} Context
28547
28264
  * @typedef {import('../types.js').Options} Options
@@ -28571,192 +28288,7 @@ function checkListItemIndent(context) {
28571
28288
  return style
28572
28289
  }
28573
28290
 
28574
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/track.js
28575
- /**
28576
- * @typedef {import('unist').Point} Point
28577
- * @typedef {import('../types.js').TrackFields} TrackFields
28578
- */
28579
-
28580
- /**
28581
- * Functions to track output positions.
28582
- * This info isn’t used yet but suchs functionality allows line wrapping,
28583
- * and theoretically source maps (though, is there practical use in that?).
28584
- *
28585
- * @param {TrackFields} options_
28586
- */
28587
- function lib_util_track_track(options_) {
28588
- // Defaults are used to prevent crashes when older utilities somehow activate
28589
- // this code.
28590
- /* c8 ignore next 5 */
28591
- const options = options_ || {}
28592
- const now = options.now || {}
28593
- let lineShift = options.lineShift || 0
28594
- let line = now.line || 1
28595
- let column = now.column || 1
28596
-
28597
- return {move, current, shift}
28598
-
28599
- /**
28600
- * Get the current tracked info.
28601
- *
28602
- * @returns {{now: Point, lineShift: number}}
28603
- */
28604
- function current() {
28605
- return {now: {line, column}, lineShift}
28606
- }
28607
-
28608
- /**
28609
- * Define an increased line shift (the typical indent for lines).
28610
- *
28611
- * @param {number} value
28612
- */
28613
- function shift(value) {
28614
- lineShift += value
28615
- }
28616
-
28617
- /**
28618
- * Move past a string.
28619
- *
28620
- * @param {string} value
28621
- * @returns {string}
28622
- */
28623
- function move(value = '') {
28624
- const chunks = value.split(/\r?\n|\r/g)
28625
- const tail = chunks[chunks.length - 1]
28626
- line += chunks.length - 1
28627
- column =
28628
- chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift
28629
- return value
28630
- }
28631
- }
28632
-
28633
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
28634
- /**
28635
- * @typedef {import('../types.js').Node} Node
28636
- * @typedef {import('../types.js').Parent} Parent
28637
- * @typedef {import('../types.js').Join} Join
28638
- * @typedef {import('../types.js').Context} Context
28639
- * @typedef {import('../types.js').TrackFields} TrackFields
28640
- */
28641
-
28642
-
28643
-
28644
- /**
28645
- * @param {Parent} parent
28646
- * @param {Context} context
28647
- * @param {TrackFields} safeOptions
28648
- * @returns {string}
28649
- */
28650
- function container_flow_containerFlow(parent, context, safeOptions) {
28651
- const indexStack = context.indexStack
28652
- const children = parent.children || []
28653
- const tracker = lib_util_track_track(safeOptions)
28654
- /** @type {Array<string>} */
28655
- const results = []
28656
- let index = -1
28657
-
28658
- indexStack.push(-1)
28659
-
28660
- while (++index < children.length) {
28661
- const child = children[index]
28662
-
28663
- indexStack[indexStack.length - 1] = index
28664
-
28665
- results.push(
28666
- tracker.move(
28667
- context.handle(child, parent, context, {
28668
- before: '\n',
28669
- after: '\n',
28670
- ...tracker.current()
28671
- })
28672
- )
28673
- )
28674
-
28675
- if (child.type !== 'list') {
28676
- context.bulletLastUsed = undefined
28677
- }
28678
-
28679
- if (index < children.length - 1) {
28680
- results.push(tracker.move(between(child, children[index + 1])))
28681
- }
28682
- }
28683
-
28684
- indexStack.pop()
28685
-
28686
- return results.join('')
28687
-
28688
- /**
28689
- * @param {Node} left
28690
- * @param {Node} right
28691
- * @returns {string}
28692
- */
28693
- function between(left, right) {
28694
- let index = context.join.length
28695
-
28696
- while (index--) {
28697
- const result = context.join[index](left, right, parent, context)
28698
-
28699
- if (result === true || result === 1) {
28700
- break
28701
- }
28702
-
28703
- if (typeof result === 'number') {
28704
- return '\n'.repeat(1 + result)
28705
- }
28706
-
28707
- if (result === false) {
28708
- return '\n\n<!---->\n\n'
28709
- }
28710
- }
28711
-
28712
- return '\n\n'
28713
- }
28714
- }
28715
-
28716
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
28717
- /**
28718
- * @callback Map
28719
- * @param {string} value
28720
- * @param {number} line
28721
- * @param {boolean} blank
28722
- * @returns {string}
28723
- */
28724
-
28725
- const indent_lines_eol = /\r?\n|\r/g
28726
-
28727
- /**
28728
- * @param {string} value
28729
- * @param {Map} map
28730
- * @returns {string}
28731
- */
28732
- function indent_lines_indentLines(value, map) {
28733
- /** @type {Array<string>} */
28734
- const result = []
28735
- let start = 0
28736
- let line = 0
28737
- /** @type {RegExpExecArray|null} */
28738
- let match
28739
-
28740
- while ((match = indent_lines_eol.exec(value))) {
28741
- one(value.slice(start, match.index))
28742
- result.push(match[0])
28743
- start = match.index + match[0].length
28744
- line++
28745
- }
28746
-
28747
- one(value.slice(start))
28748
-
28749
- return result.join('')
28750
-
28751
- /**
28752
- * @param {string} value
28753
- */
28754
- function one(value) {
28755
- result.push(map(value, line, !value))
28756
- }
28757
- }
28758
-
28759
- ;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
28291
+ ;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/handle/list-item.js
28760
28292
  /**
28761
28293
  * @typedef {import('mdast').ListItem} ListItem
28762
28294
  * @typedef {import('mdast').List} List
@@ -28801,12 +28333,12 @@ function list_item_listItem(node, parent, context, safeOptions) {
28801
28333
  size = Math.ceil(size / 4) * 4
28802
28334
  }
28803
28335
 
28804
- const tracker = lib_util_track_track(safeOptions)
28336
+ const tracker = track(safeOptions)
28805
28337
  tracker.move(bullet + ' '.repeat(size - bullet.length))
28806
28338
  tracker.shift(size)
28807
28339
  const exit = context.enter('listItem')
28808
- const value = indent_lines_indentLines(
28809
- container_flow_containerFlow(node, context, tracker.current()),
28340
+ const value = indentLines(
28341
+ containerFlow(node, context, tracker.current()),
28810
28342
  map
28811
28343
  )
28812
28344
  exit()
@@ -28915,7 +28447,7 @@ function listItemWithTaskListItem(node, parent, context, safeOptions) {
28915
28447
  const checkable =
28916
28448
  typeof node.checked === 'boolean' && head && head.type === 'paragraph'
28917
28449
  const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '
28918
- const tracker = lib_util_track_track(safeOptions)
28450
+ const tracker = track(safeOptions)
28919
28451
 
28920
28452
  if (checkable) {
28921
28453
  tracker.move(checkbox)
@@ -36262,7 +35794,7 @@ function vbnet(Prism) {
36262
35794
  })
36263
35795
  }
36264
35796
 
36265
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-entities-legacy/index.js
35797
+ ;// CONCATENATED MODULE: ../node_modules/character-entities-legacy/index.js
36266
35798
  /**
36267
35799
  * List of legacy HTML named character references that don’t need a trailing semicolon.
36268
35800
  *
@@ -36377,7 +35909,7 @@ const characterEntitiesLegacy = [
36377
35909
  'yuml'
36378
35910
  ]
36379
35911
 
36380
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-reference-invalid/index.js
35912
+ ;// CONCATENATED MODULE: ../node_modules/character-reference-invalid/index.js
36381
35913
  /**
36382
35914
  * Map of invalid numeric character references to their replacements, according to HTML.
36383
35915
  *
@@ -36414,7 +35946,7 @@ const characterReferenceInvalid = {
36414
35946
  159: 'Ÿ'
36415
35947
  }
36416
35948
 
36417
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-decimal/index.js
35949
+ ;// CONCATENATED MODULE: ../node_modules/is-decimal/index.js
36418
35950
  /**
36419
35951
  * Check if the given character code, or the character code at the first
36420
35952
  * character, is decimal.
@@ -36429,7 +35961,7 @@ function isDecimal(character) {
36429
35961
  return code >= 48 && code <= 57 /* 0-9 */
36430
35962
  }
36431
35963
 
36432
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-hexadecimal/index.js
35964
+ ;// CONCATENATED MODULE: ../node_modules/is-hexadecimal/index.js
36433
35965
  /**
36434
35966
  * Check if the given character code, or the character code at the first
36435
35967
  * character, is hexadecimal.
@@ -36448,7 +35980,7 @@ function isHexadecimal(character) {
36448
35980
  )
36449
35981
  }
36450
35982
 
36451
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphabetical/index.js
35983
+ ;// CONCATENATED MODULE: ../node_modules/is-alphabetical/index.js
36452
35984
  /**
36453
35985
  * Check if the given character code, or the character code at the first
36454
35986
  * character, is alphabetical.
@@ -36466,7 +35998,7 @@ function isAlphabetical(character) {
36466
35998
  )
36467
35999
  }
36468
36000
 
36469
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphanumerical/index.js
36001
+ ;// CONCATENATED MODULE: ../node_modules/is-alphanumerical/index.js
36470
36002
 
36471
36003
 
36472
36004
 
@@ -36481,7 +36013,7 @@ function isAlphanumerical(character) {
36481
36013
  return isAlphabetical(character) || isDecimal(character)
36482
36014
  }
36483
36015
 
36484
- ;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/parse-entities/lib/index.js
36016
+ ;// CONCATENATED MODULE: ../node_modules/parse-entities/lib/index.js
36485
36017
  /**
36486
36018
  * @typedef {import('unist').Point} Point
36487
36019
  * @typedef {import('unist').Position} Position
@@ -61308,121 +60840,6 @@ function toDecimal(code, next, omit) {
61308
60840
  : value + ';'
61309
60841
  }
61310
60842
 
61311
- ;// CONCATENATED MODULE: ../node_modules/stringify-entities/node_modules/character-entities-legacy/index.js
61312
- /**
61313
- * List of legacy HTML named character references that don’t need a trailing semicolon.
61314
- *
61315
- * @type {Array<string>}
61316
- */
61317
- const character_entities_legacy_characterEntitiesLegacy = [
61318
- 'AElig',
61319
- 'AMP',
61320
- 'Aacute',
61321
- 'Acirc',
61322
- 'Agrave',
61323
- 'Aring',
61324
- 'Atilde',
61325
- 'Auml',
61326
- 'COPY',
61327
- 'Ccedil',
61328
- 'ETH',
61329
- 'Eacute',
61330
- 'Ecirc',
61331
- 'Egrave',
61332
- 'Euml',
61333
- 'GT',
61334
- 'Iacute',
61335
- 'Icirc',
61336
- 'Igrave',
61337
- 'Iuml',
61338
- 'LT',
61339
- 'Ntilde',
61340
- 'Oacute',
61341
- 'Ocirc',
61342
- 'Ograve',
61343
- 'Oslash',
61344
- 'Otilde',
61345
- 'Ouml',
61346
- 'QUOT',
61347
- 'REG',
61348
- 'THORN',
61349
- 'Uacute',
61350
- 'Ucirc',
61351
- 'Ugrave',
61352
- 'Uuml',
61353
- 'Yacute',
61354
- 'aacute',
61355
- 'acirc',
61356
- 'acute',
61357
- 'aelig',
61358
- 'agrave',
61359
- 'amp',
61360
- 'aring',
61361
- 'atilde',
61362
- 'auml',
61363
- 'brvbar',
61364
- 'ccedil',
61365
- 'cedil',
61366
- 'cent',
61367
- 'copy',
61368
- 'curren',
61369
- 'deg',
61370
- 'divide',
61371
- 'eacute',
61372
- 'ecirc',
61373
- 'egrave',
61374
- 'eth',
61375
- 'euml',
61376
- 'frac12',
61377
- 'frac14',
61378
- 'frac34',
61379
- 'gt',
61380
- 'iacute',
61381
- 'icirc',
61382
- 'iexcl',
61383
- 'igrave',
61384
- 'iquest',
61385
- 'iuml',
61386
- 'laquo',
61387
- 'lt',
61388
- 'macr',
61389
- 'micro',
61390
- 'middot',
61391
- 'nbsp',
61392
- 'not',
61393
- 'ntilde',
61394
- 'oacute',
61395
- 'ocirc',
61396
- 'ograve',
61397
- 'ordf',
61398
- 'ordm',
61399
- 'oslash',
61400
- 'otilde',
61401
- 'ouml',
61402
- 'para',
61403
- 'plusmn',
61404
- 'pound',
61405
- 'quot',
61406
- 'raquo',
61407
- 'reg',
61408
- 'sect',
61409
- 'shy',
61410
- 'sup1',
61411
- 'sup2',
61412
- 'sup3',
61413
- 'szlig',
61414
- 'thorn',
61415
- 'times',
61416
- 'uacute',
61417
- 'ucirc',
61418
- 'ugrave',
61419
- 'uml',
61420
- 'uuml',
61421
- 'yacute',
61422
- 'yen',
61423
- 'yuml'
61424
- ]
61425
-
61426
60843
  ;// CONCATENATED MODULE: ../node_modules/character-entities-html4/index.js
61427
60844
  /**
61428
60845
  * Map of named character references from HTML 4.
@@ -61743,7 +61160,7 @@ function toNamed(code, next, omit, attribute) {
61743
61160
 
61744
61161
  if (
61745
61162
  omit &&
61746
- character_entities_legacy_characterEntitiesLegacy.includes(name) &&
61163
+ characterEntitiesLegacy.includes(name) &&
61747
61164
  !dangerous.includes(name) &&
61748
61165
  (!attribute ||
61749
61166
  (next &&
@@ -62573,16 +61990,16 @@ var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];func
62573
61990
  // extracted by mini-css-extract-plugin
62574
61991
  /* harmony default export */ const Child = ({});
62575
61992
  ;// CONCATENATED MODULE: ./src/components/Toolbar/Child.tsx
62576
- function Child_Child(props){var _ref=props||{},prefixCls=_ref.prefixCls,groupName=_ref.groupName,commands=_ref.commands,children=_ref.children;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),_useContext$barPopup=_useContext.barPopup,barPopup=_useContext$barPopup===void 0?{}:_useContext$barPopup;return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-toolbar-child ").concat(groupName&&barPopup[groupName]?'active':''),onClick:function onClick(e){return e.stopPropagation();},children:Array.isArray(commands)?/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,_objectSpread2(_objectSpread2({commands:commands},props),{},{height:"",isChild:true})):children});},// eslint-disable-next-line react-hooks/exhaustive-deps
61993
+ function Child_Child(props){var _ref=props||{},prefixCls=_ref.prefixCls,groupName=_ref.groupName,commands=_ref.commands,children=_ref.children;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),_useContext$barPopup=_useContext.barPopup,barPopup=_useContext$barPopup===void 0?{}:_useContext$barPopup;return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-toolbar-child ").concat(groupName&&barPopup[groupName]?'active':''),onClick:function onClick(e){return e.stopPropagation();},children:Array.isArray(commands)?/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,_objectSpread2(_objectSpread2({commands:commands},props),{},{isChild:true})):children});},// eslint-disable-next-line react-hooks/exhaustive-deps
62577
61994
  [commands,barPopup,groupName,prefixCls]);}
62578
61995
  ;// CONCATENATED MODULE: ./src/components/Toolbar/index.less
62579
61996
  // extracted by mini-css-extract-plugin
62580
61997
  /* harmony default export */ const Toolbar = ({});
62581
61998
  ;// CONCATENATED MODULE: ./src/components/Toolbar/index.tsx
62582
- function ToolbarItems(props){var prefixCls=props.prefixCls,overflow=props.overflow;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&&overflow){if(fullscreen){// prevent scroll on fullscreen
61999
+ function ToolbarItems(props){var prefixCls=props.prefixCls,overflow=props.overflow;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,components=_useContext.components,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&&overflow){if(fullscreen){// prevent scroll on fullscreen
62583
62000
  document.body.style.overflow='hidden';}else{// get the original overflow only the first time
62584
62001
  if(!originalOverflow.current){originalOverflow.current=window.getComputedStyle(document.body,null).overflow;}// reset to the original overflow
62585
- document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOverflow,overflow]);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.render&&typeof item.render==='function'&&item.render(item,!!disabled,handleClick,idx),!item.render&&!item.buttonProps&&item.icon,!item.render&&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,{overflow:overflow,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,toolbarBottom=props.toolbarBottom,isChild=props.isChild;var _useContext2=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),commands=_useContext2.commands,extraCommands=_useContext2.extraCommands;var bottomClassName=toolbarBottom?'bottom':'';return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-toolbar ").concat(bottomClassName),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||[]}))]});}
62002
+ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOverflow,overflow]);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);var render=(components===null||components===void 0?void 0:components.toolbar)||item.render;var com=render&&typeof render==='function'?render(item,!!disabled,handleClick,idx):null;return/*#__PURE__*/(0,jsx_runtime.jsxs)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:activeBtn?"active":'',children:[com&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(com)&&com,!com&&!item.buttonProps&&item.icon,!com&&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,{overflow:overflow,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,toolbarBottom=props.toolbarBottom,isChild=props.isChild;var _useContext2=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),commands=_useContext2.commands,extraCommands=_useContext2.extraCommands;var bottomClassName=toolbarBottom?'bottom':'';return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-toolbar ").concat(bottomClassName),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||[]}))]});}
62586
62003
  ;// CONCATENATED MODULE: ./src/components/DragBar/index.less
62587
62004
  // extracted by mini-css-extract-plugin
62588
62005
  /* harmony default export */ const DragBar = ({});
@@ -62593,14 +62010,14 @@ var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.pr
62593
62010
  // extracted by mini-css-extract-plugin
62594
62011
  /* harmony default export */ const src = ({});
62595
62012
  ;// CONCATENATED MODULE: ./src/Editor.tsx
62596
- var Editor_excluded=["prefixCls","className","value","commands","commandsFilter","extraCommands","height","toolbarHeight","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","tabSize","defaultTabEnable","onChange","onHeightChange","hideToolbar","toolbarBottom","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var InternalMDEditor=function InternalMDEditor(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$toolbarHeight=_ref.toolbarHeight,toolbarHeight=_ref$toolbarHeight===void 0?29:_ref$toolbarHeight,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,_onChange=_ref.onChange,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,height:height,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2({},state);});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
62013
+ var Editor_excluded=["prefixCls","className","value","commands","commandsFilter","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","tabSize","defaultTabEnable","onChange","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var InternalMDEditor=function InternalMDEditor(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,_onChange=_ref.onChange,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2({},state);});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
62597
62014
  },[]);var cls=[className,'wmde-markdown-var',prefixCls,state.preview?"".concat(prefixCls,"-show-").concat(state.preview):null,state.fullscreen?"".concat(prefixCls,"-fullscreen"):null].filter(Boolean).join(' ').trim();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return propsValue!==state.markdown&&dispatch({markdown:propsValue||''});},[propsValue,state.markdown]);// eslint-disable-next-line react-hooks/exhaustive-deps
62598
62015
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return previewType!==state.preview&&dispatch({preview:previewType});},[previewType]);// eslint-disable-next-line react-hooks/exhaustive-deps
62599
62016
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return tabSize!==state.tabSize&&dispatch({tabSize:tabSize});},[tabSize]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return highlightEnable!==state.highlightEnable&&dispatch({highlightEnable:highlightEnable});},// eslint-disable-next-line react-hooks/exhaustive-deps
62600
62017
  [highlightEnable]);// eslint-disable-next-line react-hooks/exhaustive-deps
62601
62018
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return autoFocus!==state.autoFocus&&dispatch({autoFocus:autoFocus});},[autoFocus]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return fullscreen!==state.fullscreen&&dispatch({fullscreen:fullscreen});},// eslint-disable-next-line react-hooks/exhaustive-deps
62602
62019
  [fullscreen]);// eslint-disable-next-line react-hooks/exhaustive-deps
62603
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&dispatch({height:height});},[height]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&onHeightChange&&onHeightChange(state.height,height,state);},[height,onHeightChange,state]);var textareaDomRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var active=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('preview');var initScroll=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){textareaDomRef.current=state.textareaWarp;if(state.textareaWarp){state.textareaWarp.addEventListener('mouseover',function(){active.current='text';});state.textareaWarp.addEventListener('mouseleave',function(){active.current='preview';});}},[state.textareaWarp]);var handleScroll=function handleScroll(e,type){if(!enableScrollRef.current)return;var textareaDom=textareaDomRef.current;var previewDom=previewRef.current?previewRef.current.mdp.current:undefined;if(!initScroll.current){active.current=type;initScroll.current=true;}if(textareaDom&&previewDom){var scale=(textareaDom.scrollHeight-textareaDom.offsetHeight)/(previewDom.scrollHeight-previewDom.offsetHeight);if(e.target===textareaDom&&active.current==='text'){previewDom.scrollTop=textareaDom.scrollTop/scale;}if(e.target===previewDom&&active.current==='preview'){textareaDom.scrollTop=previewDom.scrollTop*scale;}var scrollTop=0;if(active.current==='text'){scrollTop=textareaDom.scrollTop||0;}else if(active.current==='preview'){scrollTop=previewDom.scrollTop||0;}dispatch({scrollTop:scrollTop});}};var mdPreview=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)(esm,_objectSpread2(_objectSpread2({},previewOptions),{},{onScroll:function onScroll(e){return handleScroll(e,'preview');},ref:previewRef,source:state.markdown||'',className:"".concat(prefixCls,"-preview ").concat(previewOptions.className||'')}));},[prefixCls,previewOptions,state.markdown]);return/*#__PURE__*/(0,jsx_runtime.jsx)(EditorContext.Provider,{value:_objectSpread2(_objectSpread2({},state),{},{dispatch:dispatch}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",_objectSpread2(_objectSpread2({ref:container,className:cls},other),{},{onClick:function onClick(){dispatch({barPopup:_objectSpread2({},setGroupPopFalse(state.barPopup))});},style:_objectSpread2(_objectSpread2({},other.style),{},{height:state.height||'100%'}),children:[!hideToolbar&&!toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,height:toolbarHeight,overflow:overflow,toolbarBottom:toolbarBottom}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-content"),style:{height:"calc(100% - ".concat(toolbarHeight,"px)")},children:[/(edit|live)/.test(state.preview||'')&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextArea_TextArea,_objectSpread2(_objectSpread2({className:"".concat(prefixCls,"-input"),prefixCls:prefixCls,autoFocus:autoFocus},textareaProps),{},{onChange:function onChange(evn){_onChange&&_onChange(evn.target.value,evn,state);if(textareaProps&&textareaProps.onChange){textareaProps.onChange(evn);}},renderTextarea:renderTextarea,onScroll:function onScroll(e){return handleScroll(e,'text');}})),/(live|preview)/.test(state.preview||'')&&mdPreview]}),visibleDragbar&&!state.fullscreen&&/*#__PURE__*/(0,jsx_runtime.jsx)(components_DragBar,{prefixCls:prefixCls,height:state.height,maxHeight:maxHeight,minHeight:minHeight,onChange:function onChange(newHeight){dispatch({height:newHeight});}}),!hideToolbar&&toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,height:toolbarHeight,overflow:overflow,toolbarBottom:toolbarBottom})]}))});};var mdEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(InternalMDEditor);mdEditor.Markdown=esm;/* harmony default export */ const Editor = (mdEditor);
62020
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&dispatch({height:height});},[height]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&onHeightChange&&onHeightChange(state.height,height,state);},[height,onHeightChange,state]);var textareaDomRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var active=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('preview');var initScroll=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){textareaDomRef.current=state.textareaWarp;if(state.textareaWarp){state.textareaWarp.addEventListener('mouseover',function(){active.current='text';});state.textareaWarp.addEventListener('mouseleave',function(){active.current='preview';});}},[state.textareaWarp]);var handleScroll=function handleScroll(e,type){if(!enableScrollRef.current)return;var textareaDom=textareaDomRef.current;var previewDom=previewRef.current?previewRef.current.mdp.current:undefined;if(!initScroll.current){active.current=type;initScroll.current=true;}if(textareaDom&&previewDom){var scale=(textareaDom.scrollHeight-textareaDom.offsetHeight)/(previewDom.scrollHeight-previewDom.offsetHeight);if(e.target===textareaDom&&active.current==='text'){previewDom.scrollTop=textareaDom.scrollTop/scale;}if(e.target===previewDom&&active.current==='preview'){textareaDom.scrollTop=previewDom.scrollTop*scale;}var scrollTop=0;if(active.current==='text'){scrollTop=textareaDom.scrollTop||0;}else if(active.current==='preview'){scrollTop=previewDom.scrollTop||0;}dispatch({scrollTop:scrollTop});}};var mdPreview=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)(esm,_objectSpread2(_objectSpread2({},previewOptions),{},{onScroll:function onScroll(e){return handleScroll(e,'preview');},ref:previewRef,source:state.markdown||'',className:"".concat(prefixCls,"-preview ").concat(previewOptions.className||'')}));},[prefixCls,previewOptions,state.markdown]);return/*#__PURE__*/(0,jsx_runtime.jsx)(EditorContext.Provider,{value:_objectSpread2(_objectSpread2({},state),{},{dispatch:dispatch}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",_objectSpread2(_objectSpread2({ref:container,className:cls},other),{},{onClick:function onClick(){dispatch({barPopup:_objectSpread2({},setGroupPopFalse(state.barPopup))});},style:_objectSpread2(_objectSpread2({},other.style),{},{height:state.height||'100%'}),children:[!hideToolbar&&!toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,overflow:overflow,toolbarBottom:toolbarBottom}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-content"),children:[/(edit|live)/.test(state.preview||'')&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextArea_TextArea,_objectSpread2(_objectSpread2({className:"".concat(prefixCls,"-input"),prefixCls:prefixCls,autoFocus:autoFocus},textareaProps),{},{onChange:function onChange(evn){_onChange&&_onChange(evn.target.value,evn,state);if(textareaProps&&textareaProps.onChange){textareaProps.onChange(evn);}},renderTextarea:(components===null||components===void 0?void 0:components.textarea)||renderTextarea,onScroll:function onScroll(e){return handleScroll(e,'text');}})),/(live|preview)/.test(state.preview||'')&&mdPreview]}),visibleDragbar&&!state.fullscreen&&/*#__PURE__*/(0,jsx_runtime.jsx)(components_DragBar,{prefixCls:prefixCls,height:state.height,maxHeight:maxHeight,minHeight:minHeight,onChange:function onChange(newHeight){dispatch({height:newHeight});}}),!hideToolbar&&toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,overflow:overflow,toolbarBottom:toolbarBottom})]}))});};var mdEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(InternalMDEditor);mdEditor.Markdown=esm;/* harmony default export */ const Editor = (mdEditor);
62604
62021
  ;// CONCATENATED MODULE: ./src/index.tsx
62605
62022
  /* harmony default export */ const src_0 = (Editor);
62606
62023
  })();