ronds-metadata 1.2.37 → 1.2.39
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -4,19 +4,17 @@
|
|
4
4
|
* @LastEditTime: 2023-04-03 09:30:52
|
5
5
|
*/
|
6
6
|
import React from 'react';
|
7
|
-
|
8
7
|
var useObservable = function useObservable(fn) {
|
9
8
|
var dep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
10
9
|
React.useEffect(function () {
|
11
10
|
var _dep$, _dep$2;
|
12
|
-
|
13
11
|
var subscription = dep[0] && ((_dep$ = dep[0]) === null || _dep$ === void 0 ? void 0 : _dep$.subscribe) && ((_dep$2 = dep[0]) === null || _dep$2 === void 0 ? void 0 : _dep$2.subscribe(function (p) {
|
14
12
|
fn(p);
|
15
13
|
}));
|
16
14
|
return function () {
|
17
|
-
subscription && subscription.unsubscribe();
|
15
|
+
subscription && subscription.unsubscribe();
|
16
|
+
// dep[0] && dep[0].complete();
|
18
17
|
};
|
19
18
|
}, dep);
|
20
19
|
};
|
21
|
-
|
22
20
|
export default useObservable;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
|
3
2
|
/*
|
4
3
|
* @Author: wangxian
|
5
4
|
* @Date: 2022-05-27 10:32:55
|
@@ -12,21 +11,17 @@ export var useObservableState = function useObservableState(source$, initialStat
|
|
12
11
|
if (typeof source$ === 'function') {
|
13
12
|
return source$();
|
14
13
|
}
|
15
|
-
|
16
14
|
return source$;
|
17
15
|
}, [source$]);
|
18
|
-
|
19
16
|
var _useState = useState(function () {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
setState = _useState2[1];
|
29
|
-
|
17
|
+
if (source instanceof BehaviorSubject) {
|
18
|
+
return source.getValue();
|
19
|
+
}
|
20
|
+
return initialState;
|
21
|
+
}),
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
23
|
+
state = _useState2[0],
|
24
|
+
setState = _useState2[1];
|
30
25
|
useEffect(function () {
|
31
26
|
if (source) {
|
32
27
|
var sub = source.subscribe(function (v) {
|
@@ -38,7 +33,6 @@ export var useObservableState = function useObservableState(source$, initialStat
|
|
38
33
|
sub.unsubscribe();
|
39
34
|
};
|
40
35
|
}
|
41
|
-
|
42
36
|
return function () {};
|
43
37
|
}, [source]);
|
44
38
|
return [state, setState];
|
package/es/index.d.ts
CHANGED
@@ -14,6 +14,7 @@ export { default as DynamicPorts } from './comps/DynamicPorts';
|
|
14
14
|
export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
|
15
15
|
export { default as Icon } from './comps/Icons';
|
16
16
|
export { default as Split } from './comps/Split';
|
17
|
+
export { default as MdEditPro } from './comps/MdEditPro';
|
17
18
|
export * from './framework/metadata/index';
|
18
19
|
export { default as http, addInterceptor } from './framework/http/index';
|
19
20
|
export { default as useMemoSubject } from './framework/rxjs-hooks/useMemoSubject';
|
package/es/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author:wangxian
|
3
3
|
* @Date: 2021-09-18 14:15:04
|
4
|
-
* @LastEditTime: 2023-04-
|
4
|
+
* @LastEditTime: 2023-04-27 19:08:54
|
5
5
|
*/
|
6
6
|
import './theme.less';
|
7
7
|
export { default as MetadataEdit } from './comps/MetadataEdit';
|
@@ -19,6 +19,7 @@ export { default as DynamicPorts } from './comps/DynamicPorts';
|
|
19
19
|
export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
|
20
20
|
export { default as Icon } from './comps/Icons';
|
21
21
|
export { default as Split } from './comps/Split';
|
22
|
+
export { default as MdEditPro } from './comps/MdEditPro';
|
22
23
|
export * from './framework/metadata/index';
|
23
24
|
export { default as http, addInterceptor } from './framework/http/index';
|
24
25
|
export { default as useMemoSubject } from './framework/rxjs-hooks/useMemoSubject';
|
package/es/utils.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
4
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
|
-
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
7
6
|
/*
|
8
7
|
* @Author: wangxian
|
9
8
|
* @Date: 2021-09-18 14:15:04
|
@@ -14,41 +13,36 @@ import { asBlob } from 'html-docx-js-typescript';
|
|
14
13
|
import MarkdownIt from 'markdown-it';
|
15
14
|
import { useCallback, useEffect, useRef } from 'react';
|
16
15
|
/** 防抖 */
|
17
|
-
|
18
16
|
export function useDebounce(fn, delay) {
|
19
17
|
var dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
20
|
-
|
21
18
|
var _useRef = useRef({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
fn: fn,
|
20
|
+
timer: null
|
21
|
+
}),
|
22
|
+
current = _useRef.current;
|
27
23
|
useEffect(function () {
|
28
24
|
current.fn = fn;
|
29
25
|
return function () {
|
30
26
|
if (current.timer) {
|
31
27
|
clearTimeout(current.timer);
|
32
28
|
}
|
33
|
-
};
|
29
|
+
};
|
30
|
+
// eslint-disable-next-line
|
34
31
|
}, [fn]);
|
35
32
|
return useCallback(function f() {
|
36
33
|
var _this = this;
|
37
|
-
|
38
34
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
39
35
|
args[_key] = arguments[_key];
|
40
36
|
}
|
41
|
-
|
42
37
|
if (current.timer) {
|
43
38
|
clearTimeout(current.timer);
|
44
39
|
}
|
45
|
-
|
46
40
|
current.timer = setTimeout(function () {
|
47
41
|
var _current$fn;
|
48
|
-
|
49
42
|
// @ts-ignore
|
50
43
|
(_current$fn = current.fn).call.apply(_current$fn, [_this].concat(args));
|
51
|
-
}, delay);
|
44
|
+
}, delay);
|
45
|
+
// eslint-disable-next-line
|
52
46
|
}, dep);
|
53
47
|
}
|
54
48
|
/**
|
@@ -60,34 +54,30 @@ export function useDebounce(fn, delay) {
|
|
60
54
|
* @param {DependencyList} [dep=[]]
|
61
55
|
* @returns
|
62
56
|
*/
|
63
|
-
|
64
57
|
export function useThrottle(fn, delay) {
|
65
58
|
var dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
66
|
-
|
67
59
|
var _useRef2 = useRef({
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
60
|
+
fn: fn,
|
61
|
+
timer: null
|
62
|
+
}),
|
63
|
+
current = _useRef2.current;
|
73
64
|
useEffect(function () {
|
74
|
-
current.fn = fn;
|
65
|
+
current.fn = fn;
|
66
|
+
// eslint-disable-next-line
|
75
67
|
}, [fn]);
|
76
68
|
return useCallback(function f() {
|
77
69
|
if (!current.timer) {
|
78
70
|
var _current$fn2;
|
79
|
-
|
80
71
|
current.timer = setTimeout(function () {
|
81
72
|
delete current.timer;
|
82
|
-
}, delay);
|
83
|
-
|
73
|
+
}, delay);
|
74
|
+
// @ts-ignore
|
84
75
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
85
76
|
args[_key2] = arguments[_key2];
|
86
77
|
}
|
87
|
-
|
88
78
|
(_current$fn2 = current.fn).call.apply(_current$fn2, [this].concat(args));
|
89
|
-
}
|
90
|
-
|
79
|
+
}
|
80
|
+
// eslint-disable-next-line
|
91
81
|
}, dep);
|
92
82
|
}
|
93
83
|
export function deepClone(target) {
|
@@ -95,46 +85,36 @@ export function deepClone(target) {
|
|
95
85
|
}
|
96
86
|
export function guid() {
|
97
87
|
var id = '',
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
i,
|
89
|
+
random,
|
90
|
+
chars = 'abcdef';
|
101
91
|
id += chars[Math.floor(Math.random() * Math.floor(chars.length))];
|
102
|
-
|
103
92
|
for (i = 1; i < 32; i++) {
|
104
93
|
random = Math.random() * 16 | 0;
|
105
|
-
|
106
94
|
if (i == 8 || i == 12 || i == 16 || i == 20) {
|
107
95
|
id += '-';
|
108
96
|
}
|
109
|
-
|
110
97
|
id += (i == 12 ? 4 : i == 16 ? random & 3 | 8 : random).toString(16);
|
111
98
|
}
|
112
|
-
|
113
99
|
return id;
|
114
100
|
}
|
115
|
-
|
116
101
|
var crypto = require('crypto');
|
117
|
-
|
118
102
|
export var md5 = function md5(data) {
|
119
103
|
var digest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hex';
|
120
104
|
return crypto.createHash('md5').update(data).digest(digest || 'base64');
|
121
105
|
};
|
122
106
|
export function arrayMoveMutable(array, fromIndex, toIndex) {
|
123
107
|
var startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;
|
124
|
-
|
125
108
|
if (startIndex >= 0 && startIndex < array.length) {
|
126
109
|
var endIndex = toIndex < 0 ? array.length + toIndex : toIndex;
|
127
|
-
|
128
110
|
var _array$splice = array.splice(fromIndex, 1),
|
129
|
-
|
130
|
-
|
131
|
-
|
111
|
+
_array$splice2 = _slicedToArray(_array$splice, 1),
|
112
|
+
item = _array$splice2[0];
|
132
113
|
array.splice(endIndex, 0, item);
|
133
114
|
}
|
134
115
|
}
|
135
116
|
export function arrayMoveImmutable(array, fromIndex, toIndex) {
|
136
117
|
var newArray = _toConsumableArray(array);
|
137
|
-
|
138
118
|
arrayMoveMutable(newArray, fromIndex, toIndex);
|
139
119
|
return newArray;
|
140
120
|
}
|
@@ -148,28 +128,22 @@ export function arrayInsert(array, index, item) {
|
|
148
128
|
* @param key 指定的数值
|
149
129
|
* @returns {string|string|string}
|
150
130
|
*/
|
151
|
-
|
152
131
|
export function getConstantValue(array, key, strKey, strValue) {
|
153
132
|
var result = '';
|
154
133
|
var _strKey = 'id';
|
155
134
|
var _strValue = 'value';
|
156
|
-
|
157
135
|
if (strKey) {
|
158
136
|
_strKey = strKey;
|
159
137
|
}
|
160
|
-
|
161
138
|
if (strValue) {
|
162
139
|
_strValue = strValue;
|
163
140
|
}
|
164
|
-
|
165
141
|
if (array) {
|
166
142
|
var _iterator = _createForOfIteratorHelper(array),
|
167
|
-
|
168
|
-
|
143
|
+
_step;
|
169
144
|
try {
|
170
145
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
171
146
|
var item = _step.value;
|
172
|
-
|
173
147
|
if (key === item[_strKey]) {
|
174
148
|
result = item[_strValue];
|
175
149
|
}
|
@@ -180,7 +154,6 @@ export function getConstantValue(array, key, strKey, strValue) {
|
|
180
154
|
_iterator.f();
|
181
155
|
}
|
182
156
|
}
|
183
|
-
|
184
157
|
return result;
|
185
158
|
}
|
186
159
|
/**
|
@@ -188,58 +161,46 @@ export function getConstantValue(array, key, strKey, strValue) {
|
|
188
161
|
* @param mdText string
|
189
162
|
* @param fileName string
|
190
163
|
*/
|
191
|
-
|
192
164
|
export function handleMd2Doc(_x, _x2) {
|
193
165
|
return _handleMd2Doc.apply(this, arguments);
|
194
166
|
}
|
195
|
-
|
196
167
|
function _handleMd2Doc() {
|
197
168
|
_handleMd2Doc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mdText, fileName) {
|
198
169
|
var md, html, opt, blob;
|
199
170
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
200
|
-
while (1) {
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
return asBlob(html, opt);
|
234
|
-
|
235
|
-
case 6:
|
236
|
-
blob = _context.sent;
|
237
|
-
saveAs(blob, "".concat(fileName, ".doc"));
|
238
|
-
|
239
|
-
case 8:
|
240
|
-
case "end":
|
241
|
-
return _context.stop();
|
242
|
-
}
|
171
|
+
while (1) switch (_context.prev = _context.next) {
|
172
|
+
case 0:
|
173
|
+
md = new MarkdownIt();
|
174
|
+
md.renderer.rules.image = function (tokens, index, options, env, self) {
|
175
|
+
var token = tokens[index];
|
176
|
+
if (!token || !token.attrGet('src')) {
|
177
|
+
// 如果 token 不存在,或者缺少必要的属性,则直接返回空字符串
|
178
|
+
return '';
|
179
|
+
}
|
180
|
+
var src = token.attrGet('src');
|
181
|
+
var width = '900'; // 自定义宽度
|
182
|
+
var height = 'auto'; // 自适应高度
|
183
|
+
// 添加自定义宽高属性
|
184
|
+
token.attrSet('width', width);
|
185
|
+
token.attrSet('height', height);
|
186
|
+
// 渲染图片标签
|
187
|
+
return self.renderToken(tokens, index, options);
|
188
|
+
};
|
189
|
+
html = md.render(mdText);
|
190
|
+
opt = {
|
191
|
+
margin: {
|
192
|
+
top: 100
|
193
|
+
},
|
194
|
+
orientation: 'landscape'
|
195
|
+
};
|
196
|
+
_context.next = 6;
|
197
|
+
return asBlob(html, opt);
|
198
|
+
case 6:
|
199
|
+
blob = _context.sent;
|
200
|
+
saveAs(blob, "".concat(fileName, ".doc"));
|
201
|
+
case 8:
|
202
|
+
case "end":
|
203
|
+
return _context.stop();
|
243
204
|
}
|
244
205
|
}, _callee);
|
245
206
|
}));
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"public": true,
|
3
3
|
"name": "ronds-metadata",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.39",
|
5
5
|
"scripts": {
|
6
6
|
"start": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -68,6 +68,7 @@
|
|
68
68
|
"react-syntax-highlighter": "^15.5.0",
|
69
69
|
"rehype-raw": "^6.1.1",
|
70
70
|
"remark-gfm": "^3.0.1",
|
71
|
+
"ronds-react-markdown": "^1.0.12",
|
71
72
|
"rxjs": "^7.5.4",
|
72
73
|
"xlsx": "^0.18.5"
|
73
74
|
},
|
@@ -91,6 +92,7 @@
|
|
91
92
|
"css-loader": "^4.2.2",
|
92
93
|
"dumi": "^1.0.16",
|
93
94
|
"father-build": "^1.17.2",
|
95
|
+
"file-loader": "^6.2.0",
|
94
96
|
"gh-pages": "^3.0.0",
|
95
97
|
"less-loader": "^7.0.0",
|
96
98
|
"lint-staged": "^10.0.7",
|
@@ -99,4 +101,4 @@
|
|
99
101
|
"webpack-cli": "^3.3.12",
|
100
102
|
"yorkie": "^2.0.0"
|
101
103
|
}
|
102
|
-
}
|
104
|
+
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import MarkdownIt from 'markdown-it';
|
3
|
-
import React from 'react';
|
4
|
-
import ContentEditable from 'react-contenteditable';
|
5
|
-
|
6
|
-
var EditContent = function EditContent(props) {
|
7
|
-
var source = props.source;
|
8
|
-
|
9
|
-
var _React$useState = React.useState(),
|
10
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
11
|
-
html = _React$useState2[0],
|
12
|
-
setHtml = _React$useState2[1];
|
13
|
-
|
14
|
-
React.useEffect(function () {
|
15
|
-
var md = new MarkdownIt();
|
16
|
-
|
17
|
-
var _html = md.render(source);
|
18
|
-
|
19
|
-
setHtml(_html);
|
20
|
-
}, [source]);
|
21
|
-
return /*#__PURE__*/React.createElement(ContentEditable, {
|
22
|
-
className: "editable",
|
23
|
-
tagName: "pre",
|
24
|
-
html: html // innerHTML of the editable div
|
25
|
-
,
|
26
|
-
disabled: false // use true to disable edition
|
27
|
-
,
|
28
|
-
onChange: function onChange() {} // handle innerHTML change
|
29
|
-
,
|
30
|
-
onBlur: function onBlur() {}
|
31
|
-
});
|
32
|
-
};
|
33
|
-
|
34
|
-
export default EditContent;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import "antd/es/button/style";
|
2
|
-
import _Button from "antd/es/button";
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
-
|
5
|
-
/*
|
6
|
-
* @Author: uloveits 719310130@qq.com
|
7
|
-
* @Date: 2023-04-12 13:36:01
|
8
|
-
* @LastEditors: uloveits 719310130@qq.com
|
9
|
-
* @LastEditTime: 2023-04-12 16:19:09
|
10
|
-
*/
|
11
|
-
import React from 'react';
|
12
|
-
import { BookOutlined } from '@ant-design/icons';
|
13
|
-
|
14
|
-
var Mark = function Mark(props) {
|
15
|
-
var _React$useState = React.useState([]),
|
16
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
17
|
-
images = _React$useState2[0],
|
18
|
-
setImages = _React$useState2[1];
|
19
|
-
|
20
|
-
var onChange = function onChange(mdString) {
|
21
|
-
getImages(mdString);
|
22
|
-
};
|
23
|
-
|
24
|
-
var getImages = function getImages(mdString) {
|
25
|
-
var regex = /\!\[.*\]\((.*?)\)/g;
|
26
|
-
var _images = [];
|
27
|
-
var match;
|
28
|
-
|
29
|
-
while ((match = regex.exec(mdString)) !== null) {
|
30
|
-
_images.push(match[1]);
|
31
|
-
}
|
32
|
-
|
33
|
-
setImages([].concat(_images));
|
34
|
-
};
|
35
|
-
|
36
|
-
React.useEffect(function () {
|
37
|
-
var mdString = props.editor.getMdValue();
|
38
|
-
getImages(mdString);
|
39
|
-
props.editor.on('change', onChange);
|
40
|
-
}, []);
|
41
|
-
|
42
|
-
var handleClick = function handleClick() {// 调用API,往编辑器中插入一个数字
|
43
|
-
// props.editor.insertText(num.toString());
|
44
|
-
// // 更新一下自身的state
|
45
|
-
// setNum(num + 1);
|
46
|
-
};
|
47
|
-
|
48
|
-
return /*#__PURE__*/React.createElement(_Button, {
|
49
|
-
size: "small",
|
50
|
-
disabled: images.length === 0,
|
51
|
-
type: "link",
|
52
|
-
icon: /*#__PURE__*/React.createElement(BookOutlined, null),
|
53
|
-
onClick: handleClick
|
54
|
-
});
|
55
|
-
};
|
56
|
-
|
57
|
-
export default Mark; // 如果需要的话,可以在这里定义默认选项
|
58
|
-
|
59
|
-
Mark.align = 'left';
|
60
|
-
Mark.pluginName = 'mark';
|