@blocklet/editor 2.3.20 → 2.3.22

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,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled from '@emotion/styled';
3
2
  import { Icon } from '@iconify/react';
4
- import { Box, CircularProgress } from '@mui/material';
3
+ import { Box, CircularProgress, styled } from '@mui/material';
5
4
  import { useRequest } from 'ahooks';
6
5
  import { useEditorConfig } from '../../config';
7
6
  import { fetchOpenGraphInfo } from '../utils';
@@ -31,12 +30,13 @@ export function Bookmark({ url, title, description, image, favicon, loading }) {
31
30
  }
32
31
  return (_jsxs(Root, { href: url, target: "_blank", children: [_jsxs("div", { className: "be-bookmark-texts", children: [renderTitle(), _jsx("div", { className: "be-bookmark-description be-bookmark-clamp2", children: description }), _jsxs("div", { className: "be-bookmark-url-content", children: [favicon && _jsx("img", { src: favicon, alt: "favicon", className: "be-bookmark-favicon" }), _jsx("div", { className: "be-bookmark-url be-bookmark-ellipsis", children: url })] })] }), image && _jsx("div", { className: "be-bookmark-image", style: { backgroundImage: `url(${image})` } })] }));
33
32
  }
34
- const Root = styled.a `
33
+ const Root = styled('a') `
35
34
  box-sizing: border-box;
36
35
  display: inline-flex;
37
36
  width: 100%;
38
37
  margin: 8px 0;
39
- border: 1px solid rgba(55, 53, 47, 0.16);
38
+ border: 1px solid;
39
+ border-color: ${({ theme }) => theme.palette.divider};
40
40
  overflow: hidden;
41
41
  color: inherit;
42
42
  border-radius: 4px;
@@ -44,7 +44,7 @@ const Root = styled.a `
44
44
  cursor: pointer;
45
45
 
46
46
  :hover {
47
- background: #fafafa;
47
+ background: ${({ theme }) => theme.palette.grey[50]};
48
48
  }
49
49
 
50
50
  .be-bookmark-texts {
@@ -59,7 +59,7 @@ const Root = styled.a `
59
59
  margin: 4px 0;
60
60
  line-height: 1.2;
61
61
  font-size: 12px;
62
- color: rgba(55, 53, 47, 0.65);
62
+ color: ${({ theme }) => theme.palette.text.secondary};
63
63
  }
64
64
 
65
65
  .be-bookmark-url-content {
@@ -69,7 +69,7 @@ const Root = styled.a `
69
69
 
70
70
  .be-bookmark-url {
71
71
  font-size: 12px;
72
- color: #555;
72
+ color: ${({ theme }) => theme.palette.text.secondary};
73
73
  line-height: 1;
74
74
  }
75
75
 
@@ -129,7 +129,7 @@ const Root = styled.a `
129
129
  position: absolute;
130
130
  bottom: 0;
131
131
  right: 0;
132
- background: #fff;
132
+ background: ${({ theme }) => theme.palette.background.paper};
133
133
  border-radius: 100%;
134
134
  z-index: 1;
135
135
  }
@@ -148,7 +148,7 @@ const Root = styled.a `
148
148
  }
149
149
  }
150
150
  `;
151
- const Image = styled.img `
151
+ const Image = styled('img') `
152
152
  width: 100%;
153
153
  height: 100%;
154
154
  border-radius: 100%;
@@ -7,6 +7,7 @@ import { $createTranslationNode } from './TranslationNode';
7
7
  import { $isExcalidrawNode } from '../../main/nodes/ExcalidrawNode';
8
8
  import { $isImageNode } from '../../main/nodes/ImageNode';
9
9
  import { $isPdfNode } from '../PdfPlugin/PdfNode';
10
+ import { $isVideoNode } from '../VideoPlugin/VideoNode';
10
11
  export class EditorTranslator {
11
12
  editor;
12
13
  options;
@@ -143,7 +144,7 @@ export class EditorTranslator {
143
144
  }
144
145
  async preprocessNodes() {
145
146
  const isSpecialNode = (node) => {
146
- return $isExcalidrawNode(node) || $isImageNode(node) || $isPdfNode(node);
147
+ return $isExcalidrawNode(node) || $isImageNode(node) || $isPdfNode(node) || $isVideoNode(node);
147
148
  };
148
149
  this.editor.update(() => {
149
150
  $findTranslatableElementNodes().forEach((node) => {
@@ -3,10 +3,12 @@ import { DecoratorNode } from 'lexical';
3
3
  import { Suspense } from 'react';
4
4
  import { joinURL, withFragment } from 'ufo';
5
5
  import Box from '@mui/material/Box';
6
+ import { useTheme } from '@mui/material';
6
7
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
7
8
  import { exhaustiveGuard, safeParseJSON, discussKitMountPoint } from '../utils';
8
9
  function PostLinkComponent(postInfo) {
9
10
  const { locale } = useLocaleContext();
11
+ const { palette } = useTheme();
10
12
  // PostLinkNode 新/旧版本对于 link 的处理:
11
13
  // - 旧版本: 存储 post link, 渲染 link 时直接使用 post link
12
14
  // - 新版本: 连同 id, type, boardId 等信息一并存储, 渲染 link 时动态拼接 post link (与 embed 时的 post link 解耦)
@@ -47,7 +49,7 @@ function PostLinkComponent(postInfo) {
47
49
  return (_jsxs(Box, { sx: {
48
50
  display: 'flex',
49
51
  alignItems: 'center',
50
- '&:hover': { bgcolor: '#eee', boxShadow: '0 0 0 3px #eee', borderRadius: 1 },
52
+ '&:hover': { bgcolor: 'grey.200', boxShadow: `0 0 0 3px ${palette.grey[200]}`, borderRadius: 1 },
51
53
  }, children: [_jsx(Box, { component: "i", className: "iconify", "data-icon": "ri:file-list-2-line", sx: { flex: '0 0 auto', width: 18, height: 18, mr: 0.25, color: 'grey.600' } }), _jsx(Box, { component: "a", href: link, sx: {
52
54
  display: 'inline-block',
53
55
  overflow: 'hidden',
@@ -56,7 +58,8 @@ function PostLinkComponent(postInfo) {
56
58
  wordBreak: 'break-word',
57
59
  height: 18,
58
60
  lineHeight: '18px',
59
- borderBottom: '1px solid rgba(0, 0, 0, 0.25)',
61
+ borderBottom: '1px solid',
62
+ borderColor: 'divider',
60
63
  fontSize: 14,
61
64
  textDecoration: 'none',
62
65
  fontWeight: 'medium',
@@ -62,7 +62,7 @@ function LazyImage({ altText, className, imageRef, src, width, height, }) {
62
62
  ...(src?.endsWith('.svg') && { minWidth: 200 }),
63
63
  },
64
64
  };
65
- return (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, draggable: "false", ...imgProps }));
65
+ return (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, draggable: "false", crossOrigin: "anonymous", ...imgProps }));
66
66
  }
67
67
  export default function ImageComponent({ file, src, altText, nodeKey, width, height, maxWidth, resizable, showCaption, caption, captionsEnabled, markerState, frame, sizeMode, }) {
68
68
  const imageFrameRef = useRef(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.3.20",
3
+ "version": "2.3.22",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,8 +27,8 @@
27
27
  "@blocklet/code-editor": "^0.4.264",
28
28
  "@blocklet/embed": "^0.2.4",
29
29
  "@blocklet/js-sdk": "^1.16.42",
30
- "@blocklet/pages-kit": "^0.4.160",
31
- "@blocklet/pages-kit-runtime": "^0.4.160",
30
+ "@blocklet/pages-kit": "^0.5.2",
31
+ "@blocklet/pages-kit-runtime": "^0.5.2",
32
32
  "@excalidraw/excalidraw": "^0.14.2",
33
33
  "@iconify/iconify": "^3.1.1",
34
34
  "@iconify/icons-tabler": "^1.2.95",
@@ -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.3.20"
71
+ "@blocklet/pdf": "^2.3.22"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@babel/core": "^7.25.2",