@blocklet/editor 2.4.10 → 2.4.12

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.
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @deprecated
2
3
  * 支持 (block 级别的) 水平滚动
3
4
  */
4
5
  export declare const useResponsiveTable: () => void;
@@ -4,6 +4,7 @@ import { useEffect } from 'react';
4
4
  import { $createParagraphNode } from 'lexical';
5
5
  import { $wrapNodeInElement } from '@lexical/utils';
6
6
  /**
7
+ * @deprecated
7
8
  * 支持 (block 级别的) 水平滚动
8
9
  */
9
10
  export const useResponsiveTable = () => {
package/lib/main/index.js CHANGED
@@ -12,6 +12,7 @@ import { LexicalComposer } from '@lexical/react/LexicalComposer';
12
12
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
13
13
  import { useCallback, useEffect, useRef } from 'react';
14
14
  import { $convertFromMarkdownString } from '@lexical/markdown';
15
+ import { useTheme } from '@mui/material';
15
16
  import { SettingsContext } from './context/SettingsContext';
16
17
  import { SharedAutocompleteContext } from './context/SharedAutocompleteContext';
17
18
  import { SharedHistoryContext } from './context/SharedHistoryContext';
@@ -21,6 +22,7 @@ import { TableContext } from './plugins/TablePlugin';
21
22
  import { useCustomTheme } from './themes/customTheme';
22
23
  import { PLAYGROUND_TRANSFORMERS } from './plugins/MarkdownTransformers';
23
24
  export default function BlockletEditor({ editorState, nodes = PlaygroundNodes, editable = true, markdown, ...props }) {
25
+ const muiTheme = useTheme();
24
26
  const theme = useCustomTheme();
25
27
  const initialConfig = {
26
28
  namespace: 'Playground',
@@ -32,7 +34,7 @@ export default function BlockletEditor({ editorState, nodes = PlaygroundNodes, e
32
34
  },
33
35
  theme,
34
36
  };
35
- return (_jsx(SettingsContext, { children: _jsx(SharedHistoryContext, { children: _jsx(SharedAutocompleteContext, { children: _jsx(TableContext, { children: _jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(EditorShell, { ...props, editable: editable }) }) }) }) }) }));
37
+ return (_jsx(SettingsContext, { children: _jsx(SharedHistoryContext, { children: _jsx(SharedAutocompleteContext, { children: _jsx(TableContext, { children: _jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(EditorShell, { ...props, editable: editable }) }, muiTheme.palette.mode) }) }) }) }));
36
38
  }
37
39
  function EditorShell({ placeholder, children, prepend, editable, onChange, autoFocus, showToolbar = true, editorRef, onReady, enableHeadingsIdPlugin, ...props }) {
38
40
  const [editor] = useLexicalComposerContext();
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useEffect } from 'react';
3
3
  import mermaid from 'mermaid';
4
+ import { useTheme } from '@mui/material';
4
5
  function MermaidComponent({ code }) {
6
+ const theme = useTheme();
5
7
  const ref = React.useRef(null);
6
8
  useEffect(() => {
7
9
  if (!ref.current)
8
10
  return;
9
11
  ref.current.innerHTML = '';
10
- mermaid.initialize({ startOnLoad: false });
12
+ mermaid.initialize({ startOnLoad: false, ...(theme.palette.mode === 'dark' && { theme: 'dark' }) });
11
13
  const id = `mermaid-${Math.random().toString(36).substring(2, 9)}`;
12
14
  try {
13
15
  mermaid.render(id, code).then(({ svg }) => {
@@ -18,7 +20,7 @@ function MermaidComponent({ code }) {
18
20
  catch (e) {
19
21
  console.error(e);
20
22
  }
21
- }, [code]);
23
+ }, [code, theme.palette.mode]);
22
24
  return _jsx("div", { ref: ref });
23
25
  }
24
26
  export default MermaidComponent;
@@ -19,11 +19,6 @@ const createCustomTheme = (theme) => {
19
19
  // scroll bar and table gap
20
20
  padding-bottom: 0.628em;
21
21
  }
22
- &:has(th[style*="width"], td[style*="width"]){
23
- table {
24
- width: max-content !important;
25
- }
26
- }
27
22
  `, theme.typography.body1, noMarginTopStyle);
28
23
  const quote = css(`
29
24
  margin: 1.6em 0;
@@ -109,7 +104,7 @@ const createCustomTheme = (theme) => {
109
104
  padding: '1px .375rem',
110
105
  fontFamily: 'Menlo, Consolas, Monaco, monospace',
111
106
  fontVariantLigatures: 'none',
112
- backgroundColor: palette.grey[50],
107
+ backgroundColor: palette.grey[100],
113
108
  ...(palette.mode === 'dark' && { color: palette.grey[800] }),
114
109
  });
115
110
  const olCommon = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.10",
3
+ "version": "2.4.12",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -68,7 +68,7 @@
68
68
  "ufo": "^1.5.4",
69
69
  "url-join": "^4.0.1",
70
70
  "zustand": "^4.5.5",
71
- "@blocklet/pdf": "^2.4.10"
71
+ "@blocklet/pdf": "^2.4.12"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@babel/core": "^7.25.2",