@ctzhian/tiptap 2.0.0 → 2.1.1
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 +151 -123
- package/dist/EditorToolbar/index.js +11 -9
- package/dist/asset/css/index.css +7 -9
- package/dist/component/ActionDropdown/index.d.ts +5 -0
- package/dist/component/ActionDropdown/index.js +8 -3
- package/dist/component/FloatingPopover/index.d.ts +2 -2
- package/dist/component/HoverPopover/index.d.ts +2 -0
- package/dist/component/HoverPopover/index.js +22 -3
- package/dist/component/Icons/{expand-horizontal-line.js → expand-horizontal-line-icon.js} +1 -1
- package/dist/component/Icons/index.d.ts +8 -2
- package/dist/component/Icons/index.js +9 -3
- package/dist/component/Icons/skip-down-icon.d.ts +6 -0
- package/dist/component/Icons/skip-down-icon.js +13 -0
- package/dist/component/Icons/skip-left-icon.d.ts +6 -0
- package/dist/component/Icons/skip-left-icon.js +13 -0
- package/dist/component/Icons/skip-right-icon.d.ts +6 -0
- package/dist/component/Icons/skip-right-icon.js +13 -0
- package/dist/component/Icons/skip-up-icon.d.ts +6 -0
- package/dist/component/Icons/skip-up-icon.js +13 -0
- package/dist/component/Icons/volume-down-line-icon.d.ts +6 -0
- package/dist/component/Icons/volume-down-line-icon.js +13 -0
- package/dist/extension/component/Alert/index.js +141 -137
- package/dist/extension/component/Attachment/AttachmentContent.d.ts +0 -1
- package/dist/extension/component/Attachment/AttachmentContent.js +33 -8
- package/dist/extension/component/Attachment/index.js +21 -12
- package/dist/extension/component/Audio/AudioPlayer.d.ts +8 -0
- package/dist/extension/component/Audio/{Readonly.js → AudioPlayer.js} +129 -175
- package/dist/extension/component/Audio/index.js +93 -462
- package/dist/extension/component/Flow/Edit.d.ts +1 -1
- package/dist/extension/component/Flow/Edit.js +3 -31
- package/dist/extension/component/Flow/index.js +20 -19
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +16 -2
- package/dist/extension/component/Link/LinkContent.js +2 -0
- package/dist/extension/component/Link/index.js +1 -1
- package/dist/extension/component/TableCellHandleMenu/index.js +60 -3
- package/dist/extension/component/TableHandle/TableHandleAddButton.d.ts +14 -0
- package/dist/extension/component/TableHandle/TableHandleAddButton.js +87 -0
- package/dist/extension/component/TableHandle/TableHandleMenu.css +0 -1
- package/dist/extension/component/TableHandle/TableHandleMenu.js +7 -6
- package/dist/extension/component/TableHandle/index.js +53 -3
- package/dist/extension/component/TableSelectionOverlay/index.js +4 -12
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/component/Video/Insert.js +4 -2
- package/dist/extension/component/Video/Readonly.js +4 -11
- package/dist/extension/component/Video/index.d.ts +2 -1
- package/dist/extension/component/Video/index.js +456 -65
- package/dist/extension/extension/ImeComposition.d.ts +2 -0
- package/dist/extension/extension/ImeComposition.js +145 -0
- package/dist/extension/extension/index.d.ts +1 -0
- package/dist/extension/extension/index.js +1 -0
- package/dist/extension/index.js +2 -2
- package/dist/extension/node/CodeBlockLowlight.js +3 -2
- package/dist/extension/node/Flow/index.d.ts +0 -3
- package/dist/extension/node/Flow/index.js +7 -4
- package/dist/extension/node/Link/index.js +4 -3
- package/dist/extension/node/Table.js +18 -82
- package/dist/extension/node/TableOfContents/index.d.ts +5 -3
- package/dist/extension/node/TableOfContents/index.js +22 -2
- package/dist/extension/node/Video.d.ts +1 -0
- package/dist/extension/node/Video.js +38 -6
- package/dist/hook/index.js +1 -1
- package/dist/index.css +17 -20
- package/dist/util/index.d.ts +9 -0
- package/dist/util/index.js +26 -0
- package/package.json +1 -1
- package/dist/extension/component/Audio/Readonly.d.ts +0 -8
- /package/dist/component/Icons/{expand-horizontal-line.d.ts → expand-horizontal-line-icon.d.ts} +0 -0
|
@@ -32,10 +32,12 @@ export { CloseCircleFillIcon } from "./close-circle-fill-icon";
|
|
|
32
32
|
export { CodeBoxLineIcon } from "./code-box-line-icon";
|
|
33
33
|
export { CodeLineIcon } from "./code-line-icon";
|
|
34
34
|
export { CodeSSlashLineIcon } from "./code-s-slash-line-icon";
|
|
35
|
+
export { CollapseHorizontalLine } from "./collapse-horizontal-line";
|
|
35
36
|
export { CollapseIcon } from "./collapse-icon";
|
|
36
37
|
export { CommandLineIcon } from "./command-line-icon";
|
|
37
38
|
export { CopyIcon } from "./copy-icon";
|
|
38
39
|
export { CustomSizeIcon } from "./custom-size-icon";
|
|
40
|
+
export { DeleteBack2LineIcon } from "./delete-back-2-line-icon";
|
|
39
41
|
export { DeleteColumnIcon } from "./delete-column-icon";
|
|
40
42
|
export { DeleteLineIcon } from "./delete-line-icon";
|
|
41
43
|
export { DeleteRowIcon } from "./delete-row-icon";
|
|
@@ -48,6 +50,7 @@ export { EditLineIcon } from "./edit-line-icon";
|
|
|
48
50
|
export { EmotionLineIcon } from "./emotion-line-icon";
|
|
49
51
|
export { EraserLineIcon } from "./eraser-line-icon";
|
|
50
52
|
export { ErrorWarningFillIcon } from "./error-warning-fill-icon";
|
|
53
|
+
export { ExpandHorizontalLineIcon } from "./expand-horizontal-line-icon";
|
|
51
54
|
export { ExpendIcon } from "./expend-icon";
|
|
52
55
|
export { ExportLineIcon } from "./export-line-icon";
|
|
53
56
|
export { FileCopyLineIcon } from "./file-copy-line-icon";
|
|
@@ -117,6 +120,10 @@ export { ScreenshotLineIcon } from "./screenshot-line-icon";
|
|
|
117
120
|
export { ScrollToBottomLineIcon } from "./scroll-to-bottom-line-icon";
|
|
118
121
|
export { SeparatorIcon } from "./separator-icon";
|
|
119
122
|
export { ShareBoxLineIcon } from "./share-box-line-icon";
|
|
123
|
+
export { SkipDownIcon } from "./skip-down-icon";
|
|
124
|
+
export { SkipLeftIcon } from "./skip-left-icon";
|
|
125
|
+
export { SkipRightIcon } from "./skip-right-icon";
|
|
126
|
+
export { SkipUpIcon } from "./skip-up-icon";
|
|
120
127
|
export { SlashCommands2Icon } from "./slash-commands-2-icon";
|
|
121
128
|
export { SpeedLineIcon } from "./speed-line-icon";
|
|
122
129
|
export { SplitCellsHorizontalIcon } from "./split-cells-horizontal-icon";
|
|
@@ -134,8 +141,7 @@ export { UnderlineIcon } from "./underline-icon";
|
|
|
134
141
|
export { UploadCloud2LineIcon } from "./upload-cloud-2-line-icon";
|
|
135
142
|
export { UploadIcon } from "./upload-icon";
|
|
136
143
|
export { UserSmileFillIcon } from "./user-smile-fill-icon";
|
|
144
|
+
export { VolumeDownLineIcon } from "./volume-down-line-icon";
|
|
137
145
|
export { VolumeMuteLineIcon } from "./volume-mute-line-icon";
|
|
138
146
|
export { VolumeUpLineIcon } from "./volume-up-line-icon";
|
|
139
|
-
export { WindowFillIcon } from "./window-fill-icon";
|
|
140
|
-
export { CollapseHorizontalLine } from "./collapse-horizontal-line";
|
|
141
|
-
export { ExpandHorizontalLineIcon } from "./expand-horizontal-line";
|
|
147
|
+
export { WindowFillIcon } from "./window-fill-icon";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var SkipDownIcon = function SkipDownIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M12 10.0858L7.20711 5.29291L5.79289 6.70712L12 12.9142L18.2071 6.70712L16.7929 5.29291L12 10.0858ZM18 17L6 17L6 15L18 15V17Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
SkipDownIcon.displayName = 'icon-skip-down';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var SkipLeftIcon = function SkipLeftIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M13.9142 12L18.7071 7.20712L17.2929 5.79291L11.0858 12L17.2929 18.2071L18.7071 16.7929L13.9142 12ZM7 18V6.00001H9V18H7Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
SkipLeftIcon.displayName = 'icon-skip-left';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var SkipRightIcon = function SkipRightIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M10.0858 12L5.29289 16.7929L6.70711 18.2071L12.9142 12L6.70711 5.79291L5.29289 7.20712L10.0858 12ZM17 6.00002L17 18H15L15 6.00002L17 6.00002Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
SkipRightIcon.displayName = 'icon-skip-right';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var SkipUpIcon = function SkipUpIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M12 13.9142L16.7929 18.7071L18.2071 17.2929L12 11.0858L5.79289 17.2929L7.20711 18.7071L12 13.9142ZM6 7L18 7V9L6 9L6 7Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
SkipUpIcon.displayName = 'icon-skip-up';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var VolumeDownLineIcon = function VolumeDownLineIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M13 7.22056L9.60282 10.0001H6V14.0001H9.60282L13 16.7796V7.22056ZM8.88889 16.0001H5C4.44772 16.0001 4 15.5524 4 15.0001V9.00007C4 8.44778 4.44772 8.00007 5 8.00007H8.88889L14.1834 3.66821C14.3971 3.49335 14.7121 3.52485 14.887 3.73857C14.9601 3.8279 15 3.93977 15 4.05519V19.9449C15 20.2211 14.7761 20.4449 14.5 20.4449C14.3846 20.4449 14.2727 20.405 14.1834 20.3319L8.88889 16.0001ZM18.8631 16.5911L17.4411 15.1691C18.3892 14.4376 19 13.2902 19 12.0001C19 10.5697 18.2493 9.31476 17.1203 8.60766L18.5589 7.16906C20.0396 8.26166 21 10.0187 21 12.0001C21 13.8422 20.1698 15.4905 18.8631 16.5911Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
VolumeDownLineIcon.displayName = 'icon-volume-down-line';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
function
|
|
7
|
-
import {
|
|
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 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
|
+
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
|
+
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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
|
+
import { ActionDropdown, HoverPopover } from "../../../component";
|
|
8
8
|
import { CheckboxCircleFillIcon, CloseCircleFillIcon, ErrorWarningFillIcon, Information2FillIcon, ScrollToBottomLineIcon, TextIcon, UserSmileFillIcon } from "../../../component/Icons";
|
|
9
9
|
import { ToolbarItem } from "../../../component/Toolbar";
|
|
10
10
|
import { Box, Divider, Stack } from '@mui/material';
|
|
11
11
|
import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';
|
|
12
|
-
import React, { useMemo, useRef
|
|
12
|
+
import React, { useMemo, useRef } from 'react';
|
|
13
13
|
var VARIANT_DATA = {
|
|
14
14
|
info: {
|
|
15
15
|
icon: /*#__PURE__*/React.createElement(Information2FillIcon, {
|
|
@@ -53,17 +53,13 @@ var VARIANT_DATA = {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
var AlertView = function AlertView(_ref) {
|
|
56
|
-
var _node$attrs;
|
|
56
|
+
var _node$attrs, _node$attrs2;
|
|
57
57
|
var editor = _ref.editor,
|
|
58
58
|
node = _ref.node,
|
|
59
59
|
updateAttributes = _ref.updateAttributes,
|
|
60
60
|
selected = _ref.selected;
|
|
61
61
|
var attrs = node.attrs;
|
|
62
62
|
var containerRef = useRef(null);
|
|
63
|
-
var _useState = useState(null),
|
|
64
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
-
anchorEl = _useState2[0],
|
|
66
|
-
setAnchorEl = _useState2[1];
|
|
67
63
|
var showIcon = attrs.type !== 'text';
|
|
68
64
|
var variantData = useMemo(function () {
|
|
69
65
|
if (attrs.variant && VARIANT_DATA[attrs.variant]) {
|
|
@@ -71,31 +67,127 @@ var AlertView = function AlertView(_ref) {
|
|
|
71
67
|
}
|
|
72
68
|
return VARIANT_DATA['default'];
|
|
73
69
|
}, [attrs.variant]);
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
var variantOptions = [{
|
|
71
|
+
key: 'info',
|
|
72
|
+
label: '信息',
|
|
73
|
+
icon: Information2FillIcon,
|
|
74
|
+
color: 'primary.main'
|
|
75
|
+
}, {
|
|
76
|
+
key: 'warning',
|
|
77
|
+
label: '警告',
|
|
78
|
+
icon: ErrorWarningFillIcon,
|
|
79
|
+
color: 'warning.main'
|
|
80
|
+
}, {
|
|
81
|
+
key: 'error',
|
|
82
|
+
label: '错误',
|
|
83
|
+
icon: CloseCircleFillIcon,
|
|
84
|
+
color: 'error.main'
|
|
85
|
+
}, {
|
|
86
|
+
key: 'success',
|
|
87
|
+
label: '成功',
|
|
88
|
+
icon: CheckboxCircleFillIcon,
|
|
89
|
+
color: 'success.main'
|
|
90
|
+
}, {
|
|
91
|
+
key: 'default',
|
|
92
|
+
label: '默认',
|
|
93
|
+
icon: UserSmileFillIcon,
|
|
94
|
+
color: 'text.disabled'
|
|
95
|
+
}];
|
|
96
|
+
var typeOptions = [{
|
|
97
|
+
key: 'text',
|
|
98
|
+
label: '纯文字',
|
|
99
|
+
icon: TextIcon,
|
|
100
|
+
onClick: function onClick() {
|
|
101
|
+
return updateAttributes({
|
|
102
|
+
type: 'text'
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: 'icon',
|
|
107
|
+
label: '图标文字',
|
|
108
|
+
icon: ScrollToBottomLineIcon,
|
|
109
|
+
iconTransform: 'rotate(90deg)',
|
|
110
|
+
onClick: function onClick() {
|
|
111
|
+
return updateAttributes({
|
|
112
|
+
type: 'icon'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}];
|
|
116
|
+
var renderOperationActions = function renderOperationActions() {
|
|
117
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
118
|
+
direction: 'row',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
sx: {
|
|
121
|
+
p: 0.5
|
|
122
|
+
}
|
|
123
|
+
}, variantOptions.map(function (option) {
|
|
124
|
+
var IconComponent = option.icon;
|
|
125
|
+
return /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
126
|
+
key: option.key,
|
|
127
|
+
icon: /*#__PURE__*/React.createElement(IconComponent, {
|
|
128
|
+
sx: {
|
|
129
|
+
fontSize: '1rem',
|
|
130
|
+
color: option.color
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
tip: option.label,
|
|
134
|
+
onClick: function onClick() {
|
|
135
|
+
return updateAttributes({
|
|
136
|
+
variant: option.key
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
className: attrs.variant === option.key ? 'tool-active' : ''
|
|
140
|
+
});
|
|
141
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
142
|
+
orientation: "vertical",
|
|
143
|
+
flexItem: true,
|
|
144
|
+
sx: {
|
|
145
|
+
height: '1rem',
|
|
146
|
+
mx: 0.5,
|
|
147
|
+
alignSelf: 'center',
|
|
148
|
+
borderColor: 'divider'
|
|
149
|
+
}
|
|
150
|
+
}), /*#__PURE__*/React.createElement(ActionDropdown, {
|
|
151
|
+
id: "alert-type-dropdown",
|
|
152
|
+
selected: attrs.type || 'icon',
|
|
153
|
+
list: typeOptions.map(function (option) {
|
|
154
|
+
var IconComponent = option.icon;
|
|
155
|
+
return {
|
|
156
|
+
key: option.key,
|
|
157
|
+
label: option.label,
|
|
158
|
+
icon: /*#__PURE__*/React.createElement(IconComponent, {
|
|
159
|
+
sx: _objectSpread({
|
|
160
|
+
fontSize: '1rem'
|
|
161
|
+
}, option.iconTransform ? {
|
|
162
|
+
transform: option.iconTransform
|
|
163
|
+
} : {})
|
|
164
|
+
}),
|
|
165
|
+
onClick: option.onClick
|
|
166
|
+
};
|
|
167
|
+
})
|
|
168
|
+
}));
|
|
79
169
|
};
|
|
80
170
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
81
171
|
ref: containerRef,
|
|
82
172
|
className: "alert-wrapper ".concat(selected ? 'ProseMirror-selectednode' : ''),
|
|
83
173
|
"data-drag-handle": true,
|
|
84
|
-
as: 'div'
|
|
85
|
-
|
|
174
|
+
as: 'div'
|
|
175
|
+
}, editor.isEditable ? /*#__PURE__*/React.createElement(HoverPopover, {
|
|
176
|
+
actions: renderOperationActions(),
|
|
177
|
+
placement: "top",
|
|
178
|
+
offset: 4
|
|
179
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
180
|
+
sx: {
|
|
86
181
|
marginLeft: (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.indent ? node.attrs.indent * 32 : undefined,
|
|
87
182
|
border: '1px solid',
|
|
88
183
|
borderColor: variantData.color,
|
|
89
|
-
|
|
90
|
-
borderRadius: '10px',
|
|
184
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
91
185
|
padding: '12px 16px',
|
|
92
|
-
lineHeight: 1.625,
|
|
93
186
|
display: 'flex',
|
|
94
187
|
alignItems: 'flex-start',
|
|
95
188
|
gap: '16px',
|
|
96
189
|
background: attrs.variant === 'default' ? 'var(--mui-palette-background-paper3)' : "color-mix(in srgb, ".concat(variantData.color, " 10%, transparent)")
|
|
97
|
-
}
|
|
98
|
-
onClick: handleShowOperationPopover
|
|
190
|
+
}
|
|
99
191
|
}, showIcon && /*#__PURE__*/React.createElement(Box, {
|
|
100
192
|
sx: {
|
|
101
193
|
pt: '2px',
|
|
@@ -113,123 +205,35 @@ var AlertView = function AlertView(_ref) {
|
|
|
113
205
|
}
|
|
114
206
|
}, /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
115
207
|
as: 'div'
|
|
116
|
-
}))
|
|
117
|
-
open: Boolean(anchorEl),
|
|
118
|
-
anchorEl: anchorEl,
|
|
119
|
-
onClose: handleCloseOperationPopover,
|
|
120
|
-
placement: "top"
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Stack, {
|
|
122
|
-
direction: 'row',
|
|
123
|
-
alignItems: 'center',
|
|
208
|
+
})))) : /*#__PURE__*/React.createElement(Box, {
|
|
124
209
|
sx: {
|
|
125
|
-
|
|
210
|
+
marginLeft: (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.indent ? node.attrs.indent * 32 : undefined,
|
|
211
|
+
border: '1px solid',
|
|
212
|
+
borderColor: variantData.color,
|
|
213
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
214
|
+
padding: '12px 16px',
|
|
215
|
+
display: 'flex',
|
|
216
|
+
alignItems: 'flex-start',
|
|
217
|
+
gap: '16px',
|
|
218
|
+
background: attrs.variant === 'default' ? 'var(--mui-palette-background-paper3)' : "color-mix(in srgb, ".concat(variantData.color, " 10%, transparent)")
|
|
126
219
|
}
|
|
127
|
-
}, /*#__PURE__*/React.createElement(
|
|
128
|
-
icon: /*#__PURE__*/React.createElement(Information2FillIcon, {
|
|
129
|
-
sx: {
|
|
130
|
-
fontSize: '1rem',
|
|
131
|
-
color: 'primary.main'
|
|
132
|
-
}
|
|
133
|
-
}),
|
|
134
|
-
tip: "\u4FE1\u606F",
|
|
135
|
-
onClick: function onClick() {
|
|
136
|
-
return updateAttributes({
|
|
137
|
-
variant: 'info'
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
className: attrs.variant === 'info' ? 'tool-active' : ''
|
|
141
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
142
|
-
icon: /*#__PURE__*/React.createElement(ErrorWarningFillIcon, {
|
|
143
|
-
sx: {
|
|
144
|
-
fontSize: '1rem',
|
|
145
|
-
color: 'warning.main'
|
|
146
|
-
}
|
|
147
|
-
}),
|
|
148
|
-
tip: "\u8B66\u544A",
|
|
149
|
-
onClick: function onClick() {
|
|
150
|
-
return updateAttributes({
|
|
151
|
-
variant: 'warning'
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
className: attrs.variant === 'warning' ? 'tool-active' : ''
|
|
155
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
156
|
-
icon: /*#__PURE__*/React.createElement(CloseCircleFillIcon, {
|
|
157
|
-
sx: {
|
|
158
|
-
fontSize: '1rem',
|
|
159
|
-
color: 'error.main'
|
|
160
|
-
}
|
|
161
|
-
}),
|
|
162
|
-
tip: "\u9519\u8BEF",
|
|
163
|
-
onClick: function onClick() {
|
|
164
|
-
return updateAttributes({
|
|
165
|
-
variant: 'error'
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
className: attrs.variant === 'error' ? 'tool-active' : ''
|
|
169
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
170
|
-
icon: /*#__PURE__*/React.createElement(CheckboxCircleFillIcon, {
|
|
171
|
-
sx: {
|
|
172
|
-
fontSize: '1rem',
|
|
173
|
-
color: 'success.main'
|
|
174
|
-
}
|
|
175
|
-
}),
|
|
176
|
-
tip: "\u6210\u529F",
|
|
177
|
-
onClick: function onClick() {
|
|
178
|
-
return updateAttributes({
|
|
179
|
-
variant: 'success'
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
className: attrs.variant === 'success' ? 'tool-active' : ''
|
|
183
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
184
|
-
icon: /*#__PURE__*/React.createElement(UserSmileFillIcon, {
|
|
185
|
-
sx: {
|
|
186
|
-
fontSize: '1rem',
|
|
187
|
-
color: 'text.disabled'
|
|
188
|
-
}
|
|
189
|
-
}),
|
|
190
|
-
tip: "\u9ED8\u8BA4",
|
|
191
|
-
onClick: function onClick() {
|
|
192
|
-
return updateAttributes({
|
|
193
|
-
variant: 'default'
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
className: attrs.variant === 'default' ? 'tool-active' : ''
|
|
197
|
-
}), /*#__PURE__*/React.createElement(Divider, {
|
|
198
|
-
orientation: "vertical",
|
|
199
|
-
flexItem: true,
|
|
220
|
+
}, showIcon && /*#__PURE__*/React.createElement(Box, {
|
|
200
221
|
sx: {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
borderColor: 'divider'
|
|
222
|
+
pt: '2px',
|
|
223
|
+
lineHeight: 1,
|
|
224
|
+
color: attrs.variant === 'default' ? 'text.disabled' : variantData.color
|
|
205
225
|
}
|
|
206
|
-
}), /*#__PURE__*/React.createElement(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
onClick: function onClick() {
|
|
214
|
-
return updateAttributes({
|
|
215
|
-
type: 'text'
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
className: attrs.type === 'text' ? 'tool-active' : ''
|
|
219
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
220
|
-
icon: /*#__PURE__*/React.createElement(ScrollToBottomLineIcon, {
|
|
221
|
-
sx: {
|
|
222
|
-
transform: 'rotate(90deg)',
|
|
223
|
-
fontSize: '1rem'
|
|
226
|
+
}, variantData.icon), /*#__PURE__*/React.createElement(Box, {
|
|
227
|
+
sx: {
|
|
228
|
+
flex: 1,
|
|
229
|
+
width: 0,
|
|
230
|
+
'code': {
|
|
231
|
+
borderColor: attrs.variant === 'default' ? '' : "color-mix(in srgb, ".concat(variantData.color, " 30%, transparent) !important"),
|
|
232
|
+
bgcolor: attrs.variant === 'default' ? '' : "color-mix(in srgb, ".concat(variantData.color, " 10%, transparent) !important")
|
|
224
233
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return updateAttributes({
|
|
229
|
-
type: 'icon'
|
|
230
|
-
});
|
|
231
|
-
},
|
|
232
|
-
className: attrs.type === 'icon' ? 'tool-active' : ''
|
|
234
|
+
}
|
|
235
|
+
}, /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
236
|
+
as: 'div'
|
|
233
237
|
}))));
|
|
234
238
|
};
|
|
235
239
|
export default AlertView;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
import { Download2LineIcon, FileIcon } from "../../../component/Icons";
|
|
9
|
+
import { Box, IconButton, Stack } from "@mui/material";
|
|
10
|
+
import React, { useState } from "react";
|
|
5
11
|
/**
|
|
6
12
|
* 附件内容组件
|
|
7
13
|
* 用于渲染附件的实际内容,支持编辑和只读模式
|
|
@@ -11,7 +17,10 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
11
17
|
type = _ref.type,
|
|
12
18
|
_ref$editable = _ref.editable,
|
|
13
19
|
editable = _ref$editable === void 0 ? false : _ref$editable;
|
|
14
|
-
|
|
20
|
+
var _useState = useState(false),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
isHovered = _useState2[0],
|
|
23
|
+
setIsHovered = _useState2[1];
|
|
15
24
|
var blockStyles = editable ? {
|
|
16
25
|
display: 'flex',
|
|
17
26
|
border: '1px solid',
|
|
@@ -66,7 +75,13 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
66
75
|
'data-title': attrs.title,
|
|
67
76
|
'data-type': attrs.type
|
|
68
77
|
}, {
|
|
69
|
-
sx: blockStyles
|
|
78
|
+
sx: blockStyles,
|
|
79
|
+
onMouseEnter: function onMouseEnter() {
|
|
80
|
+
return setIsHovered(true);
|
|
81
|
+
},
|
|
82
|
+
onMouseLeave: function onMouseLeave() {
|
|
83
|
+
return setIsHovered(false);
|
|
84
|
+
}
|
|
70
85
|
}), /*#__PURE__*/React.createElement(Stack, _extends({
|
|
71
86
|
direction: 'row',
|
|
72
87
|
alignItems: 'center',
|
|
@@ -75,9 +90,9 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
75
90
|
}, !editable && {
|
|
76
91
|
'data-title': attrs.title,
|
|
77
92
|
'data-type': type
|
|
78
|
-
}), /*#__PURE__*/React.createElement(
|
|
93
|
+
}), /*#__PURE__*/React.createElement(FileIcon, {
|
|
79
94
|
sx: {
|
|
80
|
-
fontSize: '
|
|
95
|
+
fontSize: '1.625rem',
|
|
81
96
|
color: attrs.url === 'error' ? 'error.main' : 'primary.main',
|
|
82
97
|
alignSelf: 'center'
|
|
83
98
|
}
|
|
@@ -96,7 +111,17 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
96
111
|
fontSize: '0.75rem',
|
|
97
112
|
color: 'text.secondary'
|
|
98
113
|
}
|
|
99
|
-
}, attrs.size))
|
|
114
|
+
}, attrs.size)), isHovered && /*#__PURE__*/React.createElement(IconButton, {
|
|
115
|
+
size: "small",
|
|
116
|
+
sx: {
|
|
117
|
+
color: attrs.url === 'error' ? 'error.main' : 'text.disabled',
|
|
118
|
+
alignSelf: 'center'
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Download2LineIcon, {
|
|
121
|
+
sx: {
|
|
122
|
+
fontSize: '1rem'
|
|
123
|
+
}
|
|
124
|
+
})))) : /*#__PURE__*/React.createElement(Box, _extends({
|
|
100
125
|
component: "a",
|
|
101
126
|
href: attrs.url,
|
|
102
127
|
target: "_blank",
|
|
@@ -93,14 +93,6 @@ var AttachmentViewWrapper = function AttachmentViewWrapper(_ref) {
|
|
|
93
93
|
p: 0.5
|
|
94
94
|
}
|
|
95
95
|
}, /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
96
|
-
icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
|
|
97
|
-
sx: {
|
|
98
|
-
fontSize: '1rem'
|
|
99
|
-
}
|
|
100
|
-
}),
|
|
101
|
-
tip: "\u4E0B\u8F7D",
|
|
102
|
-
onClick: handleDownload
|
|
103
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
104
96
|
icon: /*#__PURE__*/React.createElement(EditLineIcon, {
|
|
105
97
|
sx: {
|
|
106
98
|
fontSize: '1rem'
|
|
@@ -109,13 +101,13 @@ var AttachmentViewWrapper = function AttachmentViewWrapper(_ref) {
|
|
|
109
101
|
tip: "\u7F16\u8F91",
|
|
110
102
|
onClick: handleShowPopover
|
|
111
103
|
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
112
|
-
icon: /*#__PURE__*/React.createElement(
|
|
104
|
+
icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
|
|
113
105
|
sx: {
|
|
114
106
|
fontSize: '1rem'
|
|
115
107
|
}
|
|
116
108
|
}),
|
|
117
|
-
tip: "\
|
|
118
|
-
onClick:
|
|
109
|
+
tip: "\u4E0B\u8F7D",
|
|
110
|
+
onClick: handleDownload
|
|
119
111
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
120
112
|
orientation: "vertical",
|
|
121
113
|
flexItem: true,
|
|
@@ -153,6 +145,23 @@ var AttachmentViewWrapper = function AttachmentViewWrapper(_ref) {
|
|
|
153
145
|
return handleConvertAttachmentType('block');
|
|
154
146
|
}
|
|
155
147
|
}]
|
|
148
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
149
|
+
orientation: "vertical",
|
|
150
|
+
flexItem: true,
|
|
151
|
+
sx: {
|
|
152
|
+
height: '1rem',
|
|
153
|
+
mx: 0.5,
|
|
154
|
+
alignSelf: 'center',
|
|
155
|
+
borderColor: 'divider'
|
|
156
|
+
}
|
|
157
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
158
|
+
icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
|
|
159
|
+
sx: {
|
|
160
|
+
fontSize: '1rem'
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
tip: "\u5220\u9664",
|
|
164
|
+
onClick: handleDeleteAttachment
|
|
156
165
|
}));
|
|
157
166
|
};
|
|
158
167
|
var handleSave = function handleSave() {
|
|
@@ -177,7 +186,7 @@ var AttachmentViewWrapper = function AttachmentViewWrapper(_ref) {
|
|
|
177
186
|
}
|
|
178
187
|
if (!editor.isEditable) {
|
|
179
188
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
180
|
-
className: "attachment-wrapper".concat(attachmentDisplayType === 'block' ? '
|
|
189
|
+
className: "attachment-wrapper ".concat(attachmentDisplayType === 'block' ? 'block-attachment-wrapper' : ''),
|
|
181
190
|
as: attachmentDisplayType === 'block' ? 'div' : 'span'
|
|
182
191
|
}, /*#__PURE__*/React.createElement(AttachmentContent, {
|
|
183
192
|
attrs: attrs,
|