@lobehub/editor 1.33.0 → 1.33.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.
@@ -25,6 +25,12 @@ declare const _default: {
25
25
  math: {
26
26
  placeholder: string;
27
27
  };
28
+ modifier: {
29
+ accept: string;
30
+ acceptAll: string;
31
+ reject: string;
32
+ rejectedAll: string;
33
+ };
28
34
  table: {
29
35
  delete: string;
30
36
  deleteColumn: string;
@@ -25,6 +25,12 @@ export default {
25
25
  math: {
26
26
  placeholder: 'Enter TeX formula'
27
27
  },
28
+ modifier: {
29
+ accept: 'Accept',
30
+ acceptAll: 'Accept All',
31
+ reject: 'Reject',
32
+ rejectedAll: 'Reject All'
33
+ },
28
34
  table: {
29
35
  delete: 'Delete table',
30
36
  deleteColumn: 'Delete column',
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { LexicalEditor } from 'lexical';
3
- import { DiffNode } from '../node/DiffNode';
3
+ import { DiffNode } from '../../node/DiffNode';
4
4
  interface ReactDiffNodeToolbarProps {
5
5
  className?: string;
6
6
  editor: LexicalEditor;
@@ -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,5 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ accept: import("antd-style").SerializedStyles;
3
+ reject: import("antd-style").SerializedStyles;
4
+ toolbar: import("antd-style").SerializedStyles;
5
+ }>;
@@ -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 border: 1px solid ", ";\n\n .toolbar {\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-end: 0;\n\n display: flex;\n gap: 4px;\n align-items: center;\n\n padding: 4px;\n border: 1px solid #eee;\n border-radius: 4px;\n\n background: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 10%);\n }\n\n .toolbarButton {\n cursor: pointer;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n padding: 2px;\n border: none;\n\n background: none;\n }\n\n .toolbarButton:focus {\n border-radius: 3px;\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n\n .accept {\n color: ", ";\n }\n\n .reject {\n color: ", ";\n }\n\n &[data-diff-type='add'] .content {\n position: relative;\n background-color: ", ";\n }\n\n &[data-diff-type='remove'] .content {\n position: relative;\n background-color: ", ";\n\n > *:first-child p,\n > *:first-child span {\n text-decoration: line-through;\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 p,\n > *:first-child span {\n text-decoration: line-through;\n }\n\n /* second child: modified/new - normal appearance */\n > *:nth-child(2) {\n color: inherit;\n opacity: 1;\n }\n }\n "])), token.colorBorderSecondary, token.colorPrimary, token.colorSuccess, token.colorError, token.colorSuccessBgHover, token.colorErrorBgHover);
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: 4px;\n background-color: ", ";\n box-shadow: -3px 0 0 ", ";\n }\n\n &[data-diff-type='remove'] .content {\n position: relative;\n padding-inline-start: 4px;\n background-color: ", ";\n box-shadow: -3px 0 0 ", ";\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.colorSuccessBg, token.colorSuccess, token.colorErrorBg, token.colorError, token.colorTextQuaternary);
8
8
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/editor",
3
- "version": "1.33.0",
3
+ "version": "1.33.2",
4
4
  "description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -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;