@blocklet/editor 2.4.41 → 2.4.43

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.
@@ -246,7 +246,7 @@ export default function ImageComponent({ file, src, altText, nodeKey, width, hei
246
246
  }
247
247
  }, [src, file, confirmText]);
248
248
  const skeleton = sizeMode === 'original' ? null : (_jsx(Skeleton, { variant: "rectangular", animation: "wave", sx: { width: 300, height: 200, borderRadius: 1 } }));
249
- const placeholder = objectUrl ? (_jsx(ImageContainer, { draggable: draggable, success: !!src, loading: loading, error: error, confirmText: confirmText, uploadImage: uploadImage, placeholder: objectUrl, placeholderProps: { style: { width, height, maxWidth } } })) : (skeleton);
249
+ const placeholder = objectUrl ? (_jsx(ImageContainer, { draggable: draggable, success: !!src, loading: loading, error: error, confirmText: confirmText, uploadImage: uploadImage, placeholder: objectUrl, placeholderProps: { style: { width, height, maxWidth } }, showBorder: !frame })) : (skeleton);
250
250
  const imageDisplayWidth = useImageDisplayWidth({ src: src || objectUrl, sizeMode, width });
251
251
  const { zoomOpened, openedImageRef } = useMediumZoom(imageRef, { enabled: !frame });
252
252
  const renderImageAnnotationView = () => {
@@ -304,7 +304,7 @@ export default function ImageComponent({ file, src, altText, nodeKey, width, hei
304
304
  }
305
305
  return (_jsxs(_Fragment, { children: [_jsx(LazyImage, { className: isFocused && editor.isEditable() ? `focused ${$isNodeSelection(selection) ? 'draggable' : ''}` : null, src: imgSrc, altText: altText, imageRef: imageRef, width: imageDisplayWidth, height: height }), renderImageAnnotationView()] }));
306
306
  };
307
- return (_jsx(Suspense, { fallback: placeholder, children: _jsxs(_Fragment, { children: [src ? (_jsxs(ImageContainer, { draggable: draggable, children: [renderImage(src), editor.isEditable() && (_jsx(ImageAnnotation, { editing: markerEditing, setEditing: setMarkerEditing, imageRef: imageRef, markerState: markerState, onChange: setMarkerState }))] })) : (placeholder), showCaption && (_jsx("div", { className: "image-caption-container", children: _jsxs(LexicalNestedComposer, { initialEditor: caption, children: [_jsx(AutoFocusPlugin, {}), _jsx(LinkPlugin, {}), _jsx(HistoryPlugin, { externalHistoryState: historyState }), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "ImageNode__contentEditable" }), placeholder: editor.isEditable() ? (_jsx(Placeholder, { className: "ImageNode__placeholder", children: "Enter a caption..." })) : null, ErrorBoundary: LexicalErrorBoundary })] }) })), resizable && $isNodeSelection(selection) && isFocused && (_jsxs(_Fragment, { children: [_jsx(ImageResizer, { showCaption: showCaption, setShowCaption: setShowCaption, editor: editor, buttonRef: buttonRef, imageRef: imageFrameRef.current ? imageFrameRef : imageRef,
307
+ return (_jsx(Suspense, { fallback: placeholder, children: _jsxs(_Fragment, { children: [src ? (_jsxs(ImageContainer, { draggable: draggable, showBorder: !frame, children: [renderImage(src), editor.isEditable() && (_jsx(ImageAnnotation, { editing: markerEditing, setEditing: setMarkerEditing, imageRef: imageRef, markerState: markerState, onChange: setMarkerState }))] })) : (placeholder), showCaption && (_jsx("div", { className: "image-caption-container", children: _jsxs(LexicalNestedComposer, { initialEditor: caption, children: [_jsx(AutoFocusPlugin, {}), _jsx(LinkPlugin, {}), _jsx(HistoryPlugin, { externalHistoryState: historyState }), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "ImageNode__contentEditable" }), placeholder: editor.isEditable() ? (_jsx(Placeholder, { className: "ImageNode__placeholder", children: "Enter a caption..." })) : null, ErrorBoundary: LexicalErrorBoundary })] }) })), resizable && $isNodeSelection(selection) && isFocused && (_jsxs(_Fragment, { children: [_jsx(ImageResizer, { showCaption: showCaption, setShowCaption: setShowCaption, editor: editor, buttonRef: buttonRef, imageRef: imageFrameRef.current ? imageFrameRef : imageRef,
308
308
  // maxWidth={maxWidth}
309
309
  onResizeStart: onResizeStart, onResizeEnd: onResizeEnd, captionsEnabled: false }), _jsxs(ImageEnhancer, { frame: frame, sizeMode: width === 'inherit' ? sizeMode || 'best-fit' : undefined, onSizeModeChange: setSizeMode, onFrameChange: setFrame, children: [_jsx(Button, { disabled: !!isDeviceFrameUsed, onClick: () => setMarkerEditing(true), variant: "outlined", size: "small", sx: {
310
310
  minWidth: 36,
@@ -322,14 +322,19 @@ export default function ImageComponent({ file, src, altText, nodeKey, width, hei
322
322
  '.MuiButton-icon': { m: 0 },
323
323
  }, startIcon: showCaption ? (_jsx("i", { className: "iconify", "data-icon": "tabler:heading-off" })) : (_jsx("i", { className: "iconify", "data-icon": "tabler:text-caption" })), title: showCaption ? 'Remove Caption' : 'Add Caption' }))] })] }))] }) }));
324
324
  }
325
- const ImageContainer = ({ success, loading, error, confirmText, uploadImage, placeholder, placeholderProps, ...props }) => {
325
+ const ImageContainer = ({ success, loading, error, confirmText, uploadImage, placeholder, placeholderProps, showBorder = true, ...props }) => {
326
326
  const [showMask, setShowMask] = useState(false);
327
- return (_jsxs(ImageContainerRoot, { ...props, children: [props.children ||
327
+ return (_jsxs(Box, { sx: {
328
+ position: 'relative',
329
+ ...(showBorder && {
330
+ p: 2,
331
+ border: 1,
332
+ borderColor: 'divider',
333
+ borderRadius: 1,
334
+ }),
335
+ }, children: [props.children ||
328
336
  (!!placeholder && _jsx("img", { alt: "", ...placeholderProps, onLoad: () => setShowMask(true), src: placeholder })), !showMask || success ? null : loading ? (_jsx(Mask, { children: _jsx(LinearProgress, {}) })) : error ? (_jsx(Mask, { children: _jsx(Alert, { severity: "error", action: _jsx(Button, { size: "small", onClick: uploadImage, children: "Retry" }), children: error }) })) : confirmText ? (_jsx(Mask, { children: _jsx(Alert, { severity: "warning", action: _jsx(Button, { size: "small", onClick: uploadImage, children: "Upload" }), children: confirmText }) })) : null] }));
329
337
  };
330
- const ImageContainerRoot = styled.div `
331
- position: relative;
332
- `;
333
338
  const Mask = styled.div `
334
339
  position: absolute;
335
340
  left: 0;
@@ -16,7 +16,7 @@
16
16
 
17
17
  .Collapsible__title {
18
18
  cursor: pointer;
19
- padding: 5px 5px 5px 20px;
19
+ padding: 5px 5px 5px 24px;
20
20
  position: relative;
21
21
  font-weight: bold;
22
22
  list-style: none;
@@ -40,7 +40,7 @@
40
40
  display: block;
41
41
  content: '';
42
42
  position: absolute;
43
- left: 7px;
43
+ left: 12px;
44
44
  top: 50%;
45
45
  transform: translateY(-50%);
46
46
  }
@@ -51,8 +51,8 @@
51
51
  border-top-color: #000;
52
52
  }
53
53
 
54
- .Collapsible__content {
55
- padding: 0 5px 5px 20px;
54
+ .Collapsible__container[open] > .Collapsible__content {
55
+ padding: 0 5px 5px 24px;
56
56
  }
57
57
 
58
58
  .Collapsible__collapsed .Collapsible__content {
@@ -43,6 +43,21 @@ const StyledEditorWrapper = styled(Box) `
43
43
  > ul > li {
44
44
  margin-left: 32px;
45
45
  }
46
+
47
+ // collapsible dark-mode
48
+ summary.Collapsible__title:before {
49
+ border-left-color: ${({ theme }) => theme.palette.text.primary} !important;
50
+ }
51
+ .Collapsible__container[open] > .Collapsible__title:before {
52
+ border-left-color: transparent !important;
53
+ border-width: 6px 4px 0 4px;
54
+ border-top-color: ${({ theme }) => theme.palette.text.primary} !important;
55
+ }
56
+ .Collapsible__container {
57
+ background: ${({ theme }) => theme.palette.grey[50]};
58
+ border: 1px solid ${({ theme }) => theme.palette.divider};
59
+ border-radius: ${({ theme }) => theme.shape.borderRadius}px;
60
+ }
46
61
  }
47
62
 
48
63
  /* fix: 自定义样式引起的 cell 高度偏大的问题 */
@@ -53,6 +68,13 @@ const StyledEditorWrapper = styled(Box) `
53
68
  .PlaygroundEditorTheme__tableRowStriping tr:nth-child(even) {
54
69
  background-color: ${({ theme }) => theme.palette.grey[100]} !important;
55
70
  }
71
+
72
+ .PlaygroundEditorTheme__tableCell {
73
+ border: 1px solid ${({ theme }) => theme.palette.divider} !important;
74
+ }
75
+ .PlaygroundEditorTheme__tableCellHeader {
76
+ background-color: ${({ theme }) => theme.palette.grey[50]} !important;
77
+ }
56
78
  `;
57
79
  export function StyledEditorContent({ ref = undefined, children, ...rest }) {
58
80
  return (_jsxs(StyledEditorWrapper, { ref: ref, ...rest, children: [_jsx(EditorGlobalStyle, {}), children] }));
@@ -30,8 +30,8 @@ const createCustomTheme = (theme) => {
30
30
  `, theme.typography.body1, noMarginTopStyle);
31
31
  const quote = css(`
32
32
  margin: 1.6em 0;
33
- border-left-color: rgb(206, 208, 212);
34
- border-left-width: 4px;
33
+ border-left-color: ${palette.grey[200]};
34
+ border-left-width: 2px;
35
35
  border-left-style: solid;
36
36
  padding-left: 1.5rem;
37
37
  font-style: italic;
@@ -262,6 +262,12 @@ const createCustomTheme = (theme) => {
262
262
  text-align: right;
263
263
  min-width: 25px;
264
264
  }
265
+ &[data-gutter='1'] {
266
+ padding: 12px 16px !important;
267
+ }
268
+ &[data-gutter='1']:before {
269
+ display: none;
270
+ }
265
271
  `;
266
272
  /**
267
273
  * 基于 mui theme 的自定义主题
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.41",
3
+ "version": "2.4.43",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -69,7 +69,7 @@
69
69
  "ufo": "^1.5.4",
70
70
  "url-join": "^4.0.1",
71
71
  "zustand": "^4.5.5",
72
- "@blocklet/pdf": "2.4.41"
72
+ "@blocklet/pdf": "2.4.43"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@babel/core": "^7.25.2",