@lobehub/editor 3.2.0 → 3.2.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.
- package/es/editor-kernel/react/useAnchor.js +4 -1
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +2 -4
- package/es/plugins/auto-complete/react/style.d.ts +4 -4
- package/es/plugins/auto-complete/react/style.js +2 -2
- package/es/plugins/code/react/CodeReactPlugin.js +2 -4
- package/es/plugins/code/react/style.d.ts +3 -3
- package/es/plugins/code/react/style.js +4 -4
- package/es/plugins/codeblock/command/index.d.ts +2 -11
- package/es/plugins/codeblock/command/index.js +1 -37
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +0 -6
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +4 -5
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +2 -7
- package/es/plugins/codeblock/plugin/FacadeShiki.js +46 -103
- package/es/plugins/codeblock/plugin/index.d.ts +0 -5
- package/es/plugins/codeblock/plugin/index.js +3 -7
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +9 -26
- package/es/plugins/codeblock/react/style.d.ts +4 -6
- package/es/plugins/codeblock/react/style.js +5 -32
- package/es/plugins/common/react/Placeholder/index.js +1 -3
- package/es/plugins/common/react/Placeholder/style.d.ts +4 -4
- package/es/plugins/common/react/Placeholder/style.js +4 -4
- package/es/plugins/common/react/ReactPlainText.js +33 -21
- package/es/plugins/common/react/style.d.ts +22 -32
- package/es/plugins/common/react/style.js +27 -30
- package/es/plugins/file/react/ReactFilePlugin.js +1 -3
- package/es/plugins/file/react/style.d.ts +3 -3
- package/es/plugins/file/react/style.js +4 -4
- package/es/plugins/hr/react/components/HRNode.d.ts +2 -2
- package/es/plugins/hr/react/components/HRNode.js +5 -7
- package/es/plugins/hr/react/style.d.ts +1 -1
- package/es/plugins/hr/react/style.js +4 -4
- package/es/plugins/image/react/ReactImagePlugin.js +1 -3
- package/es/plugins/image/react/components/BrokenImage.js +3 -5
- package/es/plugins/image/react/components/Image.js +2 -4
- package/es/plugins/image/react/components/LazyImage.d.ts +9 -8
- package/es/plugins/image/react/components/LazyImage.js +6 -7
- package/es/plugins/image/react/components/ResizeHandle.d.ts +2 -2
- package/es/plugins/image/react/components/ResizeHandle.js +5 -7
- package/es/plugins/image/react/components/style.d.ts +9 -7
- package/es/plugins/image/react/components/style.js +11 -10
- package/es/plugins/image/react/style.d.ts +4 -4
- package/es/plugins/image/react/style.js +5 -5
- package/es/plugins/link/react/ReactLinkPlugin.js +1 -3
- package/es/plugins/link/react/components/LinkEdit.d.ts +2 -2
- package/es/plugins/link/react/components/LinkEdit.js +7 -9
- package/es/plugins/link/react/components/LinkToolbar.js +1 -3
- package/es/plugins/link/react/style.d.ts +4 -4
- package/es/plugins/link/react/style.js +7 -8
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +2 -4
- package/es/plugins/link-highlight/react/style.d.ts +3 -3
- package/es/plugins/link-highlight/react/style.js +2 -2
- package/es/plugins/list/react/ReactListPlugin.js +1 -3
- package/es/plugins/list/react/style.d.ts +1 -1
- package/es/plugins/list/react/style.js +4 -5
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +5 -4
- package/es/plugins/litexml/react/DiffNodeToolbar/style.d.ts +6 -5
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +7 -7
- package/es/plugins/litexml/react/index.js +1 -3
- package/es/plugins/litexml/react/style.d.ts +1 -1
- package/es/plugins/litexml/react/style.js +4 -4
- package/es/plugins/math/react/components/MathEditorContainer.js +1 -3
- package/es/plugins/math/react/components/MathEditorContent.js +3 -7
- package/es/plugins/math/react/components/MathInline.d.ts +2 -2
- package/es/plugins/math/react/components/MathInline.js +3 -3
- package/es/plugins/math/react/components/Placeholder.js +4 -6
- package/es/plugins/math/react/index.js +1 -3
- package/es/plugins/math/react/style.d.ts +6 -4
- package/es/plugins/math/react/style.js +10 -9
- package/es/plugins/mention/react/ReactMentionPlugin.js +1 -3
- package/es/plugins/mention/react/style.d.ts +3 -3
- package/es/plugins/mention/react/style.js +4 -4
- package/es/plugins/slash/react/components/DefaultSlashMenu.d.ts +2 -2
- package/es/plugins/slash/react/components/DefaultSlashMenu.js +24 -17
- package/es/plugins/slash/react/components/SlashMenu.d.ts +2 -2
- package/es/plugins/slash/react/components/SlashMenu.js +3 -4
- package/es/plugins/slash/react/style.d.ts +1 -1
- package/es/plugins/slash/react/style.js +4 -4
- package/es/plugins/table/react/TableActionMenu/index.js +3 -7
- package/es/plugins/table/react/TableActionMenu/style.d.ts +4 -1
- package/es/plugins/table/react/TableActionMenu/style.js +7 -4
- package/es/plugins/table/react/TableHoverActions/index.js +2 -4
- package/es/plugins/table/react/TableHoverActions/style.d.ts +4 -4
- package/es/plugins/table/react/TableHoverActions/style.js +2 -2
- package/es/plugins/table/react/TableResize/index.js +8 -8
- package/es/plugins/table/react/TableResize/style.d.ts +1 -1
- package/es/plugins/table/react/TableResize/style.js +4 -4
- package/es/plugins/table/react/index.js +2 -4
- package/es/plugins/table/react/style.d.ts +1 -1
- package/es/plugins/table/react/style.js +4 -4
- package/es/plugins/toolbar/react/index.js +6 -8
- package/es/plugins/toolbar/react/style.d.ts +5 -1
- package/es/plugins/toolbar/react/style.js +9 -6
- package/es/react/ChatInput/ChatInput.d.ts +2 -2
- package/es/react/ChatInput/ChatInput.js +16 -27
- package/es/react/ChatInput/style.d.ts +11 -6
- package/es/react/ChatInput/style.js +13 -9
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +2 -4
- package/es/react/ChatInputActionBar/style.d.ts +3 -3
- package/es/react/ChatInputActionBar/style.js +2 -2
- package/es/react/ChatInputActions/ChatInputActions.js +25 -25
- package/es/react/ChatInputActions/components/ActionItem.d.ts +2 -2
- package/es/react/ChatInputActions/components/ActionItem.js +2 -4
- package/es/react/ChatInputActions/components/ActionRender.d.ts +2 -2
- package/es/react/ChatInputActions/components/ActionRender.js +5 -11
- package/es/react/ChatInputActions/components/CollapsedActions.d.ts +2 -2
- package/es/react/ChatInputActions/components/CollapsedActions.js +5 -8
- package/es/react/ChatInputActions/style.d.ts +5 -4
- package/es/react/ChatInputActions/style.js +6 -5
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +2 -2
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +6 -9
- package/es/react/CodeLanguageSelect/style.d.ts +3 -3
- package/es/react/CodeLanguageSelect/style.js +2 -2
- package/es/react/FloatActions/FloatActions.d.ts +2 -2
- package/es/react/FloatActions/FloatActions.js +4 -8
- package/es/react/FloatActions/components/ActionItem.d.ts +2 -2
- package/es/react/FloatActions/components/ActionItem.js +2 -4
- package/es/react/FloatActions/components/ActionRender.d.ts +2 -2
- package/es/react/FloatActions/components/ActionRender.js +5 -11
- package/es/react/FloatActions/components/CollapsedActions.d.ts +2 -2
- package/es/react/FloatActions/components/CollapsedActions.js +5 -8
- package/es/react/FloatActions/style.d.ts +5 -4
- package/es/react/FloatActions/style.js +6 -5
- package/es/react/FloatMenu/FloatMenu.js +2 -4
- package/es/react/FloatMenu/style.d.ts +5 -4
- package/es/react/FloatMenu/style.js +7 -6
- package/es/react/SendButton/SendButton.d.ts +2 -2
- package/es/react/SendButton/SendButton.js +17 -15
- package/es/react/SendButton/components/SendIcon.js +15 -15
- package/es/react/SendButton/components/StopIcon.js +16 -18
- package/es/react/SendButton/style.d.ts +7 -7
- package/es/react/SendButton/style.js +9 -10
- package/package.json +3 -3
|
@@ -10,16 +10,16 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import {
|
|
13
|
+
import { cx } from 'antd-style';
|
|
14
|
+
import { useEffect, useState } from 'react';
|
|
14
15
|
import BrokenImage from "./BrokenImage";
|
|
16
|
+
import { styles } from "./style";
|
|
15
17
|
import { useSuspenseImage } from "./useSupenseImage";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
function isSVG(src) {
|
|
18
20
|
return src.toLowerCase().endsWith('.svg');
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
// Keep memo: Lazy loading with dimension calculation and SVG handling
|
|
22
|
-
var LazyImage = /*#__PURE__*/memo(function (_ref) {
|
|
22
|
+
var LazyImage = function LazyImage(_ref) {
|
|
23
23
|
var className = _ref.className,
|
|
24
24
|
node = _ref.node,
|
|
25
25
|
newWidth = _ref.newWidth,
|
|
@@ -81,7 +81,7 @@ var LazyImage = /*#__PURE__*/memo(function (_ref) {
|
|
|
81
81
|
var imageStyle = calculateDimensions();
|
|
82
82
|
return /*#__PURE__*/_jsx("img", {
|
|
83
83
|
alt: altText,
|
|
84
|
-
className: className || undefined,
|
|
84
|
+
className: cx(styles.lazyImage, className || undefined),
|
|
85
85
|
draggable: "false",
|
|
86
86
|
onError: onError,
|
|
87
87
|
onLoad: function onLoad(e) {
|
|
@@ -100,11 +100,10 @@ var LazyImage = /*#__PURE__*/memo(function (_ref) {
|
|
|
100
100
|
},
|
|
101
101
|
src: src,
|
|
102
102
|
style: _objectSpread(_objectSpread({}, imageStyle), {}, {
|
|
103
|
-
cursor: 'default',
|
|
104
103
|
maxWidth: "calc(min(".concat(newWidth || imageStyle.maxWidth, "px, 100%))"),
|
|
105
104
|
width: newWidth || imageStyle.width
|
|
106
105
|
})
|
|
107
106
|
});
|
|
108
|
-
}
|
|
107
|
+
};
|
|
109
108
|
LazyImage.displayName = 'LazyImage';
|
|
110
109
|
export default LazyImage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
1
|
+
import { type FC, type RefObject } from 'react';
|
|
2
2
|
export interface ResizeHandleProps {
|
|
3
3
|
imageRef: RefObject<HTMLDivElement | null>;
|
|
4
4
|
isBlock: boolean;
|
|
@@ -7,4 +7,4 @@ export interface ResizeHandleProps {
|
|
|
7
7
|
onResizeStart: (initialWidth: number) => void;
|
|
8
8
|
position: 'left' | 'right';
|
|
9
9
|
}
|
|
10
|
-
export declare const ResizeHandle:
|
|
10
|
+
export declare const ResizeHandle: FC<ResizeHandleProps>;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { cx } from 'antd-style';
|
|
2
|
+
import { useCallback, useRef } from 'react';
|
|
3
|
+
import { styles } from "./style";
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
export var ResizeHandle =
|
|
5
|
+
export var ResizeHandle = function ResizeHandle(_ref) {
|
|
5
6
|
var imageRef = _ref.imageRef,
|
|
6
7
|
isBlock = _ref.isBlock,
|
|
7
8
|
onResize = _ref.onResize,
|
|
8
9
|
onResizeEnd = _ref.onResizeEnd,
|
|
9
10
|
onResizeStart = _ref.onResizeStart,
|
|
10
11
|
position = _ref.position;
|
|
11
|
-
var _useStyles = useStyles(),
|
|
12
|
-
styles = _useStyles.styles,
|
|
13
|
-
cx = _useStyles.cx;
|
|
14
12
|
var startWidthRef = useRef(0);
|
|
15
13
|
var handleMouseDown = useCallback(function (e) {
|
|
16
14
|
var _imageRef$current;
|
|
@@ -71,5 +69,5 @@ export var ResizeHandle = /*#__PURE__*/memo(function (_ref) {
|
|
|
71
69
|
className: cx(styles.resizeHandle, position === 'left' ? styles.resizeHandleLeft : styles.resizeHandleRight),
|
|
72
70
|
onMouseDown: handleMouseDown
|
|
73
71
|
});
|
|
74
|
-
}
|
|
72
|
+
};
|
|
75
73
|
ResizeHandle.displayName = 'ResizeHandle';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
brokenImage: string;
|
|
3
|
+
imageContainer: string;
|
|
4
|
+
lazyImage: string;
|
|
5
|
+
resizeHandle: string;
|
|
6
|
+
resizeHandleLeft: string;
|
|
7
|
+
resizeHandleRight: string;
|
|
8
|
+
scaleInfo: string;
|
|
9
|
+
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export var useStyles = createStyles(function (_ref) {
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
5
|
var css = _ref.css,
|
|
7
|
-
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
8
7
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
brokenImage: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 200px;\n height: auto;\n "]))),
|
|
9
|
+
imageContainer: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: inline-block;\n\n width: auto;\n max-width: 100%;\n height: auto;\n border-radius: ", ";\n\n transition: border-color 0.2s ease;\n\n &.selected {\n cursor: pointer;\n outline: none;\n\n &::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n z-index: 10;\n inset: 0;\n\n background-color: color-mix(in srgb, ", " 10%, transparent);\n }\n }\n "])), cssVar.borderRadiusSM, cssVar.yellow),
|
|
10
|
+
lazyImage: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: default;\n "]))),
|
|
11
|
+
resizeHandle: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: auto;\n cursor: col-resize;\n\n position: absolute;\n z-index: 9999;\n inset-block-start: 0;\n\n width: 6px;\n height: 100%;\n\n &::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0;\n transform: translateY(-50%);\n\n width: 6px;\n height: min(80px, 80%);\n border: 1px solid color-mix(in srgb, rgb(255, 255, 255) 75%, transparent);\n border-radius: 3px;\n\n background-color: color-mix(in srgb, rgb(0, 0, 0) 50%, transparent);\n }\n "]))),
|
|
12
|
+
resizeHandleLeft: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n inset-inline-start: 8px;\n "]))),
|
|
13
|
+
resizeHandleRight: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n inset-inline-end: 8px;\n "]))),
|
|
14
|
+
scaleInfo: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 11;\n inset-block-start: 2px;\n inset-inline-start: 2px;\n\n padding-block: 2px;\n padding-inline: 6px;\n border-radius: ", ";\n\n font-size: 12px;\n color: white;\n\n background-color: color-mix(in srgb, rgb(0, 0, 0) 50%, transparent);\n "])), cssVar.borderRadiusSM)
|
|
14
15
|
};
|
|
15
16
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
image:
|
|
3
|
-
blockImage:
|
|
4
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
image: string;
|
|
3
|
+
blockImage: string;
|
|
4
|
+
};
|
|
5
5
|
export declare const imageBroken = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NDAgNDAwIj48cGF0aCBmaWxsPSIjM0IzQjNCIiBkPSJNMCAwaDY0MHY0MDBIMHoiLz48cGF0aCBzdHJva2U9IiM2MjYyNjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIxNSIgZD0iTTM3Mi41IDEzMi41aC0xMDVjLTguMjg0IDAtMTUgNi43MTYtMTUgMTV2MTA1YzAgOC4yODQgNi43MTYgMTUgMTUgMTVoMTA1YzguMjg0IDAgMTUtNi43MTYgMTUtMTV2LTEwNWMwLTguMjg0LTYuNzE2LTE1LTE1LTE1eiIvPjxwYXRoIHN0cm9rZT0iIzYyNjI2MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjE1IiBkPSJNMjk3LjUgMTkyLjVjOC4yODQgMCAxNS02LjcxNiAxNS0xNSAwLTguMjg0LTYuNzE2LTE1LTE1LTE1LTguMjg0IDAtMTUgNi43MTYtMTUgMTUgMCA4LjI4NCA2LjcxNiAxNSAxNSAxNXpNMzg3LjUgMjIyLjUwMmwtMjMuMTQ1LTIzLjE0NWExNS4wMDEgMTUuMDAxIDAgMDAtMjEuMjEgMEwyNzUgMjY3LjUwMiIvPjwvc3ZnPg==";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _templateObject, _templateObject2;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
4
|
-
import {
|
|
5
|
-
export var
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
6
|
var css = _ref.css,
|
|
7
|
-
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
8
|
return {
|
|
9
|
-
image: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n position: relative;\n display: inline-block;\n\n &.selected {\n background-color: ", ";\n }\n "])),
|
|
10
|
-
blockImage: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n\n position: relative;\n\n display: block;\n\n text-align: center;\n\n &.selected {\n background-color: ", ";\n }\n "])),
|
|
9
|
+
image: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n position: relative;\n display: inline-block;\n\n &.selected {\n background-color: ", ";\n }\n "])), cssVar.colorPrimaryBg),
|
|
10
|
+
blockImage: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n\n position: relative;\n\n display: block;\n\n text-align: center;\n\n &.selected {\n background-color: ", ";\n }\n "])), cssVar.colorPrimaryBg)
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
13
|
export var imageBroken = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NDAgNDAwIj48cGF0aCBmaWxsPSIjM0IzQjNCIiBkPSJNMCAwaDY0MHY0MDBIMHoiLz48cGF0aCBzdHJva2U9IiM2MjYyNjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIxNSIgZD0iTTM3Mi41IDEzMi41aC0xMDVjLTguMjg0IDAtMTUgNi43MTYtMTUgMTV2MTA1YzAgOC4yODQgNi43MTYgMTUgMTUgMTVoMTA1YzguMjg0IDAgMTUtNi43MTYgMTUtMTV2LTEwNWMwLTguMjg0LTYuNzE2LTE1LTE1LTE1eiIvPjxwYXRoIHN0cm9rZT0iIzYyNjI2MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjE1IiBkPSJNMjk3LjUgMTkyLjVjOC4yODQgMCAxNS02LjcxNiAxNS0xNSAwLTguMjg0LTYuNzE2LTE1LTE1LTE1LTguMjg0IDAtMTUgNi43MTYtMTUgMTUgMCA4LjI4NCA2LjcxNiAxNSAxNSAxNXpNMzg3LjUgMjIyLjUwMmwtMjMuMTQ1LTIzLjE0NWExNS4wMDEgMTUuMDAxIDAgMDAtMjEuMjEgMEwyNzUgMjY3LjUwMiIvPjwvc3ZnPg==';
|
|
@@ -15,7 +15,7 @@ import { LinkPlugin } from "../plugin";
|
|
|
15
15
|
import { ILinkService } from "../service/i-link-service";
|
|
16
16
|
import LinkEdit from "./components/LinkEdit";
|
|
17
17
|
import LinkToolbar from "./components/LinkToolbar";
|
|
18
|
-
import {
|
|
18
|
+
import { styles } from "./style";
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
export var ReactLinkPlugin = function ReactLinkPlugin(_ref) {
|
|
@@ -31,8 +31,6 @@ export var ReactLinkPlugin = function ReactLinkPlugin(_ref) {
|
|
|
31
31
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
32
32
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
33
33
|
editor = _useLexicalComposerCo2[0];
|
|
34
|
-
var _useStyles = useStyles(),
|
|
35
|
-
styles = _useStyles.styles;
|
|
36
34
|
useLayoutEffect(function () {
|
|
37
35
|
editor.registerPlugin(MarkdownPlugin);
|
|
38
36
|
editor.registerPlugin(LinkPlugin, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LexicalEditor } from 'lexical';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
3
|
import { LinkNode } from '../../node/LinkNode';
|
|
4
4
|
export declare const EDIT_LINK_COMMAND: import("lexical").LexicalCommand<{
|
|
5
5
|
linkNode: LinkNode | null;
|
|
@@ -8,5 +8,5 @@ export declare const EDIT_LINK_COMMAND: import("lexical").LexicalCommand<{
|
|
|
8
8
|
interface LinkEditProps {
|
|
9
9
|
editor: LexicalEditor;
|
|
10
10
|
}
|
|
11
|
-
declare const LinkEdit:
|
|
11
|
+
declare const LinkEdit: FC<LinkEditProps>;
|
|
12
12
|
export default LinkEdit;
|
|
@@ -6,19 +6,20 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { mergeRegister } from '@lexical/utils';
|
|
8
8
|
import { Block, Button, Flexbox, Hotkey, Icon, Input, Text } from '@lobehub/ui';
|
|
9
|
+
import { cssVar } from 'antd-style';
|
|
9
10
|
import { COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_NORMAL, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, createCommand } from 'lexical';
|
|
10
11
|
import { BaselineIcon, LinkIcon } from 'lucide-react';
|
|
11
|
-
import {
|
|
12
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
13
|
import { useLexicalEditor } from "../../../../editor-kernel/react";
|
|
13
14
|
import { useEditable } from "../../../../editor-kernel/react/useEditable";
|
|
14
15
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
15
16
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition";
|
|
16
17
|
import { UPDATE_LINK_TEXT_COMMAND } from "../../command";
|
|
17
|
-
import {
|
|
18
|
+
import { styles } from "../style";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
export var EDIT_LINK_COMMAND = createCommand();
|
|
21
|
-
var LinkEdit =
|
|
22
|
+
var LinkEdit = function LinkEdit(_ref) {
|
|
22
23
|
var editor = _ref.editor;
|
|
23
24
|
var divRef = useRef(null);
|
|
24
25
|
var linkNodeRef = useRef(null);
|
|
@@ -39,9 +40,6 @@ var LinkEdit = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
40
|
var _useEditable = useEditable(),
|
|
40
41
|
editable = _useEditable.editable;
|
|
41
42
|
var t = useTranslation();
|
|
42
|
-
var _useStyles = useStyles(),
|
|
43
|
-
styles = _useStyles.styles,
|
|
44
|
-
theme = _useStyles.theme;
|
|
45
43
|
|
|
46
44
|
// 取消编辑,不保存更改
|
|
47
45
|
var handleCancel = useCallback(function () {
|
|
@@ -215,7 +213,7 @@ var LinkEdit = /*#__PURE__*/memo(function (_ref) {
|
|
|
215
213
|
},
|
|
216
214
|
onKeyDown: handleKeyDown,
|
|
217
215
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
218
|
-
color:
|
|
216
|
+
color: cssVar.colorTextDescription,
|
|
219
217
|
icon: BaselineIcon
|
|
220
218
|
}),
|
|
221
219
|
ref: linkTextInputRef,
|
|
@@ -231,7 +229,7 @@ var LinkEdit = /*#__PURE__*/memo(function (_ref) {
|
|
|
231
229
|
onKeyDown: handleKeyDown,
|
|
232
230
|
placeholder: "https://enter-link-url",
|
|
233
231
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
234
|
-
color:
|
|
232
|
+
color: cssVar.colorTextDescription,
|
|
235
233
|
icon: LinkIcon
|
|
236
234
|
}),
|
|
237
235
|
ref: linkInputRef,
|
|
@@ -259,6 +257,6 @@ var LinkEdit = /*#__PURE__*/memo(function (_ref) {
|
|
|
259
257
|
})
|
|
260
258
|
})]
|
|
261
259
|
});
|
|
262
|
-
}
|
|
260
|
+
};
|
|
263
261
|
LinkEdit.displayName = 'LinkEdit';
|
|
264
262
|
export default LinkEdit;
|
|
@@ -16,7 +16,7 @@ import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
|
16
16
|
import { getSelectedNode } from "../../utils";
|
|
17
17
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition";
|
|
18
18
|
import { $isLinkNode, HOVER_LINK_COMMAND, HOVER_OUT_LINK_COMMAND, TOGGLE_LINK_COMMAND } from "../../node/LinkNode";
|
|
19
|
-
import {
|
|
19
|
+
import { styles } from "../style";
|
|
20
20
|
import { EDIT_LINK_COMMAND } from "./LinkEdit";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
var LinkToolbar = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -24,8 +24,6 @@ var LinkToolbar = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
enable = _ref.enable;
|
|
25
25
|
var divRef = useRef(null);
|
|
26
26
|
var LinkRef = useRef(null);
|
|
27
|
-
var _useStyles = useStyles(),
|
|
28
|
-
styles = _useStyles.styles;
|
|
29
27
|
var _useState = useState(null),
|
|
30
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
29
|
linkNode = _useState2[0],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
link:
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
link: string;
|
|
3
3
|
linkEdit: string;
|
|
4
|
-
linkEditFooter:
|
|
4
|
+
linkEditFooter: string;
|
|
5
5
|
linkToolbar: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
token = _ref.token;
|
|
3
|
+
import { createStaticStyles, cx } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
8
7
|
var position = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 999;\n inset-block-start: -9999px;\n inset-inline-start: -9999px;\n "])));
|
|
9
8
|
return {
|
|
10
9
|
link: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n margin-block: 1em;\n margin-inline: 0;\n padding: 2px;\n border: none;\n "]))),
|
|
11
|
-
linkEdit: cx(position, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 320px;\n max-width: 100%;\n background: ", ";\n "])),
|
|
12
|
-
linkEditFooter: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n background: ", ";\n "])),
|
|
13
|
-
linkToolbar: cx(position, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n "])),
|
|
10
|
+
linkEdit: cx(position, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 320px;\n max-width: 100%;\n background: ", ";\n "])), cssVar.colorBgElevated)),
|
|
11
|
+
linkEditFooter: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n background: ", ";\n "])), cssVar.colorBorderSecondary, cssVar.colorFillQuaternary),
|
|
12
|
+
linkToolbar: cx(position, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n "])), cssVar.colorBgElevated))
|
|
14
13
|
};
|
|
15
14
|
});
|
|
@@ -4,11 +4,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { cx } from 'antd-style';
|
|
7
8
|
import { useLayoutEffect } from 'react';
|
|
8
9
|
import { useLexicalComposerContext } from "../../../editor-kernel/react/react-context";
|
|
9
10
|
import { MarkdownPlugin } from "../../markdown/plugin";
|
|
10
11
|
import { LinkHighlightPlugin } from "../plugin";
|
|
11
|
-
import {
|
|
12
|
+
import { styles } from "./style";
|
|
12
13
|
var ReactLinkHighlightPlugin = function ReactLinkHighlightPlugin(_ref) {
|
|
13
14
|
var className = _ref.className,
|
|
14
15
|
_ref$enableHotkey = _ref.enableHotkey,
|
|
@@ -18,9 +19,6 @@ var ReactLinkHighlightPlugin = function ReactLinkHighlightPlugin(_ref) {
|
|
|
18
19
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
19
20
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
20
21
|
editor = _useLexicalComposerCo2[0];
|
|
21
|
-
var _useStyles = useStyles(),
|
|
22
|
-
cx = _useStyles.cx,
|
|
23
|
-
styles = _useStyles.styles;
|
|
24
22
|
useLayoutEffect(function () {
|
|
25
23
|
editor.registerPlugin(MarkdownPlugin);
|
|
26
24
|
editor.registerPlugin(LinkHighlightPlugin, {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
linkHighlight:
|
|
3
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
linkHighlight: string;
|
|
3
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css;
|
|
6
6
|
return {
|
|
7
7
|
linkHighlight: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: unset;\n\n margin-block: 1em;\n margin-inline: 0;\n padding: 2px;\n border: none;\n "])))
|
|
@@ -10,15 +10,13 @@ import { useLayoutEffect } from 'react';
|
|
|
10
10
|
import { useLexicalComposerContext } from "../../../editor-kernel/react/react-context";
|
|
11
11
|
import { MarkdownPlugin } from "../../markdown/plugin";
|
|
12
12
|
import { ListPlugin } from "../plugin";
|
|
13
|
-
import {
|
|
13
|
+
import { styles } from "./style";
|
|
14
14
|
var ReactListPlugin = function ReactListPlugin(_ref) {
|
|
15
15
|
var _ref$enableHotkey = _ref.enableHotkey,
|
|
16
16
|
enableHotkey = _ref$enableHotkey === void 0 ? true : _ref$enableHotkey;
|
|
17
17
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
18
18
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
19
19
|
editor = _useLexicalComposerCo2[0];
|
|
20
|
-
var _useStyles = useStyles(),
|
|
21
|
-
styles = _useStyles.styles;
|
|
22
20
|
useLayoutEffect(function () {
|
|
23
21
|
editor.registerPlugin(MarkdownPlugin);
|
|
24
22
|
editor.registerPlugin(ListPlugin, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const styles: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export var useStyles = createStyles(function (_ref) {
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
5
|
var css = _ref.css,
|
|
7
|
-
|
|
8
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .editor_listUnordered&,\n .editor_listOrdered& {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > .editor_listUnordered,\n > ol {\n margin-block: 0;\n }\n\n > .editor_listItem {\n margin-inline-start: 1em;\n }\n }\n\n .editor_listOrdered& {\n list-style: auto;\n }\n\n .editor_listUnordered& {\n list-style-type: none;\n\n > .editor_listItem:not(:has(ul)):not([role='checkbox']) {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n\n .editor_listItem {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n font-family: var(--listitem-marker-font-family);\n font-size: var(--listitem-marker-font-size);\n background-color: var(--listitem-marker-background-color);\n\n &::marker {\n font-family: var(--listitem-marker-font-family);\n font-size: var(--listitem-marker-font-size);\n color: var(--listitem-marker-color);\n background-color: var(--listitem-marker-background-color);\n }\n\n p {\n display: inline;\n }\n\n .editor_listUnordered,\n .editor_listOrdered {\n margin: 0;\n }\n }\n\n [role='checkbox'] {\n position: relative;\n }\n\n .editor_listItemChecked::before,\n .editor_listItemUnchecked::before {\n border: 1px solid ", ";\n border-radius: 4px;\n }\n\n .editor_listItemChecked::before {\n background: ", ";\n }\n\n .editor_listItemChecked:not(:has(ul))::after {\n cursor: pointer;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0.2em;\n transform: rotate(45deg) scale(1) translate(-50%, -50%);\n\n display: block;\n\n width: 0.3em;\n height: 0.6em;\n margin-inline: -1.35em 0.5em;\n border: 2px solid ", ";\n border-block-start: 0;\n border-inline-start: 0;\n\n background-size: cover;\n\n transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;\n }\n\n .editor_listItemUnchecked:not(:has(ul))::before,\n .editor_listItemChecked:not(:has(ul))::before {\n cursor: pointer;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0;\n transform: translateY(-50%);\n\n display: inline-block;\n display: block;\n\n width: 1em;\n height: 1em;\n margin-inline: -1.4em 0.5em;\n\n background-size: cover;\n }\n\n .editor_listItemNested {\n list-style-type: none;\n }\n "])),
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .editor_listUnordered&,\n .editor_listOrdered& {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > .editor_listUnordered,\n > ol {\n margin-block: 0;\n }\n\n > .editor_listItem {\n margin-inline-start: 1em;\n }\n }\n\n .editor_listOrdered& {\n list-style: auto;\n }\n\n .editor_listUnordered& {\n list-style-type: none;\n\n > .editor_listItem:not(:has(ul)):not([role='checkbox']) {\n &::before {\n content: '-';\n display: inline-block;\n margin-inline: -1em 0.5em;\n opacity: 0.5;\n }\n }\n }\n\n .editor_listItem {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n font-family: var(--listitem-marker-font-family);\n font-size: var(--listitem-marker-font-size);\n background-color: var(--listitem-marker-background-color);\n\n &::marker {\n font-family: var(--listitem-marker-font-family);\n font-size: var(--listitem-marker-font-size);\n color: var(--listitem-marker-color);\n background-color: var(--listitem-marker-background-color);\n }\n\n p {\n display: inline;\n }\n\n .editor_listUnordered,\n .editor_listOrdered {\n margin: 0;\n }\n }\n\n [role='checkbox'] {\n position: relative;\n }\n\n .editor_listItemChecked::before,\n .editor_listItemUnchecked::before {\n border: 1px solid ", ";\n border-radius: 4px;\n }\n\n .editor_listItemChecked::before {\n background: ", ";\n }\n\n .editor_listItemChecked:not(:has(ul))::after {\n cursor: pointer;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0.2em;\n transform: rotate(45deg) scale(1) translate(-50%, -50%);\n\n display: block;\n\n width: 0.3em;\n height: 0.6em;\n margin-inline: -1.35em 0.5em;\n border: 2px solid ", ";\n border-block-start: 0;\n border-inline-start: 0;\n\n background-size: cover;\n\n transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;\n }\n\n .editor_listItemUnchecked:not(:has(ul))::before,\n .editor_listItemChecked:not(:has(ul))::before {\n cursor: pointer;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0;\n transform: translateY(-50%);\n\n display: inline-block;\n display: block;\n\n width: 1em;\n height: 1em;\n margin-inline: -1.4em 0.5em;\n\n background-size: cover;\n }\n\n .editor_listItemNested {\n list-style-type: none;\n }\n "])), cssVar.colorBorder, cssVar.colorPrimary, cssVar.colorTextLightSolid);
|
|
9
8
|
});
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ActionIcon, Block } from '@lobehub/ui';
|
|
2
|
+
import { useThemeMode } from 'antd-style';
|
|
2
3
|
import { Check, X } from 'lucide-react';
|
|
3
4
|
import { LexicalPortalContainer } from "../../../../editor-kernel/react";
|
|
4
5
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
5
6
|
import { DiffAction, LITEXML_DIFFNODE_COMMAND } from "../../command/diffCommand";
|
|
6
|
-
import {
|
|
7
|
+
import { styles } from "./style";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
var ReactDiffNodeToolbar = function ReactDiffNodeToolbar(_ref) {
|
|
10
11
|
var editor = _ref.editor,
|
|
11
12
|
node = _ref.node;
|
|
12
13
|
var t = useTranslation();
|
|
13
|
-
var
|
|
14
|
-
|
|
14
|
+
var _useThemeMode = useThemeMode(),
|
|
15
|
+
isDarkMode = _useThemeMode.isDarkMode;
|
|
15
16
|
return /*#__PURE__*/_jsx(LexicalPortalContainer, {
|
|
16
17
|
editor: editor,
|
|
17
18
|
node: node,
|
|
18
19
|
children: /*#__PURE__*/_jsxs(Block, {
|
|
19
|
-
className: styles.
|
|
20
|
+
className: isDarkMode ? styles.toolbarDark : styles.toolbarLight,
|
|
20
21
|
gap: 2,
|
|
21
22
|
horizontal: true,
|
|
22
23
|
padding: 2,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
accept:
|
|
3
|
-
reject:
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
accept: string;
|
|
3
|
+
reject: string;
|
|
4
|
+
toolbarDark: string;
|
|
5
|
+
toolbarLight: string;
|
|
6
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
7
|
-
isDarkMode = _ref.isDarkMode;
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
8
7
|
return {
|
|
9
|
-
accept: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])),
|
|
8
|
+
accept: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), cssVar.colorSuccess),
|
|
10
9
|
reject: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""]))),
|
|
11
|
-
|
|
10
|
+
toolbarDark: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-color: ", ";\n background: ", ";\n box-shadow:\n 0 14px 28px -6px color-mix(in srgb, #000 18.75%, transparent),\n 0 2px 4px -1px color-mix(in srgb, #000 12.19%, transparent);\n "])), cssVar.colorFillSecondary, cssVar.colorBgElevated),
|
|
11
|
+
toolbarLight: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-color: ", ";\n background: ", ";\n box-shadow:\n 0 14px 28px -6px color-mix(in srgb, #000 10.2%, transparent),\n 0 2px 4px -1px color-mix(in srgb, #000 5.88%, transparent);\n "])), cssVar.colorFillSecondary, cssVar.colorBgElevated)
|
|
12
12
|
};
|
|
13
13
|
});
|
|
@@ -11,14 +11,12 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react";
|
|
|
11
11
|
import { INodePlugin } from "../../inode";
|
|
12
12
|
import { LitexmlPlugin } from "../plugin";
|
|
13
13
|
import ReactDiffNodeToolbar from "./DiffNodeToolbar";
|
|
14
|
-
import {
|
|
14
|
+
import { styles } from "./style";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
export var ReactLiteXmlPlugin = function ReactLiteXmlPlugin() {
|
|
17
17
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
18
18
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
19
19
|
editor = _useLexicalComposerCo2[0];
|
|
20
|
-
var _useStyles = useStyles(),
|
|
21
|
-
styles = _useStyles.styles;
|
|
22
20
|
useLayoutEffect(function () {
|
|
23
21
|
editor.registerPlugin(INodePlugin);
|
|
24
22
|
editor.registerPlugin(LitexmlPlugin, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const styles: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
7
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .toolbar {\n position: absolute;\n z-index: 10;\n inset-block-end: 0;\n inset-inline-end: 8px;\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 margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n }\n\n &[data-diff-type='remove'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n > *:first-child * {\n color: ", " !important;\n text-decoration: line-through !important;\n }\n }\n\n &[data-diff-type='listItemModify'] {\n display: inline-block;\n\n p {\n display: block !important;\n }\n }\n\n &[data-diff-type='listItemModify'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n /* first child: original (deleted) */\n\n /* > *:first-child {} */\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\n &[data-diff-type='modify'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n /* first child: original (deleted) */\n\n /* > *:first-child {} */\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 "])),
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .toolbar {\n position: absolute;\n z-index: 10;\n inset-block-end: 0;\n inset-inline-end: 8px;\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 margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n }\n\n &[data-diff-type='remove'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n > *:first-child * {\n color: ", " !important;\n text-decoration: line-through !important;\n }\n }\n\n &[data-diff-type='listItemModify'] {\n display: inline-block;\n\n p {\n display: block !important;\n }\n }\n\n &[data-diff-type='listItemModify'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n /* first child: original (deleted) */\n\n /* > *:first-child {} */\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\n &[data-diff-type='modify'] .content {\n position: relative;\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-end: 4px;\n border-inline-end: 3px solid ", ";\n\n /* first child: original (deleted) */\n\n /* > *:first-child {} */\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 "])), cssVar.colorSuccess, cssVar.colorError, cssVar.colorTextQuaternary, cssVar.colorWarning, cssVar.colorTextQuaternary, cssVar.colorWarning, cssVar.colorTextQuaternary);
|
|
8
8
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Block } from '@lobehub/ui';
|
|
2
2
|
import { memo, useEffect, useRef } from 'react';
|
|
3
3
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition";
|
|
4
|
-
import {
|
|
4
|
+
import { styles } from "../style";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
var MathEditorContainer = /*#__PURE__*/memo(function (_ref) {
|
|
7
7
|
var children = _ref.children,
|
|
@@ -10,8 +10,6 @@ var MathEditorContainer = /*#__PURE__*/memo(function (_ref) {
|
|
|
10
10
|
onFocus = _ref.onFocus,
|
|
11
11
|
prev = _ref.prev;
|
|
12
12
|
var divRef = useRef(null);
|
|
13
|
-
var _useStyles = useStyles(),
|
|
14
|
-
styles = _useStyles.styles;
|
|
15
13
|
var updateMathPosition = function updateMathPosition() {
|
|
16
14
|
return updatePosition({
|
|
17
15
|
callback: function callback() {
|
|
@@ -4,13 +4,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Button, Hotkey, Text, TextArea
|
|
7
|
+
import { Button, Flexbox, Hotkey, Text, TextArea } from '@lobehub/ui';
|
|
8
8
|
import { renderToString } from 'katex';
|
|
9
9
|
import { isModifierMatch } from 'lexical';
|
|
10
10
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
11
11
|
import { CONTROL_OR_META } from "../../../../common/sys";
|
|
12
12
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
13
|
-
import {
|
|
13
|
+
import { styles } from "../style";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -31,8 +31,6 @@ var MathEditorContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
32
|
latexError = _useState2[0],
|
|
33
33
|
setLatexError = _useState2[1];
|
|
34
|
-
var _useStyles = useStyles(),
|
|
35
|
-
styles = _useStyles.styles;
|
|
36
34
|
|
|
37
35
|
// 将 ref 暴露给父组件
|
|
38
36
|
useEffect(function () {
|
|
@@ -115,6 +113,7 @@ var MathEditorContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
115
113
|
maxRows: 6,
|
|
116
114
|
minRows: 1
|
|
117
115
|
},
|
|
116
|
+
className: styles.mathEditorTextArea,
|
|
118
117
|
onChange: function onChange(e) {
|
|
119
118
|
onValueChange(e.target.value);
|
|
120
119
|
},
|
|
@@ -122,9 +121,6 @@ var MathEditorContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
122
121
|
placeholder: "".concat(t('math.placeholder'), "..."),
|
|
123
122
|
ref: textareaRef,
|
|
124
123
|
resize: false,
|
|
125
|
-
style: {
|
|
126
|
-
marginBlock: 4
|
|
127
|
-
},
|
|
128
124
|
value: value,
|
|
129
125
|
variant: 'borderless'
|
|
130
126
|
}), latexError && /*#__PURE__*/_jsx(Flexbox, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LexicalEditor } from 'lexical';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
3
|
import { MathBlockNode, MathInlineNode } from '../../node';
|
|
4
4
|
export interface MathInlineProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
editor: LexicalEditor;
|
|
7
7
|
node: MathInlineNode | MathBlockNode;
|
|
8
8
|
}
|
|
9
|
-
declare const MathInline:
|
|
9
|
+
declare const MathInline: FC<MathInlineProps>;
|
|
10
10
|
export default MathInline;
|