@ctzhian/tiptap 1.8.2-beta.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/demo.js +69 -14
- package/dist/extension/component/Audio/Insert.d.ts +1 -1
- package/dist/extension/component/Audio/Insert.js +51 -14
- package/dist/extension/component/Audio/index.js +91 -56
- package/dist/extension/component/Iframe/Insert.d.ts +1 -1
- package/dist/extension/component/Iframe/Insert.js +50 -10
- package/dist/extension/component/Iframe/index.js +51 -12
- package/dist/extension/component/Image/Insert.d.ts +1 -1
- package/dist/extension/component/Image/Insert.js +25 -6
- package/dist/extension/component/Image/index.js +55 -14
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/component/Video/Insert.d.ts +1 -1
- package/dist/extension/component/Video/Insert.js +51 -14
- package/dist/extension/component/Video/index.js +4 -2
- package/dist/extension/index.d.ts +1 -1
- package/dist/extension/index.js +10 -5
- package/dist/extension/node/Audio.js +2 -1
- package/dist/extension/node/FileHandler.d.ts +1 -1
- package/dist/extension/node/Iframe.js +2 -1
- package/dist/extension/node/Image.js +2 -1
- package/dist/extension/node/Table.d.ts +1 -1
- package/dist/extension/node/Video.js +2 -1
- package/dist/hook/index.d.ts +1 -1
- package/dist/hook/index.js +4 -2
- package/dist/type/index.d.ts +2 -0
- package/package.json +32 -32
package/dist/Editor/demo.js
CHANGED
|
@@ -12,6 +12,61 @@ var Reader = function Reader() {
|
|
|
12
12
|
editable: true,
|
|
13
13
|
contentType: isMarkdown ? 'markdown' : 'html',
|
|
14
14
|
exclude: ['invisibleCharacters'],
|
|
15
|
+
onError: function onError(error) {
|
|
16
|
+
console.error('Editor Error:', error);
|
|
17
|
+
alert(error.message);
|
|
18
|
+
},
|
|
19
|
+
onValidateUrl: function () {
|
|
20
|
+
var _onValidateUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, type) {
|
|
21
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
console.log("\u9A8C\u8BC1 ".concat(type, " \u94FE\u63A5:"), url);
|
|
25
|
+
|
|
26
|
+
// 拦截 base64 链接
|
|
27
|
+
if (!url.startsWith('data:')) {
|
|
28
|
+
_context.next = 3;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
throw new Error("\u4E0D\u652F\u6301 base64 \u94FE\u63A5\uFF0C\u8BF7\u4F7F\u7528\u53EF\u8BBF\u95EE\u7684 ".concat(type, " URL"));
|
|
32
|
+
case 3:
|
|
33
|
+
_context.t0 = type;
|
|
34
|
+
_context.next = _context.t0 === 'image' ? 6 : _context.t0 === 'video' ? 8 : _context.t0 === 'audio' ? 10 : _context.t0 === 'iframe' ? 12 : 14;
|
|
35
|
+
break;
|
|
36
|
+
case 6:
|
|
37
|
+
if (!url.match(/\.(jpg|jpeg|png|gif|webp|svg)(\?.*)?$/i)) {
|
|
38
|
+
console.warn('图片链接可能不是有效的图片格式');
|
|
39
|
+
}
|
|
40
|
+
return _context.abrupt("break", 14);
|
|
41
|
+
case 8:
|
|
42
|
+
if (!url.match(/\.(mp4|webm|ogg|mov|avi|wmv|flv|mkv)(\?.*)?$/i)) {
|
|
43
|
+
console.warn('视频链接可能不是有效的视频格式');
|
|
44
|
+
}
|
|
45
|
+
return _context.abrupt("break", 14);
|
|
46
|
+
case 10:
|
|
47
|
+
if (!url.match(/\.(mp3|wav|ogg|m4a|flac|aac|wma)(\?.*)?$/i)) {
|
|
48
|
+
console.warn('音频链接可能不是有效的音频格式');
|
|
49
|
+
}
|
|
50
|
+
return _context.abrupt("break", 14);
|
|
51
|
+
case 12:
|
|
52
|
+
// iframe 可以嵌入任何 URL,但可以检查是否是 HTTPS
|
|
53
|
+
if (url.startsWith('http://') && !url.includes('localhost')) {
|
|
54
|
+
console.warn('建议使用 HTTPS 链接以确保安全性');
|
|
55
|
+
}
|
|
56
|
+
return _context.abrupt("break", 14);
|
|
57
|
+
case 14:
|
|
58
|
+
return _context.abrupt("return", url);
|
|
59
|
+
case 15:
|
|
60
|
+
case "end":
|
|
61
|
+
return _context.stop();
|
|
62
|
+
}
|
|
63
|
+
}, _callee);
|
|
64
|
+
}));
|
|
65
|
+
function onValidateUrl(_x, _x2) {
|
|
66
|
+
return _onValidateUrl.apply(this, arguments);
|
|
67
|
+
}
|
|
68
|
+
return onValidateUrl;
|
|
69
|
+
}(),
|
|
15
70
|
onSave: function onSave(editor) {
|
|
16
71
|
var value = isMarkdown ? editor.getMarkdown() : editor.getHTML();
|
|
17
72
|
console.log(value);
|
|
@@ -20,23 +75,23 @@ var Reader = function Reader() {
|
|
|
20
75
|
}).run();
|
|
21
76
|
},
|
|
22
77
|
onAiWritingGetSuggestion: function () {
|
|
23
|
-
var _onAiWritingGetSuggestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
78
|
+
var _onAiWritingGetSuggestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
24
79
|
var prefix, suffix;
|
|
25
|
-
return _regeneratorRuntime().wrap(function
|
|
26
|
-
while (1) switch (
|
|
80
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
81
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
27
82
|
case 0:
|
|
28
83
|
prefix = _ref.prefix, suffix = _ref.suffix;
|
|
29
84
|
console.log('onAiWritingGetSuggestion', prefix, suffix);
|
|
30
|
-
return
|
|
85
|
+
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
31
86
|
resolve(['this is a default suggestion.', 'we are good.', 'what is your name?', 'how are you?', 'what is your favorite color?', 'what is your favorite food?', 'what is your favorite animal?', 'what is your favorite book?', 'what is your favorite movie?', 'what is your favorite song?', 'what is your favorite artist?', 'what is your favorite band?', 'what is your favorite city?', 'what is your favorite country?', 'what is your favorite sport?'][Math.floor(Math.random() * 10)]);
|
|
32
87
|
}));
|
|
33
88
|
case 3:
|
|
34
89
|
case "end":
|
|
35
|
-
return
|
|
90
|
+
return _context2.stop();
|
|
36
91
|
}
|
|
37
|
-
},
|
|
92
|
+
}, _callee2);
|
|
38
93
|
}));
|
|
39
|
-
function onAiWritingGetSuggestion(
|
|
94
|
+
function onAiWritingGetSuggestion(_x3) {
|
|
40
95
|
return _onAiWritingGetSuggestion.apply(this, arguments);
|
|
41
96
|
}
|
|
42
97
|
return onAiWritingGetSuggestion;
|
|
@@ -62,11 +117,11 @@ var Reader = function Reader() {
|
|
|
62
117
|
// })
|
|
63
118
|
// },
|
|
64
119
|
onUpload: function () {
|
|
65
|
-
var _onUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
66
|
-
return _regeneratorRuntime().wrap(function
|
|
67
|
-
while (1) switch (
|
|
120
|
+
var _onUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file, onProgress) {
|
|
121
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
122
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
68
123
|
case 0:
|
|
69
|
-
return
|
|
124
|
+
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
70
125
|
var progress = 0;
|
|
71
126
|
var interval = setInterval(function () {
|
|
72
127
|
progress += Math.random() * 20;
|
|
@@ -94,11 +149,11 @@ var Reader = function Reader() {
|
|
|
94
149
|
}));
|
|
95
150
|
case 1:
|
|
96
151
|
case "end":
|
|
97
|
-
return
|
|
152
|
+
return _context3.stop();
|
|
98
153
|
}
|
|
99
|
-
},
|
|
154
|
+
}, _callee3);
|
|
100
155
|
}));
|
|
101
|
-
function onUpload(
|
|
156
|
+
function onUpload(_x4, _x5) {
|
|
102
157
|
return _onUpload.apply(this, arguments);
|
|
103
158
|
}
|
|
104
159
|
return onUpload;
|
|
@@ -6,5 +6,5 @@ type InsertAudioProps = {
|
|
|
6
6
|
attrs: AudioAttributes;
|
|
7
7
|
updateAttributes: (attrs: AudioAttributes) => void;
|
|
8
8
|
} & EditorFnProps;
|
|
9
|
-
declare const InsertAudio: ({ selected, attrs, updateAttributes, onUpload, onError }: InsertAudioProps) => React.JSX.Element;
|
|
9
|
+
declare const InsertAudio: ({ selected, attrs, updateAttributes, onUpload, onError, onValidateUrl }: InsertAudioProps) => React.JSX.Element;
|
|
10
10
|
export default InsertAudio;
|
|
@@ -23,7 +23,8 @@ var InsertAudio = function InsertAudio(_ref) {
|
|
|
23
23
|
attrs = _ref.attrs,
|
|
24
24
|
updateAttributes = _ref.updateAttributes,
|
|
25
25
|
onUpload = _ref.onUpload,
|
|
26
|
-
onError = _ref.onError
|
|
26
|
+
onError = _ref.onError,
|
|
27
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
27
28
|
var _useState = useState(attrs.src || ''),
|
|
28
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
30
|
editSrc = _useState2[0],
|
|
@@ -167,19 +168,55 @@ var InsertAudio = function InsertAudio(_ref) {
|
|
|
167
168
|
return _ref3.apply(this, arguments);
|
|
168
169
|
};
|
|
169
170
|
}();
|
|
170
|
-
var handleInsertWithPoster = function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
var handleInsertWithPoster = /*#__PURE__*/function () {
|
|
172
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
173
|
+
var validatedSrc;
|
|
174
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
175
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
if (editSrc.trim()) {
|
|
178
|
+
_context3.next = 2;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
return _context3.abrupt("return");
|
|
182
|
+
case 2:
|
|
183
|
+
_context3.prev = 2;
|
|
184
|
+
validatedSrc = editSrc.trim();
|
|
185
|
+
if (!onValidateUrl) {
|
|
186
|
+
_context3.next = 8;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
_context3.next = 7;
|
|
190
|
+
return Promise.resolve(onValidateUrl(validatedSrc, 'audio'));
|
|
191
|
+
case 7:
|
|
192
|
+
validatedSrc = _context3.sent;
|
|
193
|
+
case 8:
|
|
194
|
+
updateAttributes({
|
|
195
|
+
src: validatedSrc,
|
|
196
|
+
title: editTitle.trim() || undefined,
|
|
197
|
+
poster: editPoster.trim() || undefined,
|
|
198
|
+
controls: attrs.controls,
|
|
199
|
+
autoplay: attrs.autoplay,
|
|
200
|
+
loop: attrs.loop,
|
|
201
|
+
muted: attrs.muted
|
|
202
|
+
});
|
|
203
|
+
handleClosePopover();
|
|
204
|
+
_context3.next = 15;
|
|
205
|
+
break;
|
|
206
|
+
case 12:
|
|
207
|
+
_context3.prev = 12;
|
|
208
|
+
_context3.t0 = _context3["catch"](2);
|
|
209
|
+
onError === null || onError === void 0 || onError(_context3.t0);
|
|
210
|
+
case 15:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context3.stop();
|
|
213
|
+
}
|
|
214
|
+
}, _callee3, null, [[2, 12]]);
|
|
215
|
+
}));
|
|
216
|
+
return function handleInsertWithPoster() {
|
|
217
|
+
return _ref4.apply(this, arguments);
|
|
218
|
+
};
|
|
219
|
+
}();
|
|
183
220
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
184
221
|
className: "audio-wrapper",
|
|
185
222
|
"data-drag-handle": true
|
|
@@ -25,7 +25,8 @@ var EditAudioDialog = function EditAudioDialog(_ref) {
|
|
|
25
25
|
var attrs = _ref.attrs,
|
|
26
26
|
onSave = _ref.onSave,
|
|
27
27
|
onUpload = _ref.onUpload,
|
|
28
|
-
onError = _ref.onError
|
|
28
|
+
onError = _ref.onError,
|
|
29
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
29
30
|
var _useState = useState(attrs.src),
|
|
30
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
32
|
src = _useState2[0],
|
|
@@ -46,13 +47,44 @@ var EditAudioDialog = function EditAudioDialog(_ref) {
|
|
|
46
47
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47
48
|
uploading = _useState10[0],
|
|
48
49
|
setUploading = _useState10[1];
|
|
49
|
-
var handleSave = function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
var handleSave = /*#__PURE__*/function () {
|
|
51
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
52
|
+
var validatedSrc;
|
|
53
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
54
|
+
while (1) switch (_context.prev = _context.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
_context.prev = 0;
|
|
57
|
+
validatedSrc = src;
|
|
58
|
+
if (!(onValidateUrl && src.trim())) {
|
|
59
|
+
_context.next = 6;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
_context.next = 5;
|
|
63
|
+
return Promise.resolve(onValidateUrl(src.trim(), 'audio'));
|
|
64
|
+
case 5:
|
|
65
|
+
validatedSrc = _context.sent;
|
|
66
|
+
case 6:
|
|
67
|
+
onSave({
|
|
68
|
+
src: validatedSrc,
|
|
69
|
+
title: title,
|
|
70
|
+
poster: poster
|
|
71
|
+
});
|
|
72
|
+
_context.next = 12;
|
|
73
|
+
break;
|
|
74
|
+
case 9:
|
|
75
|
+
_context.prev = 9;
|
|
76
|
+
_context.t0 = _context["catch"](0);
|
|
77
|
+
onError === null || onError === void 0 || onError(_context.t0);
|
|
78
|
+
case 12:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context.stop();
|
|
81
|
+
}
|
|
82
|
+
}, _callee, null, [[0, 9]]);
|
|
83
|
+
}));
|
|
84
|
+
return function handleSave() {
|
|
85
|
+
return _ref2.apply(this, arguments);
|
|
86
|
+
};
|
|
87
|
+
}();
|
|
56
88
|
var handleSelectAudio = function handleSelectAudio() {
|
|
57
89
|
var uploadId = document.getElementById('audioUploadInput');
|
|
58
90
|
if (uploadId) {
|
|
@@ -66,86 +98,86 @@ var EditAudioDialog = function EditAudioDialog(_ref) {
|
|
|
66
98
|
}
|
|
67
99
|
};
|
|
68
100
|
var handleUploadPoster = /*#__PURE__*/function () {
|
|
69
|
-
var
|
|
101
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
70
102
|
var _event$target$files;
|
|
71
|
-
var file,
|
|
72
|
-
return _regeneratorRuntime().wrap(function
|
|
73
|
-
while (1) switch (
|
|
103
|
+
var file, _url;
|
|
104
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
105
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
74
106
|
case 0:
|
|
75
107
|
file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
|
|
76
108
|
if (!file) {
|
|
77
|
-
|
|
109
|
+
_context2.next = 16;
|
|
78
110
|
break;
|
|
79
111
|
}
|
|
80
112
|
setUploadingPoster(true);
|
|
81
|
-
|
|
82
|
-
|
|
113
|
+
_context2.prev = 3;
|
|
114
|
+
_context2.next = 6;
|
|
83
115
|
return onUpload === null || onUpload === void 0 ? void 0 : onUpload(file);
|
|
84
116
|
case 6:
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
setPoster(
|
|
117
|
+
_url = _context2.sent;
|
|
118
|
+
if (_url) {
|
|
119
|
+
setPoster(_url);
|
|
88
120
|
}
|
|
89
|
-
|
|
121
|
+
_context2.next = 13;
|
|
90
122
|
break;
|
|
91
123
|
case 10:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onError === null || onError === void 0 || onError(
|
|
124
|
+
_context2.prev = 10;
|
|
125
|
+
_context2.t0 = _context2["catch"](3);
|
|
126
|
+
onError === null || onError === void 0 || onError(_context2.t0);
|
|
95
127
|
case 13:
|
|
96
|
-
|
|
128
|
+
_context2.prev = 13;
|
|
97
129
|
setUploadingPoster(false);
|
|
98
|
-
return
|
|
130
|
+
return _context2.finish(13);
|
|
99
131
|
case 16:
|
|
100
132
|
case "end":
|
|
101
|
-
return
|
|
133
|
+
return _context2.stop();
|
|
102
134
|
}
|
|
103
|
-
},
|
|
135
|
+
}, _callee2, null, [[3, 10, 13, 16]]);
|
|
104
136
|
}));
|
|
105
137
|
return function handleUploadPoster(_x) {
|
|
106
|
-
return
|
|
138
|
+
return _ref3.apply(this, arguments);
|
|
107
139
|
};
|
|
108
140
|
}();
|
|
109
141
|
var handleAudioUpload = /*#__PURE__*/function () {
|
|
110
|
-
var
|
|
142
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {
|
|
111
143
|
var _event$target$files2;
|
|
112
|
-
var file,
|
|
113
|
-
return _regeneratorRuntime().wrap(function
|
|
114
|
-
while (1) switch (
|
|
144
|
+
var file, _url2;
|
|
145
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
146
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
115
147
|
case 0:
|
|
116
148
|
file = (_event$target$files2 = event.target.files) === null || _event$target$files2 === void 0 ? void 0 : _event$target$files2[0];
|
|
117
149
|
if (!file) {
|
|
118
|
-
|
|
150
|
+
_context3.next = 16;
|
|
119
151
|
break;
|
|
120
152
|
}
|
|
121
153
|
setUploading(true);
|
|
122
|
-
|
|
123
|
-
|
|
154
|
+
_context3.prev = 3;
|
|
155
|
+
_context3.next = 6;
|
|
124
156
|
return onUpload === null || onUpload === void 0 ? void 0 : onUpload(file);
|
|
125
157
|
case 6:
|
|
126
|
-
|
|
127
|
-
if (
|
|
158
|
+
_url2 = _context3.sent;
|
|
159
|
+
if (_url2) {
|
|
128
160
|
setTitle(file.name);
|
|
129
|
-
setSrc(
|
|
161
|
+
setSrc(_url2);
|
|
130
162
|
}
|
|
131
|
-
|
|
163
|
+
_context3.next = 13;
|
|
132
164
|
break;
|
|
133
165
|
case 10:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
onError === null || onError === void 0 || onError(
|
|
166
|
+
_context3.prev = 10;
|
|
167
|
+
_context3.t0 = _context3["catch"](3);
|
|
168
|
+
onError === null || onError === void 0 || onError(_context3.t0);
|
|
137
169
|
case 13:
|
|
138
|
-
|
|
170
|
+
_context3.prev = 13;
|
|
139
171
|
setUploading(false);
|
|
140
|
-
return
|
|
172
|
+
return _context3.finish(13);
|
|
141
173
|
case 16:
|
|
142
174
|
case "end":
|
|
143
|
-
return
|
|
175
|
+
return _context3.stop();
|
|
144
176
|
}
|
|
145
|
-
},
|
|
177
|
+
}, _callee3, null, [[3, 10, 13, 16]]);
|
|
146
178
|
}));
|
|
147
179
|
return function handleAudioUpload(_x2) {
|
|
148
|
-
return
|
|
180
|
+
return _ref4.apply(this, arguments);
|
|
149
181
|
};
|
|
150
182
|
}();
|
|
151
183
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -227,14 +259,15 @@ var EditAudioDialog = function EditAudioDialog(_ref) {
|
|
|
227
259
|
onClick: handleSave
|
|
228
260
|
}, "\u5D4C\u5165\u97F3\u9891"));
|
|
229
261
|
};
|
|
230
|
-
var AudioViewWrapper = function AudioViewWrapper(
|
|
231
|
-
var editor =
|
|
232
|
-
node =
|
|
233
|
-
updateAttributes =
|
|
234
|
-
deleteNode =
|
|
235
|
-
selected =
|
|
236
|
-
onUpload =
|
|
237
|
-
_onError =
|
|
262
|
+
var AudioViewWrapper = function AudioViewWrapper(_ref5) {
|
|
263
|
+
var editor = _ref5.editor,
|
|
264
|
+
node = _ref5.node,
|
|
265
|
+
updateAttributes = _ref5.updateAttributes,
|
|
266
|
+
deleteNode = _ref5.deleteNode,
|
|
267
|
+
selected = _ref5.selected,
|
|
268
|
+
onUpload = _ref5.onUpload,
|
|
269
|
+
_onError = _ref5.onError,
|
|
270
|
+
onValidateUrl = _ref5.onValidateUrl;
|
|
238
271
|
var attrs = node.attrs;
|
|
239
272
|
var audioRef = useRef(null);
|
|
240
273
|
var _useState11 = useState(false),
|
|
@@ -425,7 +458,8 @@ var AudioViewWrapper = function AudioViewWrapper(_ref4) {
|
|
|
425
458
|
attrs: attrs,
|
|
426
459
|
updateAttributes: updateAttributes,
|
|
427
460
|
onUpload: onUpload,
|
|
428
|
-
onError: _onError
|
|
461
|
+
onError: _onError,
|
|
462
|
+
onValidateUrl: onValidateUrl
|
|
429
463
|
});
|
|
430
464
|
}
|
|
431
465
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
@@ -700,7 +734,8 @@ var AudioViewWrapper = function AudioViewWrapper(_ref4) {
|
|
|
700
734
|
attrs: attrs,
|
|
701
735
|
onSave: updateAudioSource,
|
|
702
736
|
onUpload: onUpload,
|
|
703
|
-
onError: _onError
|
|
737
|
+
onError: _onError,
|
|
738
|
+
onValidateUrl: onValidateUrl
|
|
704
739
|
})), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
705
740
|
open: Boolean(anchorElSpeed),
|
|
706
741
|
anchorEl: anchorElSpeed,
|
|
@@ -10,5 +10,5 @@ type InsertIframeProps = {
|
|
|
10
10
|
attrs: IframeAttributes;
|
|
11
11
|
updateAttributes: (attrs: IframeAttributes) => void;
|
|
12
12
|
} & EditorFnProps;
|
|
13
|
-
declare const InsertIframe: ({ selected, attrs, updateAttributes }: InsertIframeProps) => React.JSX.Element;
|
|
13
|
+
declare const InsertIframe: ({ selected, attrs, updateAttributes, onValidateUrl }: InsertIframeProps) => React.JSX.Element;
|
|
14
14
|
export default InsertIframe;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -12,7 +16,8 @@ import React, { useState } from "react";
|
|
|
12
16
|
var InsertIframe = function InsertIframe(_ref) {
|
|
13
17
|
var selected = _ref.selected,
|
|
14
18
|
attrs = _ref.attrs,
|
|
15
|
-
updateAttributes = _ref.updateAttributes
|
|
19
|
+
updateAttributes = _ref.updateAttributes,
|
|
20
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
16
21
|
var _useState = useState(attrs.src || ''),
|
|
17
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
23
|
editUrl = _useState2[0],
|
|
@@ -27,15 +32,50 @@ var InsertIframe = function InsertIframe(_ref) {
|
|
|
27
32
|
var handleClosePopover = function handleClosePopover() {
|
|
28
33
|
return setAnchorEl(null);
|
|
29
34
|
};
|
|
30
|
-
var handleInsert = function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
var handleInsert = /*#__PURE__*/function () {
|
|
36
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
37
|
+
var validatedUrl;
|
|
38
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
if (editUrl.trim()) {
|
|
42
|
+
_context.next = 2;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return _context.abrupt("return");
|
|
46
|
+
case 2:
|
|
47
|
+
_context.prev = 2;
|
|
48
|
+
validatedUrl = editUrl.trim();
|
|
49
|
+
if (!onValidateUrl) {
|
|
50
|
+
_context.next = 8;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
_context.next = 7;
|
|
54
|
+
return Promise.resolve(onValidateUrl(validatedUrl, 'iframe'));
|
|
55
|
+
case 7:
|
|
56
|
+
validatedUrl = _context.sent;
|
|
57
|
+
case 8:
|
|
58
|
+
updateAttributes({
|
|
59
|
+
src: validatedUrl,
|
|
60
|
+
width: attrs.width,
|
|
61
|
+
height: attrs.height
|
|
62
|
+
});
|
|
63
|
+
handleClosePopover();
|
|
64
|
+
_context.next = 14;
|
|
65
|
+
break;
|
|
66
|
+
case 12:
|
|
67
|
+
_context.prev = 12;
|
|
68
|
+
_context.t0 = _context["catch"](2);
|
|
69
|
+
case 14:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
72
|
+
}
|
|
73
|
+
}, _callee, null, [[2, 12]]);
|
|
74
|
+
}));
|
|
75
|
+
return function handleInsert() {
|
|
76
|
+
return _ref2.apply(this, arguments);
|
|
77
|
+
};
|
|
78
|
+
}();
|
|
39
79
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
40
80
|
className: "iframe-wrapper",
|
|
41
81
|
"data-drag-handle": true
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -16,7 +20,8 @@ var IframeViewWrapper = function IframeViewWrapper(_ref) {
|
|
|
16
20
|
node = _ref.node,
|
|
17
21
|
updateAttributes = _ref.updateAttributes,
|
|
18
22
|
deleteNode = _ref.deleteNode,
|
|
19
|
-
selected = _ref.selected
|
|
23
|
+
selected = _ref.selected,
|
|
24
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
20
25
|
var attrs = node.attrs;
|
|
21
26
|
var _useState = useState(false),
|
|
22
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -60,16 +65,49 @@ var IframeViewWrapper = function IframeViewWrapper(_ref) {
|
|
|
60
65
|
var handleClosePopover = function handleClosePopover() {
|
|
61
66
|
return setAnchorEl(null);
|
|
62
67
|
};
|
|
63
|
-
var handleSave = function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
var handleSave = /*#__PURE__*/function () {
|
|
69
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
70
|
+
var validatedUrl;
|
|
71
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
|
+
while (1) switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (!editSrc.trim()) {
|
|
75
|
+
_context.next = 12;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
_context.prev = 1;
|
|
79
|
+
validatedUrl = editSrc.trim();
|
|
80
|
+
if (!onValidateUrl) {
|
|
81
|
+
_context.next = 7;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
_context.next = 6;
|
|
85
|
+
return Promise.resolve(onValidateUrl(validatedUrl, 'iframe'));
|
|
86
|
+
case 6:
|
|
87
|
+
validatedUrl = _context.sent;
|
|
88
|
+
case 7:
|
|
89
|
+
updateAttributes({
|
|
90
|
+
src: validatedUrl,
|
|
91
|
+
width: attrs.width,
|
|
92
|
+
height: attrs.height
|
|
93
|
+
});
|
|
94
|
+
_context.next = 12;
|
|
95
|
+
break;
|
|
96
|
+
case 10:
|
|
97
|
+
_context.prev = 10;
|
|
98
|
+
_context.t0 = _context["catch"](1);
|
|
99
|
+
case 12:
|
|
100
|
+
handleClosePopover();
|
|
101
|
+
case 13:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee, null, [[1, 10]]);
|
|
106
|
+
}));
|
|
107
|
+
return function handleSave() {
|
|
108
|
+
return _ref2.apply(this, arguments);
|
|
109
|
+
};
|
|
110
|
+
}();
|
|
73
111
|
var handleMouseDownWidth = function handleMouseDownWidth(e) {
|
|
74
112
|
e.preventDefault();
|
|
75
113
|
setIsDraggingWidth(true);
|
|
@@ -126,7 +164,8 @@ var IframeViewWrapper = function IframeViewWrapper(_ref) {
|
|
|
126
164
|
return /*#__PURE__*/React.createElement(InsertIframe, {
|
|
127
165
|
selected: selected,
|
|
128
166
|
attrs: attrs,
|
|
129
|
-
updateAttributes: updateAttributes
|
|
167
|
+
updateAttributes: updateAttributes,
|
|
168
|
+
onValidateUrl: onValidateUrl
|
|
130
169
|
});
|
|
131
170
|
}
|
|
132
171
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
@@ -6,5 +6,5 @@ type InsertImageProps = {
|
|
|
6
6
|
attrs: ImageAttributes;
|
|
7
7
|
updateAttributes: (attrs: ImageAttributes) => void;
|
|
8
8
|
} & EditorFnProps;
|
|
9
|
-
declare const InsertImage: ({ selected, attrs, updateAttributes, onUpload, onError }: InsertImageProps) => React.JSX.Element;
|
|
9
|
+
declare const InsertImage: ({ selected, attrs, updateAttributes, onUpload, onError, onValidateUrl }: InsertImageProps) => React.JSX.Element;
|
|
10
10
|
export default InsertImage;
|
|
@@ -24,7 +24,8 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
24
24
|
attrs = _ref.attrs,
|
|
25
25
|
updateAttributes = _ref.updateAttributes,
|
|
26
26
|
onUpload = _ref.onUpload,
|
|
27
|
-
onError = _ref.onError
|
|
27
|
+
onError = _ref.onError,
|
|
28
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
28
29
|
var _useState = useState(attrs.src || ''),
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
31
|
editSrc = _useState2[0],
|
|
@@ -148,6 +149,7 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
148
149
|
}();
|
|
149
150
|
var handleInsertLink = /*#__PURE__*/function () {
|
|
150
151
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
152
|
+
var validatedUrl;
|
|
151
153
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
152
154
|
while (1) switch (_context3.prev = _context3.next) {
|
|
153
155
|
case 0:
|
|
@@ -157,15 +159,32 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
157
159
|
}
|
|
158
160
|
return _context3.abrupt("return");
|
|
159
161
|
case 2:
|
|
160
|
-
_context3.
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
_context3.prev = 2;
|
|
163
|
+
validatedUrl = editSrc.trim();
|
|
164
|
+
if (!onValidateUrl) {
|
|
165
|
+
_context3.next = 8;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
_context3.next = 7;
|
|
169
|
+
return Promise.resolve(onValidateUrl(validatedUrl, 'image'));
|
|
170
|
+
case 7:
|
|
171
|
+
validatedUrl = _context3.sent;
|
|
172
|
+
case 8:
|
|
173
|
+
_context3.next = 10;
|
|
174
|
+
return updateImageAttributes(validatedUrl);
|
|
175
|
+
case 10:
|
|
163
176
|
handleClosePopover();
|
|
164
|
-
|
|
177
|
+
_context3.next = 16;
|
|
178
|
+
break;
|
|
179
|
+
case 13:
|
|
180
|
+
_context3.prev = 13;
|
|
181
|
+
_context3.t0 = _context3["catch"](2);
|
|
182
|
+
onError === null || onError === void 0 || onError(_context3.t0);
|
|
183
|
+
case 16:
|
|
165
184
|
case "end":
|
|
166
185
|
return _context3.stop();
|
|
167
186
|
}
|
|
168
|
-
}, _callee3);
|
|
187
|
+
}, _callee3, null, [[2, 13]]);
|
|
169
188
|
}));
|
|
170
189
|
return function handleInsertLink() {
|
|
171
190
|
return _ref4.apply(this, arguments);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -70,7 +74,8 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
70
74
|
deleteNode = _ref.deleteNode,
|
|
71
75
|
selected = _ref.selected,
|
|
72
76
|
onUpload = _ref.onUpload,
|
|
73
|
-
_onError = _ref.onError
|
|
77
|
+
_onError = _ref.onError,
|
|
78
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
74
79
|
var attrs = node.attrs;
|
|
75
80
|
var imageRef = useRef(null);
|
|
76
81
|
var _useState = useState(false),
|
|
@@ -172,18 +177,52 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
172
177
|
});
|
|
173
178
|
setIsCropping(false);
|
|
174
179
|
};
|
|
175
|
-
var handleSave = function
|
|
176
|
-
|
|
177
|
-
var currentWidth
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
180
|
+
var handleSave = /*#__PURE__*/function () {
|
|
181
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
182
|
+
var validatedUrl, currentWidth;
|
|
183
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
184
|
+
while (1) switch (_context.prev = _context.next) {
|
|
185
|
+
case 0:
|
|
186
|
+
if (!editSrc.trim()) {
|
|
187
|
+
_context.next = 15;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
_context.prev = 1;
|
|
191
|
+
validatedUrl = editSrc.trim();
|
|
192
|
+
if (!onValidateUrl) {
|
|
193
|
+
_context.next = 7;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
_context.next = 6;
|
|
197
|
+
return Promise.resolve(onValidateUrl(validatedUrl, 'image'));
|
|
198
|
+
case 6:
|
|
199
|
+
validatedUrl = _context.sent;
|
|
200
|
+
case 7:
|
|
201
|
+
currentWidth = getCurrentDisplayWidth();
|
|
202
|
+
updateAttributes({
|
|
203
|
+
src: validatedUrl,
|
|
204
|
+
width: currentWidth,
|
|
205
|
+
error: true
|
|
206
|
+
});
|
|
207
|
+
setEditSrc(validatedUrl);
|
|
208
|
+
_context.next = 15;
|
|
209
|
+
break;
|
|
210
|
+
case 12:
|
|
211
|
+
_context.prev = 12;
|
|
212
|
+
_context.t0 = _context["catch"](1);
|
|
213
|
+
_onError === null || _onError === void 0 || _onError(_context.t0);
|
|
214
|
+
case 15:
|
|
215
|
+
handleClosePopover();
|
|
216
|
+
case 16:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context.stop();
|
|
219
|
+
}
|
|
220
|
+
}, _callee, null, [[1, 12]]);
|
|
221
|
+
}));
|
|
222
|
+
return function handleSave() {
|
|
223
|
+
return _ref2.apply(this, arguments);
|
|
224
|
+
};
|
|
225
|
+
}();
|
|
187
226
|
useEffect(function () {
|
|
188
227
|
if (isDragging) {
|
|
189
228
|
document.addEventListener('mousemove', handleMouseMove);
|
|
@@ -207,7 +246,9 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
207
246
|
selected: selected,
|
|
208
247
|
attrs: attrs,
|
|
209
248
|
onUpload: onUpload,
|
|
210
|
-
updateAttributes: updateAttributes
|
|
249
|
+
updateAttributes: updateAttributes,
|
|
250
|
+
onError: _onError,
|
|
251
|
+
onValidateUrl: onValidateUrl
|
|
211
252
|
});
|
|
212
253
|
}
|
|
213
254
|
if (isCropping) {
|
|
@@ -7,6 +7,6 @@ export interface UploadProgressAttributes {
|
|
|
7
7
|
tempId: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const getFileIcon: (fileType: string) => React.JSX.Element;
|
|
10
|
-
export declare const getFileTypeText: (fileType: string) => "
|
|
10
|
+
export declare const getFileTypeText: (fileType: string) => "图片" | "视频" | "音频" | "文件";
|
|
11
11
|
declare const UploadProgressView: React.FC<NodeViewProps>;
|
|
12
12
|
export default UploadProgressView;
|
|
@@ -6,5 +6,5 @@ type InsertVideoProps = {
|
|
|
6
6
|
attrs: VideoAttributes;
|
|
7
7
|
updateAttributes: (attrs: VideoAttributes) => void;
|
|
8
8
|
} & EditorFnProps;
|
|
9
|
-
declare const InsertVideo: ({ selected, attrs, updateAttributes, onUpload, onError }: InsertVideoProps) => React.JSX.Element;
|
|
9
|
+
declare const InsertVideo: ({ selected, attrs, updateAttributes, onUpload, onError, onValidateUrl }: InsertVideoProps) => React.JSX.Element;
|
|
10
10
|
export default InsertVideo;
|
|
@@ -23,7 +23,8 @@ var InsertVideo = function InsertVideo(_ref) {
|
|
|
23
23
|
attrs = _ref.attrs,
|
|
24
24
|
updateAttributes = _ref.updateAttributes,
|
|
25
25
|
onUpload = _ref.onUpload,
|
|
26
|
-
onError = _ref.onError
|
|
26
|
+
onError = _ref.onError,
|
|
27
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
27
28
|
var _useState = useState(attrs.src || ''),
|
|
28
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
30
|
editSrc = _useState2[0],
|
|
@@ -108,19 +109,55 @@ var InsertVideo = function InsertVideo(_ref) {
|
|
|
108
109
|
return _ref2.apply(this, arguments);
|
|
109
110
|
};
|
|
110
111
|
}();
|
|
111
|
-
var handleInsertLink = function
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
var handleInsertLink = /*#__PURE__*/function () {
|
|
113
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
114
|
+
var validatedUrl;
|
|
115
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
116
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
if (editSrc.trim()) {
|
|
119
|
+
_context2.next = 2;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context2.abrupt("return");
|
|
123
|
+
case 2:
|
|
124
|
+
_context2.prev = 2;
|
|
125
|
+
validatedUrl = editSrc.trim();
|
|
126
|
+
if (!onValidateUrl) {
|
|
127
|
+
_context2.next = 8;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
_context2.next = 7;
|
|
131
|
+
return Promise.resolve(onValidateUrl(validatedUrl, 'video'));
|
|
132
|
+
case 7:
|
|
133
|
+
validatedUrl = _context2.sent;
|
|
134
|
+
case 8:
|
|
135
|
+
updateAttributes({
|
|
136
|
+
src: validatedUrl,
|
|
137
|
+
width: attrs.width,
|
|
138
|
+
controls: attrs.controls,
|
|
139
|
+
autoplay: attrs.autoplay,
|
|
140
|
+
loop: attrs.loop,
|
|
141
|
+
muted: attrs.muted,
|
|
142
|
+
poster: attrs.poster
|
|
143
|
+
});
|
|
144
|
+
handleClosePopover();
|
|
145
|
+
_context2.next = 15;
|
|
146
|
+
break;
|
|
147
|
+
case 12:
|
|
148
|
+
_context2.prev = 12;
|
|
149
|
+
_context2.t0 = _context2["catch"](2);
|
|
150
|
+
onError === null || onError === void 0 || onError(_context2.t0);
|
|
151
|
+
case 15:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context2.stop();
|
|
154
|
+
}
|
|
155
|
+
}, _callee2, null, [[2, 12]]);
|
|
156
|
+
}));
|
|
157
|
+
return function handleInsertLink() {
|
|
158
|
+
return _ref3.apply(this, arguments);
|
|
159
|
+
};
|
|
160
|
+
}();
|
|
124
161
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
125
162
|
className: "video-wrapper",
|
|
126
163
|
"data-drag-handle": true
|
|
@@ -17,7 +17,8 @@ var VideoViewWrapper = function VideoViewWrapper(_ref) {
|
|
|
17
17
|
deleteNode = _ref.deleteNode,
|
|
18
18
|
selected = _ref.selected,
|
|
19
19
|
onUpload = _ref.onUpload,
|
|
20
|
-
_onError = _ref.onError
|
|
20
|
+
_onError = _ref.onError,
|
|
21
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
21
22
|
var attrs = node.attrs;
|
|
22
23
|
var videoRef = useRef(null);
|
|
23
24
|
var _useState = useState(false),
|
|
@@ -78,7 +79,8 @@ var VideoViewWrapper = function VideoViewWrapper(_ref) {
|
|
|
78
79
|
attrs: attrs,
|
|
79
80
|
updateAttributes: updateAttributes,
|
|
80
81
|
onUpload: onUpload,
|
|
81
|
-
onError: _onError
|
|
82
|
+
onError: _onError,
|
|
83
|
+
onValidateUrl: onValidateUrl
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GetExtensionsProps } from '../type';
|
|
2
|
-
export declare const getExtensions: ({ contentType, limit, exclude, extensions: extensionsProps, youtube, editable, mentionItems, onMentionFilter, onUpload, onError, onTocUpdate, onAiWritingGetSuggestion, }: GetExtensionsProps) => any;
|
|
2
|
+
export declare const getExtensions: ({ contentType, limit, exclude, extensions: extensionsProps, youtube, editable, mentionItems, onMentionFilter, onUpload, onError, onTocUpdate, onAiWritingGetSuggestion, onValidateUrl, }: GetExtensionsProps) => any;
|
package/dist/extension/index.js
CHANGED
|
@@ -29,7 +29,8 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
29
29
|
onUpload = _ref.onUpload,
|
|
30
30
|
onError = _ref.onError,
|
|
31
31
|
onTocUpdate = _ref.onTocUpdate,
|
|
32
|
-
onAiWritingGetSuggestion = _ref.onAiWritingGetSuggestion
|
|
32
|
+
onAiWritingGetSuggestion = _ref.onAiWritingGetSuggestion,
|
|
33
|
+
onValidateUrl = _ref.onValidateUrl;
|
|
33
34
|
var defaultExtensions = [StarterKit.configure({
|
|
34
35
|
link: false,
|
|
35
36
|
code: false,
|
|
@@ -49,7 +50,8 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
49
50
|
onTocUpdate: onTocUpdate
|
|
50
51
|
}), ImageExtension({
|
|
51
52
|
onUpload: onUpload,
|
|
52
|
-
onError: onError
|
|
53
|
+
onError: onError,
|
|
54
|
+
onValidateUrl: onValidateUrl
|
|
53
55
|
}), CustomBlockMathExtension({
|
|
54
56
|
onError: onError
|
|
55
57
|
}), CustomInlineMathExtension({
|
|
@@ -104,13 +106,16 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
104
106
|
}));
|
|
105
107
|
} else {
|
|
106
108
|
defaultExtensions.push.apply(defaultExtensions, [AlertExtension, BlockLinkExtension, InlineUploadProgressExtension, IframeExtension({
|
|
107
|
-
onError: onError
|
|
109
|
+
onError: onError,
|
|
110
|
+
onValidateUrl: onValidateUrl
|
|
108
111
|
}), VideoExtension({
|
|
109
112
|
onUpload: onUpload,
|
|
110
|
-
onError: onError
|
|
113
|
+
onError: onError,
|
|
114
|
+
onValidateUrl: onValidateUrl
|
|
111
115
|
}), AudioExtension({
|
|
112
116
|
onUpload: onUpload,
|
|
113
|
-
onError: onError
|
|
117
|
+
onError: onError,
|
|
118
|
+
onValidateUrl: onValidateUrl
|
|
114
119
|
}), BlockAttachmentExtension({
|
|
115
120
|
onUpload: onUpload,
|
|
116
121
|
onError: onError
|
|
@@ -186,7 +186,8 @@ export var AudioExtension = function AudioExtension(props) {
|
|
|
186
186
|
return ReactNodeViewRenderer(function (renderProps) {
|
|
187
187
|
return AudioViewWrapper(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
188
188
|
onUpload: props.onUpload,
|
|
189
|
-
onError: props.onError
|
|
189
|
+
onError: props.onError,
|
|
190
|
+
onValidateUrl: props.onValidateUrl
|
|
190
191
|
}));
|
|
191
192
|
});
|
|
192
193
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UploadFunction } from "../../type";
|
|
2
2
|
export declare const FileHandlerExtension: (props: {
|
|
3
3
|
onUpload?: UploadFunction;
|
|
4
|
-
}) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "
|
|
4
|
+
}) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
|
|
@@ -111,7 +111,8 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
111
111
|
addNodeView: function addNodeView() {
|
|
112
112
|
return ReactNodeViewRenderer(function (renderProps) {
|
|
113
113
|
return IframeViewWrapper(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
114
|
-
onError: props.onError
|
|
114
|
+
onError: props.onError,
|
|
115
|
+
onValidateUrl: props.onValidateUrl
|
|
115
116
|
}));
|
|
116
117
|
});
|
|
117
118
|
}
|
|
@@ -29,7 +29,8 @@ var customImage = function customImage(props) {
|
|
|
29
29
|
return ReactNodeViewRenderer(function (renderProps) {
|
|
30
30
|
return ImageViewWrapper(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
31
31
|
onUpload: props.onUpload,
|
|
32
|
-
onError: props.onError
|
|
32
|
+
onError: props.onError,
|
|
33
|
+
onValidateUrl: props.onValidateUrl
|
|
33
34
|
}));
|
|
34
35
|
});
|
|
35
36
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
2
|
export declare const TableExtension: ({ editable }: {
|
|
3
3
|
editable: boolean;
|
|
4
|
-
}) => (
|
|
4
|
+
}) => (import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableHeaderOptions, any> | Extension<any, any>)[];
|
|
5
5
|
export default TableExtension;
|
|
@@ -195,7 +195,8 @@ export var VideoExtension = function VideoExtension(props) {
|
|
|
195
195
|
return ReactNodeViewRenderer(function (renderProps) {
|
|
196
196
|
return VideoViewWrapper(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
197
197
|
onUpload: props.onUpload,
|
|
198
|
-
onError: props.onError
|
|
198
|
+
onError: props.onError,
|
|
199
|
+
onValidateUrl: props.onValidateUrl
|
|
199
200
|
}));
|
|
200
201
|
});
|
|
201
202
|
},
|
package/dist/hook/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UseTiptapProps, UseTiptapReturn } from "../type";
|
|
2
2
|
import { UseEditorOptions } from '@tiptap/react';
|
|
3
|
-
declare const useTiptap: ({ exclude, extensions: extensionsProps, mentionItems, onMentionFilter, onSave, onError, onUpload, onTocUpdate, onAiWritingGetSuggestion, editable, contentType, ...options }: UseTiptapProps & UseEditorOptions) => UseTiptapReturn;
|
|
3
|
+
declare const useTiptap: ({ exclude, extensions: extensionsProps, mentionItems, onMentionFilter, onSave, onError, onUpload, onTocUpdate, onAiWritingGetSuggestion, onValidateUrl, editable, contentType, ...options }: UseTiptapProps & UseEditorOptions) => UseTiptapReturn;
|
|
4
4
|
export default useTiptap;
|
package/dist/hook/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["exclude", "extensions", "mentionItems", "onMentionFilter", "onSave", "onError", "onUpload", "onTocUpdate", "onAiWritingGetSuggestion", "editable", "contentType"];
|
|
2
|
+
var _excluded = ["exclude", "extensions", "mentionItems", "onMentionFilter", "onSave", "onError", "onUpload", "onTocUpdate", "onAiWritingGetSuggestion", "onValidateUrl", "editable", "contentType"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -21,6 +21,7 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
21
21
|
onUpload = _ref.onUpload,
|
|
22
22
|
onTocUpdate = _ref.onTocUpdate,
|
|
23
23
|
onAiWritingGetSuggestion = _ref.onAiWritingGetSuggestion,
|
|
24
|
+
onValidateUrl = _ref.onValidateUrl,
|
|
24
25
|
_ref$editable = _ref.editable,
|
|
25
26
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
26
27
|
contentType = _ref.contentType,
|
|
@@ -35,7 +36,8 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
35
36
|
onUpload: onUpload,
|
|
36
37
|
onError: onError,
|
|
37
38
|
onTocUpdate: onTocUpdate,
|
|
38
|
-
onAiWritingGetSuggestion: onAiWritingGetSuggestion
|
|
39
|
+
onAiWritingGetSuggestion: onAiWritingGetSuggestion,
|
|
40
|
+
onValidateUrl: onValidateUrl
|
|
39
41
|
});
|
|
40
42
|
var editor = useEditor(_objectSpread(_objectSpread(_objectSpread({
|
|
41
43
|
editable: editable,
|
package/dist/type/index.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type TocItem = {
|
|
|
69
69
|
textContent: string;
|
|
70
70
|
};
|
|
71
71
|
export type TocList = TocItem[];
|
|
72
|
+
export type ValidateUrlFunction = (url: string, type: 'image' | 'video' | 'audio' | 'iframe') => Promise<string> | string;
|
|
72
73
|
export type EditorFnProps = {
|
|
73
74
|
onError?: (error: Error) => void;
|
|
74
75
|
onUpload?: UploadFunction;
|
|
@@ -77,6 +78,7 @@ export type EditorFnProps = {
|
|
|
77
78
|
prefix: string;
|
|
78
79
|
suffix: string;
|
|
79
80
|
}) => Promise<string>;
|
|
81
|
+
onValidateUrl?: ValidateUrlFunction;
|
|
80
82
|
};
|
|
81
83
|
export type MentionItems = string[];
|
|
82
84
|
export type MentionExtensionProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctzhian/tiptap",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "基于 Tiptap 二次开发的编辑器组件",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -81,37 +81,37 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@floating-ui/dom": "^1.7.2",
|
|
84
|
-
"@tiptap/core": "3.
|
|
85
|
-
"@tiptap/extension-bubble-menu": "3.
|
|
86
|
-
"@tiptap/extension-code": "3.
|
|
87
|
-
"@tiptap/extension-code-block-lowlight": "3.
|
|
88
|
-
"@tiptap/extension-details": "3.
|
|
89
|
-
"@tiptap/extension-drag-handle-react": "3.
|
|
90
|
-
"@tiptap/extension-emoji": "3.
|
|
91
|
-
"@tiptap/extension-file-handler": "3.
|
|
92
|
-
"@tiptap/extension-highlight": "3.
|
|
93
|
-
"@tiptap/extension-image": "3.
|
|
94
|
-
"@tiptap/extension-invisible-characters": "3.
|
|
95
|
-
"@tiptap/extension-link": "3.
|
|
96
|
-
"@tiptap/extension-list": "3.
|
|
97
|
-
"@tiptap/extension-mathematics": "3.
|
|
98
|
-
"@tiptap/extension-mention": "3.
|
|
99
|
-
"@tiptap/extension-subscript": "3.
|
|
100
|
-
"@tiptap/extension-superscript": "3.
|
|
101
|
-
"@tiptap/extension-table": "3.
|
|
102
|
-
"@tiptap/extension-table-of-contents": "3.
|
|
103
|
-
"@tiptap/extension-text-align": "3.
|
|
104
|
-
"@tiptap/extension-text-style": "3.
|
|
105
|
-
"@tiptap/extension-unique-id": "3.
|
|
106
|
-
"@tiptap/extension-youtube": "3.
|
|
107
|
-
"@tiptap/extensions": "3.
|
|
108
|
-
"@tiptap/html": "3.
|
|
109
|
-
"@tiptap/markdown": "^3.
|
|
110
|
-
"@tiptap/pm": "3.
|
|
111
|
-
"@tiptap/react": "3.
|
|
112
|
-
"@tiptap/starter-kit": "3.
|
|
113
|
-
"@tiptap/static-renderer": "3.
|
|
114
|
-
"@tiptap/suggestion": "3.
|
|
84
|
+
"@tiptap/core": "^3.9.1",
|
|
85
|
+
"@tiptap/extension-bubble-menu": "^3.9.1",
|
|
86
|
+
"@tiptap/extension-code": "^3.9.1",
|
|
87
|
+
"@tiptap/extension-code-block-lowlight": "^3.9.1",
|
|
88
|
+
"@tiptap/extension-details": "^3.9.1",
|
|
89
|
+
"@tiptap/extension-drag-handle-react": "^3.9.1",
|
|
90
|
+
"@tiptap/extension-emoji": "^3.9.1",
|
|
91
|
+
"@tiptap/extension-file-handler": "^3.9.1",
|
|
92
|
+
"@tiptap/extension-highlight": "^3.9.1",
|
|
93
|
+
"@tiptap/extension-image": "^3.9.1",
|
|
94
|
+
"@tiptap/extension-invisible-characters": "^3.9.1",
|
|
95
|
+
"@tiptap/extension-link": "^3.9.1",
|
|
96
|
+
"@tiptap/extension-list": "^3.9.1",
|
|
97
|
+
"@tiptap/extension-mathematics": "^3.9.1",
|
|
98
|
+
"@tiptap/extension-mention": "^3.9.1",
|
|
99
|
+
"@tiptap/extension-subscript": "^3.9.1",
|
|
100
|
+
"@tiptap/extension-superscript": "^3.9.1",
|
|
101
|
+
"@tiptap/extension-table": "^3.9.1",
|
|
102
|
+
"@tiptap/extension-table-of-contents": "^3.9.1",
|
|
103
|
+
"@tiptap/extension-text-align": "^3.9.1",
|
|
104
|
+
"@tiptap/extension-text-style": "^3.9.1",
|
|
105
|
+
"@tiptap/extension-unique-id": "^3.9.1",
|
|
106
|
+
"@tiptap/extension-youtube": "^3.9.1",
|
|
107
|
+
"@tiptap/extensions": "^3.9.1",
|
|
108
|
+
"@tiptap/html": "^3.9.1",
|
|
109
|
+
"@tiptap/markdown": "^3.9.1",
|
|
110
|
+
"@tiptap/pm": "^3.9.1",
|
|
111
|
+
"@tiptap/react": "^3.9.1",
|
|
112
|
+
"@tiptap/starter-kit": "^3.9.1",
|
|
113
|
+
"@tiptap/static-renderer": "^3.9.1",
|
|
114
|
+
"@tiptap/suggestion": "^3.9.1",
|
|
115
115
|
"core-js": "^3.46.0",
|
|
116
116
|
"diff-match-patch": "^1.0.5",
|
|
117
117
|
"highlight.js": "^11.11.1",
|