@ctzhian/tiptap 1.11.3 → 1.12.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 +16 -21
- package/dist/EditorMarkdown/index.js +2 -2
- package/dist/asset/css/index.css +19 -8
- package/dist/component/ActionDropdown/index.d.ts +25 -0
- package/dist/component/ActionDropdown/index.js +147 -0
- package/dist/component/CustomDragHandle/index.js +2 -2
- package/dist/component/FloatingPopover/index.d.ts +2 -0
- package/dist/component/FloatingPopover/index.js +7 -1
- package/dist/component/HoverPopover/index.d.ts +29 -0
- package/dist/component/HoverPopover/index.js +143 -0
- package/dist/component/Icons/chrome-icon.d.ts +6 -0
- package/dist/component/Icons/chrome-icon.js +31 -0
- package/dist/component/Icons/edit-line-icon.d.ts +6 -0
- package/dist/component/Icons/edit-line-icon.js +13 -0
- package/dist/component/Icons/file-icon.d.ts +6 -0
- package/dist/component/Icons/file-icon.js +20 -0
- package/dist/component/Icons/index.d.ts +3 -0
- package/dist/component/Icons/index.js +3 -0
- package/dist/component/index.d.ts +2 -0
- package/dist/component/index.js +2 -0
- package/dist/extension/component/Alert/index.js +73 -85
- package/dist/extension/component/Attachment/AttachmentContent.d.ts +14 -0
- package/dist/extension/component/Attachment/AttachmentContent.js +142 -0
- package/dist/extension/component/Attachment/index.js +144 -201
- package/dist/extension/component/CodeBlock/Readonly.js +43 -35
- package/dist/extension/component/CodeBlock/index.js +139 -90
- package/dist/extension/component/Image/Insert.js +41 -26
- package/dist/extension/component/Image/Readonly.js +13 -6
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +234 -92
- package/dist/extension/component/Link/Insert.js +1 -1
- package/dist/extension/component/Link/LinkContent.d.ts +13 -0
- package/dist/extension/component/Link/LinkContent.js +169 -0
- package/dist/extension/component/Link/index.js +182 -264
- package/dist/extension/component/MentionList/index.js +1 -1
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/index.js +1 -1
- package/dist/index.css +64 -63
- package/dist/themes/dark.js +2 -2
- package/dist/themes/light.d.ts +1 -1
- package/dist/themes/light.js +2 -2
- package/dist/themes/palette.d.ts +1 -1
- package/package.json +1 -1
- package/dist/extension/component/Attachment/Readonly.d.ts +0 -9
- package/dist/extension/component/Attachment/Readonly.js +0 -91
- package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
- package/dist/extension/component/CustomLink/Insert.js +0 -176
- package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
- package/dist/extension/component/CustomLink/Readonly.js +0 -106
- package/dist/extension/component/CustomLink/index.d.ts +0 -0
- package/dist/extension/component/CustomLink/index.js +0 -440
- package/dist/extension/component/Link/Readonly.d.ts +0 -8
- package/dist/extension/component/Link/Readonly.js +0 -110
|
@@ -12,9 +12,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
13
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
import { ArrowDownSLineIcon, FileCopyLineIcon
|
|
15
|
+
import { ArrowDownSLineIcon, FileCopyLineIcon } from "../../../component/Icons";
|
|
16
16
|
import { languages } from "../../../contants/highlight";
|
|
17
|
-
import { Box, MenuItem, Select, Stack, TextField } from '@mui/material';
|
|
17
|
+
import { Box, Divider, ListSubheader, MenuItem, Select, Stack, TextField } from '@mui/material';
|
|
18
18
|
import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';
|
|
19
19
|
import React, { useCallback, useState } from 'react';
|
|
20
20
|
import ReadonlyCodeBlock from "./Readonly";
|
|
@@ -35,7 +35,26 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
35
35
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
36
|
titleValue = _useState6[0],
|
|
37
37
|
setTitleValue = _useState6[1];
|
|
38
|
+
var _useState7 = useState(''),
|
|
39
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
40
|
+
searchText = _useState8[0],
|
|
41
|
+
setSearchText = _useState8[1];
|
|
42
|
+
var menuListRef = React.useRef(null);
|
|
38
43
|
var attrs = node.attrs;
|
|
44
|
+
var filteredLanguages = React.useMemo(function () {
|
|
45
|
+
if (!searchText) return languages;
|
|
46
|
+
var lowerSearch = searchText.toLowerCase();
|
|
47
|
+
return languages.filter(function (lang) {
|
|
48
|
+
return lang.label.toLowerCase().includes(lowerSearch) || lang.value.toLowerCase().includes(lowerSearch);
|
|
49
|
+
});
|
|
50
|
+
}, [searchText]);
|
|
51
|
+
|
|
52
|
+
// 当搜索文本改变时,重置滚动位置
|
|
53
|
+
React.useEffect(function () {
|
|
54
|
+
if (menuListRef.current) {
|
|
55
|
+
menuListRef.current.scrollTop = 0;
|
|
56
|
+
}
|
|
57
|
+
}, [searchText]);
|
|
39
58
|
var handleLanguageChange = useCallback(function (language) {
|
|
40
59
|
updateAttributes({
|
|
41
60
|
language: language
|
|
@@ -105,7 +124,7 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
105
124
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
106
125
|
component: "pre",
|
|
107
126
|
sx: {
|
|
108
|
-
p: '
|
|
127
|
+
p: '0.75rem 1rem',
|
|
109
128
|
m: 0,
|
|
110
129
|
borderRadius: showTitleInput ? '6px 6px 0 0 !important' : '6px',
|
|
111
130
|
overflow: 'hidden'
|
|
@@ -116,19 +135,69 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
116
135
|
justifyContent: "space-between",
|
|
117
136
|
className: "codeblock-toolbar",
|
|
118
137
|
sx: {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
zIndex: 1,
|
|
139
|
+
mb: 2
|
|
140
|
+
}
|
|
141
|
+
}, showTitleInput ? /*#__PURE__*/React.createElement(Box, {
|
|
142
|
+
sx: {
|
|
143
|
+
py: 0.5,
|
|
144
|
+
flex: 1,
|
|
145
|
+
borderRadius: '0 0 4px 4px',
|
|
146
|
+
bgcolor: 'background.paper3',
|
|
147
|
+
boxSizing: 'border-box',
|
|
148
|
+
letterSpacing: '0.01rem'
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
151
|
+
fullWidth: true,
|
|
152
|
+
size: "small",
|
|
153
|
+
placeholder: "\u8BF7\u8F93\u5165\u4EE3\u7801\u5757\u540D\u79F0",
|
|
154
|
+
value: titleValue,
|
|
155
|
+
onChange: handleTitleChange,
|
|
156
|
+
onKeyDown: handleTitleKeyDown,
|
|
157
|
+
onBlur: handleTitleSubmit,
|
|
158
|
+
autoFocus: true,
|
|
159
|
+
sx: {
|
|
160
|
+
'& .MuiInputBase-input': {
|
|
161
|
+
p: 0,
|
|
162
|
+
height: '0.875rem',
|
|
163
|
+
lineHeight: 1,
|
|
164
|
+
fontSize: '0.875rem',
|
|
165
|
+
color: 'text.auxiliary'
|
|
166
|
+
},
|
|
167
|
+
'& .MuiInputBase-input::placeholder': {
|
|
168
|
+
fontSize: '0.875rem'
|
|
169
|
+
},
|
|
170
|
+
'& .MuiOutlinedInput-root': {
|
|
171
|
+
'& fieldset': {
|
|
172
|
+
border: 'none',
|
|
173
|
+
top: 0,
|
|
174
|
+
p: 0
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})) : /*#__PURE__*/React.createElement(Box, {
|
|
179
|
+
sx: {
|
|
180
|
+
py: 0.5,
|
|
181
|
+
flex: 1,
|
|
182
|
+
fontSize: '0.875rem',
|
|
183
|
+
color: 'text.auxiliary',
|
|
184
|
+
letterSpacing: '0.01rem'
|
|
185
|
+
},
|
|
186
|
+
onClick: handleTitleToggle
|
|
187
|
+
}, attrs.title || '代码块'), /*#__PURE__*/React.createElement(Stack, {
|
|
188
|
+
direction: "row",
|
|
189
|
+
alignItems: "center",
|
|
190
|
+
sx: {
|
|
191
|
+
flexShrink: 0
|
|
126
192
|
}
|
|
127
193
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
128
194
|
value: attrs.language || 'auto',
|
|
129
195
|
onChange: function onChange(e) {
|
|
130
196
|
return handleLanguageChange(e.target.value);
|
|
131
197
|
},
|
|
198
|
+
onClose: function onClose() {
|
|
199
|
+
return setSearchText('');
|
|
200
|
+
},
|
|
132
201
|
size: "small",
|
|
133
202
|
variant: "outlined",
|
|
134
203
|
sx: {
|
|
@@ -162,32 +231,80 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
162
231
|
},
|
|
163
232
|
MenuProps: {
|
|
164
233
|
PaperProps: {
|
|
165
|
-
|
|
166
|
-
maxHeight:
|
|
234
|
+
sx: {
|
|
235
|
+
maxHeight: 400,
|
|
236
|
+
p: 0
|
|
167
237
|
}
|
|
238
|
+
},
|
|
239
|
+
autoFocus: false,
|
|
240
|
+
MenuListProps: {
|
|
241
|
+
ref: menuListRef
|
|
168
242
|
}
|
|
169
243
|
}
|
|
170
|
-
},
|
|
244
|
+
}, /*#__PURE__*/React.createElement(ListSubheader, {
|
|
245
|
+
sx: {
|
|
246
|
+
position: 'sticky',
|
|
247
|
+
top: 0,
|
|
248
|
+
bgcolor: 'background.default',
|
|
249
|
+
zIndex: 1,
|
|
250
|
+
p: 0.5,
|
|
251
|
+
lineHeight: 1
|
|
252
|
+
}
|
|
253
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
254
|
+
size: "small",
|
|
255
|
+
autoFocus: true,
|
|
256
|
+
placeholder: "\u641C\u7D22\u8BED\u8A00...",
|
|
257
|
+
fullWidth: true,
|
|
258
|
+
value: searchText,
|
|
259
|
+
onChange: function onChange(e) {
|
|
260
|
+
return setSearchText(e.target.value);
|
|
261
|
+
},
|
|
262
|
+
onKeyDown: function onKeyDown(e) {
|
|
263
|
+
e.stopPropagation();
|
|
264
|
+
},
|
|
265
|
+
sx: {
|
|
266
|
+
'& .MuiInputBase-root': {
|
|
267
|
+
fontSize: '0.75rem'
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
})), searchText && /*#__PURE__*/React.createElement(MenuItem, {
|
|
271
|
+
value: searchText,
|
|
272
|
+
sx: {
|
|
273
|
+
fontSize: '0.75rem',
|
|
274
|
+
height: '30px',
|
|
275
|
+
m: 0.5,
|
|
276
|
+
bgcolor: 'action.hover',
|
|
277
|
+
fontWeight: 500
|
|
278
|
+
}
|
|
279
|
+
}, searchText, filteredLanguages.length === 0 && ' (自定义)'), !searchText && attrs.language && !languages.find(function (it) {
|
|
171
280
|
return it.value === attrs.language;
|
|
172
281
|
}) && /*#__PURE__*/React.createElement(MenuItem, {
|
|
173
282
|
value: attrs.language,
|
|
174
283
|
sx: {
|
|
175
|
-
fontSize: '0.75rem'
|
|
284
|
+
fontSize: '0.75rem',
|
|
285
|
+
height: '30px',
|
|
286
|
+
m: 0.5
|
|
176
287
|
}
|
|
177
|
-
}, attrs.language),
|
|
288
|
+
}, attrs.language), filteredLanguages.map(function (lang) {
|
|
178
289
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
179
290
|
key: lang.value,
|
|
180
291
|
value: lang.value,
|
|
181
292
|
sx: {
|
|
182
|
-
fontSize: '0.75rem'
|
|
293
|
+
fontSize: '0.75rem',
|
|
294
|
+
height: '30px',
|
|
295
|
+
m: 0.5
|
|
183
296
|
}
|
|
184
297
|
}, lang.label);
|
|
185
|
-
})), /*#__PURE__*/React.createElement(
|
|
186
|
-
|
|
298
|
+
})), /*#__PURE__*/React.createElement(Divider, {
|
|
299
|
+
orientation: "vertical",
|
|
300
|
+
flexItem: true,
|
|
187
301
|
sx: {
|
|
188
|
-
|
|
302
|
+
height: '1.25rem',
|
|
303
|
+
m: 0.5,
|
|
304
|
+
alignSelf: 'center',
|
|
305
|
+
borderColor: 'divider'
|
|
189
306
|
}
|
|
190
|
-
}, /*#__PURE__*/React.createElement(Stack, {
|
|
307
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
191
308
|
direction: "row",
|
|
192
309
|
alignItems: "center",
|
|
193
310
|
gap: 0.5,
|
|
@@ -211,81 +328,13 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
211
328
|
fontSize: '0.75rem',
|
|
212
329
|
lineHeight: 1
|
|
213
330
|
}
|
|
214
|
-
}, copyText)), /*#__PURE__*/React.createElement(
|
|
215
|
-
direction: "row",
|
|
216
|
-
alignItems: "center",
|
|
217
|
-
gap: 0.5,
|
|
218
|
-
onClick: handleTitleToggle,
|
|
219
|
-
sx: {
|
|
220
|
-
px: 1,
|
|
221
|
-
py: 0.5,
|
|
222
|
-
cursor: 'pointer',
|
|
223
|
-
bgcolor: 'inherit',
|
|
224
|
-
color: 'inherit'
|
|
225
|
-
}
|
|
226
|
-
}, /*#__PURE__*/React.createElement(TitleIcon, {
|
|
227
|
-
sx: {
|
|
228
|
-
fontSize: '0.875rem',
|
|
229
|
-
color: 'inherit'
|
|
230
|
-
}
|
|
231
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
232
|
-
sx: {
|
|
233
|
-
fontSize: '0.75rem',
|
|
234
|
-
lineHeight: 1
|
|
235
|
-
}
|
|
236
|
-
}, "\u6807\u9898")))), /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
331
|
+
}, copyText)))), /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
237
332
|
style: {
|
|
238
333
|
margin: 0,
|
|
239
334
|
fontSize: '0.875rem',
|
|
240
|
-
lineHeight: '1.5',
|
|
241
335
|
whiteSpace: 'pre-wrap',
|
|
242
336
|
wordBreak: 'break-word'
|
|
243
337
|
}
|
|
244
|
-
}))
|
|
245
|
-
sx: {
|
|
246
|
-
px: 1,
|
|
247
|
-
pt: 0.25,
|
|
248
|
-
pb: 0.5,
|
|
249
|
-
borderRadius: '0 0 4px 4px',
|
|
250
|
-
bgcolor: 'background.paper3',
|
|
251
|
-
borderTop: '1px solid var(--mui-palette-divider)',
|
|
252
|
-
boxSizing: 'border-box',
|
|
253
|
-
letterSpacing: '0.01rem'
|
|
254
|
-
}
|
|
255
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
256
|
-
fullWidth: true,
|
|
257
|
-
size: "small",
|
|
258
|
-
placeholder: "\u8F93\u5165\u4EE3\u7801\u5757\u6807\u9898...",
|
|
259
|
-
value: titleValue,
|
|
260
|
-
onChange: handleTitleChange,
|
|
261
|
-
onKeyDown: handleTitleKeyDown,
|
|
262
|
-
onBlur: handleTitleSubmit,
|
|
263
|
-
autoFocus: true,
|
|
264
|
-
sx: {
|
|
265
|
-
'& .MuiInputBase-input': {
|
|
266
|
-
p: 0,
|
|
267
|
-
height: '1rem',
|
|
268
|
-
lineHeight: 1,
|
|
269
|
-
fontSize: '0.875rem',
|
|
270
|
-
color: 'text.secondary'
|
|
271
|
-
},
|
|
272
|
-
'& .MuiOutlinedInput-root': {
|
|
273
|
-
'& fieldset': {
|
|
274
|
-
border: 'none',
|
|
275
|
-
top: 0,
|
|
276
|
-
p: 0
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
})), attrs.title && !showTitleInput && /*#__PURE__*/React.createElement(Box, {
|
|
281
|
-
sx: {
|
|
282
|
-
px: 1,
|
|
283
|
-
py: 0.5,
|
|
284
|
-
fontSize: '0.875rem',
|
|
285
|
-
color: 'text.secondary',
|
|
286
|
-
letterSpacing: '0.01rem'
|
|
287
|
-
},
|
|
288
|
-
onClick: handleTitleToggle
|
|
289
|
-
}, attrs.title));
|
|
338
|
+
})));
|
|
290
339
|
};
|
|
291
340
|
export default CodeBlockView;
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
+
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; }
|
|
2
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; }
|
|
3
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; }
|
|
4
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; }
|
|
5
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
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; }
|
|
8
8
|
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); } }
|
|
9
9
|
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); }); }; }
|
|
10
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -30,22 +30,26 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
30
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
31
|
editSrc = _useState2[0],
|
|
32
32
|
setEditSrc = _useState2[1];
|
|
33
|
-
var _useState3 = useState(
|
|
33
|
+
var _useState3 = useState(attrs.title || ''),
|
|
34
34
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _useState5 = useState(
|
|
35
|
+
editTitle = _useState4[0],
|
|
36
|
+
setEditTitle = _useState4[1];
|
|
37
|
+
var _useState5 = useState(onUpload ? 'upload' : 'link'),
|
|
38
38
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var _useState7 = useState(
|
|
39
|
+
insertType = _useState6[0],
|
|
40
|
+
setInsertType = _useState6[1];
|
|
41
|
+
var _useState7 = useState(null),
|
|
42
42
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var _useState9 = useState(
|
|
43
|
+
anchorEl = _useState8[0],
|
|
44
|
+
setAnchorEl = _useState8[1];
|
|
45
|
+
var _useState9 = useState(false),
|
|
46
46
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
uploading = _useState10[0],
|
|
48
|
+
setUploading = _useState10[1];
|
|
49
|
+
var _useState11 = useState(0),
|
|
50
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
51
|
+
uploadProgress = _useState12[0],
|
|
52
|
+
setUploadProgress = _useState12[1];
|
|
49
53
|
var handleShowPopover = function handleShowPopover(event) {
|
|
50
54
|
return setAnchorEl(event.currentTarget);
|
|
51
55
|
};
|
|
@@ -58,7 +62,7 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
58
62
|
|
|
59
63
|
// 更新图片属性,包含自动获取的宽度
|
|
60
64
|
var updateImageAttributes = /*#__PURE__*/function () {
|
|
61
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(src) {
|
|
65
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(src, title) {
|
|
62
66
|
var dimensions;
|
|
63
67
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
64
68
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -68,28 +72,30 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
68
72
|
return getImageDimensions(src);
|
|
69
73
|
case 3:
|
|
70
74
|
dimensions = _context.sent;
|
|
71
|
-
updateAttributes({
|
|
75
|
+
updateAttributes(_objectSpread({
|
|
72
76
|
src: src,
|
|
73
77
|
width: dimensions.width
|
|
74
|
-
}
|
|
75
|
-
|
|
78
|
+
}, title ? {
|
|
79
|
+
title: title
|
|
80
|
+
} : {}));
|
|
81
|
+
_context.next = 10;
|
|
76
82
|
break;
|
|
77
83
|
case 7:
|
|
78
84
|
_context.prev = 7;
|
|
79
85
|
_context.t0 = _context["catch"](0);
|
|
80
|
-
|
|
81
|
-
console.warn('无法获取图片尺寸,使用默认宽度:', _context.t0);
|
|
82
|
-
updateAttributes({
|
|
86
|
+
updateAttributes(_objectSpread({
|
|
83
87
|
src: src,
|
|
84
|
-
width: attrs.width || 400
|
|
85
|
-
}
|
|
86
|
-
|
|
88
|
+
width: attrs.width || 400
|
|
89
|
+
}, title ? {
|
|
90
|
+
title: title
|
|
91
|
+
} : {}));
|
|
92
|
+
case 10:
|
|
87
93
|
case "end":
|
|
88
94
|
return _context.stop();
|
|
89
95
|
}
|
|
90
96
|
}, _callee, null, [[0, 7]]);
|
|
91
97
|
}));
|
|
92
|
-
return function updateImageAttributes(_x) {
|
|
98
|
+
return function updateImageAttributes(_x, _x2) {
|
|
93
99
|
return _ref2.apply(this, arguments);
|
|
94
100
|
};
|
|
95
101
|
}();
|
|
@@ -143,7 +149,7 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
143
149
|
}
|
|
144
150
|
}, _callee2, null, [[5, 16, 19, 23]]);
|
|
145
151
|
}));
|
|
146
|
-
return function handleUploadImage(
|
|
152
|
+
return function handleUploadImage(_x3) {
|
|
147
153
|
return _ref3.apply(this, arguments);
|
|
148
154
|
};
|
|
149
155
|
}();
|
|
@@ -171,7 +177,7 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
171
177
|
validatedUrl = _context3.sent;
|
|
172
178
|
case 8:
|
|
173
179
|
_context3.next = 10;
|
|
174
|
-
return updateImageAttributes(validatedUrl);
|
|
180
|
+
return updateImageAttributes(validatedUrl, editTitle.trim());
|
|
175
181
|
case 10:
|
|
176
182
|
handleClosePopover();
|
|
177
183
|
_context3.next = 16;
|
|
@@ -317,6 +323,15 @@ var InsertImage = function InsertImage(_ref) {
|
|
|
317
323
|
},
|
|
318
324
|
placeholder: "\u8F93\u5165\u56FE\u7247\u7684 URL",
|
|
319
325
|
label: "\u56FE\u7247\u94FE\u63A5"
|
|
326
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
327
|
+
fullWidth: true,
|
|
328
|
+
size: "small",
|
|
329
|
+
value: editTitle,
|
|
330
|
+
onChange: function onChange(e) {
|
|
331
|
+
return setEditTitle(e.target.value);
|
|
332
|
+
},
|
|
333
|
+
placeholder: "\u8F93\u5165\u56FE\u7247\u63CF\u8FF0\uFF08\u53EF\u9009\uFF09",
|
|
334
|
+
label: "\u56FE\u7247\u63CF\u8FF0"
|
|
320
335
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
321
336
|
variant: "contained",
|
|
322
337
|
fullWidth: true,
|
|
@@ -11,11 +11,7 @@ var ReadonlyImage = function ReadonlyImage(_ref) {
|
|
|
11
11
|
component: 'span',
|
|
12
12
|
sx: {
|
|
13
13
|
position: 'relative',
|
|
14
|
-
display: 'inline-block'
|
|
15
|
-
border: '1px solid',
|
|
16
|
-
borderColor: 'divider',
|
|
17
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
18
|
-
p: '0.25rem'
|
|
14
|
+
display: 'inline-block'
|
|
19
15
|
}
|
|
20
16
|
}, /*#__PURE__*/React.createElement(PhotoView, {
|
|
21
17
|
src: attrs.src
|
|
@@ -30,6 +26,17 @@ var ReadonlyImage = function ReadonlyImage(_ref) {
|
|
|
30
26
|
onError: function onError(e) {
|
|
31
27
|
console.error('Image load error:', e);
|
|
32
28
|
}
|
|
33
|
-
})))
|
|
29
|
+
})), attrs.title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Box, {
|
|
30
|
+
component: "span",
|
|
31
|
+
sx: {
|
|
32
|
+
position: 'relative',
|
|
33
|
+
left: '50%',
|
|
34
|
+
transform: 'translateX(-50%)',
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
fontSize: '0.75rem',
|
|
37
|
+
color: 'text.auxiliary',
|
|
38
|
+
mt: 1.5
|
|
39
|
+
}
|
|
40
|
+
}, attrs.title))));
|
|
34
41
|
};
|
|
35
42
|
export default ReadonlyImage;
|