ronds-metadata 1.2.37 → 1.2.39
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/es/api/index.js +83 -131
- package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
- package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +40 -73
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +23 -39
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +131 -226
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +12 -14
- package/es/comps/Split/index.js +40 -38
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils.js +58 -97
- package/package.json +4 -2
- package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
- package/es/comps/MdEdit/plugin/EditContent.js +0 -34
- package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
- package/es/comps/MdEdit/plugin/Mark.js +0 -60
- package/es/framework/libs/iconfont/iconfont.json +0 -401
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
interface IMdEditProProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (txt: string) => void;
|
|
5
|
+
onImageUpload?: (file: File) => Promise<{
|
|
6
|
+
default: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
declare const MdEditPro: (props: IMdEditProProps) => JSX.Element;
|
|
10
|
+
export default MdEditPro;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wangxian
|
|
3
|
+
* @Date: 2023-04-27 19:03:05
|
|
4
|
+
* @LastEditTime: 2023-05-04 16:34:09
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import MdEdit from 'ronds-react-markdown';
|
|
8
|
+
import './index.less';
|
|
9
|
+
var MdEditPro = function MdEditPro(props) {
|
|
10
|
+
var value = props.value,
|
|
11
|
+
onImageUpload = props.onImageUpload,
|
|
12
|
+
_onChange = props.onChange;
|
|
13
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MdEdit, {
|
|
14
|
+
handleImageUpload: onImageUpload,
|
|
15
|
+
data: value,
|
|
16
|
+
onChange: function onChange(event, editor) {
|
|
17
|
+
var _data = editor.getData();
|
|
18
|
+
_onChange && _onChange(_data);
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
export default MdEditPro;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* ---- Cross-editor content styles. --------------------------------------------------------------- */
|
|
2
|
+
.ck.ck-content:not(.ck-style-grid__button__preview) {
|
|
3
|
+
/* Make sure all content containers have some min height to make them easier to locate. */
|
|
4
|
+
min-height: 300px;
|
|
5
|
+
padding: 10px 20px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Make sure all content containers are distinguishable on a web page even of not focused. */
|
|
9
|
+
.ck.ck-content:not(:focus) {
|
|
10
|
+
border: 1px solid var(--ck-color-base-border);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Font sizes and vertical rhythm for common elements (headings, lists, paragraphs, etc.) */
|
|
14
|
+
.ck-content h1 {
|
|
15
|
+
font-size: 28px;
|
|
16
|
+
}
|
|
17
|
+
.ck-content h2 {
|
|
18
|
+
font-size: 18px;
|
|
19
|
+
}
|
|
20
|
+
.ck-content h3 {
|
|
21
|
+
font-size: 16px;
|
|
22
|
+
}
|
|
23
|
+
.ck-content h4 {
|
|
24
|
+
font-size: 15px;
|
|
25
|
+
}
|
|
26
|
+
.ck-content h5 {
|
|
27
|
+
font-size: 15px;
|
|
28
|
+
}
|
|
29
|
+
.ck-content h6 {
|
|
30
|
+
font-size: 15px;
|
|
31
|
+
}
|
|
32
|
+
.ck-content h1,
|
|
33
|
+
.ck-content h2,
|
|
34
|
+
.ck-content h3,
|
|
35
|
+
.ck-content h4,
|
|
36
|
+
.ck-content h5,
|
|
37
|
+
.ck-content h6 {
|
|
38
|
+
margin: 42px 0 18px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
line-height: 1.40625;
|
|
41
|
+
}
|
|
42
|
+
.ck-content blockquote,
|
|
43
|
+
.ck-content ol,
|
|
44
|
+
.ck-content p,
|
|
45
|
+
.ck-content ul {
|
|
46
|
+
font-size: 15px;
|
|
47
|
+
line-height: 1.40625;
|
|
48
|
+
padding-top: 10px;
|
|
49
|
+
margin-bottom: var(--ck-spacing-large);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// .ck-content ol,
|
|
53
|
+
// .ck-content ul {
|
|
54
|
+
// margin-left: 10px !important;
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
.ck-content ul li {
|
|
58
|
+
list-style: disc !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ck-content ol li {
|
|
62
|
+
list-style: decimal !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ck.ck-content.ck-editor__editable_inline > :first-child {
|
|
66
|
+
margin-top: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ck-content .table {
|
|
70
|
+
margin: 0px !important;
|
|
71
|
+
}
|
|
72
|
+
.ck-content .image {
|
|
73
|
+
margin: 0px !important;
|
|
74
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
|
|
4
3
|
/*
|
|
5
4
|
* @Author: wangxian
|
|
6
5
|
* @Date: 2022-10-14 09:05:50
|
|
@@ -9,27 +8,22 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
9
8
|
import React from 'react';
|
|
10
9
|
import { getCurrentHashValue, trimArrZero } from './utils';
|
|
11
10
|
import './index.less';
|
|
12
|
-
|
|
13
11
|
var MdNavbar = function MdNavbar(props) {
|
|
14
12
|
var source = props.source,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
ordered = props.ordered,
|
|
14
|
+
declarative = props.declarative,
|
|
15
|
+
className = props.className,
|
|
16
|
+
onNavItemClick = props.onNavItemClick,
|
|
17
|
+
onHashChange = props.onHashChange;
|
|
21
18
|
var _React$useState = React.useState([]),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20
|
+
navStructure = _React$useState2[0],
|
|
21
|
+
setNavStructure = _React$useState2[1];
|
|
26
22
|
var navStructureRef = React.useRef([]);
|
|
27
|
-
|
|
28
23
|
var _React$useState3 = React.useState(''),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
25
|
+
currentListNo = _React$useState4[0],
|
|
26
|
+
setCurrentListNo = _React$useState4[1];
|
|
33
27
|
var scrollTimeoutRef = React.useRef();
|
|
34
28
|
var addTargetTimeoutRef = React.useRef();
|
|
35
29
|
var getNavStructure = React.useCallback(function () {
|
|
@@ -38,11 +32,9 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
38
32
|
.replace(/^#\s[^#\n]*\n+/, '').replace(/```[^`\n]*\n+[^```]+```\n+/g, '').replace(/`([^`\n]+)`/g, '$1').replace(/\*\*?([^*\n]+)\*\*?/g, '$1').replace(/__?([^_\n]+)__?/g, '$1').trim();
|
|
39
33
|
var pattOfTitle = /#+\s([^#\n]+)\n*/g;
|
|
40
34
|
var matchResult = contentWithoutCode.match(pattOfTitle);
|
|
41
|
-
|
|
42
35
|
if (!matchResult) {
|
|
43
36
|
return;
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
var navData = matchResult.map(function (r, i) {
|
|
47
39
|
return {
|
|
48
40
|
index: i,
|
|
@@ -56,19 +48,16 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
56
48
|
maxLevel = t.level;
|
|
57
49
|
}
|
|
58
50
|
});
|
|
59
|
-
var matchStack = [];
|
|
60
|
-
|
|
51
|
+
var matchStack = [];
|
|
52
|
+
// 此部分重构,原有方法会出现次级标题后再次出现高级标题时,listNo重复的bug
|
|
61
53
|
for (var i = 0; i < navData.length; i++) {
|
|
62
54
|
var t = navData[i];
|
|
63
55
|
var level = t.level;
|
|
64
|
-
|
|
65
56
|
while (matchStack.length && matchStack[matchStack.length - 1].level > level) {
|
|
66
57
|
matchStack.pop();
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
if (matchStack.length === 0) {
|
|
70
60
|
var _arr = new Array(maxLevel).fill(0);
|
|
71
|
-
|
|
72
61
|
_arr[level - 1] += 1;
|
|
73
62
|
matchStack.push({
|
|
74
63
|
level: level,
|
|
@@ -77,7 +66,6 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
77
66
|
t.listNo = trimArrZero(_arr).join('.');
|
|
78
67
|
continue;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
var arr = matchStack[matchStack.length - 1].arr;
|
|
82
70
|
var newArr = arr.slice();
|
|
83
71
|
newArr[level - 1] += 1;
|
|
@@ -87,7 +75,6 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
87
75
|
});
|
|
88
76
|
t.listNo = trimArrZero(newArr).join('.');
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
setNavStructure(_toConsumableArray(navData));
|
|
92
79
|
navStructureRef.current = navData;
|
|
93
80
|
}
|
|
@@ -99,10 +86,8 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
99
86
|
var curHeading = Array.prototype.slice.apply(headings).find(function (h) {
|
|
100
87
|
return h.innerText.trim() === t.text.trim() && (!h.dataset || !h.dataset.id);
|
|
101
88
|
});
|
|
102
|
-
|
|
103
89
|
if (curHeading) {
|
|
104
90
|
curHeading.dataset.id = declarative ? "".concat(t.listNo, "-").concat(t.text) : "heading-".concat(t.index);
|
|
105
|
-
|
|
106
91
|
if (headingId && headingId === curHeading.dataset.id) {
|
|
107
92
|
scrollToTarget(headingId);
|
|
108
93
|
setCurrentListNo(t.listNo);
|
|
@@ -114,10 +99,8 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
114
99
|
if (addTargetTimeoutRef.current) {
|
|
115
100
|
clearTimeout(addTargetTimeoutRef.current);
|
|
116
101
|
}
|
|
117
|
-
|
|
118
102
|
addTargetTimeoutRef.current = setTimeout(function () {
|
|
119
103
|
initHeadingsId();
|
|
120
|
-
|
|
121
104
|
if (navStructure.length) {
|
|
122
105
|
var listNo = navStructure[0].listNo;
|
|
123
106
|
setCurrentListNo(listNo);
|
|
@@ -134,15 +117,12 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
134
117
|
refreshNav();
|
|
135
118
|
}
|
|
136
119
|
}, [navStructure, source]);
|
|
137
|
-
|
|
138
120
|
var scrollToTarget = function scrollToTarget(dataId) {
|
|
139
121
|
if (scrollTimeoutRef.current) {
|
|
140
122
|
clearTimeout(scrollTimeoutRef.current);
|
|
141
123
|
}
|
|
142
|
-
|
|
143
124
|
scrollTimeoutRef.current = setTimeout(function () {
|
|
144
125
|
var target = document.querySelector("[data-id=\"".concat(dataId, "\"]"));
|
|
145
|
-
|
|
146
126
|
if (target) {
|
|
147
127
|
target.scrollIntoView({
|
|
148
128
|
block: 'start',
|
|
@@ -151,7 +131,6 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
151
131
|
}
|
|
152
132
|
}, 0);
|
|
153
133
|
};
|
|
154
|
-
|
|
155
134
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
156
135
|
className: "markdown-navigation ".concat(className)
|
|
157
136
|
}, navStructure.map(function (t) {
|
|
@@ -160,14 +139,13 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
160
139
|
className: cls,
|
|
161
140
|
onClick: function onClick(evt) {
|
|
162
141
|
var currentHash = declarative ? "".concat(t.listNo, "-").concat(t.text) // 加入listNo确保hash唯一ZZ
|
|
163
|
-
: "heading-".concat(t.index);
|
|
164
|
-
|
|
142
|
+
: "heading-".concat(t.index);
|
|
143
|
+
// Avoid execution the callback `onHashChange` when clicking current nav item
|
|
165
144
|
if (t.listNo !== currentListNo) {
|
|
166
145
|
// Hash changing callback
|
|
167
146
|
onHashChange && onHashChange(currentHash, getCurrentHashValue());
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
147
|
+
}
|
|
148
|
+
// Nav item clicking callback
|
|
171
149
|
onNavItemClick && onNavItemClick(evt, evt.target, currentHash);
|
|
172
150
|
scrollToTarget(currentHash);
|
|
173
151
|
setCurrentListNo(t.listNo);
|
|
@@ -176,5 +154,4 @@ var MdNavbar = function MdNavbar(props) {
|
|
|
176
154
|
}, ordered ? /*#__PURE__*/React.createElement("small", null, t.listNo) : null, t.text);
|
|
177
155
|
})));
|
|
178
156
|
};
|
|
179
|
-
|
|
180
157
|
export default MdNavbar;
|
|
@@ -8,26 +8,22 @@ export var getCurrentHashValue = function getCurrentHashValue() {
|
|
|
8
8
|
};
|
|
9
9
|
export var trimArrZero = function trimArrZero(arr) {
|
|
10
10
|
var start, end;
|
|
11
|
-
|
|
12
11
|
for (start = 0; start < arr.length; start++) {
|
|
13
12
|
if (arr[start]) {
|
|
14
13
|
break;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
for (end = arr.length - 1; end >= 0; end--) {
|
|
19
17
|
if (arr[end]) {
|
|
20
18
|
break;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
return arr.slice(start, end + 1);
|
|
25
22
|
};
|
|
26
23
|
export var updateHash = function updateHash(updateHashTimeout, value) {
|
|
27
24
|
if (updateHashTimeout) {
|
|
28
25
|
clearTimeout(updateHashTimeout);
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
updateHashTimeout = setTimeout(function () {
|
|
32
28
|
window.history.replaceState({}, '', "".concat(window.location.pathname).concat(window.location.search, "#").concat(value));
|
|
33
29
|
}, 0);
|
package/es/comps/MdView/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["node", "inline", "className", "children"];
|
|
4
4
|
import React from "react";
|
|
5
|
-
|
|
6
5
|
/*
|
|
7
6
|
* @Author: wangxian
|
|
8
7
|
* @Date: 2022-09-02 16:17:38
|
|
@@ -16,12 +15,11 @@ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
|
16
15
|
import { oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
17
16
|
import './index.less';
|
|
18
17
|
import MdNavbar from '../MdNavbar';
|
|
19
|
-
|
|
20
18
|
var MdView = function MdView(props) {
|
|
21
19
|
var source = props.source,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
_props$isMarkNav = props.isMarkNav,
|
|
21
|
+
isMarkNav = _props$isMarkNav === void 0 ? false : _props$isMarkNav,
|
|
22
|
+
navOptions = props.navOptions;
|
|
25
23
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
26
24
|
className: "react-mark-down",
|
|
27
25
|
style: {
|
|
@@ -36,11 +34,10 @@ var MdView = function MdView(props) {
|
|
|
36
34
|
components: {
|
|
37
35
|
code: function code(_ref) {
|
|
38
36
|
var node = _ref.node,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
inline = _ref.inline,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
children = _ref.children,
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
44
41
|
var match = /language-(\w+)/.exec(className || 'javascript');
|
|
45
42
|
return !inline && match ? /*#__PURE__*/React.createElement(SyntaxHighlighter, _extends({
|
|
46
43
|
showLineNumbers: true,
|
|
@@ -66,5 +63,4 @@ var MdView = function MdView(props) {
|
|
|
66
63
|
ordered: true
|
|
67
64
|
}, navOptions)))));
|
|
68
65
|
};
|
|
69
|
-
|
|
70
66
|
export default MdView;
|