@blocklet/editor 2.4.61 → 2.4.63

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.
@@ -37,11 +37,12 @@ export default function Card({ title, body, image, icon, href, horizontal = fals
37
37
  }, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', flex: 1, gap: 1 }, children: [_jsxs(Box, { sx: {
38
38
  display: 'flex',
39
39
  flexDirection: 'column',
40
- gap: 1,
40
+ gap: horizontal ? 1 : 2,
41
41
  ...(horizontal && { flexDirection: 'row', alignItems: 'center' }),
42
42
  }, children: [renderIcon(), _jsx(Typography, { variant: "h5", component: "h4", sx: {
43
43
  fontWeight: 600,
44
44
  color: 'text.primary',
45
+ lineHeight: 1,
45
46
  }, children: title })] }), body && (_jsx(Typography, { variant: "body2", sx: {
46
47
  color: 'text.secondary',
47
48
  }, children: body })), isLink && cta && (_jsx(Box, { sx: { display: 'flex', alignItems: 'center', marginTop: 'auto' }, children: _jsxs(Typography, { variant: "body2", sx: {
@@ -330,7 +330,7 @@ const ImageContainer = ({ success, loading, error, confirmText, uploadImage, pla
330
330
  p: 1,
331
331
  border: 1,
332
332
  borderColor: 'divider',
333
- borderRadius: 1,
333
+ borderRadius: 2,
334
334
  }),
335
335
  }, children: [props.children ||
336
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] }));
@@ -1,5 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, alpha, styled, GlobalStyles, useTheme } from '@mui/material';
3
+ const getShapeRadiusValue = (theme) => {
4
+ if (typeof theme.shape.borderRadius === 'number') {
5
+ return theme.shape.borderRadius;
6
+ }
7
+ return parseInt(theme.shape.borderRadius, 10);
8
+ };
3
9
  const StyledEditorWrapper = styled(Box) `
4
10
  position: relative;
5
11
  color: ${({ theme }) => alpha(theme.palette.text.primary, 0.8)};
@@ -41,7 +47,7 @@ const StyledEditorWrapper = styled(Box) `
41
47
  // 增大最外层 list item 的 marginLeft, https://github.com/blocklet/discuss-kit/issues/2123
42
48
  > ol > li,
43
49
  > ul > li {
44
- margin-left: 32px;
50
+ margin-left: 24px;
45
51
  }
46
52
 
47
53
  // collapsible dark-mode
@@ -71,21 +77,41 @@ const StyledEditorWrapper = styled(Box) `
71
77
  border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
72
78
  border-left: 0;
73
79
  }
74
- .PlaygroundEditorTheme__table tr:nth-of-type(1) th {
75
- border-top: 1px solid ${({ theme }) => theme.palette.divider};
80
+ .PlaygroundEditorTheme__table tr:nth-of-type(1) {
81
+ th,
82
+ td {
83
+ border-top: 1px solid ${({ theme }) => theme.palette.divider};
84
+ }
76
85
  }
77
- .PlaygroundEditorTheme__table tr th:first-child {
78
- border-left: 1px solid ${({ theme }) => theme.palette.divider};
86
+ .PlaygroundEditorTheme__table tr {
87
+ th:first-child,
88
+ td:first-child {
89
+ border-left: 1px solid ${({ theme }) => theme.palette.divider};
90
+ }
79
91
  }
80
-
81
- .PlaygroundEditorTheme__table tr:nth-of-type(1) th:first-child {
82
- border-top-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
92
+ .PlaygroundEditorTheme__table tr:nth-of-type(1) {
93
+ th:first-child,
94
+ td:first-child {
95
+ border-top-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
96
+ }
83
97
  }
84
- .PlaygroundEditorTheme__table tr:nth-of-type(1) th:last-child {
85
- border-top-right-radius: ${({ theme }) => theme.shape.borderRadius}px;
98
+ .PlaygroundEditorTheme__table tr:nth-of-type(1) {
99
+ th:last-child,
100
+ td:last-child {
101
+ border-top-right-radius: ${({ theme }) => theme.shape.borderRadius}px;
102
+ }
86
103
  }
87
- .PlaygroundEditorTheme__table tr:last-child th:first-child {
88
- border-bottom-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
104
+ .PlaygroundEditorTheme__table tr:last-child {
105
+ th:first-child,
106
+ td:first-child {
107
+ border-bottom-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
108
+ }
109
+ }
110
+ .PlaygroundEditorTheme__table tr:last-child {
111
+ th:first-child,
112
+ td:first-child {
113
+ border-bottom-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
114
+ }
89
115
  }
90
116
  .PlaygroundEditorTheme__table tr:last-child td:last-child {
91
117
  border-bottom-right-radius: ${({ theme }) => theme.shape.borderRadius}px;
@@ -103,23 +129,29 @@ const StyledEditorWrapper = styled(Box) `
103
129
  background-color: ${({ theme }) => theme.palette.grey[50]} !important;
104
130
  }
105
131
 
106
- @container blocklet-editor (max-width: 700px) {
132
+ @container blocklet-editor (max-width: 1000px) {
107
133
  .be-editable img,
108
134
  .be-editable *:has(img) {
109
135
  width: 100% !important;
110
136
  }
111
137
  }
112
138
 
139
+ /* img/video 圆角样式 */
113
140
  .be-editable div:has(> video) {
114
141
  padding: 8px;
115
142
  border: 1px solid ${({ theme }) => theme.palette.divider};
116
- border-radius: ${({ theme }) => theme.shape.borderRadius}px;
143
+ border-radius: ${({ theme }) => getShapeRadiusValue(theme) * 2}px;
117
144
  overflow: hidden;
118
145
  line-height: 1;
119
146
  }
120
147
 
121
- .be-editable video {
122
- border-radius: 4px;
148
+ .be-editable video,
149
+ .be-editable img {
150
+ border-radius: 8px;
151
+ }
152
+
153
+ .be-editable p > table {
154
+ margin: 0;
123
155
  }
124
156
  `;
125
157
  export function StyledEditorContent({ ref = undefined, children, ...rest }) {
@@ -147,7 +147,9 @@ const createCustomTheme = (theme) => {
147
147
  margin-top: 0.5em;
148
148
  margin-bottom: 0.5em;
149
149
  padding-left: 0.25em;
150
- `, theme.typography.body1, { lineHeight: 1.5 });
150
+ `, theme.typography.body1
151
+ // { lineHeight: 1.5 }
152
+ );
151
153
  const listItemChecked = css `
152
154
  margin-left: 0 !important;
153
155
  margin-right: 8px;
@@ -201,12 +203,6 @@ const createCustomTheme = (theme) => {
201
203
  outline: 2px solid ${palette.primary.light};
202
204
  `;
203
205
  const image = css `
204
- img {
205
- .be-content:not(.editable) & {
206
- border-radius: 0.375rem;
207
- }
208
- }
209
-
210
206
  .image-caption-container {
211
207
  // fix #924
212
208
  .ImageNode__contentEditable {
@@ -241,8 +237,8 @@ const createCustomTheme = (theme) => {
241
237
  line-height: 1.53;
242
238
  font-size: 13px;
243
239
  margin: 0;
244
- margin-top: 8px;
245
- margin-bottom: 8px;
240
+ margin-top: 20px;
241
+ margin-bottom: 32px;
246
242
  tab-size: 2;
247
243
  /* white-space: pre; */
248
244
  overflow-x: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.61",
3
+ "version": "2.4.63",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,7 +70,7 @@
70
70
  "ufo": "^1.5.4",
71
71
  "url-join": "^4.0.1",
72
72
  "zustand": "^4.5.5",
73
- "@blocklet/pdf": "2.4.61"
73
+ "@blocklet/pdf": "2.4.63"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@babel/core": "^7.25.2",