@uiw/react-md-editor 3.14.5 → 3.17.0
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/README.md +71 -4
- package/dist/mdeditor.css +1 -0
- package/dist/mdeditor.js +686 -83
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Context.d.ts +17 -2
- package/esm/Context.js.map +2 -2
- package/esm/Editor.d.ts +20 -4
- package/esm/Editor.js +6 -4
- package/esm/Editor.js.map +4 -3
- package/esm/commands/index.d.ts +2 -0
- package/esm/commands/index.js.map +2 -2
- package/esm/components/Toolbar/index.js +4 -1
- package/esm/components/Toolbar/index.js.map +7 -2
- package/esm/index.css +1 -0
- package/esm/index.less +1 -0
- package/lib/Context.d.ts +17 -2
- package/lib/Context.js.map +2 -2
- package/lib/Editor.d.ts +20 -4
- package/lib/Editor.js +6 -4
- package/lib/Editor.js.map +4 -3
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js.map +2 -2
- package/lib/components/Toolbar/index.js +4 -1
- package/lib/components/Toolbar/index.js.map +8 -3
- package/lib/index.less +1 -0
- package/markdown-editor.css +1 -0
- package/package.json +1 -1
- package/src/Context.tsx +3 -1
- package/src/Editor.tsx +25 -8
- package/src/commands/index.ts +7 -0
- package/src/components/Toolbar/index.tsx +9 -3
- package/src/index.less +1 -0
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/micromark/lib/constructs.js
|
|
9674
|
+
// NAMESPACE OBJECT: ../node_modules/react-markdown/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/unist-util-stringify-position/index.js
|
|
9914
|
+
;// CONCATENATED MODULE: ../node_modules/vfile-message/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/mdast-util-to-string/index.js
|
|
11858
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/initialize/content.js
|
|
12359
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/initialize/document.js
|
|
12440
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/initialize/flow.js
|
|
13215
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/initialize/text.js
|
|
13282
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/create-tokenizer.js
|
|
13534
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/constructs.js
|
|
18139
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/parse.js
|
|
18225
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/preprocess.js
|
|
18279
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/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/micromark/lib/postprocess.js
|
|
18410
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/postprocess.js
|
|
18411
18411
|
/**
|
|
18412
18412
|
* @typedef {import('micromark-util-types').Event} Event
|
|
18413
18413
|
*/
|
|
@@ -18499,7 +18499,71 @@ function decode($0, $1, $2) {
|
|
|
18499
18499
|
return decodeNamedCharacterReference($2) || $0
|
|
18500
18500
|
}
|
|
18501
18501
|
|
|
18502
|
-
;// CONCATENATED MODULE: ../node_modules/
|
|
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
|
|
18503
18567
|
/**
|
|
18504
18568
|
* @typedef {import('micromark-util-types').Encoding} Encoding
|
|
18505
18569
|
* @typedef {import('micromark-util-types').Event} Event
|
|
@@ -19104,7 +19168,7 @@ function compiler(options = {}) {
|
|
|
19104
19168
|
'Cannot close `' +
|
|
19105
19169
|
token.type +
|
|
19106
19170
|
'` (' +
|
|
19107
|
-
|
|
19171
|
+
unist_util_stringify_position_stringifyPosition({
|
|
19108
19172
|
start: token.start,
|
|
19109
19173
|
end: token.end
|
|
19110
19174
|
}) +
|
|
@@ -19717,14 +19781,14 @@ function defaultOnError(left, right) {
|
|
|
19717
19781
|
'Cannot close `' +
|
|
19718
19782
|
left.type +
|
|
19719
19783
|
'` (' +
|
|
19720
|
-
|
|
19784
|
+
unist_util_stringify_position_stringifyPosition({
|
|
19721
19785
|
start: left.start,
|
|
19722
19786
|
end: left.end
|
|
19723
19787
|
}) +
|
|
19724
19788
|
'): a different token (`' +
|
|
19725
19789
|
right.type +
|
|
19726
19790
|
'`, ' +
|
|
19727
|
-
|
|
19791
|
+
unist_util_stringify_position_stringifyPosition({
|
|
19728
19792
|
start: right.start,
|
|
19729
19793
|
end: right.end
|
|
19730
19794
|
}) +
|
|
@@ -19735,7 +19799,7 @@ function defaultOnError(left, right) {
|
|
|
19735
19799
|
'Cannot close document, a token (`' +
|
|
19736
19800
|
right.type +
|
|
19737
19801
|
'`, ' +
|
|
19738
|
-
|
|
19802
|
+
unist_util_stringify_position_stringifyPosition({
|
|
19739
19803
|
start: right.start,
|
|
19740
19804
|
end: right.end
|
|
19741
19805
|
}) +
|
|
@@ -19744,7 +19808,7 @@ function defaultOnError(left, right) {
|
|
|
19744
19808
|
}
|
|
19745
19809
|
}
|
|
19746
19810
|
|
|
19747
|
-
;// CONCATENATED MODULE: ../node_modules/remark-parse/lib/index.js
|
|
19811
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/lib/index.js
|
|
19748
19812
|
/**
|
|
19749
19813
|
* @typedef {import('mdast').Root} Root
|
|
19750
19814
|
* @typedef {import('mdast-util-from-markdown').Options} Options
|
|
@@ -19774,7 +19838,7 @@ function remarkParse(options) {
|
|
|
19774
19838
|
Object.assign(this, {Parser: parser})
|
|
19775
19839
|
}
|
|
19776
19840
|
|
|
19777
|
-
;// CONCATENATED MODULE: ../node_modules/remark-parse/index.js
|
|
19841
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/index.js
|
|
19778
19842
|
|
|
19779
19843
|
|
|
19780
19844
|
/* harmony default export */ const remark_parse = (remarkParse);
|
|
@@ -26365,6 +26429,7 @@ const findAndReplace =
|
|
|
26365
26429
|
let start = 0
|
|
26366
26430
|
// @ts-expect-error: TS is wrong, some of these children can be text.
|
|
26367
26431
|
const index = parent.children.indexOf(node)
|
|
26432
|
+
let change = false
|
|
26368
26433
|
/** @type {Array<PhrasingContent>} */
|
|
26369
26434
|
let nodes = []
|
|
26370
26435
|
/** @type {number|undefined} */
|
|
@@ -26388,9 +26453,7 @@ const findAndReplace =
|
|
|
26388
26453
|
value = value.length > 0 ? {type: 'text', value} : undefined
|
|
26389
26454
|
}
|
|
26390
26455
|
|
|
26391
|
-
if (value
|
|
26392
|
-
position = undefined
|
|
26393
|
-
} else {
|
|
26456
|
+
if (value !== false) {
|
|
26394
26457
|
if (start !== position) {
|
|
26395
26458
|
nodes.push({
|
|
26396
26459
|
type: 'text',
|
|
@@ -26405,6 +26468,7 @@ const findAndReplace =
|
|
|
26405
26468
|
}
|
|
26406
26469
|
|
|
26407
26470
|
start = position + match[0].length
|
|
26471
|
+
change = true
|
|
26408
26472
|
}
|
|
26409
26473
|
|
|
26410
26474
|
if (!find.global) {
|
|
@@ -26414,14 +26478,14 @@ const findAndReplace =
|
|
|
26414
26478
|
match = find.exec(node.value)
|
|
26415
26479
|
}
|
|
26416
26480
|
|
|
26417
|
-
if (
|
|
26418
|
-
nodes = [node]
|
|
26419
|
-
} else {
|
|
26481
|
+
if (change) {
|
|
26420
26482
|
if (start < node.value.length) {
|
|
26421
26483
|
nodes.push({type: 'text', value: node.value.slice(start)})
|
|
26422
26484
|
}
|
|
26423
26485
|
|
|
26424
26486
|
parent.children.splice(index, 1, ...nodes)
|
|
26487
|
+
} else {
|
|
26488
|
+
nodes = [node]
|
|
26425
26489
|
}
|
|
26426
26490
|
|
|
26427
26491
|
return index + nodes.length
|
|
@@ -26724,7 +26788,7 @@ function mdast_util_gfm_autolink_literal_previous(match, email) {
|
|
|
26724
26788
|
)
|
|
26725
26789
|
}
|
|
26726
26790
|
|
|
26727
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/association.js
|
|
26791
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/association.js
|
|
26728
26792
|
/**
|
|
26729
26793
|
* @typedef {import('mdast').Association} Association
|
|
26730
26794
|
*/
|
|
@@ -26754,7 +26818,7 @@ function association(node) {
|
|
|
26754
26818
|
return decodeString(node.identifier)
|
|
26755
26819
|
}
|
|
26756
26820
|
|
|
26757
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
26821
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
26758
26822
|
/**
|
|
26759
26823
|
* @typedef {import('unist').Point} Point
|
|
26760
26824
|
* @typedef {import('../types.js').TrackFields} TrackFields
|
|
@@ -26813,7 +26877,7 @@ function track(options_) {
|
|
|
26813
26877
|
}
|
|
26814
26878
|
}
|
|
26815
26879
|
|
|
26816
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
26880
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
26817
26881
|
/**
|
|
26818
26882
|
* @typedef {import('../types.js').Node} Node
|
|
26819
26883
|
* @typedef {import('../types.js').Parent} Parent
|
|
@@ -26896,7 +26960,7 @@ function containerFlow(parent, context, safeOptions) {
|
|
|
26896
26960
|
}
|
|
26897
26961
|
}
|
|
26898
26962
|
|
|
26899
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
|
|
26963
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
|
|
26900
26964
|
/**
|
|
26901
26965
|
* @callback Map
|
|
26902
26966
|
* @param {string} value
|
|
@@ -26939,7 +27003,7 @@ function indentLines(value, map) {
|
|
|
26939
27003
|
}
|
|
26940
27004
|
}
|
|
26941
27005
|
|
|
26942
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
27006
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
26943
27007
|
/**
|
|
26944
27008
|
* @typedef {import('../types.js').Unsafe} Unsafe
|
|
26945
27009
|
*/
|
|
@@ -26966,7 +27030,7 @@ function patternCompile(pattern) {
|
|
|
26966
27030
|
return pattern._compiled
|
|
26967
27031
|
}
|
|
26968
27032
|
|
|
26969
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
27033
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
26970
27034
|
/**
|
|
26971
27035
|
* @typedef {import('../types.js').Unsafe} Unsafe
|
|
26972
27036
|
*/
|
|
@@ -27009,7 +27073,7 @@ function listInScope(stack, list, none) {
|
|
|
27009
27073
|
return false
|
|
27010
27074
|
}
|
|
27011
27075
|
|
|
27012
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/safe.js
|
|
27076
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/safe.js
|
|
27013
27077
|
/**
|
|
27014
27078
|
* @typedef {import('../types.js').Context} Context
|
|
27015
27079
|
* @typedef {import('../types.js').SafeOptions} SafeOptions
|
|
@@ -27342,7 +27406,66 @@ function gfmFootnoteToMarkdown() {
|
|
|
27342
27406
|
}
|
|
27343
27407
|
}
|
|
27344
27408
|
|
|
27345
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/
|
|
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
|
|
27346
27469
|
/**
|
|
27347
27470
|
* @typedef {import('../types.js').Node} Node
|
|
27348
27471
|
* @typedef {import('../types.js').Parent} Parent
|
|
@@ -27367,7 +27490,7 @@ function containerPhrasing(parent, context, safeOptions) {
|
|
|
27367
27490
|
let before = safeOptions.before
|
|
27368
27491
|
|
|
27369
27492
|
indexStack.push(-1)
|
|
27370
|
-
let tracker =
|
|
27493
|
+
let tracker = track_track(safeOptions)
|
|
27371
27494
|
|
|
27372
27495
|
while (++index < children.length) {
|
|
27373
27496
|
const child = children[index]
|
|
@@ -27409,7 +27532,7 @@ function containerPhrasing(parent, context, safeOptions) {
|
|
|
27409
27532
|
before = ' '
|
|
27410
27533
|
|
|
27411
27534
|
// To do: does this work to reset tracker?
|
|
27412
|
-
tracker =
|
|
27535
|
+
tracker = track_track(safeOptions)
|
|
27413
27536
|
tracker.move(results.join(''))
|
|
27414
27537
|
}
|
|
27415
27538
|
|
|
@@ -27473,7 +27596,7 @@ function exitStrikethrough(token) {
|
|
|
27473
27596
|
* @param {Delete} node
|
|
27474
27597
|
*/
|
|
27475
27598
|
function handleDelete(node, _, context, safeOptions) {
|
|
27476
|
-
const tracker =
|
|
27599
|
+
const tracker = track_track(safeOptions)
|
|
27477
27600
|
const exit = context.enter('emphasis')
|
|
27478
27601
|
let value = tracker.move('~~')
|
|
27479
27602
|
value += containerPhrasing(node, context, {
|
|
@@ -27491,7 +27614,182 @@ function peekDelete() {
|
|
|
27491
27614
|
return '~'
|
|
27492
27615
|
}
|
|
27493
27616
|
|
|
27494
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/
|
|
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
|
|
27495
27793
|
/**
|
|
27496
27794
|
* @typedef {import('mdast').InlineCode} InlineCode
|
|
27497
27795
|
* @typedef {import('../types.js').Handle} Handle
|
|
@@ -27535,7 +27833,7 @@ function inline_code_inlineCode(node, _, context) {
|
|
|
27535
27833
|
// them out.
|
|
27536
27834
|
while (++index < context.unsafe.length) {
|
|
27537
27835
|
const pattern = context.unsafe[index]
|
|
27538
|
-
const expression =
|
|
27836
|
+
const expression = pattern_compile_patternCompile(pattern)
|
|
27539
27837
|
/** @type {RegExpExecArray|null} */
|
|
27540
27838
|
let match
|
|
27541
27839
|
|
|
@@ -28127,7 +28425,7 @@ function gfmTableToMarkdown(options) {
|
|
|
28127
28425
|
function handleTableCell(node, _, context, safeOptions) {
|
|
28128
28426
|
const exit = context.enter('tableCell')
|
|
28129
28427
|
const subexit = context.enter('phrasing')
|
|
28130
|
-
const value =
|
|
28428
|
+
const value = container_phrasing_containerPhrasing(node, context, {
|
|
28131
28429
|
...safeOptions,
|
|
28132
28430
|
before: around,
|
|
28133
28431
|
after: around
|
|
@@ -28219,7 +28517,7 @@ function gfmTableToMarkdown(options) {
|
|
|
28219
28517
|
}
|
|
28220
28518
|
}
|
|
28221
28519
|
|
|
28222
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
28520
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
28223
28521
|
/**
|
|
28224
28522
|
* @typedef {import('../types.js').Context} Context
|
|
28225
28523
|
* @typedef {import('../types.js').Options} Options
|
|
@@ -28243,7 +28541,7 @@ function checkBullet(context) {
|
|
|
28243
28541
|
return marker
|
|
28244
28542
|
}
|
|
28245
28543
|
|
|
28246
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
28544
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
28247
28545
|
/**
|
|
28248
28546
|
* @typedef {import('../types.js').Context} Context
|
|
28249
28547
|
* @typedef {import('../types.js').Options} Options
|
|
@@ -28273,7 +28571,192 @@ function checkListItemIndent(context) {
|
|
|
28273
28571
|
return style
|
|
28274
28572
|
}
|
|
28275
28573
|
|
|
28276
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/
|
|
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
|
|
28277
28760
|
/**
|
|
28278
28761
|
* @typedef {import('mdast').ListItem} ListItem
|
|
28279
28762
|
* @typedef {import('mdast').List} List
|
|
@@ -28318,12 +28801,12 @@ function list_item_listItem(node, parent, context, safeOptions) {
|
|
|
28318
28801
|
size = Math.ceil(size / 4) * 4
|
|
28319
28802
|
}
|
|
28320
28803
|
|
|
28321
|
-
const tracker =
|
|
28804
|
+
const tracker = lib_util_track_track(safeOptions)
|
|
28322
28805
|
tracker.move(bullet + ' '.repeat(size - bullet.length))
|
|
28323
28806
|
tracker.shift(size)
|
|
28324
28807
|
const exit = context.enter('listItem')
|
|
28325
|
-
const value =
|
|
28326
|
-
|
|
28808
|
+
const value = indent_lines_indentLines(
|
|
28809
|
+
container_flow_containerFlow(node, context, tracker.current()),
|
|
28327
28810
|
map
|
|
28328
28811
|
)
|
|
28329
28812
|
exit()
|
|
@@ -28432,7 +28915,7 @@ function listItemWithTaskListItem(node, parent, context, safeOptions) {
|
|
|
28432
28915
|
const checkable =
|
|
28433
28916
|
typeof node.checked === 'boolean' && head && head.type === 'paragraph'
|
|
28434
28917
|
const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '
|
|
28435
|
-
const tracker =
|
|
28918
|
+
const tracker = lib_util_track_track(safeOptions)
|
|
28436
28919
|
|
|
28437
28920
|
if (checkable) {
|
|
28438
28921
|
tracker.move(checkbox)
|
|
@@ -30707,22 +31190,22 @@ const htmlVoidElements = [
|
|
|
30707
31190
|
* @typedef {Omit<Comment, 'value'> & {value: {stitch: Node}}} Stitch
|
|
30708
31191
|
*
|
|
30709
31192
|
* @typedef Options
|
|
30710
|
-
* @property {Array
|
|
31193
|
+
* @property {Array<string>} [passThrough]
|
|
30711
31194
|
* List of custom hast node types to pass through (keep) in hast.
|
|
30712
31195
|
* If the passed through nodes have children, those children are expected to
|
|
30713
31196
|
* be hast and will be handled.
|
|
30714
31197
|
*
|
|
30715
31198
|
* @typedef HiddenTokenizer
|
|
30716
|
-
* @property {Array
|
|
31199
|
+
* @property {Array<HiddenLocationTracker>} __mixins
|
|
30717
31200
|
* Way too simple, but works for us.
|
|
30718
31201
|
* @property {HiddenPreprocessor} preprocessor
|
|
30719
31202
|
* @property {(value: string) => void} write
|
|
30720
31203
|
* @property {() => number} _consume
|
|
30721
|
-
* @property {Array
|
|
31204
|
+
* @property {Array<HiddenToken>} tokenQueue
|
|
30722
31205
|
* @property {string} state
|
|
30723
31206
|
* @property {string} returnState
|
|
30724
31207
|
* @property {number} charRefCode
|
|
30725
|
-
* @property {Array
|
|
31208
|
+
* @property {Array<number>} tempBuff
|
|
30726
31209
|
* @property {Function} _flushCodePointsConsumedAsCharacterReference
|
|
30727
31210
|
* @property {string} lastStartTagName
|
|
30728
31211
|
* @property {number} consumedAfterSnapshot
|
|
@@ -30733,14 +31216,14 @@ const htmlVoidElements = [
|
|
|
30733
31216
|
* @property {Function} NAMED_CHARACTER_REFERENCE_STATE
|
|
30734
31217
|
* @property {Function} NUMERIC_CHARACTER_REFERENCE_END_STATE
|
|
30735
31218
|
*
|
|
30736
|
-
* @typedef {
|
|
31219
|
+
* @typedef {Record<string, unknown> & {location: P5Location}} HiddenToken
|
|
30737
31220
|
*
|
|
30738
31221
|
* @typedef HiddenPreprocessor
|
|
30739
31222
|
* @property {string|undefined} html
|
|
30740
31223
|
* @property {number} pos
|
|
30741
31224
|
* @property {number} lastGapPos
|
|
30742
31225
|
* @property {number} lastCharPos
|
|
30743
|
-
* @property {Array
|
|
31226
|
+
* @property {Array<number>} gapStack
|
|
30744
31227
|
* @property {boolean} skipNextNewLine
|
|
30745
31228
|
* @property {boolean} lastChunkWritten
|
|
30746
31229
|
* @property {boolean} endOfChunkHit
|
|
@@ -30902,6 +31385,8 @@ const raw =
|
|
|
30902
31385
|
|
|
30903
31386
|
one(tree)
|
|
30904
31387
|
|
|
31388
|
+
resetTokenizer()
|
|
31389
|
+
|
|
30905
31390
|
parser._adoptNodes(mock.childNodes[0], doc)
|
|
30906
31391
|
|
|
30907
31392
|
return doc
|
|
@@ -30924,11 +31409,13 @@ const raw =
|
|
|
30924
31409
|
|
|
30925
31410
|
one(tree)
|
|
30926
31411
|
|
|
31412
|
+
resetTokenizer()
|
|
31413
|
+
|
|
30927
31414
|
return doc
|
|
30928
31415
|
}
|
|
30929
31416
|
|
|
30930
31417
|
/**
|
|
30931
|
-
* @param {Content
|
|
31418
|
+
* @param {Array<Content>} nodes
|
|
30932
31419
|
* @returns {void}
|
|
30933
31420
|
*/
|
|
30934
31421
|
function all(nodes) {
|
|
@@ -31025,7 +31512,7 @@ const raw =
|
|
|
31025
31512
|
if (!locationTracker) throw new Error('Expected `locationTracker`')
|
|
31026
31513
|
|
|
31027
31514
|
// Reset preprocessor:
|
|
31028
|
-
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/tokenizer/preprocessor.js>.
|
|
31515
|
+
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/tokenizer/preprocessor.js#L17>.
|
|
31029
31516
|
preprocessor.html = undefined
|
|
31030
31517
|
preprocessor.pos = -1
|
|
31031
31518
|
preprocessor.lastGapPos = -1
|
|
@@ -31066,18 +31553,6 @@ const raw =
|
|
|
31066
31553
|
preprocessor.lastChunkWritten = true
|
|
31067
31554
|
tokenizer[tokenizer.state](tokenizer._consume())
|
|
31068
31555
|
}
|
|
31069
|
-
|
|
31070
|
-
// Process final characters if they’re still there after hibernating.
|
|
31071
|
-
// Similar to:
|
|
31072
|
-
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/extensions/location-info/tokenizer-mixin.js#L95>.
|
|
31073
|
-
const token = tokenizer.currentCharacterToken
|
|
31074
|
-
|
|
31075
|
-
if (token) {
|
|
31076
|
-
token.location.endLine = posTracker.line
|
|
31077
|
-
token.location.endCol = posTracker.col + 1
|
|
31078
|
-
token.location.endOffset = posTracker.offset + 1
|
|
31079
|
-
parser._processToken(token)
|
|
31080
|
-
}
|
|
31081
31556
|
}
|
|
31082
31557
|
|
|
31083
31558
|
/**
|
|
@@ -31112,8 +31587,21 @@ const raw =
|
|
|
31112
31587
|
}
|
|
31113
31588
|
|
|
31114
31589
|
function resetTokenizer() {
|
|
31115
|
-
/* c8 ignore next */
|
|
31590
|
+
/* c8 ignore next 2 */
|
|
31116
31591
|
if (!tokenizer) throw new Error('Expected `tokenizer`')
|
|
31592
|
+
if (!posTracker) throw new Error('Expected `posTracker`')
|
|
31593
|
+
|
|
31594
|
+
// Process final characters if they’re still there after hibernating.
|
|
31595
|
+
// Similar to:
|
|
31596
|
+
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/extensions/location-info/tokenizer-mixin.js#L95>.
|
|
31597
|
+
const token = tokenizer.currentCharacterToken
|
|
31598
|
+
|
|
31599
|
+
if (token) {
|
|
31600
|
+
token.location.endLine = posTracker.line
|
|
31601
|
+
token.location.endCol = posTracker.col + 1
|
|
31602
|
+
token.location.endOffset = posTracker.offset + 1
|
|
31603
|
+
parser._processToken(token)
|
|
31604
|
+
}
|
|
31117
31605
|
|
|
31118
31606
|
// Reset tokenizer:
|
|
31119
31607
|
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/tokenizer/index.js#L218-L234>.
|
|
@@ -31158,7 +31646,7 @@ function startTag(node) {
|
|
|
31158
31646
|
|
|
31159
31647
|
/**
|
|
31160
31648
|
* @param {Element} node
|
|
31161
|
-
* @returns {Array
|
|
31649
|
+
* @returns {Array<P5Attribute>}
|
|
31162
31650
|
*/
|
|
31163
31651
|
function attributes(node) {
|
|
31164
31652
|
return toParse5({
|
|
@@ -35774,7 +36262,7 @@ function vbnet(Prism) {
|
|
|
35774
36262
|
})
|
|
35775
36263
|
}
|
|
35776
36264
|
|
|
35777
|
-
;// CONCATENATED MODULE: ../node_modules/character-entities-legacy/index.js
|
|
36265
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-entities-legacy/index.js
|
|
35778
36266
|
/**
|
|
35779
36267
|
* List of legacy HTML named character references that don’t need a trailing semicolon.
|
|
35780
36268
|
*
|
|
@@ -35889,7 +36377,7 @@ const characterEntitiesLegacy = [
|
|
|
35889
36377
|
'yuml'
|
|
35890
36378
|
]
|
|
35891
36379
|
|
|
35892
|
-
;// CONCATENATED MODULE: ../node_modules/character-reference-invalid/index.js
|
|
36380
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-reference-invalid/index.js
|
|
35893
36381
|
/**
|
|
35894
36382
|
* Map of invalid numeric character references to their replacements, according to HTML.
|
|
35895
36383
|
*
|
|
@@ -35926,7 +36414,7 @@ const characterReferenceInvalid = {
|
|
|
35926
36414
|
159: 'Ÿ'
|
|
35927
36415
|
}
|
|
35928
36416
|
|
|
35929
|
-
;// CONCATENATED MODULE: ../node_modules/is-decimal/index.js
|
|
36417
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-decimal/index.js
|
|
35930
36418
|
/**
|
|
35931
36419
|
* Check if the given character code, or the character code at the first
|
|
35932
36420
|
* character, is decimal.
|
|
@@ -35941,7 +36429,7 @@ function isDecimal(character) {
|
|
|
35941
36429
|
return code >= 48 && code <= 57 /* 0-9 */
|
|
35942
36430
|
}
|
|
35943
36431
|
|
|
35944
|
-
;// CONCATENATED MODULE: ../node_modules/is-hexadecimal/index.js
|
|
36432
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-hexadecimal/index.js
|
|
35945
36433
|
/**
|
|
35946
36434
|
* Check if the given character code, or the character code at the first
|
|
35947
36435
|
* character, is hexadecimal.
|
|
@@ -35960,7 +36448,7 @@ function isHexadecimal(character) {
|
|
|
35960
36448
|
)
|
|
35961
36449
|
}
|
|
35962
36450
|
|
|
35963
|
-
;// CONCATENATED MODULE: ../node_modules/is-alphabetical/index.js
|
|
36451
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphabetical/index.js
|
|
35964
36452
|
/**
|
|
35965
36453
|
* Check if the given character code, or the character code at the first
|
|
35966
36454
|
* character, is alphabetical.
|
|
@@ -35978,7 +36466,7 @@ function isAlphabetical(character) {
|
|
|
35978
36466
|
)
|
|
35979
36467
|
}
|
|
35980
36468
|
|
|
35981
|
-
;// CONCATENATED MODULE: ../node_modules/is-alphanumerical/index.js
|
|
36469
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphanumerical/index.js
|
|
35982
36470
|
|
|
35983
36471
|
|
|
35984
36472
|
|
|
@@ -35993,7 +36481,7 @@ function isAlphanumerical(character) {
|
|
|
35993
36481
|
return isAlphabetical(character) || isDecimal(character)
|
|
35994
36482
|
}
|
|
35995
36483
|
|
|
35996
|
-
;// CONCATENATED MODULE: ../node_modules/parse-entities/lib/index.js
|
|
36484
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/parse-entities/lib/index.js
|
|
35997
36485
|
/**
|
|
35998
36486
|
* @typedef {import('unist').Point} Point
|
|
35999
36487
|
* @typedef {import('unist').Position} Position
|
|
@@ -57446,7 +57934,7 @@ refractor.register(zig)
|
|
|
57446
57934
|
|
|
57447
57935
|
|
|
57448
57936
|
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/dist/rehype-prism-plus.es.js
|
|
57449
|
-
function a(){a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){return r[t]=e[n[t]],r},Object.create(null))}return rehype_prism_plus_es_s(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);return t&&(t.groups=n(t,this)),t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){return"$"+o[r]}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},a.apply(this,arguments)}function rehype_prism_plus_es_s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}function l(e,r){return l=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},l(e,r)}function rehype_prism_plus_es_u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function rehype_prism_plus_es_c(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return rehype_prism_plus_es_u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rehype_prism_plus_es_u(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p=function
|
|
57937
|
+
function a(){a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){return r[t]=e[n[t]],r},Object.create(null))}return rehype_prism_plus_es_s(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);return t&&(t.groups=n(t,this)),t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){return"$"+o[r]}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},a.apply(this,arguments)}function rehype_prism_plus_es_s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}function l(e,r){return l=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},l(e,r)}function rehype_prism_plus_es_u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function rehype_prism_plus_es_c(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return rehype_prism_plus_es_u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rehype_prism_plus_es_u(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p=function(i){return function(o){return void 0===o&&(o={}),function(r){visit(r,"element",s)};function s(e,s,l){if(l&&"pre"===l.tagName&&"code"===e.tagName){var u=e.data&&e.data.meta?e.data.meta:"";e.properties.className?"boolean"==typeof e.properties.className?e.properties.className=[]:Array.isArray(e.properties.className)||(e.properties.className=[e.properties.className]):e.properties.className=[],e.properties.className.push("code-highlight");var p,f,m=function(e){for(var r,t=rehype_prism_plus_es_c(e.properties.className);!(r=t()).done;){var n=r.value;if("language-"===n.slice(0,9))return n.slice(9).toLowerCase()}return null}(e);if(m)try{p=i.highlight(hast_util_to_string_toString(e),m),l.properties.className=(l.properties.className||[]).concat("language-"+m)}catch(r){if(!o.ignoreMissing||!/Unknown language/.test(r.message))throw r;p=e}else p=e;p.children=(f=1,function e(r){return r.reduce(function(r,t){if("text"===t.type){var n=t.value,i=(n.match(/\n/g)||"").length;if(0===i)t.position={start:{line:f,column:0},end:{line:f,column:0}},r.push(t);else for(var o,a=n.split("\n"),s=rehype_prism_plus_es_c(a.entries());!(o=s()).done;){var l=o.value,u=l[0],p=l[1];r.push({type:"text",value:u===a.length-1?p:p+"\n",position:{start:{line:f+u},end:{line:f+u}}})}return f+=i,r}if(Object.prototype.hasOwnProperty.call(t,"children")){var m=f;return t.children=e(t.children),r.push(t),t.position={start:{line:m,column:0},end:{line:f,column:0}},r}return r.push(t),r},[])})(p.children),p.position=p.children.length>0?{start:{line:p.children[0].position.start.line,column:0},end:{line:p.children[p.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var h,d=function(e){var r=/{([\d,-]+)}/,t=e.split(",").map(function(e){return e.trim()}).join();if(r.test(t)){var i=r.exec(t)[1],o=parse_numeric_range(i);return function(e){return o.includes(e+1)}}return function(){return!1}}(u),g=function(e){var r=/*#__PURE__*/a(/showLineNumbers=([0-9]+)/i,{lines:1});if(r.test(e)){var t=r.exec(e);return Number(t.groups.lines)}return 1}(u),y=function(e){for(var r=new Array(e),t=0;t<e;t++)r[t]={type:"element",tagName:"span",properties:{className:[]},children:[]};return r}(p.position.end.line),v=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],b=function(){var e=h.value,n=e[0],i=e[1];i.properties.className=["code-line"];var a=filter(p,function(e){return e.position.start.line<=n+1&&e.position.end.line>=n+1});i.children=a.children,!u.toLowerCase().includes("showLineNumbers".toLowerCase())&&!o.showLineNumbers||v.some(function(e){return u.toLowerCase().includes(e)})||(i.properties.line=[(n+g).toString()],i.properties.className.push("line-number")),d(n)&&i.properties.className.push("highlight-line"),"diff"===m&&"-"===hast_util_to_string_toString(i).substring(0,1)?i.properties.className.push("deleted"):"diff"===m&&"+"===hast_util_to_string_toString(i).substring(0,1)&&i.properties.className.push("inserted")},w=rehype_prism_plus_es_c(y.entries());!(h=w()).done;)b();y.length>0&&""===hast_util_to_string_toString(y[y.length-1]).trim()&&y.pop(),e.children=y}}}},f=p(refractor),m=p(refractor);
|
|
57450
57938
|
//# sourceMappingURL=rehype-prism-plus.es.js.map
|
|
57451
57939
|
|
|
57452
57940
|
;// CONCATENATED MODULE: ../node_modules/direction/index.js
|
|
@@ -59788,7 +60276,7 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "on
|
|
|
59788
60276
|
rewrite && rewrite(node, index, parent);
|
|
59789
60277
|
};
|
|
59790
60278
|
|
|
59791
|
-
var rehypePlugins = [reservedMeta, [
|
|
60279
|
+
var rehypePlugins = [reservedMeta, [m, {
|
|
59792
60280
|
ignoreMissing: true
|
|
59793
60281
|
}], rehypeRaw, rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_lib, [rehype_rewrite_lib, {
|
|
59794
60282
|
rewrite: rehypeRewriteHandle
|
|
@@ -60820,6 +61308,121 @@ function toDecimal(code, next, omit) {
|
|
|
60820
61308
|
: value + ';'
|
|
60821
61309
|
}
|
|
60822
61310
|
|
|
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
|
+
|
|
60823
61426
|
;// CONCATENATED MODULE: ../node_modules/character-entities-html4/index.js
|
|
60824
61427
|
/**
|
|
60825
61428
|
* Map of named character references from HTML 4.
|
|
@@ -61140,7 +61743,7 @@ function toNamed(code, next, omit, attribute) {
|
|
|
61140
61743
|
|
|
61141
61744
|
if (
|
|
61142
61745
|
omit &&
|
|
61143
|
-
|
|
61746
|
+
character_entities_legacy_characterEntitiesLegacy.includes(name) &&
|
|
61144
61747
|
!dangerous.includes(name) &&
|
|
61145
61748
|
(!attribute ||
|
|
61146
61749
|
(next &&
|
|
@@ -61757,7 +62360,7 @@ const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
|
|
|
61757
62360
|
|
|
61758
62361
|
;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
|
|
61759
62362
|
function html2Escape(sHtml){return sHtml.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g,function(str){return str.replace(/[<&"]/g,function(c){return{'<':'<','>':'>','&':'&','"':'"'}[c];});}).replace(/[<&"]/g,function(c){return{'<':'<','>':'>','&':'&','"':'"'}[c];});}function Markdown(props){var prefixCls=props.prefixCls;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),_useContext$markdown=_useContext.markdown,markdown=_useContext$markdown===void 0?'':_useContext$markdown,highlightEnable=_useContext.highlightEnable,dispatch=_useContext.dispatch;var preRef=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(preRef.current&&dispatch){dispatch({textareaPre:preRef.current});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61760
|
-
},[]);return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){if(!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var mdStr="<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown),"\n</code></pre>");if(highlightEnable){try{mdStr=rehype().data('settings',{fragment:true}).use(
|
|
62363
|
+
},[]);return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){if(!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var mdStr="<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown),"\n</code></pre>");if(highlightEnable){try{mdStr=rehype().data('settings',{fragment:true}).use(m,{ignoreMissing:true}).processSync(mdStr).toString();}catch(error){}}return/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('div',{className:'wmde-markdown-color',dangerouslySetInnerHTML:{__html:mdStr||''}});},[markdown,preRef,prefixCls]);}
|
|
61761
62364
|
;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
61762
62365
|
|
|
61763
62366
|
function _arrayWithoutHoles(arr) {
|
|
@@ -61976,10 +62579,10 @@ function Child_Child(props){var _ref=props||{},prefixCls=_ref.prefixCls,groupNam
|
|
|
61976
62579
|
// extracted by mini-css-extract-plugin
|
|
61977
62580
|
/* harmony default export */ const Toolbar = ({});
|
|
61978
62581
|
;// CONCATENATED MODULE: ./src/components/Toolbar/index.tsx
|
|
61979
|
-
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
|
|
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,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
|
|
61980
62583
|
document.body.style.overflow='hidden';}else{// get the original overflow only the first time
|
|
61981
62584
|
if(!originalOverflow.current){originalOverflow.current=window.getComputedStyle(document.body,null).overflow;}// reset to the original overflow
|
|
61982
|
-
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:[
|
|
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);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,_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||[]}))]});}
|
|
61983
62586
|
;// CONCATENATED MODULE: ./src/components/DragBar/index.less
|
|
61984
62587
|
// extracted by mini-css-extract-plugin
|
|
61985
62588
|
/* harmony default export */ const DragBar = ({});
|
|
@@ -61990,14 +62593,14 @@ var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.pr
|
|
|
61990
62593
|
// extracted by mini-css-extract-plugin
|
|
61991
62594
|
/* harmony default export */ const src = ({});
|
|
61992
62595
|
;// CONCATENATED MODULE: ./src/Editor.tsx
|
|
61993
|
-
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
|
|
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","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$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,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
|
|
61994
62597
|
},[]);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
|
|
61995
62598
|
(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
|
|
61996
62599
|
(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
|
|
61997
62600
|
[highlightEnable]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61998
62601
|
(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
|
|
61999
62602
|
[fullscreen]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62000
|
-
(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.
|
|
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:(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,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);
|
|
62001
62604
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
62002
62605
|
/* harmony default export */ const src_0 = (Editor);
|
|
62003
62606
|
})();
|