@uiw/react-md-editor 3.14.2 → 3.14.5
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 +88 -0
- package/dist/mdeditor.css +0 -6
- package/dist/mdeditor.js +137 -274
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/commands/group.d.ts +1 -1
- package/esm/components/TextArea/Markdown.js +1 -1
- package/esm/components/TextArea/Markdown.js.map +1 -1
- package/esm/components/TextArea/index.js +10 -5
- package/esm/components/TextArea/index.js.map +6 -4
- package/lib/commands/group.d.ts +1 -1
- package/lib/components/TextArea/Markdown.js +1 -1
- package/lib/components/TextArea/Markdown.js.map +1 -1
- package/lib/components/TextArea/index.js +11 -6
- package/lib/components/TextArea/index.js.map +6 -4
- package/package.json +2 -2
- package/src/components/TextArea/Markdown.tsx +1 -1
- package/src/components/TextArea/index.tsx +4 -5
package/dist/mdeditor.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/
|
|
14
|
+
/***/ 71:
|
|
15
15
|
/***/ (function(module) {
|
|
16
16
|
|
|
17
17
|
/*!
|
|
@@ -11084,12 +11084,12 @@ function bail(error) {
|
|
|
11084
11084
|
var extend = __webpack_require__(112);
|
|
11085
11085
|
;// CONCATENATED MODULE: ../node_modules/unified/node_modules/is-plain-obj/index.js
|
|
11086
11086
|
function isPlainObject(value) {
|
|
11087
|
-
if (
|
|
11087
|
+
if (typeof value !== 'object' || value === null) {
|
|
11088
11088
|
return false;
|
|
11089
11089
|
}
|
|
11090
11090
|
|
|
11091
11091
|
const prototype = Object.getPrototypeOf(value);
|
|
11092
|
-
return prototype === null || prototype === Object.prototype;
|
|
11092
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
11093
11093
|
}
|
|
11094
11094
|
|
|
11095
11095
|
;// CONCATENATED MODULE: ../node_modules/trough/index.js
|
|
@@ -20388,258 +20388,10 @@ function generated(node) {
|
|
|
20388
20388
|
)
|
|
20389
20389
|
}
|
|
20390
20390
|
|
|
20391
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-definitions/node_modules/unist-util-visit-parents/color.browser.js
|
|
20392
|
-
/**
|
|
20393
|
-
* @param {string} d
|
|
20394
|
-
* @returns {string}
|
|
20395
|
-
*/
|
|
20396
|
-
function color_browser_color(d) {
|
|
20397
|
-
return d
|
|
20398
|
-
}
|
|
20399
|
-
|
|
20400
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-definitions/node_modules/unist-util-visit-parents/index.js
|
|
20401
|
-
/**
|
|
20402
|
-
* @typedef {import('unist').Node} Node
|
|
20403
|
-
* @typedef {import('unist').Parent} Parent
|
|
20404
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
20405
|
-
*/
|
|
20406
|
-
|
|
20407
|
-
/**
|
|
20408
|
-
* @typedef {CONTINUE|SKIP|EXIT} Action Union of the action types
|
|
20409
|
-
* @typedef {number} Index Move to the sibling at index next (after node itself is completely traversed). Useful if mutating the tree, such as removing the node the visitor is currently on, or any of its previous siblings (or next siblings, in case of reverse) Results less than 0 or greater than or equal to children.length stop traversing the parent
|
|
20410
|
-
* @typedef {[(Action|null|undefined|void)?, (Index|null|undefined)?]} ActionTuple List with one or two values, the first an action, the second an index.
|
|
20411
|
-
* @typedef {null|undefined|Action|Index|ActionTuple|void} VisitorResult Any value that can be returned from a visitor
|
|
20412
|
-
*/
|
|
20413
|
-
|
|
20414
|
-
/**
|
|
20415
|
-
* Invoked when a node (matching test, if given) is found.
|
|
20416
|
-
* Visitors are free to transform node.
|
|
20417
|
-
* They can also transform the parent of node (the last of ancestors).
|
|
20418
|
-
* Replacing node itself, if `SKIP` is not returned, still causes its descendants to be visited.
|
|
20419
|
-
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
|
|
20420
|
-
* visitor should return a new index (number) to specify the sibling to traverse after node is traversed.
|
|
20421
|
-
* Adding or removing next siblings of node (or previous siblings, in case of reverse)
|
|
20422
|
-
* is handled as expected without needing to return a new index.
|
|
20423
|
-
* Removing the children property of an ancestor still results in them being traversed.
|
|
20424
|
-
*
|
|
20425
|
-
* @template {Node} V
|
|
20426
|
-
* @callback Visitor
|
|
20427
|
-
* @param {V} node Found node
|
|
20428
|
-
* @param {Array.<Parent>} ancestors Ancestors of node
|
|
20429
|
-
* @returns {VisitorResult}
|
|
20430
|
-
*/
|
|
20431
|
-
|
|
20432
|
-
|
|
20433
|
-
|
|
20434
|
-
|
|
20435
|
-
/**
|
|
20436
|
-
* Continue traversing as normal
|
|
20437
|
-
*/
|
|
20438
|
-
const unist_util_visit_parents_CONTINUE = true
|
|
20439
|
-
/**
|
|
20440
|
-
* Do not traverse this node’s children
|
|
20441
|
-
*/
|
|
20442
|
-
const unist_util_visit_parents_SKIP = 'skip'
|
|
20443
|
-
/**
|
|
20444
|
-
* Stop traversing immediately
|
|
20445
|
-
*/
|
|
20446
|
-
const unist_util_visit_parents_EXIT = false
|
|
20447
|
-
|
|
20448
|
-
const unist_util_visit_parents_visitParents =
|
|
20449
|
-
/**
|
|
20450
|
-
* @type {(
|
|
20451
|
-
* (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) &
|
|
20452
|
-
* ((tree: Node, test: Test, visitor: Visitor<Node>, reverse?: boolean) => void) &
|
|
20453
|
-
* ((tree: Node, visitor: Visitor<Node>, reverse?: boolean) => void)
|
|
20454
|
-
* )}
|
|
20455
|
-
*/
|
|
20456
|
-
(
|
|
20457
|
-
/**
|
|
20458
|
-
* Visit children of tree which pass a test
|
|
20459
|
-
*
|
|
20460
|
-
* @param {Node} tree Abstract syntax tree to walk
|
|
20461
|
-
* @param {Test} test test Test node
|
|
20462
|
-
* @param {Visitor<Node>} visitor Function to run for each node
|
|
20463
|
-
* @param {boolean} [reverse] Fisit the tree in reverse, defaults to false
|
|
20464
|
-
*/
|
|
20465
|
-
function (tree, test, visitor, reverse) {
|
|
20466
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
20467
|
-
reverse = visitor
|
|
20468
|
-
// @ts-ignore no visitor given, so `visitor` is test.
|
|
20469
|
-
visitor = test
|
|
20470
|
-
test = null
|
|
20471
|
-
}
|
|
20472
|
-
|
|
20473
|
-
var is = convert(test)
|
|
20474
|
-
var step = reverse ? -1 : 1
|
|
20475
|
-
|
|
20476
|
-
factory(tree, null, [])()
|
|
20477
|
-
|
|
20478
|
-
/**
|
|
20479
|
-
* @param {Node} node
|
|
20480
|
-
* @param {number?} index
|
|
20481
|
-
* @param {Array.<Parent>} parents
|
|
20482
|
-
*/
|
|
20483
|
-
function factory(node, index, parents) {
|
|
20484
|
-
/** @type {Object.<string, unknown>} */
|
|
20485
|
-
var value = typeof node === 'object' && node !== null ? node : {}
|
|
20486
|
-
/** @type {string} */
|
|
20487
|
-
var name
|
|
20488
|
-
|
|
20489
|
-
if (typeof value.type === 'string') {
|
|
20490
|
-
name =
|
|
20491
|
-
typeof value.tagName === 'string'
|
|
20492
|
-
? value.tagName
|
|
20493
|
-
: typeof value.name === 'string'
|
|
20494
|
-
? value.name
|
|
20495
|
-
: undefined
|
|
20496
|
-
|
|
20497
|
-
Object.defineProperty(visit, 'name', {
|
|
20498
|
-
value:
|
|
20499
|
-
'node (' +
|
|
20500
|
-
color_browser_color(value.type + (name ? '<' + name + '>' : '')) +
|
|
20501
|
-
')'
|
|
20502
|
-
})
|
|
20503
|
-
}
|
|
20504
|
-
|
|
20505
|
-
return visit
|
|
20506
|
-
|
|
20507
|
-
function visit() {
|
|
20508
|
-
/** @type {ActionTuple} */
|
|
20509
|
-
var result = []
|
|
20510
|
-
/** @type {ActionTuple} */
|
|
20511
|
-
var subresult
|
|
20512
|
-
/** @type {number} */
|
|
20513
|
-
var offset
|
|
20514
|
-
/** @type {Array.<Parent>} */
|
|
20515
|
-
var grandparents
|
|
20516
|
-
|
|
20517
|
-
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
20518
|
-
result = unist_util_visit_parents_toResult(visitor(node, parents))
|
|
20519
|
-
|
|
20520
|
-
if (result[0] === unist_util_visit_parents_EXIT) {
|
|
20521
|
-
return result
|
|
20522
|
-
}
|
|
20523
|
-
}
|
|
20524
|
-
|
|
20525
|
-
if (node.children && result[0] !== unist_util_visit_parents_SKIP) {
|
|
20526
|
-
// @ts-ignore looks like a parent.
|
|
20527
|
-
offset = (reverse ? node.children.length : -1) + step
|
|
20528
|
-
// @ts-ignore looks like a parent.
|
|
20529
|
-
grandparents = parents.concat(node)
|
|
20530
|
-
|
|
20531
|
-
// @ts-ignore looks like a parent.
|
|
20532
|
-
while (offset > -1 && offset < node.children.length) {
|
|
20533
|
-
subresult = factory(node.children[offset], offset, grandparents)()
|
|
20534
|
-
|
|
20535
|
-
if (subresult[0] === unist_util_visit_parents_EXIT) {
|
|
20536
|
-
return subresult
|
|
20537
|
-
}
|
|
20538
|
-
|
|
20539
|
-
offset =
|
|
20540
|
-
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
20541
|
-
}
|
|
20542
|
-
}
|
|
20543
|
-
|
|
20544
|
-
return result
|
|
20545
|
-
}
|
|
20546
|
-
}
|
|
20547
|
-
}
|
|
20548
|
-
)
|
|
20549
|
-
|
|
20550
|
-
/**
|
|
20551
|
-
* @param {VisitorResult} value
|
|
20552
|
-
* @returns {ActionTuple}
|
|
20553
|
-
*/
|
|
20554
|
-
function unist_util_visit_parents_toResult(value) {
|
|
20555
|
-
if (Array.isArray(value)) {
|
|
20556
|
-
return value
|
|
20557
|
-
}
|
|
20558
|
-
|
|
20559
|
-
if (typeof value === 'number') {
|
|
20560
|
-
return [unist_util_visit_parents_CONTINUE, value]
|
|
20561
|
-
}
|
|
20562
|
-
|
|
20563
|
-
return [value]
|
|
20564
|
-
}
|
|
20565
|
-
|
|
20566
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-definitions/node_modules/unist-util-visit/index.js
|
|
20567
|
-
/**
|
|
20568
|
-
* @typedef {import('unist').Node} Node
|
|
20569
|
-
* @typedef {import('unist').Parent} Parent
|
|
20570
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
20571
|
-
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
20572
|
-
*/
|
|
20573
|
-
|
|
20574
|
-
/**
|
|
20575
|
-
* Invoked when a node (matching test, if given) is found.
|
|
20576
|
-
* Visitors are free to transform node.
|
|
20577
|
-
* They can also transform the parent of node (the last of ancestors).
|
|
20578
|
-
* Replacing node itself, if `SKIP` is not returned, still causes its descendants to be visited.
|
|
20579
|
-
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
|
|
20580
|
-
* visitor should return a new index (number) to specify the sibling to traverse after node is traversed.
|
|
20581
|
-
* Adding or removing next siblings of node (or previous siblings, in case of reverse)
|
|
20582
|
-
* is handled as expected without needing to return a new index.
|
|
20583
|
-
* Removing the children property of an ancestor still results in them being traversed.
|
|
20584
|
-
*
|
|
20585
|
-
* @template {Node} V
|
|
20586
|
-
* @callback Visitor
|
|
20587
|
-
* @param {V} node Found node
|
|
20588
|
-
* @param {number|null} index Position of `node` in `parent`
|
|
20589
|
-
* @param {Parent|null} parent Parent of `node`
|
|
20590
|
-
* @returns {VisitorResult}
|
|
20591
|
-
*/
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
|
|
20596
|
-
|
|
20597
|
-
const unist_util_visit_visit =
|
|
20598
|
-
/**
|
|
20599
|
-
* @type {(
|
|
20600
|
-
* (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) &
|
|
20601
|
-
* ((tree: Node, test: Test, visitor: Visitor<Node>, reverse?: boolean) => void) &
|
|
20602
|
-
* ((tree: Node, visitor: Visitor<Node>, reverse?: boolean) => void)
|
|
20603
|
-
* )}
|
|
20604
|
-
*/
|
|
20605
|
-
(
|
|
20606
|
-
/**
|
|
20607
|
-
* Visit children of tree which pass a test
|
|
20608
|
-
*
|
|
20609
|
-
* @param {Node} tree Abstract syntax tree to walk
|
|
20610
|
-
* @param {Test} test test Test node
|
|
20611
|
-
* @param {Visitor<Node>} visitor Function to run for each node
|
|
20612
|
-
* @param {boolean} [reverse] Fisit the tree in reverse, defaults to false
|
|
20613
|
-
*/
|
|
20614
|
-
function (tree, test, visitor, reverse) {
|
|
20615
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
20616
|
-
reverse = visitor
|
|
20617
|
-
visitor = test
|
|
20618
|
-
test = null
|
|
20619
|
-
}
|
|
20620
|
-
|
|
20621
|
-
unist_util_visit_parents_visitParents(tree, test, overload, reverse)
|
|
20622
|
-
|
|
20623
|
-
/**
|
|
20624
|
-
* @param {Node} node
|
|
20625
|
-
* @param {Array.<Parent>} parents
|
|
20626
|
-
*/
|
|
20627
|
-
function overload(node, parents) {
|
|
20628
|
-
var parent = parents[parents.length - 1]
|
|
20629
|
-
return visitor(
|
|
20630
|
-
node,
|
|
20631
|
-
parent ? parent.children.indexOf(node) : null,
|
|
20632
|
-
parent
|
|
20633
|
-
)
|
|
20634
|
-
}
|
|
20635
|
-
}
|
|
20636
|
-
)
|
|
20637
|
-
|
|
20638
20391
|
;// CONCATENATED MODULE: ../node_modules/mdast-util-definitions/index.js
|
|
20639
20392
|
/**
|
|
20640
20393
|
* @typedef {import('mdast').Root|import('mdast').Content} Node
|
|
20641
20394
|
* @typedef {import('mdast').Definition} Definition
|
|
20642
|
-
* @typedef {import('unist-util-visit').Visitor<Definition>} DefinitionVisitor
|
|
20643
20395
|
*/
|
|
20644
20396
|
|
|
20645
20397
|
|
|
@@ -20647,36 +20399,36 @@ const unist_util_visit_visit =
|
|
|
20647
20399
|
const mdast_util_definitions_own = {}.hasOwnProperty
|
|
20648
20400
|
|
|
20649
20401
|
/**
|
|
20402
|
+
* Find definitions in `node`.
|
|
20403
|
+
* Uses CommonMark precedence, which means that earlier definitions are
|
|
20404
|
+
* preferred over duplicate later definitions.
|
|
20650
20405
|
*
|
|
20651
20406
|
* @param {Node} node
|
|
20652
20407
|
*/
|
|
20653
20408
|
function definitions(node) {
|
|
20654
|
-
/** @type {
|
|
20409
|
+
/** @type {Record<string, Definition>} */
|
|
20655
20410
|
const cache = Object.create(null)
|
|
20656
20411
|
|
|
20657
20412
|
if (!node || !node.type) {
|
|
20658
20413
|
throw new Error('mdast-util-definitions expected node')
|
|
20659
20414
|
}
|
|
20660
20415
|
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
return getDefinition
|
|
20664
|
-
|
|
20665
|
-
/** @type {DefinitionVisitor} */
|
|
20666
|
-
function ondefinition(definition) {
|
|
20416
|
+
visit(node, 'definition', (definition) => {
|
|
20667
20417
|
const id = clean(definition.identifier)
|
|
20668
20418
|
if (id && !mdast_util_definitions_own.call(cache, id)) {
|
|
20669
20419
|
cache[id] = definition
|
|
20670
20420
|
}
|
|
20671
|
-
}
|
|
20421
|
+
})
|
|
20422
|
+
|
|
20423
|
+
return definition
|
|
20672
20424
|
|
|
20673
20425
|
/**
|
|
20674
|
-
* Get a node from the bound definition
|
|
20426
|
+
* Get a node from the bound definition cache.
|
|
20675
20427
|
*
|
|
20676
20428
|
* @param {string} identifier
|
|
20677
20429
|
* @returns {Definition|null}
|
|
20678
20430
|
*/
|
|
20679
|
-
function
|
|
20431
|
+
function definition(identifier) {
|
|
20680
20432
|
const id = clean(identifier)
|
|
20681
20433
|
return id && mdast_util_definitions_own.call(cache, id) ? cache[id] : null
|
|
20682
20434
|
}
|
|
@@ -21790,6 +21542,77 @@ function table(h, node) {
|
|
|
21790
21542
|
)
|
|
21791
21543
|
}
|
|
21792
21544
|
|
|
21545
|
+
;// CONCATENATED MODULE: ../node_modules/trim-lines/index.js
|
|
21546
|
+
const tab = 9 /* `\t` */
|
|
21547
|
+
const space = 32 /* ` ` */
|
|
21548
|
+
|
|
21549
|
+
/**
|
|
21550
|
+
* Remove initial and final spaces and tabs at the line breaks in `value`.
|
|
21551
|
+
* Does not trim initial and final spaces and tabs of the value itself.
|
|
21552
|
+
*
|
|
21553
|
+
* @param {string} value
|
|
21554
|
+
* Value to trim.
|
|
21555
|
+
* @returns {string}
|
|
21556
|
+
* Trimmed value.
|
|
21557
|
+
*/
|
|
21558
|
+
function trimLines(value) {
|
|
21559
|
+
const source = String(value)
|
|
21560
|
+
const search = /\r?\n|\r/g
|
|
21561
|
+
let match = search.exec(source)
|
|
21562
|
+
let last = 0
|
|
21563
|
+
/** @type {Array<string>} */
|
|
21564
|
+
const lines = []
|
|
21565
|
+
|
|
21566
|
+
while (match) {
|
|
21567
|
+
lines.push(
|
|
21568
|
+
trimLine(source.slice(last, match.index), last > 0, true),
|
|
21569
|
+
match[0]
|
|
21570
|
+
)
|
|
21571
|
+
|
|
21572
|
+
last = match.index + match[0].length
|
|
21573
|
+
match = search.exec(source)
|
|
21574
|
+
}
|
|
21575
|
+
|
|
21576
|
+
lines.push(trimLine(source.slice(last), last > 0, false))
|
|
21577
|
+
|
|
21578
|
+
return lines.join('')
|
|
21579
|
+
}
|
|
21580
|
+
|
|
21581
|
+
/**
|
|
21582
|
+
* @param {string} value
|
|
21583
|
+
* Line to trim.
|
|
21584
|
+
* @param {boolean} start
|
|
21585
|
+
* Whether to trim the start of the line.
|
|
21586
|
+
* @param {boolean} end
|
|
21587
|
+
* Whether to trim the end of the line.
|
|
21588
|
+
* @returns {string}
|
|
21589
|
+
* Trimmed line.
|
|
21590
|
+
*/
|
|
21591
|
+
function trimLine(value, start, end) {
|
|
21592
|
+
let startIndex = 0
|
|
21593
|
+
let endIndex = value.length
|
|
21594
|
+
|
|
21595
|
+
if (start) {
|
|
21596
|
+
let code = value.codePointAt(startIndex)
|
|
21597
|
+
|
|
21598
|
+
while (code === tab || code === space) {
|
|
21599
|
+
startIndex++
|
|
21600
|
+
code = value.codePointAt(startIndex)
|
|
21601
|
+
}
|
|
21602
|
+
}
|
|
21603
|
+
|
|
21604
|
+
if (end) {
|
|
21605
|
+
let code = value.codePointAt(endIndex - 1)
|
|
21606
|
+
|
|
21607
|
+
while (code === tab || code === space) {
|
|
21608
|
+
endIndex--
|
|
21609
|
+
code = value.codePointAt(endIndex - 1)
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21612
|
+
|
|
21613
|
+
return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''
|
|
21614
|
+
}
|
|
21615
|
+
|
|
21793
21616
|
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/handlers/text.js
|
|
21794
21617
|
/**
|
|
21795
21618
|
* @typedef {import('mdast').Text} Text
|
|
@@ -21798,15 +21621,13 @@ function table(h, node) {
|
|
|
21798
21621
|
|
|
21799
21622
|
|
|
21800
21623
|
|
|
21624
|
+
|
|
21801
21625
|
/**
|
|
21802
21626
|
* @type {Handler}
|
|
21803
21627
|
* @param {Text} node
|
|
21804
21628
|
*/
|
|
21805
21629
|
function handlers_text_text(h, node) {
|
|
21806
|
-
return h.augment(
|
|
21807
|
-
node,
|
|
21808
|
-
u('text', String(node.value).replace(/[ \t]*(\r?\n|\r)[ \t]*/g, '$1'))
|
|
21809
|
-
)
|
|
21630
|
+
return h.augment(node, u('text', trimLines(String(node.value))))
|
|
21810
21631
|
}
|
|
21811
21632
|
|
|
21812
21633
|
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
|
|
@@ -22068,6 +21889,7 @@ function factory(tree, options) {
|
|
|
22068
21889
|
const ctx = 'type' in left ? left : {position: left}
|
|
22069
21890
|
|
|
22070
21891
|
if (!generated(ctx)) {
|
|
21892
|
+
// @ts-expect-error: fine.
|
|
22071
21893
|
right.position = {start: pointStart(ctx), end: pointEnd(ctx)}
|
|
22072
21894
|
}
|
|
22073
21895
|
}
|
|
@@ -31546,6 +31368,36 @@ const rehypeAttrs = (options) => {
|
|
|
31546
31368
|
};
|
|
31547
31369
|
/* harmony default export */ const rehype_attr_lib = (rehypeAttrs);
|
|
31548
31370
|
|
|
31371
|
+
;// CONCATENATED MODULE: ../node_modules/rehype-ignore/lib/index.js
|
|
31372
|
+
|
|
31373
|
+
const rehypeIgnore = (options = {}) => {
|
|
31374
|
+
const { openDelimiter = 'rehype:ignore:start', closeDelimiter = 'rehype:ignore:end' } = options;
|
|
31375
|
+
return (tree) => {
|
|
31376
|
+
visit(tree, (node, index, parent) => {
|
|
31377
|
+
if (node.type === 'element' || node.type === 'root') {
|
|
31378
|
+
// const start = node.children.findIndex((item) => item.type === 'comment' && item.value === openDelimiter);
|
|
31379
|
+
// const end = node.children.findIndex((item) => item.type === 'comment' && item.value === closeDelimiter);
|
|
31380
|
+
// if (start > -1 && end > -1) {
|
|
31381
|
+
// node.children = node.children.filter((_, idx) => idx < start || idx > end);
|
|
31382
|
+
// }
|
|
31383
|
+
let start = false;
|
|
31384
|
+
node.children = node.children.filter((item) => {
|
|
31385
|
+
if (item.type === 'comment' && item.value.trim() === openDelimiter) {
|
|
31386
|
+
start = true;
|
|
31387
|
+
return false;
|
|
31388
|
+
}
|
|
31389
|
+
if (item.type === 'comment' && item.value.trim() === closeDelimiter) {
|
|
31390
|
+
start = false;
|
|
31391
|
+
return false;
|
|
31392
|
+
}
|
|
31393
|
+
return !start;
|
|
31394
|
+
});
|
|
31395
|
+
}
|
|
31396
|
+
});
|
|
31397
|
+
};
|
|
31398
|
+
};
|
|
31399
|
+
/* harmony default export */ const rehype_ignore_lib = (rehypeIgnore);
|
|
31400
|
+
|
|
31549
31401
|
;// CONCATENATED MODULE: ../node_modules/unist-util-filter/index.js
|
|
31550
31402
|
/**
|
|
31551
31403
|
* @typedef {import('unist').Node} Node
|
|
@@ -59774,7 +59626,7 @@ var octiconLink = {
|
|
|
59774
59626
|
};
|
|
59775
59627
|
|
|
59776
59628
|
// EXTERNAL MODULE: ../node_modules/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js
|
|
59777
|
-
var copy_to_clipboard_umd = __webpack_require__(
|
|
59629
|
+
var copy_to_clipboard_umd = __webpack_require__(71);
|
|
59778
59630
|
var copy_to_clipboard_umd_default = /*#__PURE__*/__webpack_require__.n(copy_to_clipboard_umd);
|
|
59779
59631
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/nodes/copy.js
|
|
59780
59632
|
|
|
@@ -59879,7 +59731,8 @@ var jsx_runtime = __webpack_require__(605);
|
|
|
59879
59731
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/index.js
|
|
59880
59732
|
|
|
59881
59733
|
|
|
59882
|
-
var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "onScroll", "onMouseOver", "pluginsFilter", "warpperElement"];
|
|
59734
|
+
var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "onScroll", "onMouseOver", "pluginsFilter", "rehypeRewrite", "warpperElement"];
|
|
59735
|
+
|
|
59883
59736
|
|
|
59884
59737
|
|
|
59885
59738
|
|
|
@@ -59904,6 +59757,7 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "on
|
|
|
59904
59757
|
onScroll,
|
|
59905
59758
|
onMouseOver,
|
|
59906
59759
|
pluginsFilter,
|
|
59760
|
+
rehypeRewrite: rewrite,
|
|
59907
59761
|
warpperElement = {}
|
|
59908
59762
|
} = props,
|
|
59909
59763
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
@@ -59930,15 +59784,26 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "on
|
|
|
59930
59784
|
var code = getCodeString(node.children);
|
|
59931
59785
|
node.children.push(copyElement(code));
|
|
59932
59786
|
}
|
|
59787
|
+
|
|
59788
|
+
rewrite && rewrite(node, index, parent);
|
|
59933
59789
|
};
|
|
59934
59790
|
|
|
59935
59791
|
var rehypePlugins = [reservedMeta, [rehype_prism_plus_es_h, {
|
|
59936
59792
|
ignoreMissing: true
|
|
59937
|
-
}], rehypeRaw, rehypeSlug, rehypeAutolinkHeadings, [rehype_rewrite_lib, {
|
|
59793
|
+
}], rehypeRaw, rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_lib, [rehype_rewrite_lib, {
|
|
59938
59794
|
rewrite: rehypeRewriteHandle
|
|
59939
59795
|
}], [rehype_attr_lib, {
|
|
59940
59796
|
properties: 'attr'
|
|
59941
59797
|
}], ...(other.rehypePlugins || [])];
|
|
59798
|
+
var customProps = {
|
|
59799
|
+
allowElement: (element, index, parent) => {
|
|
59800
|
+
if (other.allowElement) {
|
|
59801
|
+
return other.allowElement(element, index, parent);
|
|
59802
|
+
}
|
|
59803
|
+
|
|
59804
|
+
return /^[A-Za-z0-9]+$/.test(element.tagName);
|
|
59805
|
+
}
|
|
59806
|
+
};
|
|
59942
59807
|
var remarkPlugins = [...(other.remarkPlugins || []), remarkGfm];
|
|
59943
59808
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
|
|
59944
59809
|
ref: mdp,
|
|
@@ -59947,7 +59812,7 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "on
|
|
|
59947
59812
|
}, warpperElement, {
|
|
59948
59813
|
className: cls,
|
|
59949
59814
|
style: style,
|
|
59950
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown, _extends({}, other, {
|
|
59815
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown, _extends({}, other, customProps, {
|
|
59951
59816
|
rehypePlugins: pluginsFilter ? pluginsFilter('rehype', rehypePlugins) : rehypePlugins,
|
|
59952
59817
|
remarkPlugins: pluginsFilter ? pluginsFilter('remark', remarkPlugins) : remarkPlugins,
|
|
59953
59818
|
children: source || ''
|
|
@@ -61892,7 +61757,7 @@ const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
|
|
|
61892
61757
|
|
|
61893
61758
|
;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
|
|
61894
61759
|
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
|
|
61895
|
-
},[]);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(rehype_prism_plus_es_h,{ignoreMissing:
|
|
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(rehype_prism_plus_es_h,{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]);}
|
|
61896
61761
|
;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
61897
61762
|
|
|
61898
61763
|
function _arrayWithoutHoles(arr) {
|
|
@@ -62098,11 +61963,9 @@ var Textarea_excluded=["prefixCls","onChange"];function Textarea(props){var pref
|
|
|
62098
61963
|
textRef.current.removeEventListener('keydown',onKeyDown);}};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62099
61964
|
},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("textarea",_objectSpread2(_objectSpread2({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:false},other),{},{ref:textRef,className:"".concat(prefixCls,"-text-input ").concat(other.className?other.className:''),value:markdown,onChange:function onChange(e){dispatch&&dispatch({markdown:e.target.value});_onChange&&_onChange(e);}}));}
|
|
62100
61965
|
;// CONCATENATED MODULE: ./src/components/TextArea/index.tsx
|
|
62101
|
-
var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];function TextArea_TextArea(props){var _ref=props||{},prefixCls=_ref.prefixCls,className=_ref.className,onScroll=_ref.onScroll,renderTextarea=_ref.renderTextarea,otherProps=_objectWithoutProperties(_ref,TextArea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,scrollTop=_useContext.scrollTop,commands=_useContext.commands,extraCommands=_useContext.extraCommands,dispatch=_useContext.dispatch;var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var warp=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var state={};if(warp.current){state.textareaWarp=warp.current||undefined;warp.current.scrollTop=scrollTop||0;}if(dispatch){dispatch(_objectSpread2({},state));}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61966
|
+
var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];function TextArea_TextArea(props){var _ref=props||{},prefixCls=_ref.prefixCls,className=_ref.className,onScroll=_ref.onScroll,renderTextarea=_ref.renderTextarea,otherProps=_objectWithoutProperties(_ref,TextArea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,scrollTop=_useContext.scrollTop,commands=_useContext.commands,highlightEnable=_useContext.highlightEnable,extraCommands=_useContext.extraCommands,dispatch=_useContext.dispatch;var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var warp=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var state={};if(warp.current){state.textareaWarp=warp.current||undefined;warp.current.scrollTop=scrollTop||0;}if(dispatch){dispatch(_objectSpread2({},state));}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62102
61967
|
},[]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current&&dispatch){var _commandOrchestrator=new TextAreaCommandOrchestrator(textRef.current);executeRef.current=_commandOrchestrator;dispatch({textarea:textRef.current,commandOrchestrator:_commandOrchestrator});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62103
|
-
},[])
|
|
62104
|
-
// const textStyle: React.CSSProperties = highlightEnable ? { WebkitTextFillColor: 'transparent' } : { };
|
|
62105
|
-
return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{ref:warp,className:"".concat(prefixCls,"-aree ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-text"),children:renderTextarea?/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(renderTextarea(_objectSpread2(_objectSpread2({},otherProps),{},{value:markdown,autoComplete:'off',autoCorrect:'off',spellCheck:'false',autoCapitalize:'off',className:"".concat(prefixCls,"-text-input"),style:{WebkitTextFillColor:'inherit',overflow:'auto'}}),{dispatch:dispatch,onChange:otherProps.onChange,shortcuts:shortcutsHandle,useContext:{commands:commands,extraCommands:extraCommands,commandOrchestrator:executeRef.current}}),{ref:textRef}):/*#__PURE__*/(0,jsx_runtime.jsxs)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Markdown,{prefixCls:prefixCls}),/*#__PURE__*/(0,jsx_runtime.jsx)(Textarea,_objectSpread2({prefixCls:prefixCls},otherProps))]})})});}
|
|
61968
|
+
},[]);var textStyle=highlightEnable?{}:{WebkitTextFillColor:'initial',overflow:'auto'};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{ref:warp,className:"".concat(prefixCls,"-aree ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-text"),children:renderTextarea?/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(renderTextarea(_objectSpread2(_objectSpread2({},otherProps),{},{value:markdown,autoComplete:'off',autoCorrect:'off',spellCheck:'false',autoCapitalize:'off',className:"".concat(prefixCls,"-text-input"),style:{WebkitTextFillColor:'inherit',overflow:'auto'}}),{dispatch:dispatch,onChange:otherProps.onChange,shortcuts:shortcutsHandle,useContext:{commands:commands,extraCommands:extraCommands,commandOrchestrator:executeRef.current}}),{ref:textRef}):/*#__PURE__*/(0,jsx_runtime.jsxs)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{children:[highlightEnable&&/*#__PURE__*/(0,jsx_runtime.jsx)(Markdown,{prefixCls:prefixCls}),/*#__PURE__*/(0,jsx_runtime.jsx)(Textarea,_objectSpread2(_objectSpread2({prefixCls:prefixCls},otherProps),{},{style:textStyle}))]})})});}
|
|
62106
61969
|
;// CONCATENATED MODULE: ./src/components/Toolbar/Child.less
|
|
62107
61970
|
// extracted by mini-css-extract-plugin
|
|
62108
61971
|
/* harmony default export */ const Child = ({});
|