@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.
Files changed (132) hide show
  1. package/es/editor-kernel/react/useAnchor.js +4 -1
  2. package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +2 -4
  3. package/es/plugins/auto-complete/react/style.d.ts +4 -4
  4. package/es/plugins/auto-complete/react/style.js +2 -2
  5. package/es/plugins/code/react/CodeReactPlugin.js +2 -4
  6. package/es/plugins/code/react/style.d.ts +3 -3
  7. package/es/plugins/code/react/style.js +4 -4
  8. package/es/plugins/codeblock/command/index.d.ts +2 -11
  9. package/es/plugins/codeblock/command/index.js +1 -37
  10. package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +0 -6
  11. package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +4 -5
  12. package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +2 -7
  13. package/es/plugins/codeblock/plugin/FacadeShiki.js +46 -103
  14. package/es/plugins/codeblock/plugin/index.d.ts +0 -5
  15. package/es/plugins/codeblock/plugin/index.js +3 -7
  16. package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +9 -26
  17. package/es/plugins/codeblock/react/style.d.ts +4 -6
  18. package/es/plugins/codeblock/react/style.js +5 -32
  19. package/es/plugins/common/react/Placeholder/index.js +1 -3
  20. package/es/plugins/common/react/Placeholder/style.d.ts +4 -4
  21. package/es/plugins/common/react/Placeholder/style.js +4 -4
  22. package/es/plugins/common/react/ReactPlainText.js +33 -21
  23. package/es/plugins/common/react/style.d.ts +22 -32
  24. package/es/plugins/common/react/style.js +27 -30
  25. package/es/plugins/file/react/ReactFilePlugin.js +1 -3
  26. package/es/plugins/file/react/style.d.ts +3 -3
  27. package/es/plugins/file/react/style.js +4 -4
  28. package/es/plugins/hr/react/components/HRNode.d.ts +2 -2
  29. package/es/plugins/hr/react/components/HRNode.js +5 -7
  30. package/es/plugins/hr/react/style.d.ts +1 -1
  31. package/es/plugins/hr/react/style.js +4 -4
  32. package/es/plugins/image/react/ReactImagePlugin.js +1 -3
  33. package/es/plugins/image/react/components/BrokenImage.js +3 -5
  34. package/es/plugins/image/react/components/Image.js +2 -4
  35. package/es/plugins/image/react/components/LazyImage.d.ts +9 -8
  36. package/es/plugins/image/react/components/LazyImage.js +6 -7
  37. package/es/plugins/image/react/components/ResizeHandle.d.ts +2 -2
  38. package/es/plugins/image/react/components/ResizeHandle.js +5 -7
  39. package/es/plugins/image/react/components/style.d.ts +9 -7
  40. package/es/plugins/image/react/components/style.js +11 -10
  41. package/es/plugins/image/react/style.d.ts +4 -4
  42. package/es/plugins/image/react/style.js +5 -5
  43. package/es/plugins/link/react/ReactLinkPlugin.js +1 -3
  44. package/es/plugins/link/react/components/LinkEdit.d.ts +2 -2
  45. package/es/plugins/link/react/components/LinkEdit.js +7 -9
  46. package/es/plugins/link/react/components/LinkToolbar.js +1 -3
  47. package/es/plugins/link/react/style.d.ts +4 -4
  48. package/es/plugins/link/react/style.js +7 -8
  49. package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +2 -4
  50. package/es/plugins/link-highlight/react/style.d.ts +3 -3
  51. package/es/plugins/link-highlight/react/style.js +2 -2
  52. package/es/plugins/list/react/ReactListPlugin.js +1 -3
  53. package/es/plugins/list/react/style.d.ts +1 -1
  54. package/es/plugins/list/react/style.js +4 -5
  55. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +5 -4
  56. package/es/plugins/litexml/react/DiffNodeToolbar/style.d.ts +6 -5
  57. package/es/plugins/litexml/react/DiffNodeToolbar/style.js +7 -7
  58. package/es/plugins/litexml/react/index.js +1 -3
  59. package/es/plugins/litexml/react/style.d.ts +1 -1
  60. package/es/plugins/litexml/react/style.js +4 -4
  61. package/es/plugins/math/react/components/MathEditorContainer.js +1 -3
  62. package/es/plugins/math/react/components/MathEditorContent.js +3 -7
  63. package/es/plugins/math/react/components/MathInline.d.ts +2 -2
  64. package/es/plugins/math/react/components/MathInline.js +3 -3
  65. package/es/plugins/math/react/components/Placeholder.js +4 -6
  66. package/es/plugins/math/react/index.js +1 -3
  67. package/es/plugins/math/react/style.d.ts +6 -4
  68. package/es/plugins/math/react/style.js +10 -9
  69. package/es/plugins/mention/react/ReactMentionPlugin.js +1 -3
  70. package/es/plugins/mention/react/style.d.ts +3 -3
  71. package/es/plugins/mention/react/style.js +4 -4
  72. package/es/plugins/slash/react/components/DefaultSlashMenu.d.ts +2 -2
  73. package/es/plugins/slash/react/components/DefaultSlashMenu.js +24 -17
  74. package/es/plugins/slash/react/components/SlashMenu.d.ts +2 -2
  75. package/es/plugins/slash/react/components/SlashMenu.js +3 -4
  76. package/es/plugins/slash/react/style.d.ts +1 -1
  77. package/es/plugins/slash/react/style.js +4 -4
  78. package/es/plugins/table/react/TableActionMenu/index.js +3 -7
  79. package/es/plugins/table/react/TableActionMenu/style.d.ts +4 -1
  80. package/es/plugins/table/react/TableActionMenu/style.js +7 -4
  81. package/es/plugins/table/react/TableHoverActions/index.js +2 -4
  82. package/es/plugins/table/react/TableHoverActions/style.d.ts +4 -4
  83. package/es/plugins/table/react/TableHoverActions/style.js +2 -2
  84. package/es/plugins/table/react/TableResize/index.js +8 -8
  85. package/es/plugins/table/react/TableResize/style.d.ts +1 -1
  86. package/es/plugins/table/react/TableResize/style.js +4 -4
  87. package/es/plugins/table/react/index.js +2 -4
  88. package/es/plugins/table/react/style.d.ts +1 -1
  89. package/es/plugins/table/react/style.js +4 -4
  90. package/es/plugins/toolbar/react/index.js +6 -8
  91. package/es/plugins/toolbar/react/style.d.ts +5 -1
  92. package/es/plugins/toolbar/react/style.js +9 -6
  93. package/es/react/ChatInput/ChatInput.d.ts +2 -2
  94. package/es/react/ChatInput/ChatInput.js +16 -27
  95. package/es/react/ChatInput/style.d.ts +11 -6
  96. package/es/react/ChatInput/style.js +13 -9
  97. package/es/react/ChatInputActionBar/ChatInputActionBar.js +2 -4
  98. package/es/react/ChatInputActionBar/style.d.ts +3 -3
  99. package/es/react/ChatInputActionBar/style.js +2 -2
  100. package/es/react/ChatInputActions/ChatInputActions.js +25 -25
  101. package/es/react/ChatInputActions/components/ActionItem.d.ts +2 -2
  102. package/es/react/ChatInputActions/components/ActionItem.js +2 -4
  103. package/es/react/ChatInputActions/components/ActionRender.d.ts +2 -2
  104. package/es/react/ChatInputActions/components/ActionRender.js +5 -11
  105. package/es/react/ChatInputActions/components/CollapsedActions.d.ts +2 -2
  106. package/es/react/ChatInputActions/components/CollapsedActions.js +5 -8
  107. package/es/react/ChatInputActions/style.d.ts +5 -4
  108. package/es/react/ChatInputActions/style.js +6 -5
  109. package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +2 -2
  110. package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +6 -9
  111. package/es/react/CodeLanguageSelect/style.d.ts +3 -3
  112. package/es/react/CodeLanguageSelect/style.js +2 -2
  113. package/es/react/FloatActions/FloatActions.d.ts +2 -2
  114. package/es/react/FloatActions/FloatActions.js +4 -8
  115. package/es/react/FloatActions/components/ActionItem.d.ts +2 -2
  116. package/es/react/FloatActions/components/ActionItem.js +2 -4
  117. package/es/react/FloatActions/components/ActionRender.d.ts +2 -2
  118. package/es/react/FloatActions/components/ActionRender.js +5 -11
  119. package/es/react/FloatActions/components/CollapsedActions.d.ts +2 -2
  120. package/es/react/FloatActions/components/CollapsedActions.js +5 -8
  121. package/es/react/FloatActions/style.d.ts +5 -4
  122. package/es/react/FloatActions/style.js +6 -5
  123. package/es/react/FloatMenu/FloatMenu.js +2 -4
  124. package/es/react/FloatMenu/style.d.ts +5 -4
  125. package/es/react/FloatMenu/style.js +7 -6
  126. package/es/react/SendButton/SendButton.d.ts +2 -2
  127. package/es/react/SendButton/SendButton.js +17 -15
  128. package/es/react/SendButton/components/SendIcon.js +15 -15
  129. package/es/react/SendButton/components/StopIcon.js +16 -18
  130. package/es/react/SendButton/style.d.ts +7 -7
  131. package/es/react/SendButton/style.js +9 -10
  132. package/package.json +3 -3
@@ -1,6 +1,4 @@
1
- import { AllColorReplacements } from "../plugin/FacadeShiki";
2
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
3
- code: import("antd-style").SerializedStyles;
4
- noBackground: import("antd-style").SerializedStyles;
5
- }>;
6
- export declare const colorReplacements: AllColorReplacements;
1
+ export declare const styles: {
2
+ code: string;
3
+ noBackground: string;
4
+ };
@@ -1,38 +1,11 @@
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
- import { createStyles } from 'antd-style';
4
- export var useStyles = createStyles(function (_ref) {
3
+ import { createStaticStyles } from 'antd-style';
4
+ export var styles = createStaticStyles(function (_ref) {
5
5
  var css = _ref.css,
6
- token = _ref.token,
7
- stylish = _ref.stylish,
8
- isDarkMode = _ref.isDarkMode;
6
+ cssVar = _ref.cssVar;
9
7
  return {
10
- code: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --color-yellow: ", ";\n --color-error: ", ";\n --color-gray: ", ";\n --color-purple: ", ";\n --color-info: ", ";\n --color-success: ", ";\n --color-warning: ", ";\n --color-text: ", ";\n --color-geekblue: ", ";\n --color-purple10: ", ";\n --color-warning-text-active: ", ";\n --color-yellow11: ", ";\n\n position: relative;\n\n overflow: hidden;\n display: block;\n\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding: 16px;\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n font-family: ", ";\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n\n background: ", " !important;\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color) inset;\n\n &::after {\n border-radius: ", "px;\n\n content: attr(data-language);\n\n padding-block: 1px;\n padding-inline: 7px;\n\n font-size: 12px;\n\n display: block;\n\n position: absolute;\n z-index: 3;\n inset-block-end: 8px;\n inset-inline-end: 8px;\n\n font-family: ", ";\n color: ", ";\n\n background: ", ";\n\n transition: opacity 0.1s;\n\n opacity: 0;\n\n ", "\n }\n\n span {\n color: var(", ");\n }\n\n &:hover {\n &::after {\n opacity: 1;\n }\n }\n "])), token.yellow, token.colorError, token.gray, token.purple10, token.colorInfo, token.colorSuccess, token.colorWarning, token.colorText, token.geekblue, token.purple10, token.colorWarningTextActive, token.yellow11, token.fontFamilyCode, token.colorFillTertiary, token.borderRadius, token.fontFamilyCode, token.colorTextSecondary, token.colorFillQuaternary, stylish.blur, isDarkMode ? '--shiki-dark' : '--shiki-light'),
8
+ code: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n display: block;\n\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding: 16px;\n border-radius: var(--lobe-markdown-border-radius);\n\n font-family: ", ";\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n\n background: ", " !important;\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color) inset;\n\n &::after {\n content: attr(data-language);\n\n position: absolute;\n z-index: 3;\n inset-block-end: 8px;\n inset-inline-end: 8px;\n\n display: block;\n\n padding-block: 1px;\n padding-inline: 7px;\n border-radius: ", ";\n\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n\n opacity: 0;\n background: ", ";\n backdrop-filter: blur(8px);\n backdrop-filter: blur(8px);\n\n transition: opacity 0.1s;\n }\n\n &:hover {\n &::after {\n opacity: 1;\n }\n }\n "])), cssVar.fontFamilyCode, cssVar.colorFillTertiary, cssVar.borderRadius, cssVar.fontFamilyCode, cssVar.colorTextSecondary, cssVar.colorFillQuaternary),
11
9
  noBackground: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: transparent !important;\n "])))
12
10
  };
13
- });
14
- export var colorReplacements = {
15
- 'slack-dark': {
16
- '#4ec9b0': 'var(--color-yellow)',
17
- '#569cd6': 'var(--color-error)',
18
- '#6a9955': 'var(--color-gray)',
19
- '#9cdcfe': 'var(--color-text)',
20
- '#b5cea8': 'var(--color-purple10)',
21
- '#c586c0': 'var(--color-info)',
22
- '#ce9178': 'var(--color-success)',
23
- '#dcdcaa': 'var(--color-warning)',
24
- '#e6e6e6': 'var(--color-text)'
25
- },
26
- 'slack-ochin': {
27
- '#002339': 'var(--color-text)',
28
- '#0444ac': 'var(--color-geekblue)',
29
- '#0991b6': 'var(--color-error)',
30
- '#174781': 'var(--color-purple10)',
31
- '#2f86d2': 'var(--color-text)',
32
- '#357b42': 'var(--color-gray)',
33
- '#7b30d0': 'var(--color-info)',
34
- '#7eb233': 'var(--color-warning-text-active)',
35
- '#a44185': 'var(--color-success)',
36
- '#dc3eb7': 'var(--color-yellow11)'
37
- }
38
- };
11
+ });
@@ -10,7 +10,7 @@ import { memo, useRef, useState } from 'react';
10
10
  import { $closestNodeType } from "../../../../editor-kernel";
11
11
  import { useLexicalEditor } from "../../../../editor-kernel/react";
12
12
  import { $canShowPlaceholderCurry } from "../../utils";
13
- import { useStyles } from "./style";
13
+ import { styles } from "./style";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  function canShowPlaceholderFromCurrentEditorState(editor) {
16
16
  var currentCanShowPlaceholder = editor.getEditorState().read($canShowPlaceholderCurry(editor.isComposing()));
@@ -35,8 +35,6 @@ var Placeholder = /*#__PURE__*/memo(function (_ref) {
35
35
  _useState2 = _slicedToArray(_useState, 2),
36
36
  canShowPlaceholder = _useState2[0],
37
37
  setCanShowPlaceholder = _useState2[1];
38
- var _useStyles = useStyles(),
39
- styles = _useStyles.styles;
40
38
  useLexicalEditor(function (editor) {
41
39
  setCanShowPlaceholder(function () {
42
40
  return canShowPlaceholderFromCurrentEditorState(editor);
@@ -1,4 +1,4 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
- placeholder: import("antd-style").SerializedStyles;
3
- placeholderContainer: import("antd-style").SerializedStyles;
4
- }>;
1
+ export declare const styles: {
2
+ placeholder: string;
3
+ placeholderContainer: string;
4
+ };
@@ -1,12 +1,12 @@
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 { createStyles } from 'antd-style';
5
- export var useStyles = createStyles(function (_ref) {
4
+ import { createStaticStyles } from 'antd-style';
5
+ export var styles = createStaticStyles(function (_ref) {
6
6
  var css = _ref.css,
7
- token = _ref.token;
7
+ cssVar = _ref.cssVar;
8
8
  return {
9
- placeholder: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n user-select: none;\n\n position: absolute;\n inset-block-start: 0;\n\n margin-block: 4px;\n\n line-height: var(--lobe-markdown-line-height);\n color: ", ";\n letter-spacing: 0.02em;\n "])), token.colorTextDescription),
9
+ placeholder: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n user-select: none;\n\n position: absolute;\n inset-block-start: 0;\n\n margin-block: 4px;\n\n line-height: var(--lobe-markdown-line-height);\n color: ", ";\n letter-spacing: 0.02em;\n "])), cssVar.colorTextDescription),
10
10
  placeholderContainer: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transform: translateY(-2px);\n "])))
11
11
  };
12
12
  });
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  var _excluded = ["fontSize", "headerMultiple", "lineHeight", "marginMultiple"];
4
- 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); }
5
4
  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; }
6
5
  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; }
7
6
  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; }
8
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
8
  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); }
9
+ 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); }
10
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -15,15 +15,17 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
17
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
+ import { cx } from 'antd-style';
18
19
  import { COMMAND_PRIORITY_EDITOR, KEY_DOWN_COMMAND } from 'lexical';
19
20
  import { Children, memo, useEffect, useLayoutEffect, useRef, useState } from 'react';
21
+ import { useMemo } from 'react';
20
22
  import { LexicalErrorBoundary } from "../../../editor-kernel/react/LexicalErrorBoundary";
21
23
  import { useLexicalComposerContext } from "../../../editor-kernel/react/react-context";
22
24
  import { useDecorators } from "../../../editor-kernel/react/useDecorators";
23
25
  import { MarkdownPlugin } from "../../markdown/plugin";
24
26
  import { CommonPlugin } from "../plugin";
25
27
  import Placeholder from "./Placeholder";
26
- import { useStyles, useThemeStyles } from "./style";
28
+ import { styles, themeStyles } from "./style";
27
29
  import { jsx as _jsx } from "react/jsx-runtime";
28
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
31
  // Keep memo: Core editor rendering layer with complex event handling and decorator management
@@ -66,16 +68,30 @@ var ReactPlainText = /*#__PURE__*/memo(function (_ref) {
66
68
  _useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
67
69
  editor = _useLexicalComposerCo2[0];
68
70
  var decorators = useDecorators(editor, LexicalErrorBoundary);
69
- var _useThemeStyles = useThemeStyles(markdownOption),
70
- themeStyles = _useThemeStyles.styles;
71
- var _useStyles = useStyles({
72
- fontSize: fontSize,
73
- headerMultiple: headerMultiple,
74
- lineHeight: lineHeight,
75
- marginMultiple: marginMultiple
76
- }),
77
- cx = _useStyles.cx,
78
- styles = _useStyles.styles;
71
+ var cssVariables = useMemo(function () {
72
+ return {
73
+ '--common-font-size': "".concat(fontSize, "px"),
74
+ '--common-header-multiple': String(headerMultiple),
75
+ '--common-line-height': String(lineHeight),
76
+ '--common-margin-multiple': String(marginMultiple)
77
+ };
78
+ }, [fontSize, headerMultiple, marginMultiple, lineHeight]);
79
+ var computedThemeStyles = useMemo(function () {
80
+ var bold = markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.bold === true;
81
+ var italic = markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.italic === true;
82
+ var strikethrough = markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.strikethrough === true;
83
+ var underline = markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.underline === true;
84
+ var underlineStrikethrough = markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.underlineStrikethrough === true;
85
+ return {
86
+ quote: themeStyles.quote,
87
+ textBold: bold ? themeStyles.textBold_true : themeStyles.textBold_false,
88
+ textCode: themeStyles.textCode,
89
+ textItalic: italic ? themeStyles.textItalic_true : themeStyles.textItalic_false,
90
+ textStrikethrough: strikethrough ? themeStyles.textStrikethrough_true : themeStyles.textStrikethrough_false,
91
+ textUnderline: underline ? themeStyles.textUnderline_true : themeStyles.textUnderline_false,
92
+ textUnderlineStrikethrough: underlineStrikethrough ? themeStyles.textUnderlineStrikethrough_true : themeStyles.textUnderlineStrikethrough_false
93
+ };
94
+ }, [markdownOption]);
79
95
  var _useState = useState(false),
80
96
  _useState2 = _slicedToArray(_useState, 2),
81
97
  isInitialized = _useState2[0],
@@ -93,9 +109,9 @@ var ReactPlainText = /*#__PURE__*/memo(function (_ref) {
93
109
  editor.registerPlugin(CommonPlugin, {
94
110
  enableHotkey: enableHotkey,
95
111
  markdownOption: markdownOption,
96
- theme: restTheme ? _objectSpread(_objectSpread({}, themeStyles), restTheme) : themeStyles
112
+ theme: restTheme ? _objectSpread(_objectSpread({}, computedThemeStyles), restTheme) : computedThemeStyles
97
113
  });
98
- }, [editor, enableHotkey, enablePasteMarkdown, markdownOption, restTheme, themeStyles]);
114
+ }, [editor, enableHotkey, enablePasteMarkdown, markdownOption, restTheme, computedThemeStyles]);
99
115
  useEffect(function () {
100
116
  var _editor$getLexicalEdi;
101
117
  var container = editorContainerRef.current;
@@ -196,20 +212,16 @@ var ReactPlainText = /*#__PURE__*/memo(function (_ref) {
196
212
  };
197
213
  return /*#__PURE__*/_jsxs("div", {
198
214
  className: cx(styles.root, markdownOption === true && styles.variant, markdownOption === false && styles.noStyle, markdownOption === false && styles.noHeader, _typeof(markdownOption) === 'object' && markdownOption.header === true && styles.header, _typeof(markdownOption) === 'object' && markdownOption.header === false && styles.noHeader, _typeof(markdownOption) === 'object' && markdownOption.code === true && styles.code, _typeof(markdownOption) === 'object' && markdownOption.quote === true && styles.blockquote, className),
199
- style: style,
215
+ style: _objectSpread(_objectSpread({}, cssVariables), style),
200
216
  children: [/*#__PURE__*/_jsx("div", {
217
+ className: styles.editorContent,
201
218
  contentEditable: editable !== null && editable !== void 0 ? editable : true,
202
219
  onBlur: handleBlur,
203
220
  onCompositionEnd: handleCompositionEnd,
204
221
  onCompositionStart: handleCompositionStart,
205
222
  onContextMenu: handleContextMenu,
206
223
  onFocus: handleFocus,
207
- ref: editorContainerRef,
208
- style: {
209
- flex: 1,
210
- minHeight: 0,
211
- outline: 'none'
212
- }
224
+ ref: editorContainerRef
213
225
  }), /*#__PURE__*/_jsx(Placeholder, {
214
226
  lineEmptyPlaceholder: lineEmptyPlaceholder,
215
227
  style: style,
@@ -1,35 +1,25 @@
1
- export declare const useThemeStyles: (props?: boolean | {
2
- bold?: boolean | undefined;
3
- code?: boolean | undefined;
4
- header?: boolean | undefined;
5
- italic?: boolean | undefined;
6
- quote?: boolean | undefined;
7
- strikethrough?: boolean | undefined;
8
- subscript?: boolean | undefined;
9
- superscript?: boolean | undefined;
10
- underline?: boolean | undefined;
11
- underlineStrikethrough?: boolean | undefined;
12
- } | undefined) => import("antd-style").ReturnStyles<{
1
+ export declare const themeStyles: {
13
2
  quote: string;
14
- textBold: import("antd-style").SerializedStyles;
3
+ textBold_false: string;
4
+ textBold_true: string;
15
5
  textCode: string;
16
- textItalic: import("antd-style").SerializedStyles;
17
- textStrikethrough: import("antd-style").SerializedStyles;
18
- textUnderline: import("antd-style").SerializedStyles;
19
- textUnderlineStrikethrough: import("antd-style").SerializedStyles;
20
- }>;
21
- export declare const useStyles: (props?: {
22
- fontSize?: number | undefined;
23
- headerMultiple?: number | undefined;
24
- lineHeight?: number | undefined;
25
- marginMultiple?: number | undefined;
26
- } | undefined) => import("antd-style").ReturnStyles<{
27
- blockquote: import("antd-style").SerializedStyles;
28
- code: import("antd-style").SerializedStyles;
29
- header: import("antd-style").SerializedStyles;
30
- noHeader: import("antd-style").SerializedStyles;
31
- noStyle: import("antd-style").SerializedStyles;
32
- p: import("antd-style").SerializedStyles;
33
- root: import("antd-style").SerializedStyles;
6
+ textItalic_false: string;
7
+ textItalic_true: string;
8
+ textStrikethrough_false: string;
9
+ textStrikethrough_true: string;
10
+ textUnderlineStrikethrough_false: string;
11
+ textUnderlineStrikethrough_true: string;
12
+ textUnderline_false: string;
13
+ textUnderline_true: string;
14
+ };
15
+ export declare const styles: {
16
+ blockquote: string;
17
+ code: string;
18
+ editorContent: string;
19
+ header: string;
20
+ noHeader: string;
21
+ noStyle: string;
22
+ p: string;
23
+ root: string;
34
24
  variant: string;
35
- }>;
25
+ };
@@ -1,44 +1,41 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
- 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); }
4
- import { createStyles } from 'antd-style';
5
- export var useThemeStyles = createStyles(function (_ref) {
3
+ import { createStaticStyles, keyframes, cx } from 'antd-style';
4
+ var cursorBlink = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n to {\n visibility: hidden;\n }\n"])));
5
+ export var themeStyles = createStaticStyles(function (_ref) {
6
6
  var css = _ref.css,
7
- token = _ref.token;
8
- var markdownOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
7
+ cssVar = _ref.cssVar;
9
8
  return {
10
9
  quote: 'editor_quote',
11
- textBold: markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.bold === true ? css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-weight: bold;\n "]))) : css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-weight: unset;\n "]))),
10
+ textBold_false: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-weight: unset;\n "]))),
11
+ textBold_true: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-weight: bold;\n "]))),
12
12
  textCode: 'editor_code',
13
- textItalic: markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.italic === true ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-style: italic;\n "]))) : css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-style: unset;\n "]))),
14
- textStrikethrough: markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.strikethrough === true ? css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n text-decoration: line-through;\n "])), token.colorTextDescription) : css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "]))),
15
- textUnderline: markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.strikethrough === true ? css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n text-decoration: underline;\n "]))) : css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "]))),
16
- textUnderlineStrikethrough: markdownOption === true || _typeof(markdownOption) === 'object' && markdownOption.underlineStrikethrough === true ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n text-decoration: underline line-through;\n "]))) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "])))
13
+ textItalic_false: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-style: unset;\n "]))),
14
+ textItalic_true: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-style: italic;\n "]))),
15
+ textStrikethrough_false: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "]))),
16
+ textStrikethrough_true: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n text-decoration: line-through;\n "])), cssVar.colorTextDescription),
17
+ textUnderlineStrikethrough_false: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "]))),
18
+ textUnderlineStrikethrough_true: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n text-decoration: underline line-through;\n "]))),
19
+ textUnderline_false: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n text-decoration: unset;\n "]))),
20
+ textUnderline_true: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n text-decoration: underline;\n "])))
17
21
  };
18
22
  });
19
- export var useStyles = createStyles(function (_ref2, _ref3) {
20
- var cx = _ref2.cx,
21
- token = _ref2.token,
22
- css = _ref2.css;
23
- var _ref3$fontSize = _ref3.fontSize,
24
- fontSize = _ref3$fontSize === void 0 ? 16 : _ref3$fontSize,
25
- _ref3$headerMultiple = _ref3.headerMultiple,
26
- headerMultiple = _ref3$headerMultiple === void 0 ? 1 : _ref3$headerMultiple,
27
- _ref3$marginMultiple = _ref3.marginMultiple,
28
- marginMultiple = _ref3$marginMultiple === void 0 ? 2 : _ref3$marginMultiple,
29
- _ref3$lineHeight = _ref3.lineHeight,
30
- lineHeight = _ref3$lineHeight === void 0 ? 1.8 : _ref3$lineHeight;
31
- var __root = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n max-width: 100%;\n height: 100%;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n @keyframes cursor-blink {\n to {\n visibility: hidden;\n }\n }\n\n [data-placeholder] {\n position: relative;\n }\n\n [data-placeholder]::after {\n pointer-events: none;\n content: attr(data-placeholder);\n user-select: none;\n\n position: absolute;\n inset-block-start: 50%;\n transform: translateY(-50%);\n\n padding-inline-start: 2px;\n\n color: ", ";\n white-space: nowrap;\n }\n\n [data-lexical-cursor='true'] {\n pointer-events: none;\n position: absolute;\n display: block;\n\n &::after {\n content: '';\n\n position: absolute;\n inset-block-start: -2px;\n\n display: block;\n\n width: 20px;\n border-block-start: 1px solid ", ";\n\n animation: cursor-blink 1.1s steps(2, start) infinite;\n }\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadiusLG, token.colorFillQuaternary, token.colorTextDescription, token.colorText);
32
- var header = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5,\n h6 {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])));
33
- var p = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n p {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
34
- var blockquote = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .editor_quote {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n border-inline-start: solid 4px ", ";\n\n color: ", ";\n }\n "])), token.colorBorder, token.colorTextSecondary);
35
- var code = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n .editor_code {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n }\n "])), token.fontFamilyCode, token.colorFillSecondary);
23
+ export var styles = createStaticStyles(function (_ref2) {
24
+ var css = _ref2.css,
25
+ cssVar = _ref2.cssVar;
26
+ var __root = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: var(--common-font-size, 16px);\n --lobe-markdown-header-multiple: var(--common-header-multiple, 1);\n --lobe-markdown-margin-multiple: var(--common-margin-multiple, 2);\n --lobe-markdown-line-height: var(--common-line-height, 1.8);\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n max-width: 100%;\n height: 100%;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n [data-placeholder] {\n position: relative;\n }\n\n [data-placeholder]::after {\n pointer-events: none;\n content: attr(data-placeholder);\n user-select: none;\n\n position: absolute;\n inset-block-start: 50%;\n transform: translateY(-50%);\n\n padding-inline-start: 2px;\n\n color: ", ";\n white-space: nowrap;\n }\n\n [data-lexical-cursor='true'] {\n pointer-events: none;\n position: absolute;\n display: block;\n\n &::after {\n content: '';\n\n position: absolute;\n inset-block-start: -2px;\n\n display: block;\n\n width: 20px;\n border-block-start: 1px solid ", ";\n\n animation: ", " 1.1s steps(2, start) infinite;\n }\n }\n "])), cssVar.borderRadiusLG, cssVar.colorFillQuaternary, cssVar.colorTextDescription, cssVar.colorText, cursorBlink);
27
+ var header = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2 {\n font-size: calc(var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple)));\n }\n\n h3 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5,\n h6 {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])));
28
+ var p = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n p {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
29
+ var blockquote = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n .editor_quote {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n border-inline-start: solid 4px ", ";\n\n color: ", ";\n }\n "])), cssVar.colorBorder, cssVar.colorTextSecondary);
30
+ var code = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n .editor_code {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n }\n "])), cssVar.fontFamilyCode, cssVar.colorFillSecondary);
31
+ var editorContent = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n outline: none;\n "])));
36
32
  return {
37
33
  blockquote: blockquote,
38
34
  code: code,
35
+ editorContent: editorContent,
39
36
  header: header,
40
- noHeader: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: 0;\n font-size: var(--lobe-markdown-font-size);\n font-weight: normal;\n line-height: var(--lobe-markdown-line-height);\n }\n "]))),
41
- noStyle: css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n --lobe-markdown-header-multiple: 0;\n --lobe-markdown-margin-multiple: 0;\n --lobe-markdown-line-height: 1.5;\n\n p {\n margin-block: 4px;\n }\n "]))),
37
+ noHeader: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: 0;\n font-size: var(--lobe-markdown-font-size);\n font-weight: normal;\n line-height: var(--lobe-markdown-line-height);\n }\n "]))),
38
+ noStyle: css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n --lobe-markdown-header-multiple: 0;\n --lobe-markdown-margin-multiple: 0;\n --lobe-markdown-line-height: 1.5;\n\n p {\n margin-block: 4px;\n }\n "]))),
42
39
  p: p,
43
40
  root: __root,
44
41
  variant: cx(header, p, blockquote, code)
@@ -15,7 +15,7 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
15
15
  import { UploadPlugin } from "../../upload";
16
16
  import { FilePlugin } from "../plugin";
17
17
  import ReactFile from "./components/ReactFile";
18
- import { useStyles } from "./style";
18
+ import { styles } from "./style";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  var ReactFilePlugin = function ReactFilePlugin(_ref) {
21
21
  var className = _ref.className,
@@ -26,8 +26,6 @@ var ReactFilePlugin = function ReactFilePlugin(_ref) {
26
26
  var _useLexicalComposerCo = useLexicalComposerContext(),
27
27
  _useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
28
28
  editor = _useLexicalComposerCo2[0];
29
- var _useStyles = useStyles(),
30
- styles = _useStyles.styles;
31
29
  useLayoutEffect(function () {
32
30
  if (locale) {
33
31
  editor.registerLocale(locale);
@@ -1,3 +1,3 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
- file: import("antd-style").SerializedStyles;
3
- }>;
1
+ export declare const styles: {
2
+ file: string;
3
+ };
@@ -1,11 +1,11 @@
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
3
  /* eslint-disable sort-keys-fix/sort-keys-fix */
4
- import { createStyles } from 'antd-style';
5
- export var useStyles = createStyles(function (_ref) {
4
+ import { createStaticStyles } from 'antd-style';
5
+ export var styles = createStaticStyles(function (_ref) {
6
6
  var css = _ref.css,
7
- token = _ref.token;
7
+ cssVar = _ref.cssVar;
8
8
  return {
9
- file: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n\n display: inline-block;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n\n span {\n user-select: none;\n }\n\n &.selected {\n color: #000;\n background: ", ";\n }\n "])), token.fontFamilyCode, token.colorFillSecondary, token.yellow)
9
+ file: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n\n display: inline-block;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n\n span {\n user-select: none;\n }\n\n &.selected {\n color: #000;\n background: ", ";\n }\n "])), cssVar.fontFamilyCode, cssVar.colorFillSecondary, cssVar.yellow)
10
10
  };
11
11
  });
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
1
  import { LexicalEditor } from 'lexical';
2
+ import { type FC } from 'react';
3
3
  import { HorizontalRuleNode } from '../../node/HorizontalRuleNode';
4
4
  interface HRNodeProps {
5
5
  className?: string;
6
6
  editor: LexicalEditor;
7
7
  node: HorizontalRuleNode;
8
8
  }
9
- declare const HRNode: import("react").NamedExoticComponent<HRNodeProps>;
9
+ declare const HRNode: FC<HRNodeProps>;
10
10
  export default HRNode;
@@ -7,12 +7,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7
7
  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; } }
8
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  import { mergeRegister } from '@lexical/utils';
10
+ import { cx } from 'antd-style';
10
11
  import { CLICK_COMMAND, COMMAND_PRIORITY_LOW } from 'lexical';
11
- import { memo, useEffect } from 'react';
12
+ import { useEffect } from 'react';
12
13
  import { useLexicalNodeSelection } from "../../../../editor-kernel/react/useLexicalNodeSelection";
13
- import { useStyles } from "../style";
14
+ import { styles } from "../style";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
- var HRNode = /*#__PURE__*/memo(function (_ref) {
16
+ var HRNode = function HRNode(_ref) {
16
17
  var node = _ref.node,
17
18
  className = _ref.className,
18
19
  editor = _ref.editor;
@@ -21,9 +22,6 @@ var HRNode = /*#__PURE__*/memo(function (_ref) {
21
22
  isSelected = _useLexicalNodeSelect2[0],
22
23
  setSelected = _useLexicalNodeSelect2[1],
23
24
  clearSelection = _useLexicalNodeSelect2[2];
24
- var _useStyles = useStyles(),
25
- cx = _useStyles.cx,
26
- styles = _useStyles.styles;
27
25
  useEffect(function () {
28
26
  return mergeRegister(editor.registerCommand(CLICK_COMMAND, function (event) {
29
27
  var hrElem = editor.getElementByKey(node.getKey());
@@ -41,6 +39,6 @@ var HRNode = /*#__PURE__*/memo(function (_ref) {
41
39
  className: cx(styles, isSelected && 'selected', className),
42
40
  children: /*#__PURE__*/_jsx("hr", {})
43
41
  });
44
- });
42
+ };
45
43
  HRNode.displayName = 'HRNode';
46
44
  export default HRNode;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
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 { createStyles } from 'antd-style';
4
- export var useStyles = createStyles(function (_ref) {
3
+ import { createStaticStyles } from 'antd-style';
4
+ export var styles = createStaticStyles(function (_ref) {
5
5
  var css = _ref.css,
6
- token = _ref.token;
7
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n\n hr {\n width: 100%;\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n\n &.selected {\n background: ", ";\n\n hr {\n border-color: #000;\n }\n }\n "])), token.colorBorder, token.yellow);
6
+ cssVar = _ref.cssVar;
7
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: calc(var(--lobe-markdown-margin-multiple) * 1em);\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1em);\n\n hr {\n width: 100%;\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n\n &.selected {\n background: ", ";\n\n hr {\n border-color: #000;\n }\n }\n "])), cssVar.colorBorder, cssVar.yellow);
8
8
  });
@@ -11,7 +11,7 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
11
11
  import { UploadPlugin } from "../../upload";
12
12
  import { ImagePlugin } from "../plugin";
13
13
  import Image from "./components/Image";
14
- import { useStyles } from "./style";
14
+ import { styles } from "./style";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  var defaultUpload = function defaultUpload(file) {
17
17
  return new Promise(function (resolve) {
@@ -32,8 +32,6 @@ var ReactImagePlugin = function ReactImagePlugin(_ref) {
32
32
  var _useLexicalComposerCo = useLexicalComposerContext(),
33
33
  _useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
34
34
  editor = _useLexicalComposerCo2[0];
35
- var _useStyles = useStyles(),
36
- styles = _useStyles.styles;
37
35
  useLayoutEffect(function () {
38
36
  editor.registerPlugin(UploadPlugin);
39
37
  editor.registerPlugin(ImagePlugin, {
@@ -1,16 +1,14 @@
1
1
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
2
2
  import { imageBroken } from "../style";
3
+ import { styles } from "./style";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  var BrokenImage = function BrokenImage() {
5
6
  var t = useTranslation();
6
7
  return /*#__PURE__*/_jsx("img", {
7
8
  alt: t('image.broken'),
9
+ className: styles.brokenImage,
8
10
  draggable: "false",
9
- src: imageBroken,
10
- style: {
11
- height: 'auto',
12
- width: 200
13
- }
11
+ src: imageBroken
14
12
  });
15
13
  };
16
14
  BrokenImage.displayName = 'BrokenImage';
@@ -4,6 +4,7 @@ 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 { COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND } from 'lexical';
8
9
  import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
9
10
  import { useLexicalEditor } from "../../../../editor-kernel/react/useLexicalEditor";
@@ -12,7 +13,7 @@ import { $isBlockImageNode } from "../../node/block-image-node";
12
13
  import BrokenImage from "./BrokenImage";
13
14
  import LazyImage from "./LazyImage";
14
15
  import { ResizeHandle } from "./ResizeHandle";
15
- import { useStyles } from "./style";
16
+ import { styles } from "./style";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
19
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -22,9 +23,6 @@ var Image = /*#__PURE__*/memo(function (_ref) {
22
23
  className = _ref.className,
23
24
  _ref$showScaleInfo = _ref.showScaleInfo,
24
25
  showScaleInfo = _ref$showScaleInfo === void 0 ? false : _ref$showScaleInfo;
25
- var _useStyles = useStyles(),
26
- styles = _useStyles.styles,
27
- cx = _useStyles.cx;
28
26
  var _useLexicalNodeSelect = useLexicalNodeSelection(node.getKey()),
29
27
  _useLexicalNodeSelect2 = _slicedToArray(_useLexicalNodeSelect, 2),
30
28
  isSelected = _useLexicalNodeSelect2[0],
@@ -1,14 +1,15 @@
1
- /// <reference types="react" />
1
+ import { type FC } from 'react';
2
2
  import { BlockImageNode } from '../../node/block-image-node';
3
3
  import { ImageNode } from '../../node/image-node';
4
- declare const LazyImage: import("react").NamedExoticComponent<{
5
- className?: string | null | undefined;
6
- newWidth?: number | null | undefined;
4
+ interface LazyImageProps {
5
+ className?: string | null;
6
+ newWidth?: number | null;
7
7
  node: ImageNode | BlockImageNode;
8
- onError?: (() => void) | undefined;
9
- onLoad?: ((dimensions: {
8
+ onError?: () => void;
9
+ onLoad?: (dimensions: {
10
10
  height: number;
11
11
  width: number;
12
- }) => void) | undefined;
13
- }>;
12
+ }) => void;
13
+ }
14
+ declare const LazyImage: FC<LazyImageProps>;
14
15
  export default LazyImage;