@ctzhian/tiptap 1.13.9 → 2.1.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 +133 -123
- package/dist/Editor/index.js +17 -0
- package/dist/EditorToolbar/index.js +11 -9
- package/dist/asset/css/index.css +5 -7
- package/dist/component/ActionDropdown/index.d.ts +5 -0
- package/dist/component/ActionDropdown/index.js +8 -3
- package/dist/component/CustomBubbleMenu/index.js +1 -1
- package/dist/component/CustomDragHandle/index.js +3 -59
- 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/delete-back-2-line-icon.d.ts +6 -0
- package/dist/component/Icons/delete-back-2-line-icon.js +13 -0
- package/dist/component/Icons/{expand-horizontal-line.js → expand-horizontal-line-icon.js} +1 -1
- package/dist/component/Icons/index.d.ts +3 -2
- package/dist/component/Icons/index.js +4 -3
- package/dist/component/Menu/index.js +5 -1
- package/dist/contants/enums.d.ts +9 -0
- package/dist/contants/enums.js +61 -1
- package/dist/extension/component/Alert/index.js +141 -137
- 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/index.js +1 -1
- package/dist/extension/component/TableCellHandleMenu/index.d.ts +9 -0
- package/dist/extension/component/TableCellHandleMenu/index.js +500 -0
- package/dist/extension/component/TableExtendButton/TableExtendButton.css +30 -0
- package/dist/extension/component/TableExtendButton/index.d.ts +23 -0
- package/dist/extension/component/TableExtendButton/index.js +201 -0
- package/dist/extension/component/TableExtendButton/use-table-extend-row-column.d.ts +15 -0
- package/dist/extension/component/TableExtendButton/use-table-extend-row-column.js +87 -0
- package/dist/extension/component/TableHandle/TableHandleMenu.css +36 -0
- package/dist/extension/component/TableHandle/TableHandleMenu.d.ts +17 -0
- package/dist/extension/component/TableHandle/TableHandleMenu.js +685 -0
- package/dist/extension/component/TableHandle/index.d.ts +28 -0
- package/dist/extension/component/TableHandle/index.js +93 -0
- package/dist/extension/component/TableHandle/use-table-handle-positioning.d.ts +40 -0
- package/dist/extension/component/TableHandle/use-table-handle-positioning.js +193 -0
- package/dist/extension/component/TableHandle/use-table-handle-state.d.ts +22 -0
- package/dist/extension/component/TableHandle/use-table-handle-state.js +45 -0
- package/dist/extension/component/TableSelectionOverlay/index.d.ts +16 -0
- package/dist/extension/component/TableSelectionOverlay/index.js +452 -0
- 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 +447 -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/FileHandler.d.ts +1 -1
- 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 +236 -117
- package/dist/extension/node/TableHandler/create-image.d.ts +9 -0
- package/dist/extension/node/TableHandler/create-image.js +235 -0
- package/dist/extension/node/TableHandler/index.d.ts +15 -0
- package/dist/extension/node/TableHandler/index.js +33 -0
- package/dist/extension/node/TableHandler/plugin.d.ts +49 -0
- package/dist/extension/node/TableHandler/plugin.js +1030 -0
- 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 +45 -29
- package/dist/type/index.d.ts +2 -0
- package/dist/util/index.d.ts +9 -0
- package/dist/util/index.js +26 -0
- package/dist/util/table-utils.d.ts +161 -0
- package/dist/util/table-utils.js +605 -0
- package/package.json +2 -1
- package/dist/extension/component/Table/ContextMenu.d.ts +0 -11
- package/dist/extension/component/Table/ContextMenu.js +0 -186
- package/dist/extension/component/Table/TableContextMenuPlugin.d.ts +0 -9
- package/dist/extension/component/Table/TableContextMenuPlugin.js +0 -336
- package/dist/extension/component/Table/index.d.ts +0 -2
- package/dist/extension/component/Table/index.js +0 -2
- /package/dist/component/Icons/{expand-horizontal-line.d.ts → expand-horizontal-line-icon.d.ts} +0 -0
|
@@ -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 DeleteBack2LineIcon = function DeleteBack2LineIcon(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: "M6.53451 3H20.9993C21.5516 3 21.9993 3.44772 21.9993 4V20C21.9993 20.5523 21.5516 21 20.9993 21H6.53451C6.20015 21 5.88792 20.8329 5.70246 20.5547L0.369122 12.5547C0.145189 12.2188 0.145189 11.7812 0.369122 11.4453L5.70246 3.4453C5.88792 3.1671 6.20015 3 6.53451 3ZM7.06969 5L2.40302 12L7.06969 19H19.9993V5H7.06969ZM12.9993 10.5858L15.8277 7.75736L17.242 9.17157L14.4135 12L17.242 14.8284L15.8277 16.2426L12.9993 13.4142L10.1709 16.2426L8.75668 14.8284L11.5851 12L8.75668 9.17157L10.1709 7.75736L12.9993 10.5858Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
DeleteBack2LineIcon.displayName = 'icon-delete-back-2-line';
|
|
@@ -10,4 +10,4 @@ export var ExpandHorizontalLineIcon = function ExpandHorizontalLineIcon(props) {
|
|
|
10
10
|
d: "M0.5 12L5.44975 7.05029L6.86396 8.46451L4.32843 11H10V13H4.32843L6.86148 15.5331L5.44727 16.9473L0.5 12ZM14 13H19.6708L17.1358 15.535L18.55 16.9493L23.5 11.9996L18.5503 7.0498L17.136 8.46402L19.6721 11H14V13Z"
|
|
11
11
|
}));
|
|
12
12
|
};
|
|
13
|
-
ExpandHorizontalLineIcon.displayName = 'expand-horizontal-line';
|
|
13
|
+
ExpandHorizontalLineIcon.displayName = 'icon-expand-horizontal-line';
|
|
@@ -29,10 +29,12 @@ export { CloseCircleFillIcon } from './close-circle-fill-icon';
|
|
|
29
29
|
export { CodeBoxLineIcon } from './code-box-line-icon';
|
|
30
30
|
export { CodeLineIcon } from './code-line-icon';
|
|
31
31
|
export { CodeSSlashLineIcon } from './code-s-slash-line-icon';
|
|
32
|
+
export { CollapseHorizontalLine } from './collapse-horizontal-line';
|
|
32
33
|
export { CollapseIcon } from './collapse-icon';
|
|
33
34
|
export { CommandLineIcon } from './command-line-icon';
|
|
34
35
|
export { CopyIcon } from './copy-icon';
|
|
35
36
|
export { CustomSizeIcon } from './custom-size-icon';
|
|
37
|
+
export { DeleteBack2LineIcon } from './delete-back-2-line-icon';
|
|
36
38
|
export { DeleteColumnIcon } from './delete-column-icon';
|
|
37
39
|
export { DeleteLineIcon } from './delete-line-icon';
|
|
38
40
|
export { DeleteRowIcon } from './delete-row-icon';
|
|
@@ -45,6 +47,7 @@ export { EditLineIcon } from './edit-line-icon';
|
|
|
45
47
|
export { EmotionLineIcon } from './emotion-line-icon';
|
|
46
48
|
export { EraserLineIcon } from './eraser-line-icon';
|
|
47
49
|
export { ErrorWarningFillIcon } from './error-warning-fill-icon';
|
|
50
|
+
export { ExpandHorizontalLineIcon } from './expand-horizontal-line-icon';
|
|
48
51
|
export { ExpendIcon } from './expend-icon';
|
|
49
52
|
export { ExportLineIcon } from './export-line-icon';
|
|
50
53
|
export { FileCopyLineIcon } from './file-copy-line-icon';
|
|
@@ -134,5 +137,3 @@ export { UserSmileFillIcon } from './user-smile-fill-icon';
|
|
|
134
137
|
export { VolumeMuteLineIcon } from './volume-mute-line-icon';
|
|
135
138
|
export { VolumeUpLineIcon } from './volume-up-line-icon';
|
|
136
139
|
export { WindowFillIcon } from './window-fill-icon';
|
|
137
|
-
export { CollapseHorizontalLine } from './collapse-horizontal-line';
|
|
138
|
-
export { ExpandHorizontalLineIcon } from './expand-horizontal-line';
|
|
@@ -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";
|
|
@@ -136,6 +139,4 @@ export { UploadIcon } from "./upload-icon";
|
|
|
136
139
|
export { UserSmileFillIcon } from "./user-smile-fill-icon";
|
|
137
140
|
export { VolumeMuteLineIcon } from "./volume-mute-line-icon";
|
|
138
141
|
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";
|
|
142
|
+
export { WindowFillIcon } from "./window-fill-icon";
|
|
@@ -38,7 +38,9 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
38
38
|
horizontal: 'left'
|
|
39
39
|
}
|
|
40
40
|
} : _ref$childrenProps,
|
|
41
|
-
zIndex = _ref.zIndex
|
|
41
|
+
zIndex = _ref.zIndex,
|
|
42
|
+
onOpen = _ref.onOpen,
|
|
43
|
+
onClose = _ref.onClose;
|
|
42
44
|
var _React$useState = React.useState(null),
|
|
43
45
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
44
46
|
anchorEl = _React$useState2[0],
|
|
@@ -49,9 +51,11 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
49
51
|
context.props.onClick(event);
|
|
50
52
|
}
|
|
51
53
|
setAnchorEl(event.currentTarget);
|
|
54
|
+
onOpen === null || onOpen === void 0 || onOpen();
|
|
52
55
|
};
|
|
53
56
|
var handleClose = function handleClose() {
|
|
54
57
|
setAnchorEl(null);
|
|
58
|
+
onClose === null || onClose === void 0 || onClose();
|
|
55
59
|
};
|
|
56
60
|
React.useImperativeHandle(ref, function () {
|
|
57
61
|
return {
|
package/dist/contants/enums.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Theme } from "@mui/material";
|
|
1
2
|
export declare enum NodeTypeEnum {
|
|
2
3
|
Alert = "alert",
|
|
3
4
|
BlockAttachment = "blockAttachment",
|
|
@@ -30,3 +31,11 @@ export declare const NODE_TYPE_LABEL: Record<NodeTypeEnum, {
|
|
|
30
31
|
download?: boolean;
|
|
31
32
|
[key: string]: any;
|
|
32
33
|
}>;
|
|
34
|
+
export declare const getThemeTextColor: (theme: Theme) => {
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}[];
|
|
38
|
+
export declare const getThemeTextBgColor: (theme: Theme) => {
|
|
39
|
+
label: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}[];
|
package/dist/contants/enums.js
CHANGED
|
@@ -105,4 +105,64 @@ export var NODE_TYPE_LABEL = (_NODE_TYPE_LABEL = {}, _defineProperty(_defineProp
|
|
|
105
105
|
label: '附件'
|
|
106
106
|
}), _defineProperty(_NODE_TYPE_LABEL, NodeTypeEnum.HorizontalRule, {
|
|
107
107
|
label: '分割线'
|
|
108
|
-
}));
|
|
108
|
+
}));
|
|
109
|
+
export var getThemeTextColor = function getThemeTextColor(theme) {
|
|
110
|
+
return [{
|
|
111
|
+
label: '默认色',
|
|
112
|
+
value: theme.palette.text.primary
|
|
113
|
+
}, {
|
|
114
|
+
label: '主题色',
|
|
115
|
+
value: theme.palette.primary.main
|
|
116
|
+
}, {
|
|
117
|
+
label: '成功色',
|
|
118
|
+
value: theme.palette.success.main
|
|
119
|
+
}, {
|
|
120
|
+
label: '警告色',
|
|
121
|
+
value: theme.palette.warning.main
|
|
122
|
+
}, {
|
|
123
|
+
label: '错误色',
|
|
124
|
+
value: theme.palette.error.main
|
|
125
|
+
}, {
|
|
126
|
+
label: '黑色',
|
|
127
|
+
value: theme.palette.common.black
|
|
128
|
+
}, {
|
|
129
|
+
label: '灰色',
|
|
130
|
+
value: theme.palette.text.disabled
|
|
131
|
+
}, {
|
|
132
|
+
label: '白色',
|
|
133
|
+
value: theme.palette.common.white
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
136
|
+
export var getThemeTextBgColor = function getThemeTextBgColor(theme) {
|
|
137
|
+
return [{
|
|
138
|
+
label: '默认背景',
|
|
139
|
+
value: theme.palette.background.paper
|
|
140
|
+
}, {
|
|
141
|
+
label: '灰色背景',
|
|
142
|
+
value: '#f8f8f7'
|
|
143
|
+
}, {
|
|
144
|
+
label: '棕色背景',
|
|
145
|
+
value: '#f4eeee'
|
|
146
|
+
}, {
|
|
147
|
+
label: '橙色背景',
|
|
148
|
+
value: '#fbecdd'
|
|
149
|
+
}, {
|
|
150
|
+
label: '黄色背景',
|
|
151
|
+
value: '#fef9c3'
|
|
152
|
+
}, {
|
|
153
|
+
label: '绿色背景',
|
|
154
|
+
value: '#dcfce7'
|
|
155
|
+
}, {
|
|
156
|
+
label: '蓝色背景',
|
|
157
|
+
value: '#e0f2fe'
|
|
158
|
+
}, {
|
|
159
|
+
label: '紫色背景',
|
|
160
|
+
value: '#f3e8ff'
|
|
161
|
+
}, {
|
|
162
|
+
label: '粉色背景',
|
|
163
|
+
value: '#fcf1f6'
|
|
164
|
+
}, {
|
|
165
|
+
label: '红色背景',
|
|
166
|
+
value: '#ffe4e6'
|
|
167
|
+
}];
|
|
168
|
+
};
|
|
@@ -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;
|
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { FloatingPopover } from "../../../component/FloatingPopover";
|
|
8
8
|
import { Button, Stack, TextField } from "@mui/material";
|
|
9
|
-
import React, { useEffect,
|
|
9
|
+
import React, { useEffect, useState } from "react";
|
|
10
10
|
var EditFlow = function EditFlow(_ref) {
|
|
11
11
|
var anchorEl = _ref.anchorEl,
|
|
12
12
|
attrs = _ref.attrs,
|
|
@@ -16,34 +16,9 @@ var EditFlow = function EditFlow(_ref) {
|
|
|
16
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
17
|
editCode = _useState2[0],
|
|
18
18
|
setEditCode = _useState2[1];
|
|
19
|
-
|
|
20
|
-
// 当 attrs.code 更新时,同步更新 editCode
|
|
21
19
|
useEffect(function () {
|
|
22
20
|
setEditCode(attrs.code || '');
|
|
23
21
|
}, [attrs.code]);
|
|
24
|
-
|
|
25
|
-
// 创建虚拟元素,表示 flow-wrapper 的中心点
|
|
26
|
-
var centerVirtualElement = useMemo(function () {
|
|
27
|
-
if (!anchorEl) return null;
|
|
28
|
-
return {
|
|
29
|
-
getBoundingClientRect: function getBoundingClientRect() {
|
|
30
|
-
// 每次调用时重新计算,确保位置实时更新
|
|
31
|
-
var rect = anchorEl.getBoundingClientRect();
|
|
32
|
-
var centerX = rect.left + rect.width / 2;
|
|
33
|
-
var centerY = rect.top + rect.height / 2;
|
|
34
|
-
return {
|
|
35
|
-
width: 0,
|
|
36
|
-
height: 0,
|
|
37
|
-
x: centerX,
|
|
38
|
-
y: centerY,
|
|
39
|
-
top: centerY,
|
|
40
|
-
left: centerX,
|
|
41
|
-
right: centerX,
|
|
42
|
-
bottom: centerY
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}, [anchorEl]);
|
|
47
22
|
var handleSaveFlow = function handleSaveFlow() {
|
|
48
23
|
var trimmedCode = editCode.trim();
|
|
49
24
|
if (!trimmedCode) return;
|
|
@@ -54,12 +29,9 @@ var EditFlow = function EditFlow(_ref) {
|
|
|
54
29
|
};
|
|
55
30
|
return /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
56
31
|
open: true,
|
|
57
|
-
anchorEl:
|
|
32
|
+
anchorEl: anchorEl,
|
|
58
33
|
onClose: onCancel,
|
|
59
|
-
placement: "
|
|
60
|
-
style: {
|
|
61
|
-
transform: 'translate(-50%, 0)'
|
|
62
|
-
}
|
|
34
|
+
placement: "bottom"
|
|
63
35
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
64
36
|
gap: 2,
|
|
65
37
|
sx: {
|