@lobehub/editor 1.33.0 → 1.33.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/es/locale/index.d.ts +4 -0
- package/es/locale/index.js +4 -0
- package/es/plugins/litexml/react/{DiffNodeToolbar.d.ts → DiffNodeToolbar/index.d.ts} +1 -1
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +62 -0
- package/es/plugins/litexml/react/DiffNodeToolbar/style.d.ts +5 -0
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +13 -0
- package/es/plugins/litexml/react/style.js +1 -1
- package/package.json +1 -1
- package/es/plugins/litexml/react/DiffNodeToolbar.js +0 -47
package/es/locale/index.d.ts
CHANGED
package/es/locale/index.js
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ActionIcon, Block } from '@lobehub/ui';
|
|
2
|
+
import { Check, X } from 'lucide-react';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { LexicalPortalContainer } from "../../../../editor-kernel/react";
|
|
5
|
+
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
6
|
+
import { DiffAction, LITEXML_DIFFNODE_COMMAND } from "../../command/diffCommand";
|
|
7
|
+
import { useStyles } from "./style";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
var ReactDiffNodeToolbar = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
+
var editor = _ref.editor,
|
|
12
|
+
node = _ref.node;
|
|
13
|
+
var t = useTranslation();
|
|
14
|
+
var _useStyles = useStyles(),
|
|
15
|
+
styles = _useStyles.styles;
|
|
16
|
+
return /*#__PURE__*/_jsx(LexicalPortalContainer, {
|
|
17
|
+
editor: editor,
|
|
18
|
+
node: node,
|
|
19
|
+
children: /*#__PURE__*/_jsxs(Block, {
|
|
20
|
+
className: styles.toolbar,
|
|
21
|
+
gap: 2,
|
|
22
|
+
horizontal: true,
|
|
23
|
+
padding: 2,
|
|
24
|
+
shadow: true,
|
|
25
|
+
variant: 'outlined',
|
|
26
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
27
|
+
"aria-label": "Reject change",
|
|
28
|
+
className: styles.reject,
|
|
29
|
+
danger: true,
|
|
30
|
+
icon: X,
|
|
31
|
+
onClick: function onClick() {
|
|
32
|
+
editor.dispatchCommand(LITEXML_DIFFNODE_COMMAND, {
|
|
33
|
+
action: DiffAction.Reject,
|
|
34
|
+
nodeKey: node.getKey()
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
blockSize: 28,
|
|
39
|
+
size: 16
|
|
40
|
+
},
|
|
41
|
+
title: t('modifier.reject')
|
|
42
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
43
|
+
"aria-label": "Accept change",
|
|
44
|
+
className: styles.accept,
|
|
45
|
+
icon: Check,
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
editor.dispatchCommand(LITEXML_DIFFNODE_COMMAND, {
|
|
48
|
+
action: DiffAction.Accept,
|
|
49
|
+
nodeKey: node.getKey()
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
blockSize: 28,
|
|
54
|
+
size: 16
|
|
55
|
+
},
|
|
56
|
+
title: t('modifier.accept')
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
ReactDiffNodeToolbar.displayName = 'ReactDiffNodeToolbar';
|
|
62
|
+
export default ReactDiffNodeToolbar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
isDarkMode = _ref.isDarkMode;
|
|
8
|
+
return {
|
|
9
|
+
accept: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorSuccess),
|
|
10
|
+
reject: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""]))),
|
|
11
|
+
toolbar: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-color: ", ";\n background: ", ";\n box-shadow: ", ";\n "])), token.colorFillSecondary, token.colorBgElevated, isDarkMode ? '0px 14px 28px -6px #0003,0px 2px 4px -1px #0000001f' : '0 14px 28px -6px #0000001a, 0 2px 4px -1px #0000000f')
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -4,5 +4,5 @@ import { createStyles } from 'antd-style';
|
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .toolbar {\n position: absolute;\n z-index: 10;\n inset-block-start: -4px;\n inset-inline-end: 0;\n transform: translateY(-100%);\n\n opacity: 0;\n }\n\n &:hover {\n .toolbar {\n opacity: 1;\n }\n }\n\n &[data-diff-type='add'] .content {\n position: relative;\n padding-inline-start: 16px;\n border-inline-start: 3px solid ", ";\n background-color: ", ";\n }\n\n &[data-diff-type='remove'] .content {\n position: relative;\n padding-inline-start: 16px;\n border-inline-start: 3px solid ", ";\n background-color: ", ";\n\n /* first child: original (deleted) */\n > *:first-child {\n opacity: 0.8;\n }\n }\n\n &[data-diff-type='modify'] .content {\n position: relative;\n\n /* first child: original (deleted) */\n > *:first-child {\n opacity: 0.6;\n }\n\n /* visually indicate deletion with strike-through for text nodes */\n > *:first-child * {\n color: ", " !important;\n text-decoration: line-through !important;\n }\n\n /* second child: modified/new - normal appearance */\n > *:nth-child(2) {\n color: inherit;\n opacity: 1;\n }\n }\n "])), token.colorSuccess, token.colorSuccessBgHover, token.colorError, token.colorErrorBgHover, token.colorTextQuaternary);
|
|
8
8
|
});
|
package/package.json
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Check, X } from 'lucide-react';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { LexicalPortalContainer } from "../../../editor-kernel/react";
|
|
4
|
-
import { DiffAction, LITEXML_DIFFNODE_COMMAND } from "../command/diffCommand";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var ReactDiffNodeToolbar = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
-
var editor = _ref.editor,
|
|
9
|
-
node = _ref.node;
|
|
10
|
-
return /*#__PURE__*/_jsxs(LexicalPortalContainer, {
|
|
11
|
-
editor: editor,
|
|
12
|
-
node: node,
|
|
13
|
-
children: [/*#__PURE__*/_jsx("button", {
|
|
14
|
-
"aria-label": "Accept change",
|
|
15
|
-
className: "toolbarButton accept",
|
|
16
|
-
onClick: function onClick() {
|
|
17
|
-
console.log('Accept change');
|
|
18
|
-
editor.dispatchCommand(LITEXML_DIFFNODE_COMMAND, {
|
|
19
|
-
action: DiffAction.Accept,
|
|
20
|
-
nodeKey: node.getKey()
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
title: "Accept",
|
|
24
|
-
type: "button",
|
|
25
|
-
children: /*#__PURE__*/_jsx(Check, {
|
|
26
|
-
size: 16
|
|
27
|
-
})
|
|
28
|
-
}), /*#__PURE__*/_jsx("button", {
|
|
29
|
-
"aria-label": "Reject change",
|
|
30
|
-
className: "toolbarButton reject",
|
|
31
|
-
onClick: function onClick() {
|
|
32
|
-
console.log('Reject change');
|
|
33
|
-
editor.dispatchCommand(LITEXML_DIFFNODE_COMMAND, {
|
|
34
|
-
action: DiffAction.Reject,
|
|
35
|
-
nodeKey: node.getKey()
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
title: "Reject",
|
|
39
|
-
type: "button",
|
|
40
|
-
children: /*#__PURE__*/_jsx(X, {
|
|
41
|
-
size: 16
|
|
42
|
-
})
|
|
43
|
-
})]
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
ReactDiffNodeToolbar.displayName = 'ReactDiffNodeToolbar';
|
|
47
|
-
export default ReactDiffNodeToolbar;
|