@blocklet/discuss-kit-ux 2.4.11 → 2.4.13
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.
|
@@ -3,7 +3,7 @@ export interface EditorProps extends Omit<BlockletEditorProps, 'onChange' | 'ref
|
|
|
3
3
|
content: string;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function EditorPreview({ content, children, ...rest }: EditorProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function EditorPreview({ content, children, prepend, ...rest }: EditorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare namespace EditorPreview {
|
|
8
8
|
var fallback: import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
}
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, g as getExcerptSync, s as stringify } from "./index
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, g as getExcerptSync, s as stringify } from "./index-CgGSacMv.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -2,7 +2,7 @@ import { Labels2, LabelPicker } from "@blocklet/labels";
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useTheme, ThemeProvider, styled as styled$2 } from "@mui/material/styles";
|
|
4
4
|
import { create as create$1, styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
-
import { useEffect, useRef, useState, createElement, useContext, useMemo,
|
|
5
|
+
import { useEffect, useLayoutEffect, useRef, useState, createElement, useContext, useMemo, useCallback, isValidElement, Suspense, createContext, Fragment as Fragment$1, useImperativeHandle } from "react";
|
|
6
6
|
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText, IconButton as IconButton$3, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Divider, Skeleton, InputBase, Badge as Badge$1, tooltipClasses as tooltipClasses$1, CircularProgress, Backdrop, Autocomplete, TextField, InputAdornment, Typography as Typography$1, ToggleButtonGroup, ToggleButton, Link as Link$1 } from "@mui/material";
|
|
7
7
|
import isNil from "lodash/isNil";
|
|
8
8
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
@@ -521,7 +521,7 @@ function imageNodeTransform(node) {
|
|
|
521
521
|
}
|
|
522
522
|
function ImagePathFixerPlugin() {
|
|
523
523
|
const [editor] = useLexicalComposerContext();
|
|
524
|
-
|
|
524
|
+
useLayoutEffect(() => {
|
|
525
525
|
return editor.registerNodeTransform(ImageNode, imageNodeTransform);
|
|
526
526
|
}, [editor]);
|
|
527
527
|
return null;
|
|
@@ -545,7 +545,7 @@ function VideoNodeTransform(node) {
|
|
|
545
545
|
}
|
|
546
546
|
function VideoPathFixerPlugin() {
|
|
547
547
|
const [editor] = useLexicalComposerContext();
|
|
548
|
-
|
|
548
|
+
useLayoutEffect(() => {
|
|
549
549
|
return editor.registerNodeTransform(VideoNode, VideoNodeTransform);
|
|
550
550
|
}, [editor]);
|
|
551
551
|
return null;
|
|
@@ -1758,10 +1758,12 @@ function PostContent({
|
|
|
1758
1758
|
editorState: inferInitialEditorState(content),
|
|
1759
1759
|
enableHeadingsIdPlugin,
|
|
1760
1760
|
onReady,
|
|
1761
|
-
prepend:
|
|
1762
|
-
children: [
|
|
1761
|
+
prepend: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1763
1762
|
/* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
|
|
1764
1763
|
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
|
|
1764
|
+
editorPrepend
|
|
1765
|
+
] }),
|
|
1766
|
+
children: [
|
|
1765
1767
|
/* @__PURE__ */ jsx(CheckboxPlugin, { send: onSubmit }),
|
|
1766
1768
|
children
|
|
1767
1769
|
]
|
|
@@ -1775,9 +1777,12 @@ function PostContent({
|
|
|
1775
1777
|
editorState: inferInitialEditorState(content),
|
|
1776
1778
|
enableHeadingsIdPlugin,
|
|
1777
1779
|
onReady,
|
|
1778
|
-
prepend:
|
|
1779
|
-
|
|
1780
|
+
prepend: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1781
|
+
editorPrepend,
|
|
1780
1782
|
/* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
|
|
1783
|
+
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {})
|
|
1784
|
+
] }),
|
|
1785
|
+
children: [
|
|
1781
1786
|
/* @__PURE__ */ jsx(CheckboxPlugin, { send: onSubmit }),
|
|
1782
1787
|
children
|
|
1783
1788
|
]
|
|
@@ -4020,6 +4025,7 @@ function BlogListWrapper({
|
|
|
4020
4025
|
return /* @__PURE__ */ jsx(BlogList, { ...rest });
|
|
4021
4026
|
}
|
|
4022
4027
|
const baseURL$1 = joinURL(window.location.origin, discussKitMountPoint || "");
|
|
4028
|
+
const SLUG_VALIDATION_REGEX = /^[a-zA-Z0-9-]+$/;
|
|
4023
4029
|
function PostPermaLink({ slug, onChange, prefix = "blog", ...rest }) {
|
|
4024
4030
|
return /* @__PURE__ */ jsx(Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxs(
|
|
4025
4031
|
Box,
|
|
@@ -4069,6 +4075,11 @@ function PostPermaLink({ slug, onChange, prefix = "blog", ...rest }) {
|
|
|
4069
4075
|
{
|
|
4070
4076
|
value: slug,
|
|
4071
4077
|
onChange: (e) => onChange(e.target.value),
|
|
4078
|
+
onKeyDown: (event) => {
|
|
4079
|
+
if (!SLUG_VALIDATION_REGEX.test(event.key)) {
|
|
4080
|
+
event.preventDefault();
|
|
4081
|
+
}
|
|
4082
|
+
},
|
|
4072
4083
|
sx: { ml: 0.5, flex: 1, bgcolor: "transparent", input: { py: 1, fontSize: 14 } }
|
|
4073
4084
|
}
|
|
4074
4085
|
),
|
|
@@ -5210,7 +5221,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
5210
5221
|
}
|
|
5211
5222
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
5212
5223
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
5213
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
5224
|
+
const Editor = lazyRetry(() => import("./editor-C6E_RkGl.mjs"));
|
|
5214
5225
|
function LazyEditor(props) {
|
|
5215
5226
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
5216
5227
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5227,19 +5238,20 @@ const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
|
5227
5238
|
/* @__PURE__ */ jsx(Skeleton, { width: "60%" }),
|
|
5228
5239
|
/* @__PURE__ */ jsx(Skeleton, { width: "40%" })
|
|
5229
5240
|
] });
|
|
5230
|
-
function EditorPreview({ content, children, ...rest }) {
|
|
5231
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */
|
|
5241
|
+
function EditorPreview({ content, children, prepend, ...rest }) {
|
|
5242
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(
|
|
5232
5243
|
BlockletEditor,
|
|
5233
5244
|
{
|
|
5234
5245
|
editorState: inferInitialEditorState(content),
|
|
5235
5246
|
editable: false,
|
|
5236
5247
|
enableHeadingsIdPlugin: true,
|
|
5237
|
-
|
|
5238
|
-
|
|
5248
|
+
prepend: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5249
|
+
prepend,
|
|
5239
5250
|
/* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
|
|
5240
|
-
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {})
|
|
5241
|
-
|
|
5242
|
-
|
|
5251
|
+
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {})
|
|
5252
|
+
] }),
|
|
5253
|
+
...rest,
|
|
5254
|
+
children
|
|
5243
5255
|
}
|
|
5244
5256
|
) });
|
|
5245
5257
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { W, o, Y, aQ, A, n, af, B, G, N, L, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, O, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index
|
|
2
|
+
import { W, o, Y, aQ, A, n, af, B, G, N, L, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, O, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-CgGSacMv.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
}
|
|
441
441
|
function ImagePathFixerPlugin() {
|
|
442
442
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
443
|
-
react.
|
|
443
|
+
react.useLayoutEffect(() => {
|
|
444
444
|
return editor2.registerNodeTransform(ImageNode.ImageNode, imageNodeTransform);
|
|
445
445
|
}, [editor2]);
|
|
446
446
|
return null;
|
|
@@ -464,7 +464,7 @@
|
|
|
464
464
|
}
|
|
465
465
|
function VideoPathFixerPlugin() {
|
|
466
466
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
467
|
-
react.
|
|
467
|
+
react.useLayoutEffect(() => {
|
|
468
468
|
return editor2.registerNodeTransform(VideoNode.VideoNode, VideoNodeTransform);
|
|
469
469
|
}, [editor2]);
|
|
470
470
|
return null;
|
|
@@ -1677,10 +1677,12 @@
|
|
|
1677
1677
|
editorState: inferInitialEditorState(content),
|
|
1678
1678
|
enableHeadingsIdPlugin,
|
|
1679
1679
|
onReady,
|
|
1680
|
-
prepend:
|
|
1681
|
-
children: [
|
|
1680
|
+
prepend: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1682
1681
|
/* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
|
|
1683
1682
|
/* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
|
|
1683
|
+
editorPrepend
|
|
1684
|
+
] }),
|
|
1685
|
+
children: [
|
|
1684
1686
|
/* @__PURE__ */ jsxRuntime.jsx(CheckboxPlugin, { send: onSubmit }),
|
|
1685
1687
|
children
|
|
1686
1688
|
]
|
|
@@ -1694,9 +1696,12 @@
|
|
|
1694
1696
|
editorState: inferInitialEditorState(content),
|
|
1695
1697
|
enableHeadingsIdPlugin,
|
|
1696
1698
|
onReady,
|
|
1697
|
-
prepend:
|
|
1698
|
-
|
|
1699
|
+
prepend: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1700
|
+
editorPrepend,
|
|
1699
1701
|
/* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
|
|
1702
|
+
/* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {})
|
|
1703
|
+
] }),
|
|
1704
|
+
children: [
|
|
1700
1705
|
/* @__PURE__ */ jsxRuntime.jsx(CheckboxPlugin, { send: onSubmit }),
|
|
1701
1706
|
children
|
|
1702
1707
|
]
|
|
@@ -3939,6 +3944,7 @@
|
|
|
3939
3944
|
return /* @__PURE__ */ jsxRuntime.jsx(BlogList, { ...rest });
|
|
3940
3945
|
}
|
|
3941
3946
|
const baseURL$1 = ufo.joinURL(window.location.origin, discussKitMountPoint || "");
|
|
3947
|
+
const SLUG_VALIDATION_REGEX = /^[a-zA-Z0-9-]+$/;
|
|
3942
3948
|
function PostPermaLink({ slug, onChange, prefix = "blog", ...rest }) {
|
|
3943
3949
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3944
3950
|
material.Box,
|
|
@@ -3988,6 +3994,11 @@
|
|
|
3988
3994
|
{
|
|
3989
3995
|
value: slug,
|
|
3990
3996
|
onChange: (e) => onChange(e.target.value),
|
|
3997
|
+
onKeyDown: (event) => {
|
|
3998
|
+
if (!SLUG_VALIDATION_REGEX.test(event.key)) {
|
|
3999
|
+
event.preventDefault();
|
|
4000
|
+
}
|
|
4001
|
+
},
|
|
3991
4002
|
sx: { ml: 0.5, flex: 1, bgcolor: "transparent", input: { py: 1, fontSize: 14 } }
|
|
3992
4003
|
}
|
|
3993
4004
|
),
|
|
@@ -5146,19 +5157,20 @@
|
|
|
5146
5157
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
|
|
5147
5158
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
|
|
5148
5159
|
] });
|
|
5149
|
-
function EditorPreview({ content, children, ...rest }) {
|
|
5150
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.
|
|
5160
|
+
function EditorPreview({ content, children, prepend, ...rest }) {
|
|
5161
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5151
5162
|
BlockletEditor$1,
|
|
5152
5163
|
{
|
|
5153
5164
|
editorState: inferInitialEditorState(content),
|
|
5154
5165
|
editable: false,
|
|
5155
5166
|
enableHeadingsIdPlugin: true,
|
|
5156
|
-
|
|
5157
|
-
|
|
5167
|
+
prepend: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5168
|
+
prepend,
|
|
5158
5169
|
/* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
|
|
5159
|
-
/* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {})
|
|
5160
|
-
|
|
5161
|
-
|
|
5170
|
+
/* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {})
|
|
5171
|
+
] }),
|
|
5172
|
+
...rest,
|
|
5173
|
+
children
|
|
5162
5174
|
}
|
|
5163
5175
|
) });
|
|
5164
5176
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.13",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcblock/bridge": "^3.0.
|
|
22
|
-
"@arcblock/react-hooks": "^3.0.
|
|
21
|
+
"@arcblock/bridge": "^3.0.26",
|
|
22
|
+
"@arcblock/react-hooks": "^3.0.26",
|
|
23
23
|
"@arcblock/ws": "^1.20.15",
|
|
24
24
|
"@blocklet/js-sdk": "^1.16.46",
|
|
25
25
|
"@blocklet/uploader": "^0.2.4",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"unstated-next": "^1.1.0",
|
|
49
49
|
"url-join": "^4.0.1",
|
|
50
50
|
"zustand": "^4.5.5",
|
|
51
|
-
"@blocklet/editor": "^2.4.
|
|
52
|
-
"@blocklet/labels": "^2.4.
|
|
51
|
+
"@blocklet/editor": "^2.4.13",
|
|
52
|
+
"@blocklet/labels": "^2.4.13"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@arcblock/did-connect": "^3.0.1",
|