@ctzhian/tiptap 1.13.2 → 1.13.3
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.
|
@@ -6,7 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
6
6
|
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; }
|
|
7
7
|
import { Box, Divider, Stack, Typography } from "@mui/material";
|
|
8
8
|
import React from "react";
|
|
9
|
-
import { AddCircleFillIcon, ArrowDownSLineIcon, AttachmentLineIcon, BoldIcon, CheckboxCircleFillIcon, CloseCircleFillIcon, CodeBoxLineIcon, CodeLineIcon, CodeSSlashLineIcon, DoubleQuotesLIcon, ErrorWarningFillIcon, Folder2LineIcon, FormulaIcon, FunctionsIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, H6Icon, ImageLineIcon, Information2FillIcon, Information2LineIcon, ItalicIcon, LinkIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MarkPenLineIcon, MenuFold2FillIcon, MovieLineIcon, Music2LineIcon, SeparatorIcon, SquareRootIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, Table2Icon, UnderlineIcon, UserSmileFillIcon } from "../component/Icons";
|
|
9
|
+
import { AddCircleFillIcon, ArrowDownSLineIcon, AttachmentLineIcon, BoldIcon, CheckboxCircleFillIcon, CloseCircleFillIcon, CodeBoxLineIcon, CodeLineIcon, CodeSSlashLineIcon, DoubleQuotesLIcon, ErrorWarningFillIcon, FlowChartIcon, Folder2LineIcon, FormulaIcon, FunctionsIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, H6Icon, ImageLineIcon, Information2FillIcon, Information2LineIcon, ItalicIcon, LinkIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MarkPenLineIcon, MenuFold2FillIcon, MovieLineIcon, Music2LineIcon, SeparatorIcon, SquareRootIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, Table2Icon, UnderlineIcon, UserSmileFillIcon } from "../component/Icons";
|
|
10
10
|
import Menu from "../component/Menu";
|
|
11
11
|
import { ToolbarItem } from "../component/Toolbar";
|
|
12
12
|
import TableSizePicker from "../component/Toolbar/TableSizePicker";
|
|
@@ -674,8 +674,23 @@ var EditorMarkdownToolbar = function EditorMarkdownToolbar(_ref) {
|
|
|
674
674
|
fontSize: '12px',
|
|
675
675
|
color: 'text.disabled'
|
|
676
676
|
}
|
|
677
|
-
}, "\
|
|
678
|
-
key: '
|
|
677
|
+
}, "\u4E13\u4E1A"),
|
|
678
|
+
key: 'professional'
|
|
679
|
+
}, {
|
|
680
|
+
label: '流程图',
|
|
681
|
+
key: 'flowchart',
|
|
682
|
+
icon: /*#__PURE__*/React.createElement(FlowChartIcon, {
|
|
683
|
+
sx: {
|
|
684
|
+
fontSize: '1rem'
|
|
685
|
+
}
|
|
686
|
+
}),
|
|
687
|
+
onClick: function onClick() {
|
|
688
|
+
return handleInsertBlock({
|
|
689
|
+
text: '```mermaid\n\n```',
|
|
690
|
+
row: 1,
|
|
691
|
+
wrap: true
|
|
692
|
+
});
|
|
693
|
+
}
|
|
679
694
|
}, {
|
|
680
695
|
label: '代码',
|
|
681
696
|
key: 'code',
|
|
@@ -25,14 +25,12 @@ var ReadonlyImage = function ReadonlyImage(_ref) {
|
|
|
25
25
|
}
|
|
26
26
|
})), attrs.title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Box, {
|
|
27
27
|
component: "span",
|
|
28
|
+
className: "editor-image-title",
|
|
28
29
|
sx: {
|
|
29
30
|
position: 'relative',
|
|
30
|
-
left: '50%',
|
|
31
|
-
transform: 'translateX(-50%)',
|
|
32
31
|
display: 'inline-block',
|
|
33
32
|
fontSize: '0.75rem',
|
|
34
|
-
color: 'text.tertiary'
|
|
35
|
-
mt: 1.5
|
|
33
|
+
color: 'text.tertiary'
|
|
36
34
|
}
|
|
37
35
|
}, attrs.title))));
|
|
38
36
|
};
|
|
@@ -483,6 +483,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
483
483
|
}
|
|
484
484
|
}))), attrs.title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Box, {
|
|
485
485
|
component: "span",
|
|
486
|
+
className: "editor-image-title",
|
|
486
487
|
sx: {
|
|
487
488
|
display: 'inline-block',
|
|
488
489
|
fontSize: '0.75rem',
|
|
@@ -40,7 +40,7 @@ var customImage = function customImage(props) {
|
|
|
40
40
|
key: new PluginKey('imagePasteHandler'),
|
|
41
41
|
props: {
|
|
42
42
|
handlePaste: function handlePaste(view, event) {
|
|
43
|
-
var _event$clipboardData;
|
|
43
|
+
var _event$clipboardData, _event$clipboardData2, _event$clipboardData3;
|
|
44
44
|
if (!props.onUpload) return false;
|
|
45
45
|
var items = Array.from(((_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.items) || []);
|
|
46
46
|
var imageFiles = items.map(function (item) {
|
|
@@ -49,6 +49,23 @@ var customImage = function customImage(props) {
|
|
|
49
49
|
return file !== null && getFileType(file) === 'image';
|
|
50
50
|
});
|
|
51
51
|
if (imageFiles.length === 0) return false;
|
|
52
|
+
var htmlData = (_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData('text/html');
|
|
53
|
+
if (htmlData && htmlData.trim().length > 0) {
|
|
54
|
+
var htmlLower = htmlData.toLowerCase();
|
|
55
|
+
if (htmlLower.includes('<table') || htmlLower.includes('<tr') || htmlLower.includes('<td') || htmlLower.includes('<th')) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
var textData = (_event$clipboardData3 = event.clipboardData) === null || _event$clipboardData3 === void 0 ? void 0 : _event$clipboardData3.getData('text/plain');
|
|
60
|
+
if (textData && textData.trim().length > 0) {
|
|
61
|
+
var trimmedText = textData.trim();
|
|
62
|
+
var hasTab = trimmedText.includes('\t');
|
|
63
|
+
var lineCount = trimmedText.split('\n').length;
|
|
64
|
+
var isLikelyFileName = /\.(jpg|jpeg|png|gif|webp|svg|bmp)$/i.test(trimmedText);
|
|
65
|
+
if ((hasTab || lineCount > 2) && !isLikelyFileName) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
52
69
|
var from = view.state.selection.from;
|
|
53
70
|
var editor = _this2.editor;
|
|
54
71
|
var findNodePosition = function findNodePosition(typeName, tempId) {
|