@uiw/react-md-editor 3.20.6 → 3.20.8
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 +3 -0
- package/dist/mdeditor.js +393 -196
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +12 -10
- package/esm/components/DragBar/index.js +7 -1
- package/esm/components/TextArea/Markdown.js +8 -8
- package/lib/components/DragBar/index.js +7 -1
- package/lib/components/TextArea/Markdown.js +8 -10
- package/package.json +1 -1
- package/src/components/DragBar/index.tsx +9 -1
- package/src/components/TextArea/Markdown.tsx +11 -9
package/dist/mdeditor.js
CHANGED
|
@@ -14,20 +14,22 @@ return /******/ (() => { // webpackBootstrap
|
|
|
14
14
|
/***/ 7071:
|
|
15
15
|
/***/ (function(module) {
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
* @uiw/copy-to-clipboard v1.0.
|
|
19
|
-
* Copy to clipboard.
|
|
17
|
+
/**!
|
|
18
|
+
* @uiw/copy-to-clipboard v1.0.14
|
|
19
|
+
* Copy to clipboard.
|
|
20
20
|
*
|
|
21
|
-
* Copyright (c)
|
|
22
|
-
* https://github.com/uiwjs/copy-to-clipboard.git
|
|
21
|
+
* Copyright (c) 2023 Kenny Wang
|
|
22
|
+
* https://github.com/uiwjs/copy-to-clipboard.git
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* @website: https://uiwjs.github.io/copy-to-clipboard
|
|
25
|
+
|
|
26
|
+
* Licensed under the MIT license
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
29
|
(function (global, factory) {
|
|
28
30
|
true ? module.exports = factory() :
|
|
29
31
|
0;
|
|
30
|
-
}(this, (function () { 'use strict';
|
|
32
|
+
})(this, (function () { 'use strict';
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* *** This styling is an extra step which is likely not required. ***
|
|
@@ -82,7 +84,7 @@ return /******/ (() => { // webpackBootstrap
|
|
|
82
84
|
|
|
83
85
|
return copyTextToClipboard;
|
|
84
86
|
|
|
85
|
-
}))
|
|
87
|
+
}));
|
|
86
88
|
//# sourceMappingURL=copy-to-clipboard.umd.js.map
|
|
87
89
|
|
|
88
90
|
|
|
@@ -19842,8 +19844,13 @@ function looksLikeAVFileValue(value) {
|
|
|
19842
19844
|
* Configuration (optional).
|
|
19843
19845
|
* @property {boolean | null | undefined} [includeImageAlt=true]
|
|
19844
19846
|
* Whether to use `alt` for `image`s.
|
|
19847
|
+
* @property {boolean | null | undefined} [includeHtml=true]
|
|
19848
|
+
* Whether to use `value` of HTML.
|
|
19845
19849
|
*/
|
|
19846
19850
|
|
|
19851
|
+
/** @type {Options} */
|
|
19852
|
+
const emptyOptions = {}
|
|
19853
|
+
|
|
19847
19854
|
/**
|
|
19848
19855
|
* Get the text content of a node or list of nodes.
|
|
19849
19856
|
*
|
|
@@ -19858,11 +19865,15 @@ function looksLikeAVFileValue(value) {
|
|
|
19858
19865
|
* Serialized `value`.
|
|
19859
19866
|
*/
|
|
19860
19867
|
function lib_toString(value, options) {
|
|
19861
|
-
const
|
|
19862
|
-
|
|
19863
|
-
|
|
19864
|
-
|
|
19865
|
-
|
|
19868
|
+
const settings = options || emptyOptions
|
|
19869
|
+
const includeImageAlt =
|
|
19870
|
+
typeof settings.includeImageAlt === 'boolean'
|
|
19871
|
+
? settings.includeImageAlt
|
|
19872
|
+
: true
|
|
19873
|
+
const includeHtml =
|
|
19874
|
+
typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true
|
|
19875
|
+
|
|
19876
|
+
return one(value, includeImageAlt, includeHtml)
|
|
19866
19877
|
}
|
|
19867
19878
|
|
|
19868
19879
|
/**
|
|
@@ -19872,18 +19883,31 @@ function lib_toString(value, options) {
|
|
|
19872
19883
|
* Thing to serialize.
|
|
19873
19884
|
* @param {boolean} includeImageAlt
|
|
19874
19885
|
* Include image `alt`s.
|
|
19886
|
+
* @param {boolean} includeHtml
|
|
19887
|
+
* Include HTML.
|
|
19875
19888
|
* @returns {string}
|
|
19876
19889
|
* Serialized node.
|
|
19877
19890
|
*/
|
|
19878
|
-
function one(value, includeImageAlt) {
|
|
19879
|
-
|
|
19880
|
-
(
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
(
|
|
19885
|
-
|
|
19886
|
-
|
|
19891
|
+
function one(value, includeImageAlt, includeHtml) {
|
|
19892
|
+
if (node(value)) {
|
|
19893
|
+
if ('value' in value) {
|
|
19894
|
+
return value.type === 'html' && !includeHtml ? '' : value.value
|
|
19895
|
+
}
|
|
19896
|
+
|
|
19897
|
+
if (includeImageAlt && 'alt' in value && value.alt) {
|
|
19898
|
+
return value.alt
|
|
19899
|
+
}
|
|
19900
|
+
|
|
19901
|
+
if ('children' in value) {
|
|
19902
|
+
return lib_all(value.children, includeImageAlt, includeHtml)
|
|
19903
|
+
}
|
|
19904
|
+
}
|
|
19905
|
+
|
|
19906
|
+
if (Array.isArray(value)) {
|
|
19907
|
+
return lib_all(value, includeImageAlt, includeHtml)
|
|
19908
|
+
}
|
|
19909
|
+
|
|
19910
|
+
return ''
|
|
19887
19911
|
}
|
|
19888
19912
|
|
|
19889
19913
|
/**
|
|
@@ -19893,16 +19917,18 @@ function one(value, includeImageAlt) {
|
|
|
19893
19917
|
* Thing to serialize.
|
|
19894
19918
|
* @param {boolean} includeImageAlt
|
|
19895
19919
|
* Include image `alt`s.
|
|
19920
|
+
* @param {boolean} includeHtml
|
|
19921
|
+
* Include HTML.
|
|
19896
19922
|
* @returns {string}
|
|
19897
19923
|
* Serialized nodes.
|
|
19898
19924
|
*/
|
|
19899
|
-
function lib_all(values, includeImageAlt) {
|
|
19925
|
+
function lib_all(values, includeImageAlt, includeHtml) {
|
|
19900
19926
|
/** @type {Array<string>} */
|
|
19901
19927
|
const result = []
|
|
19902
19928
|
let index = -1
|
|
19903
19929
|
|
|
19904
19930
|
while (++index < values.length) {
|
|
19905
|
-
result[index] = one(values[index], includeImageAlt)
|
|
19931
|
+
result[index] = one(values[index], includeImageAlt, includeHtml)
|
|
19906
19932
|
}
|
|
19907
19933
|
|
|
19908
19934
|
return result.join('')
|
|
@@ -32905,12 +32931,7 @@ function toReact(context, node, index, parent) {
|
|
|
32905
32931
|
)
|
|
32906
32932
|
}
|
|
32907
32933
|
|
|
32908
|
-
properties.key =
|
|
32909
|
-
name,
|
|
32910
|
-
position.start.line,
|
|
32911
|
-
position.start.column,
|
|
32912
|
-
index
|
|
32913
|
-
].join('-')
|
|
32934
|
+
properties.key = index
|
|
32914
32935
|
|
|
32915
32936
|
if (name === 'a' && options.linkTarget) {
|
|
32916
32937
|
properties.target =
|
|
@@ -33957,26 +33978,38 @@ function previousUnbalanced(events) {
|
|
|
33957
33978
|
|
|
33958
33979
|
;// CONCATENATED MODULE: ../node_modules/micromark-extension-gfm-footnote/lib/syntax.js
|
|
33959
33980
|
/**
|
|
33981
|
+
* @typedef {import('micromark-util-types').Event} Event
|
|
33982
|
+
* @typedef {import('micromark-util-types').Exiter} Exiter
|
|
33960
33983
|
* @typedef {import('micromark-util-types').Extension} Extension
|
|
33961
33984
|
* @typedef {import('micromark-util-types').Resolver} Resolver
|
|
33985
|
+
* @typedef {import('micromark-util-types').State} State
|
|
33962
33986
|
* @typedef {import('micromark-util-types').Token} Token
|
|
33987
|
+
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
|
33963
33988
|
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
|
33964
|
-
* @typedef {import('micromark-util-types').Exiter} Exiter
|
|
33965
|
-
* @typedef {import('micromark-util-types').State} State
|
|
33966
|
-
* @typedef {import('micromark-util-types').Event} Event
|
|
33967
33989
|
*/
|
|
33968
33990
|
|
|
33969
33991
|
|
|
33970
33992
|
|
|
33971
33993
|
|
|
33994
|
+
|
|
33972
33995
|
const indent = {
|
|
33973
33996
|
tokenize: syntax_tokenizeIndent,
|
|
33974
33997
|
partial: true
|
|
33975
33998
|
}
|
|
33999
|
+
|
|
34000
|
+
// To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only
|
|
34001
|
+
// affects label start (image).
|
|
34002
|
+
// That will let us drop `tokenizePotentialGfmFootnote*`.
|
|
34003
|
+
// It currently has a `_hiddenFootnoteSupport`, which affects that and more.
|
|
34004
|
+
// That can be removed when `micromark-extension-footnote` is archived.
|
|
34005
|
+
|
|
33976
34006
|
/**
|
|
34007
|
+
* Create an extension for `micromark` to enable GFM footnote syntax.
|
|
34008
|
+
*
|
|
33977
34009
|
* @returns {Extension}
|
|
34010
|
+
* Extension for `micromark` that can be passed in `extensions` to
|
|
34011
|
+
* enable GFM footnote syntax.
|
|
33978
34012
|
*/
|
|
33979
|
-
|
|
33980
34013
|
function gfmFootnote() {
|
|
33981
34014
|
/** @type {Extension} */
|
|
33982
34015
|
return {
|
|
@@ -34001,27 +34034,30 @@ function gfmFootnote() {
|
|
|
34001
34034
|
}
|
|
34002
34035
|
}
|
|
34003
34036
|
}
|
|
34004
|
-
/** @type {Tokenizer} */
|
|
34005
34037
|
|
|
34038
|
+
// To do: remove after micromark update.
|
|
34039
|
+
/**
|
|
34040
|
+
* @this {TokenizeContext}
|
|
34041
|
+
* @type {Tokenizer}
|
|
34042
|
+
*/
|
|
34006
34043
|
function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
|
|
34007
34044
|
const self = this
|
|
34008
34045
|
let index = self.events.length
|
|
34009
34046
|
/** @type {Array<string>} */
|
|
34010
34047
|
// @ts-expect-error It’s fine!
|
|
34011
|
-
|
|
34012
34048
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
|
|
34013
34049
|
/** @type {Token} */
|
|
34050
|
+
let labelStart
|
|
34014
34051
|
|
|
34015
|
-
|
|
34016
|
-
|
|
34052
|
+
// Find an opening.
|
|
34017
34053
|
while (index--) {
|
|
34018
34054
|
const token = self.events[index][1]
|
|
34019
|
-
|
|
34020
34055
|
if (token.type === 'labelImage') {
|
|
34021
34056
|
labelStart = token
|
|
34022
34057
|
break
|
|
34023
|
-
}
|
|
34058
|
+
}
|
|
34024
34059
|
|
|
34060
|
+
// Exit if we’ve walked far enough.
|
|
34025
34061
|
if (
|
|
34026
34062
|
token.type === 'gfmFootnoteCall' ||
|
|
34027
34063
|
token.type === 'labelLink' ||
|
|
@@ -34032,40 +34068,39 @@ function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
|
|
|
34032
34068
|
break
|
|
34033
34069
|
}
|
|
34034
34070
|
}
|
|
34035
|
-
|
|
34036
34071
|
return start
|
|
34037
|
-
/** @type {State} */
|
|
34038
34072
|
|
|
34073
|
+
/**
|
|
34074
|
+
* @type {State}
|
|
34075
|
+
*/
|
|
34039
34076
|
function start(code) {
|
|
34040
34077
|
if (!labelStart || !labelStart._balanced) {
|
|
34041
34078
|
return nok(code)
|
|
34042
34079
|
}
|
|
34043
|
-
|
|
34044
34080
|
const id = normalizeIdentifier(
|
|
34045
34081
|
self.sliceSerialize({
|
|
34046
34082
|
start: labelStart.end,
|
|
34047
34083
|
end: self.now()
|
|
34048
34084
|
})
|
|
34049
34085
|
)
|
|
34050
|
-
|
|
34051
|
-
if (id.charCodeAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
|
34086
|
+
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
|
34052
34087
|
return nok(code)
|
|
34053
34088
|
}
|
|
34054
|
-
|
|
34055
34089
|
effects.enter('gfmFootnoteCallLabelMarker')
|
|
34056
34090
|
effects.consume(code)
|
|
34057
34091
|
effects.exit('gfmFootnoteCallLabelMarker')
|
|
34058
34092
|
return ok(code)
|
|
34059
34093
|
}
|
|
34060
34094
|
}
|
|
34061
|
-
/** @type {Resolver} */
|
|
34062
34095
|
|
|
34096
|
+
// To do: remove after micromark update.
|
|
34097
|
+
/** @type {Resolver} */
|
|
34063
34098
|
function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
34064
34099
|
let index = events.length
|
|
34065
|
-
/** @type {Token|undefined} */
|
|
34066
|
-
|
|
34067
|
-
let labelStart // Find an opening.
|
|
34100
|
+
/** @type {Token | undefined} */
|
|
34101
|
+
let labelStart
|
|
34068
34102
|
|
|
34103
|
+
// Find an opening.
|
|
34069
34104
|
while (index--) {
|
|
34070
34105
|
if (
|
|
34071
34106
|
events[index][1].type === 'labelImage' &&
|
|
@@ -34075,23 +34110,23 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
|
34075
34110
|
break
|
|
34076
34111
|
}
|
|
34077
34112
|
}
|
|
34078
|
-
|
|
34079
34113
|
// Change the `labelImageMarker` to a `data`.
|
|
34080
34114
|
events[index + 1][1].type = 'data'
|
|
34081
|
-
events[index + 3][1].type = 'gfmFootnoteCallLabelMarker'
|
|
34115
|
+
events[index + 3][1].type = 'gfmFootnoteCallLabelMarker'
|
|
34082
34116
|
|
|
34117
|
+
// The whole (without `!`):
|
|
34083
34118
|
const call = {
|
|
34084
34119
|
type: 'gfmFootnoteCall',
|
|
34085
34120
|
start: Object.assign({}, events[index + 3][1].start),
|
|
34086
34121
|
end: Object.assign({}, events[events.length - 1][1].end)
|
|
34087
|
-
}
|
|
34088
|
-
|
|
34122
|
+
}
|
|
34123
|
+
// The `^` marker
|
|
34089
34124
|
const marker = {
|
|
34090
34125
|
type: 'gfmFootnoteCallMarker',
|
|
34091
34126
|
start: Object.assign({}, events[index + 3][1].end),
|
|
34092
34127
|
end: Object.assign({}, events[index + 3][1].end)
|
|
34093
|
-
}
|
|
34094
|
-
|
|
34128
|
+
}
|
|
34129
|
+
// Increment the end 1 character.
|
|
34095
34130
|
marker.end.column++
|
|
34096
34131
|
marker.end.offset++
|
|
34097
34132
|
marker.end._bufferIndex++
|
|
@@ -34106,21 +34141,25 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
|
34106
34141
|
start: Object.assign({}, string.start),
|
|
34107
34142
|
end: Object.assign({}, string.end)
|
|
34108
34143
|
}
|
|
34109
|
-
/** @type {Array<Event>} */
|
|
34110
34144
|
|
|
34145
|
+
/** @type {Array<Event>} */
|
|
34111
34146
|
const replacement = [
|
|
34112
34147
|
// Take the `labelImageMarker` (now `data`, the `!`)
|
|
34113
34148
|
events[index + 1],
|
|
34114
34149
|
events[index + 2],
|
|
34115
|
-
['enter', call, context],
|
|
34150
|
+
['enter', call, context],
|
|
34151
|
+
// The `[`
|
|
34116
34152
|
events[index + 3],
|
|
34117
|
-
events[index + 4],
|
|
34153
|
+
events[index + 4],
|
|
34154
|
+
// The `^`.
|
|
34118
34155
|
['enter', marker, context],
|
|
34119
|
-
['exit', marker, context],
|
|
34156
|
+
['exit', marker, context],
|
|
34157
|
+
// Everything in between.
|
|
34120
34158
|
['enter', string, context],
|
|
34121
34159
|
['enter', chunk, context],
|
|
34122
34160
|
['exit', chunk, context],
|
|
34123
|
-
['exit', string, context],
|
|
34161
|
+
['exit', string, context],
|
|
34162
|
+
// The ending (`]`, properly parsed and labelled).
|
|
34124
34163
|
events[events.length - 2],
|
|
34125
34164
|
events[events.length - 1],
|
|
34126
34165
|
['exit', call, context]
|
|
@@ -34128,21 +34167,37 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
|
34128
34167
|
events.splice(index, events.length - index + 1, ...replacement)
|
|
34129
34168
|
return events
|
|
34130
34169
|
}
|
|
34131
|
-
/** @type {Tokenizer} */
|
|
34132
34170
|
|
|
34171
|
+
/**
|
|
34172
|
+
* @this {TokenizeContext}
|
|
34173
|
+
* @type {Tokenizer}
|
|
34174
|
+
*/
|
|
34133
34175
|
function tokenizeGfmFootnoteCall(effects, ok, nok) {
|
|
34134
34176
|
const self = this
|
|
34135
34177
|
/** @type {Array<string>} */
|
|
34136
34178
|
// @ts-expect-error It’s fine!
|
|
34137
|
-
|
|
34138
34179
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
|
|
34139
34180
|
let size = 0
|
|
34140
34181
|
/** @type {boolean} */
|
|
34141
|
-
|
|
34142
34182
|
let data
|
|
34183
|
+
|
|
34184
|
+
// Note: the implementation of `markdown-rs` is different, because it houses
|
|
34185
|
+
// core *and* extensions in one project.
|
|
34186
|
+
// Therefore, it can include footnote logic inside `label-end`.
|
|
34187
|
+
// We can’t do that, but luckily, we can parse footnotes in a simpler way than
|
|
34188
|
+
// needed for labels.
|
|
34143
34189
|
return start
|
|
34144
|
-
/** @type {State} */
|
|
34145
34190
|
|
|
34191
|
+
/**
|
|
34192
|
+
* Start of footnote label.
|
|
34193
|
+
*
|
|
34194
|
+
* ```markdown
|
|
34195
|
+
* > | a [^b] c
|
|
34196
|
+
* ^
|
|
34197
|
+
* ```
|
|
34198
|
+
*
|
|
34199
|
+
* @type {State}
|
|
34200
|
+
*/
|
|
34146
34201
|
function start(code) {
|
|
34147
34202
|
effects.enter('gfmFootnoteCall')
|
|
34148
34203
|
effects.enter('gfmFootnoteCallLabelMarker')
|
|
@@ -34150,8 +34205,17 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
|
|
|
34150
34205
|
effects.exit('gfmFootnoteCallLabelMarker')
|
|
34151
34206
|
return callStart
|
|
34152
34207
|
}
|
|
34153
|
-
/** @type {State} */
|
|
34154
34208
|
|
|
34209
|
+
/**
|
|
34210
|
+
* After `[`, at `^`.
|
|
34211
|
+
*
|
|
34212
|
+
* ```markdown
|
|
34213
|
+
* > | a [^b] c
|
|
34214
|
+
* ^
|
|
34215
|
+
* ```
|
|
34216
|
+
*
|
|
34217
|
+
* @type {State}
|
|
34218
|
+
*/
|
|
34155
34219
|
function callStart(code) {
|
|
34156
34220
|
if (code !== 94) return nok(code)
|
|
34157
34221
|
effects.enter('gfmFootnoteCallMarker')
|
|
@@ -34161,112 +34225,158 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
|
|
|
34161
34225
|
effects.enter('chunkString').contentType = 'string'
|
|
34162
34226
|
return callData
|
|
34163
34227
|
}
|
|
34164
|
-
/** @type {State} */
|
|
34165
34228
|
|
|
34229
|
+
/**
|
|
34230
|
+
* In label.
|
|
34231
|
+
*
|
|
34232
|
+
* ```markdown
|
|
34233
|
+
* > | a [^b] c
|
|
34234
|
+
* ^
|
|
34235
|
+
* ```
|
|
34236
|
+
*
|
|
34237
|
+
* @type {State}
|
|
34238
|
+
*/
|
|
34166
34239
|
function callData(code) {
|
|
34167
|
-
|
|
34168
|
-
|
|
34169
|
-
|
|
34170
|
-
|
|
34240
|
+
if (
|
|
34241
|
+
// Too long.
|
|
34242
|
+
size > 999 ||
|
|
34243
|
+
// Closing brace with nothing.
|
|
34244
|
+
(code === 93 && !data) ||
|
|
34245
|
+
// Space or tab is not supported by GFM for some reason.
|
|
34246
|
+
// `\n` and `[` not being supported makes sense.
|
|
34247
|
+
code === null ||
|
|
34248
|
+
code === 91 ||
|
|
34249
|
+
markdownLineEndingOrSpace(code)
|
|
34250
|
+
) {
|
|
34171
34251
|
return nok(code)
|
|
34172
34252
|
}
|
|
34173
|
-
|
|
34174
34253
|
if (code === 93) {
|
|
34175
|
-
|
|
34254
|
+
effects.exit('chunkString')
|
|
34255
|
+
const token = effects.exit('gfmFootnoteCallString')
|
|
34256
|
+
if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
|
|
34176
34257
|
return nok(code)
|
|
34177
34258
|
}
|
|
34178
|
-
|
|
34179
|
-
effects.
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
: nok(code)
|
|
34259
|
+
effects.enter('gfmFootnoteCallLabelMarker')
|
|
34260
|
+
effects.consume(code)
|
|
34261
|
+
effects.exit('gfmFootnoteCallLabelMarker')
|
|
34262
|
+
effects.exit('gfmFootnoteCall')
|
|
34263
|
+
return ok
|
|
34184
34264
|
}
|
|
34185
|
-
|
|
34186
|
-
effects.consume(code)
|
|
34187
|
-
|
|
34188
34265
|
if (!markdownLineEndingOrSpace(code)) {
|
|
34189
34266
|
data = true
|
|
34190
34267
|
}
|
|
34191
|
-
|
|
34268
|
+
size++
|
|
34269
|
+
effects.consume(code)
|
|
34192
34270
|
return code === 92 ? callEscape : callData
|
|
34193
34271
|
}
|
|
34194
|
-
/** @type {State} */
|
|
34195
34272
|
|
|
34273
|
+
/**
|
|
34274
|
+
* On character after escape.
|
|
34275
|
+
*
|
|
34276
|
+
* ```markdown
|
|
34277
|
+
* > | a [^b\c] d
|
|
34278
|
+
* ^
|
|
34279
|
+
* ```
|
|
34280
|
+
*
|
|
34281
|
+
* @type {State}
|
|
34282
|
+
*/
|
|
34196
34283
|
function callEscape(code) {
|
|
34197
34284
|
if (code === 91 || code === 92 || code === 93) {
|
|
34198
34285
|
effects.consume(code)
|
|
34199
34286
|
size++
|
|
34200
34287
|
return callData
|
|
34201
34288
|
}
|
|
34202
|
-
|
|
34203
34289
|
return callData(code)
|
|
34204
34290
|
}
|
|
34205
|
-
/** @type {State} */
|
|
34206
|
-
|
|
34207
|
-
function end(code) {
|
|
34208
|
-
effects.enter('gfmFootnoteCallLabelMarker')
|
|
34209
|
-
effects.consume(code)
|
|
34210
|
-
effects.exit('gfmFootnoteCallLabelMarker')
|
|
34211
|
-
effects.exit('gfmFootnoteCall')
|
|
34212
|
-
return ok
|
|
34213
|
-
}
|
|
34214
34291
|
}
|
|
34215
|
-
/** @type {Tokenizer} */
|
|
34216
34292
|
|
|
34293
|
+
/**
|
|
34294
|
+
* @this {TokenizeContext}
|
|
34295
|
+
* @type {Tokenizer}
|
|
34296
|
+
*/
|
|
34217
34297
|
function tokenizeDefinitionStart(effects, ok, nok) {
|
|
34218
34298
|
const self = this
|
|
34219
34299
|
/** @type {Array<string>} */
|
|
34220
34300
|
// @ts-expect-error It’s fine!
|
|
34221
|
-
|
|
34222
34301
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
|
|
34223
34302
|
/** @type {string} */
|
|
34224
|
-
|
|
34225
34303
|
let identifier
|
|
34226
34304
|
let size = 0
|
|
34227
|
-
/** @type {boolean|undefined} */
|
|
34228
|
-
|
|
34305
|
+
/** @type {boolean | undefined} */
|
|
34229
34306
|
let data
|
|
34230
34307
|
return start
|
|
34231
|
-
/** @type {State} */
|
|
34232
34308
|
|
|
34309
|
+
/**
|
|
34310
|
+
* Start of GFM footnote definition.
|
|
34311
|
+
*
|
|
34312
|
+
* ```markdown
|
|
34313
|
+
* > | [^a]: b
|
|
34314
|
+
* ^
|
|
34315
|
+
* ```
|
|
34316
|
+
*
|
|
34317
|
+
* @type {State}
|
|
34318
|
+
*/
|
|
34233
34319
|
function start(code) {
|
|
34234
34320
|
effects.enter('gfmFootnoteDefinition')._container = true
|
|
34235
34321
|
effects.enter('gfmFootnoteDefinitionLabel')
|
|
34236
34322
|
effects.enter('gfmFootnoteDefinitionLabelMarker')
|
|
34237
34323
|
effects.consume(code)
|
|
34238
34324
|
effects.exit('gfmFootnoteDefinitionLabelMarker')
|
|
34239
|
-
return
|
|
34325
|
+
return labelAtMarker
|
|
34240
34326
|
}
|
|
34241
|
-
/** @type {State} */
|
|
34242
34327
|
|
|
34243
|
-
|
|
34328
|
+
/**
|
|
34329
|
+
* In label, at caret.
|
|
34330
|
+
*
|
|
34331
|
+
* ```markdown
|
|
34332
|
+
* > | [^a]: b
|
|
34333
|
+
* ^
|
|
34334
|
+
* ```
|
|
34335
|
+
*
|
|
34336
|
+
* @type {State}
|
|
34337
|
+
*/
|
|
34338
|
+
function labelAtMarker(code) {
|
|
34244
34339
|
if (code === 94) {
|
|
34245
34340
|
effects.enter('gfmFootnoteDefinitionMarker')
|
|
34246
34341
|
effects.consume(code)
|
|
34247
34342
|
effects.exit('gfmFootnoteDefinitionMarker')
|
|
34248
34343
|
effects.enter('gfmFootnoteDefinitionLabelString')
|
|
34249
|
-
|
|
34344
|
+
effects.enter('chunkString').contentType = 'string'
|
|
34345
|
+
return labelInside
|
|
34250
34346
|
}
|
|
34251
|
-
|
|
34252
34347
|
return nok(code)
|
|
34253
34348
|
}
|
|
34254
|
-
/** @type {State} */
|
|
34255
34349
|
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
|
|
34350
|
+
/**
|
|
34351
|
+
* In label.
|
|
34352
|
+
*
|
|
34353
|
+
* > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote
|
|
34354
|
+
* > definition labels.
|
|
34355
|
+
*
|
|
34356
|
+
* ```markdown
|
|
34357
|
+
* > | [^a]: b
|
|
34358
|
+
* ^
|
|
34359
|
+
* ```
|
|
34360
|
+
*
|
|
34361
|
+
* @type {State}
|
|
34362
|
+
*/
|
|
34363
|
+
function labelInside(code) {
|
|
34364
|
+
if (
|
|
34365
|
+
// Too long.
|
|
34366
|
+
size > 999 ||
|
|
34367
|
+
// Closing brace with nothing.
|
|
34368
|
+
(code === 93 && !data) ||
|
|
34369
|
+
// Space or tab is not supported by GFM for some reason.
|
|
34370
|
+
// `\n` and `[` not being supported makes sense.
|
|
34371
|
+
code === null ||
|
|
34372
|
+
code === 91 ||
|
|
34373
|
+
markdownLineEndingOrSpace(code)
|
|
34374
|
+
) {
|
|
34261
34375
|
return nok(code)
|
|
34262
34376
|
}
|
|
34263
|
-
|
|
34264
34377
|
if (code === 93) {
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
}
|
|
34268
|
-
|
|
34269
|
-
token = effects.exit('gfmFootnoteDefinitionLabelString')
|
|
34378
|
+
effects.exit('chunkString')
|
|
34379
|
+
const token = effects.exit('gfmFootnoteDefinitionLabelString')
|
|
34270
34380
|
identifier = normalizeIdentifier(self.sliceSerialize(token))
|
|
34271
34381
|
effects.enter('gfmFootnoteDefinitionLabelMarker')
|
|
34272
34382
|
effects.consume(code)
|
|
@@ -34274,89 +34384,109 @@ function tokenizeDefinitionStart(effects, ok, nok) {
|
|
|
34274
34384
|
effects.exit('gfmFootnoteDefinitionLabel')
|
|
34275
34385
|
return labelAfter
|
|
34276
34386
|
}
|
|
34277
|
-
|
|
34278
|
-
if (markdownLineEnding(code)) {
|
|
34279
|
-
effects.enter('lineEnding')
|
|
34280
|
-
effects.consume(code)
|
|
34281
|
-
effects.exit('lineEnding')
|
|
34282
|
-
size++
|
|
34283
|
-
return atBreak
|
|
34284
|
-
}
|
|
34285
|
-
|
|
34286
|
-
effects.enter('chunkString').contentType = 'string'
|
|
34287
|
-
return label(code)
|
|
34288
|
-
}
|
|
34289
|
-
/** @type {State} */
|
|
34290
|
-
|
|
34291
|
-
function label(code) {
|
|
34292
|
-
if (
|
|
34293
|
-
code === null ||
|
|
34294
|
-
markdownLineEnding(code) ||
|
|
34295
|
-
code === 91 ||
|
|
34296
|
-
code === 93 ||
|
|
34297
|
-
size > 999
|
|
34298
|
-
) {
|
|
34299
|
-
effects.exit('chunkString')
|
|
34300
|
-
return atBreak(code)
|
|
34301
|
-
}
|
|
34302
|
-
|
|
34303
34387
|
if (!markdownLineEndingOrSpace(code)) {
|
|
34304
34388
|
data = true
|
|
34305
34389
|
}
|
|
34306
|
-
|
|
34307
34390
|
size++
|
|
34308
34391
|
effects.consume(code)
|
|
34309
|
-
return code === 92 ? labelEscape :
|
|
34392
|
+
return code === 92 ? labelEscape : labelInside
|
|
34310
34393
|
}
|
|
34311
|
-
/** @type {State} */
|
|
34312
34394
|
|
|
34395
|
+
/**
|
|
34396
|
+
* After `\`, at a special character.
|
|
34397
|
+
*
|
|
34398
|
+
* > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets:
|
|
34399
|
+
* > <https://github.com/github/cmark-gfm/issues/240>
|
|
34400
|
+
*
|
|
34401
|
+
* ```markdown
|
|
34402
|
+
* > | [^a\*b]: c
|
|
34403
|
+
* ^
|
|
34404
|
+
* ```
|
|
34405
|
+
*
|
|
34406
|
+
* @type {State}
|
|
34407
|
+
*/
|
|
34313
34408
|
function labelEscape(code) {
|
|
34314
34409
|
if (code === 91 || code === 92 || code === 93) {
|
|
34315
34410
|
effects.consume(code)
|
|
34316
34411
|
size++
|
|
34317
|
-
return
|
|
34412
|
+
return labelInside
|
|
34318
34413
|
}
|
|
34319
|
-
|
|
34320
|
-
return label(code)
|
|
34414
|
+
return labelInside(code)
|
|
34321
34415
|
}
|
|
34322
|
-
/** @type {State} */
|
|
34323
34416
|
|
|
34417
|
+
/**
|
|
34418
|
+
* After definition label.
|
|
34419
|
+
*
|
|
34420
|
+
* ```markdown
|
|
34421
|
+
* > | [^a]: b
|
|
34422
|
+
* ^
|
|
34423
|
+
* ```
|
|
34424
|
+
*
|
|
34425
|
+
* @type {State}
|
|
34426
|
+
*/
|
|
34324
34427
|
function labelAfter(code) {
|
|
34325
34428
|
if (code === 58) {
|
|
34326
34429
|
effects.enter('definitionMarker')
|
|
34327
34430
|
effects.consume(code)
|
|
34328
|
-
effects.exit('definitionMarker')
|
|
34431
|
+
effects.exit('definitionMarker')
|
|
34432
|
+
if (!defined.includes(identifier)) {
|
|
34433
|
+
defined.push(identifier)
|
|
34434
|
+
}
|
|
34435
|
+
|
|
34436
|
+
// Any whitespace after the marker is eaten, forming indented code
|
|
34329
34437
|
// is not possible.
|
|
34330
34438
|
// No space is also fine, just like a block quote marker.
|
|
34331
|
-
|
|
34332
|
-
|
|
34439
|
+
return factorySpace(
|
|
34440
|
+
effects,
|
|
34441
|
+
whitespaceAfter,
|
|
34442
|
+
'gfmFootnoteDefinitionWhitespace'
|
|
34443
|
+
)
|
|
34333
34444
|
}
|
|
34334
|
-
|
|
34335
34445
|
return nok(code)
|
|
34336
34446
|
}
|
|
34337
|
-
/** @type {State} */
|
|
34338
|
-
|
|
34339
|
-
function done(code) {
|
|
34340
|
-
if (!defined.includes(identifier)) {
|
|
34341
|
-
defined.push(identifier)
|
|
34342
|
-
}
|
|
34343
34447
|
|
|
34448
|
+
/**
|
|
34449
|
+
* After definition prefix.
|
|
34450
|
+
*
|
|
34451
|
+
* ```markdown
|
|
34452
|
+
* > | [^a]: b
|
|
34453
|
+
* ^
|
|
34454
|
+
* ```
|
|
34455
|
+
*
|
|
34456
|
+
* @type {State}
|
|
34457
|
+
*/
|
|
34458
|
+
function whitespaceAfter(code) {
|
|
34459
|
+
// `markdown-rs` has a wrapping token for the prefix that is closed here.
|
|
34344
34460
|
return ok(code)
|
|
34345
34461
|
}
|
|
34346
34462
|
}
|
|
34347
|
-
/** @type {Tokenizer} */
|
|
34348
34463
|
|
|
34464
|
+
/**
|
|
34465
|
+
* @this {TokenizeContext}
|
|
34466
|
+
* @type {Tokenizer}
|
|
34467
|
+
*/
|
|
34349
34468
|
function tokenizeDefinitionContinuation(effects, ok, nok) {
|
|
34469
|
+
/// Start of footnote definition continuation.
|
|
34470
|
+
///
|
|
34471
|
+
/// ```markdown
|
|
34472
|
+
/// | [^a]: b
|
|
34473
|
+
/// > | c
|
|
34474
|
+
/// ^
|
|
34475
|
+
/// ```
|
|
34476
|
+
//
|
|
34350
34477
|
// Either a blank line, which is okay, or an indented thing.
|
|
34351
34478
|
return effects.check(blankLine, ok, effects.attempt(indent, ok, nok))
|
|
34352
34479
|
}
|
|
34353
|
-
/** @type {Exiter} */
|
|
34354
34480
|
|
|
34481
|
+
/** @type {Exiter} */
|
|
34355
34482
|
function gfmFootnoteDefinitionEnd(effects) {
|
|
34356
34483
|
effects.exit('gfmFootnoteDefinition')
|
|
34357
34484
|
}
|
|
34358
|
-
/** @type {Tokenizer} */
|
|
34359
34485
|
|
|
34486
|
+
/**
|
|
34487
|
+
* @this {TokenizeContext}
|
|
34488
|
+
* @type {Tokenizer}
|
|
34489
|
+
*/
|
|
34360
34490
|
function syntax_tokenizeIndent(effects, ok, nok) {
|
|
34361
34491
|
const self = this
|
|
34362
34492
|
return factorySpace(
|
|
@@ -34365,8 +34495,10 @@ function syntax_tokenizeIndent(effects, ok, nok) {
|
|
|
34365
34495
|
'gfmFootnoteDefinitionIndent',
|
|
34366
34496
|
4 + 1
|
|
34367
34497
|
)
|
|
34368
|
-
/** @type {State} */
|
|
34369
34498
|
|
|
34499
|
+
/**
|
|
34500
|
+
* @type {State}
|
|
34501
|
+
*/
|
|
34370
34502
|
function afterPrefix(code) {
|
|
34371
34503
|
const tail = self.events[self.events.length - 1]
|
|
34372
34504
|
return tail &&
|
|
@@ -35160,106 +35292,165 @@ function tokenizeNextPrefixedOrBlank(effects, ok, nok) {
|
|
|
35160
35292
|
;// CONCATENATED MODULE: ../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
|
|
35161
35293
|
/**
|
|
35162
35294
|
* @typedef {import('micromark-util-types').Extension} Extension
|
|
35163
|
-
* @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
|
|
35164
|
-
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
|
35165
|
-
* @typedef {import('micromark-util-types').Previous} Previous
|
|
35166
35295
|
* @typedef {import('micromark-util-types').State} State
|
|
35167
|
-
* @typedef {import('micromark-util-types').
|
|
35168
|
-
* @typedef {import('micromark-util-types').
|
|
35296
|
+
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
|
35297
|
+
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
|
35169
35298
|
*/
|
|
35170
35299
|
|
|
35171
35300
|
|
|
35301
|
+
|
|
35172
35302
|
const tasklistCheck = {
|
|
35173
35303
|
tokenize: tokenizeTasklistCheck
|
|
35174
35304
|
}
|
|
35305
|
+
|
|
35306
|
+
// To do: next major: expose function to make extension.
|
|
35307
|
+
|
|
35308
|
+
/**
|
|
35309
|
+
* Extension for `micromark` that can be passed in `extensions`, to
|
|
35310
|
+
* enable GFM task list items syntax.
|
|
35311
|
+
*
|
|
35312
|
+
* @type {Extension}
|
|
35313
|
+
*/
|
|
35175
35314
|
const gfmTaskListItem = {
|
|
35176
35315
|
text: {
|
|
35177
35316
|
[91]: tasklistCheck
|
|
35178
35317
|
}
|
|
35179
35318
|
}
|
|
35180
|
-
/** @type {Tokenizer} */
|
|
35181
35319
|
|
|
35320
|
+
/**
|
|
35321
|
+
* @this {TokenizeContext}
|
|
35322
|
+
* @type {Tokenizer}
|
|
35323
|
+
*/
|
|
35182
35324
|
function tokenizeTasklistCheck(effects, ok, nok) {
|
|
35183
35325
|
const self = this
|
|
35184
35326
|
return open
|
|
35185
|
-
/** @type {State} */
|
|
35186
35327
|
|
|
35328
|
+
/**
|
|
35329
|
+
* At start of task list item check.
|
|
35330
|
+
*
|
|
35331
|
+
* ```markdown
|
|
35332
|
+
* > | * [x] y.
|
|
35333
|
+
* ^
|
|
35334
|
+
* ```
|
|
35335
|
+
*
|
|
35336
|
+
* @type {State}
|
|
35337
|
+
*/
|
|
35187
35338
|
function open(code) {
|
|
35188
35339
|
if (
|
|
35189
35340
|
// Exit if there’s stuff before.
|
|
35190
|
-
self.previous !== null ||
|
|
35341
|
+
self.previous !== null ||
|
|
35342
|
+
// Exit if not in the first content that is the first child of a list
|
|
35191
35343
|
// item.
|
|
35192
35344
|
!self._gfmTasklistFirstContentOfListItem
|
|
35193
35345
|
) {
|
|
35194
35346
|
return nok(code)
|
|
35195
35347
|
}
|
|
35196
|
-
|
|
35197
35348
|
effects.enter('taskListCheck')
|
|
35198
35349
|
effects.enter('taskListCheckMarker')
|
|
35199
35350
|
effects.consume(code)
|
|
35200
35351
|
effects.exit('taskListCheckMarker')
|
|
35201
35352
|
return inside
|
|
35202
35353
|
}
|
|
35203
|
-
/** @type {State} */
|
|
35204
35354
|
|
|
35355
|
+
/**
|
|
35356
|
+
* In task list item check.
|
|
35357
|
+
*
|
|
35358
|
+
* ```markdown
|
|
35359
|
+
* > | * [x] y.
|
|
35360
|
+
* ^
|
|
35361
|
+
* ```
|
|
35362
|
+
*
|
|
35363
|
+
* @type {State}
|
|
35364
|
+
*/
|
|
35205
35365
|
function inside(code) {
|
|
35206
|
-
//
|
|
35207
|
-
//
|
|
35366
|
+
// Currently we match how GH works in files.
|
|
35367
|
+
// To match how GH works in comments, use `markdownSpace` (`[\t ]`) instead
|
|
35368
|
+
// of `markdownLineEndingOrSpace` (`[\t\n\r ]`).
|
|
35208
35369
|
if (markdownLineEndingOrSpace(code)) {
|
|
35209
35370
|
effects.enter('taskListCheckValueUnchecked')
|
|
35210
35371
|
effects.consume(code)
|
|
35211
35372
|
effects.exit('taskListCheckValueUnchecked')
|
|
35212
35373
|
return close
|
|
35213
35374
|
}
|
|
35214
|
-
|
|
35215
35375
|
if (code === 88 || code === 120) {
|
|
35216
35376
|
effects.enter('taskListCheckValueChecked')
|
|
35217
35377
|
effects.consume(code)
|
|
35218
35378
|
effects.exit('taskListCheckValueChecked')
|
|
35219
35379
|
return close
|
|
35220
35380
|
}
|
|
35221
|
-
|
|
35222
35381
|
return nok(code)
|
|
35223
35382
|
}
|
|
35224
|
-
/** @type {State} */
|
|
35225
35383
|
|
|
35384
|
+
/**
|
|
35385
|
+
* At close of task list item check.
|
|
35386
|
+
*
|
|
35387
|
+
* ```markdown
|
|
35388
|
+
* > | * [x] y.
|
|
35389
|
+
* ^
|
|
35390
|
+
* ```
|
|
35391
|
+
*
|
|
35392
|
+
* @type {State}
|
|
35393
|
+
*/
|
|
35226
35394
|
function close(code) {
|
|
35227
35395
|
if (code === 93) {
|
|
35228
35396
|
effects.enter('taskListCheckMarker')
|
|
35229
35397
|
effects.consume(code)
|
|
35230
35398
|
effects.exit('taskListCheckMarker')
|
|
35231
35399
|
effects.exit('taskListCheck')
|
|
35400
|
+
return after
|
|
35401
|
+
}
|
|
35402
|
+
return nok(code)
|
|
35403
|
+
}
|
|
35404
|
+
|
|
35405
|
+
/**
|
|
35406
|
+
* @type {State}
|
|
35407
|
+
*/
|
|
35408
|
+
function after(code) {
|
|
35409
|
+
// EOL in paragraph means there must be something else after it.
|
|
35410
|
+
if (markdownLineEnding(code)) {
|
|
35411
|
+
return ok(code)
|
|
35412
|
+
}
|
|
35413
|
+
|
|
35414
|
+
// Space or tab?
|
|
35415
|
+
// Check what comes after.
|
|
35416
|
+
if (markdownSpace(code)) {
|
|
35232
35417
|
return effects.check(
|
|
35233
35418
|
{
|
|
35234
35419
|
tokenize: spaceThenNonSpace
|
|
35235
35420
|
},
|
|
35236
35421
|
ok,
|
|
35237
35422
|
nok
|
|
35238
|
-
)
|
|
35423
|
+
)(code)
|
|
35239
35424
|
}
|
|
35240
35425
|
|
|
35426
|
+
// EOF, or non-whitespace, both wrong.
|
|
35241
35427
|
return nok(code)
|
|
35242
35428
|
}
|
|
35243
35429
|
}
|
|
35244
|
-
/** @type {Tokenizer} */
|
|
35245
35430
|
|
|
35431
|
+
/**
|
|
35432
|
+
* @this {TokenizeContext}
|
|
35433
|
+
* @type {Tokenizer}
|
|
35434
|
+
*/
|
|
35246
35435
|
function spaceThenNonSpace(effects, ok, nok) {
|
|
35247
|
-
const self = this
|
|
35248
35436
|
return factorySpace(effects, after, 'whitespace')
|
|
35249
|
-
/** @type {State} */
|
|
35250
35437
|
|
|
35438
|
+
/**
|
|
35439
|
+
* After whitespace, after task list item check.
|
|
35440
|
+
*
|
|
35441
|
+
* ```markdown
|
|
35442
|
+
* > | * [x] y.
|
|
35443
|
+
* ^
|
|
35444
|
+
* ```
|
|
35445
|
+
*
|
|
35446
|
+
* @type {State}
|
|
35447
|
+
*/
|
|
35251
35448
|
function after(code) {
|
|
35252
|
-
|
|
35253
|
-
|
|
35254
|
-
|
|
35255
|
-
|
|
35256
|
-
|
|
35257
|
-
// EOF as the content is closed with blank lines.
|
|
35258
|
-
markdownLineEnding(code)) &&
|
|
35259
|
-
code !== null
|
|
35260
|
-
? ok(code)
|
|
35261
|
-
: nok(code)
|
|
35262
|
-
)
|
|
35449
|
+
// EOF means there was nothing, so bad.
|
|
35450
|
+
// EOL means there’s content after it, so good.
|
|
35451
|
+
// Impossible to have more spaces.
|
|
35452
|
+
// Anything else is good.
|
|
35453
|
+
return code === null ? nok(code) : ok(code)
|
|
35263
35454
|
}
|
|
35264
35455
|
}
|
|
35265
35456
|
|
|
@@ -72494,7 +72685,13 @@ function rehypeStringify(config) {
|
|
|
72494
72685
|
const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
|
|
72495
72686
|
|
|
72496
72687
|
;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
|
|
72497
|
-
var _templateObject;function html2Escape(sHtml){return sHtml.replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g,
|
|
72688
|
+
var _templateObject;function html2Escape(sHtml){return sHtml// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
|
|
72689
|
+
// return str.replace(
|
|
72690
|
+
// /[<&"]/g,
|
|
72691
|
+
// (c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
72692
|
+
// );
|
|
72693
|
+
// })
|
|
72694
|
+
.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
|
|
72498
72695
|
},[]);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(String.raw(_templateObject||(_templateObject=_taggedTemplateLiteral(["",""])),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||''}});}
|
|
72499
72696
|
;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
72500
72697
|
|
|
@@ -72725,7 +72922,7 @@ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOv
|
|
|
72725
72922
|
// extracted by mini-css-extract-plugin
|
|
72726
72923
|
/* harmony default export */ const DragBar = ({});
|
|
72727
72924
|
;// CONCATENATED MODULE: ./src/components/DragBar/index.tsx
|
|
72728
|
-
var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:
|
|
72925
|
+
var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72729
72926
|
},[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})});},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
|
|
72730
72927
|
;// CONCATENATED MODULE: ./src/index.less
|
|
72731
72928
|
// extracted by mini-css-extract-plugin
|