@ctzhian/tiptap 2.11.0 → 2.11.2
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.
|
@@ -33,12 +33,12 @@ var ExcalidrawEditorWrapper = function ExcalidrawEditorWrapper(_ref) {
|
|
|
33
33
|
setIsLoaded = _useState2[1];
|
|
34
34
|
var handleSave = /*#__PURE__*/function () {
|
|
35
35
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
36
|
-
var elements, appState, files, excalidrawModule,
|
|
36
|
+
var elements, appState, files, excalidrawModule, exportToSvg, svgElement, svgString, blob, _file;
|
|
37
37
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
38
|
while (1) switch (_context.prev = _context.next) {
|
|
39
39
|
case 0:
|
|
40
40
|
if (!excalidrawAPIRef.current) {
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 25;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
_context.prev = 1;
|
|
@@ -55,39 +55,42 @@ var ExcalidrawEditorWrapper = function ExcalidrawEditorWrapper(_ref) {
|
|
|
55
55
|
return import('@excalidraw/excalidraw');
|
|
56
56
|
case 9:
|
|
57
57
|
excalidrawModule = _context.sent;
|
|
58
|
-
|
|
58
|
+
exportToSvg = excalidrawModule.exportToSvg;
|
|
59
59
|
_context.next = 13;
|
|
60
|
-
return
|
|
60
|
+
return exportToSvg({
|
|
61
61
|
elements: elements,
|
|
62
62
|
appState: _objectSpread(_objectSpread({}, appState), {}, {
|
|
63
63
|
exportBackground: true,
|
|
64
64
|
exportScale: 2
|
|
65
65
|
}),
|
|
66
|
-
files: files
|
|
67
|
-
mimeType: 'image/svg+xml'
|
|
66
|
+
files: files
|
|
68
67
|
});
|
|
69
68
|
case 13:
|
|
70
|
-
|
|
69
|
+
svgElement = _context.sent;
|
|
70
|
+
svgString = new XMLSerializer().serializeToString(svgElement);
|
|
71
|
+
blob = new Blob([svgString], {
|
|
72
|
+
type: 'image/svg+xml'
|
|
73
|
+
});
|
|
71
74
|
_file = new File([blob], "excalidraw-".concat(Date.now(), ".svg"), {
|
|
72
75
|
type: 'image/svg+xml'
|
|
73
76
|
});
|
|
74
77
|
onSave(_file);
|
|
75
|
-
_context.next =
|
|
78
|
+
_context.next = 23;
|
|
76
79
|
break;
|
|
77
|
-
case
|
|
78
|
-
_context.prev =
|
|
80
|
+
case 20:
|
|
81
|
+
_context.prev = 20;
|
|
79
82
|
_context.t0 = _context["catch"](1);
|
|
80
|
-
console.error('Failed to export Excalidraw as
|
|
81
|
-
case 21:
|
|
82
|
-
_context.next = 24;
|
|
83
|
-
break;
|
|
83
|
+
console.error('Failed to export Excalidraw as SVG', _context.t0);
|
|
84
84
|
case 23:
|
|
85
|
+
_context.next = 26;
|
|
86
|
+
break;
|
|
87
|
+
case 25:
|
|
85
88
|
console.warn('Excalidraw API not available');
|
|
86
|
-
case
|
|
89
|
+
case 26:
|
|
87
90
|
case "end":
|
|
88
91
|
return _context.stop();
|
|
89
92
|
}
|
|
90
|
-
}, _callee, null, [[1,
|
|
93
|
+
}, _callee, null, [[1, 20]]);
|
|
91
94
|
}));
|
|
92
95
|
return function handleSave() {
|
|
93
96
|
return _ref2.apply(this, arguments);
|
|
@@ -35,7 +35,10 @@ var FlowDiagram = function FlowDiagram(_ref) {
|
|
|
35
35
|
color: 'error.main',
|
|
36
36
|
padding: '20px',
|
|
37
37
|
textAlign: 'center',
|
|
38
|
-
fontSize: '14px'
|
|
38
|
+
fontSize: '14px',
|
|
39
|
+
whiteSpace: 'pre-line',
|
|
40
|
+
maxWidth: '100%',
|
|
41
|
+
wordBreak: 'break-word'
|
|
39
42
|
}
|
|
40
43
|
}, error), svgContent && !error && /*#__PURE__*/React.createElement(Box, {
|
|
41
44
|
dangerouslySetInnerHTML: {
|
|
@@ -36,7 +36,7 @@ var ReadonlyFlow = function ReadonlyFlow(_ref) {
|
|
|
36
36
|
sx: {
|
|
37
37
|
width: '100%',
|
|
38
38
|
height: '100%',
|
|
39
|
-
minHeight: '200px',
|
|
39
|
+
minHeight: error ? 'auto' : '200px',
|
|
40
40
|
display: 'flex',
|
|
41
41
|
alignItems: 'center',
|
|
42
42
|
justifyContent: 'center',
|
|
@@ -48,7 +48,10 @@ var ReadonlyFlow = function ReadonlyFlow(_ref) {
|
|
|
48
48
|
color: 'error.main',
|
|
49
49
|
padding: '20px',
|
|
50
50
|
textAlign: 'center',
|
|
51
|
-
fontSize: '14px'
|
|
51
|
+
fontSize: '14px',
|
|
52
|
+
whiteSpace: 'pre-line',
|
|
53
|
+
maxWidth: '100%',
|
|
54
|
+
wordBreak: 'break-word'
|
|
52
55
|
}
|
|
53
56
|
}, error), svgContent && !error && /*#__PURE__*/React.createElement(Box, {
|
|
54
57
|
dangerouslySetInnerHTML: {
|