eddev 2.0.0-beta.155 → 2.0.0-beta.156
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.
- package/dist/app/lib/blocks/EditableText.d.ts +6 -0
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -1
- package/dist/app/lib/blocks/EditableText.js +21 -6
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +10 -10
- package/dist/app/lib/routing/components/Link.d.ts +16 -1
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -1
- package/dist/app/lib/routing/components/Link.js +37 -22
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,12 @@ type Props<T extends ElementType> = {
|
|
|
17
17
|
* You can register new formats in `_editor.tsx` using the `defineEditorConfig` function.
|
|
18
18
|
**/
|
|
19
19
|
allowedFormats?: (BuiltinFormats | (string & {}))[];
|
|
20
|
+
/**
|
|
21
|
+
* A shortcut for `allowedFormats={[]}`, but also ensures that any formatting is removed automatically.
|
|
22
|
+
*
|
|
23
|
+
* This is useful for ensuring that links are removed when the user pastes content into the editor, or removing them when they already exist within the content.
|
|
24
|
+
*/
|
|
25
|
+
plainText?: boolean;
|
|
20
26
|
/**
|
|
21
27
|
* @deprecated use `allowedFormats` instead
|
|
22
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/EditableText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/EditableText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiC,MAAM,OAAO,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAoD,MAAM,qBAAqB,CAAA;AAExG,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MA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W,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,kDAyFvG"}
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
2
3
|
import { useRouter } from "../routing/hooks/useRouter.js";
|
|
3
4
|
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing.js";
|
|
4
5
|
export function EditableText({ id, as, appendOnEnter, store, ...props }) {
|
|
5
6
|
if (env.admin) {
|
|
6
7
|
const readOnly = useBlockContext()?.readonly;
|
|
7
8
|
if (!readOnly) {
|
|
9
|
+
const ref = useRef(null);
|
|
8
10
|
const [value, setValue] = useValueStore(store ?? id);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if ((props.plainText || props.allowedFormats?.length === 0) && ref.current) {
|
|
13
|
+
let wasUpdated = false;
|
|
14
|
+
ref.current?.childNodes.forEach((node) => {
|
|
15
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
16
|
+
const element = node;
|
|
17
|
+
if (element.tagName != "BR") {
|
|
18
|
+
element.replaceWith(document.createTextNode(element.textContent ?? ""));
|
|
19
|
+
wasUpdated = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
if (wasUpdated) {
|
|
24
|
+
setValue(ref.current?.innerHTML);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, [value, props.plainText, props.allowedFormats]);
|
|
14
28
|
const appendBlocks = useBlockAppender();
|
|
15
|
-
return (_jsx(wp.blockEditor.RichText, { ...props, placeholder: props.placeholder ?? props.defaultValue, tagName: as, value: value || "", onChange: setValue, allowedFormats: props.inlineToolbar === false ? [] : props.allowedFormats, disableLineBreaks: props.disableLineBreaks, "data-allowed-formats": props.allowedFormats?.join(" "), onKeyDownCapture: (e) => {
|
|
29
|
+
return (_jsx(wp.blockEditor.RichText, { ...props, ref: ref, placeholder: props.placeholder ?? props.defaultValue, tagName: as, value: value || "", onChange: setValue, allowedFormats: props.inlineToolbar === false || props.plainText ? [] : props.allowedFormats, disableLineBreaks: props.disableLineBreaks, "data-allowed-formats": props.allowedFormats?.join(" "), onKeyDownCapture: (e) => {
|
|
16
30
|
if (e.key === "Enter" && appendOnEnter && appendBlocks) {
|
|
17
31
|
appendBlocks([
|
|
18
32
|
wp.blocks.createBlock(typeof appendOnEnter === "string" ? appendOnEnter : "core/paragraph"),
|
|
@@ -32,6 +46,7 @@ export function EditableText({ id, as, appendOnEnter, store, ...props }) {
|
|
|
32
46
|
delete otherProps.asProp;
|
|
33
47
|
delete otherProps.allowedFormats;
|
|
34
48
|
delete otherProps.inlineToolbar;
|
|
49
|
+
delete otherProps.plainText;
|
|
35
50
|
delete otherProps.disableLineBreaks;
|
|
36
51
|
delete otherProps.placeholder;
|
|
37
52
|
if (value === "" || typeof value !== "string") {
|
|
@@ -883,8 +883,6 @@ export declare function useTailwindConfig(): {
|
|
|
883
883
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
884
884
|
readonly filter?: boolean | undefined;
|
|
885
885
|
readonly fill?: boolean | undefined;
|
|
886
|
-
readonly translate?: boolean | undefined;
|
|
887
|
-
readonly content?: boolean | undefined;
|
|
888
886
|
readonly height?: boolean | undefined;
|
|
889
887
|
readonly width?: boolean | undefined;
|
|
890
888
|
readonly cursor?: boolean | undefined;
|
|
@@ -905,6 +903,8 @@ export declare function useTailwindConfig(): {
|
|
|
905
903
|
readonly textDecoration?: boolean | undefined;
|
|
906
904
|
readonly transform?: boolean | undefined;
|
|
907
905
|
readonly visibility?: boolean | undefined;
|
|
906
|
+
readonly translate?: boolean | undefined;
|
|
907
|
+
readonly content?: boolean | undefined;
|
|
908
908
|
readonly size?: boolean | undefined;
|
|
909
909
|
readonly backgroundColor?: boolean | undefined;
|
|
910
910
|
readonly inset?: boolean | undefined;
|
|
@@ -1928,8 +1928,6 @@ export declare function useTailwindConfig(): {
|
|
|
1928
1928
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
1929
1929
|
readonly filter?: boolean | undefined;
|
|
1930
1930
|
readonly fill?: boolean | undefined;
|
|
1931
|
-
readonly translate?: boolean | undefined;
|
|
1932
|
-
readonly content?: boolean | undefined;
|
|
1933
1931
|
readonly height?: boolean | undefined;
|
|
1934
1932
|
readonly width?: boolean | undefined;
|
|
1935
1933
|
readonly cursor?: boolean | undefined;
|
|
@@ -1950,6 +1948,8 @@ export declare function useTailwindConfig(): {
|
|
|
1950
1948
|
readonly textDecoration?: boolean | undefined;
|
|
1951
1949
|
readonly transform?: boolean | undefined;
|
|
1952
1950
|
readonly visibility?: boolean | undefined;
|
|
1951
|
+
readonly translate?: boolean | undefined;
|
|
1952
|
+
readonly content?: boolean | undefined;
|
|
1953
1953
|
readonly size?: boolean | undefined;
|
|
1954
1954
|
readonly backgroundColor?: boolean | undefined;
|
|
1955
1955
|
readonly inset?: boolean | undefined;
|
|
@@ -2948,8 +2948,6 @@ export declare function useTailwindConfig(): {
|
|
|
2948
2948
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
2949
2949
|
readonly filter?: boolean | undefined;
|
|
2950
2950
|
readonly fill?: boolean | undefined;
|
|
2951
|
-
readonly translate?: boolean | undefined;
|
|
2952
|
-
readonly content?: boolean | undefined;
|
|
2953
2951
|
readonly height?: boolean | undefined;
|
|
2954
2952
|
readonly width?: boolean | undefined;
|
|
2955
2953
|
readonly cursor?: boolean | undefined;
|
|
@@ -2970,6 +2968,8 @@ export declare function useTailwindConfig(): {
|
|
|
2970
2968
|
readonly textDecoration?: boolean | undefined;
|
|
2971
2969
|
readonly transform?: boolean | undefined;
|
|
2972
2970
|
readonly visibility?: boolean | undefined;
|
|
2971
|
+
readonly translate?: boolean | undefined;
|
|
2972
|
+
readonly content?: boolean | undefined;
|
|
2973
2973
|
readonly size?: boolean | undefined;
|
|
2974
2974
|
readonly backgroundColor?: boolean | undefined;
|
|
2975
2975
|
readonly inset?: boolean | undefined;
|
|
@@ -4019,8 +4019,6 @@ export declare function useTailwindConfig(): {
|
|
|
4019
4019
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
4020
4020
|
readonly filter?: boolean | undefined;
|
|
4021
4021
|
readonly fill?: boolean | undefined;
|
|
4022
|
-
readonly translate?: boolean | undefined;
|
|
4023
|
-
readonly content?: boolean | undefined;
|
|
4024
4022
|
readonly height?: boolean | undefined;
|
|
4025
4023
|
readonly width?: boolean | undefined;
|
|
4026
4024
|
readonly cursor?: boolean | undefined;
|
|
@@ -4041,6 +4039,8 @@ export declare function useTailwindConfig(): {
|
|
|
4041
4039
|
readonly textDecoration?: boolean | undefined;
|
|
4042
4040
|
readonly transform?: boolean | undefined;
|
|
4043
4041
|
readonly visibility?: boolean | undefined;
|
|
4042
|
+
readonly translate?: boolean | undefined;
|
|
4043
|
+
readonly content?: boolean | undefined;
|
|
4044
4044
|
readonly size?: boolean | undefined;
|
|
4045
4045
|
readonly backgroundColor?: boolean | undefined;
|
|
4046
4046
|
readonly inset?: boolean | undefined;
|
|
@@ -5037,8 +5037,6 @@ export declare function useTailwindConfig(): {
|
|
|
5037
5037
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
5038
5038
|
readonly filter?: boolean | undefined;
|
|
5039
5039
|
readonly fill?: boolean | undefined;
|
|
5040
|
-
readonly translate?: boolean | undefined;
|
|
5041
|
-
readonly content?: boolean | undefined;
|
|
5042
5040
|
readonly height?: boolean | undefined;
|
|
5043
5041
|
readonly width?: boolean | undefined;
|
|
5044
5042
|
readonly cursor?: boolean | undefined;
|
|
@@ -5059,6 +5057,8 @@ export declare function useTailwindConfig(): {
|
|
|
5059
5057
|
readonly textDecoration?: boolean | undefined;
|
|
5060
5058
|
readonly transform?: boolean | undefined;
|
|
5061
5059
|
readonly visibility?: boolean | undefined;
|
|
5060
|
+
readonly translate?: boolean | undefined;
|
|
5061
|
+
readonly content?: boolean | undefined;
|
|
5062
5062
|
readonly size?: boolean | undefined;
|
|
5063
5063
|
readonly backgroundColor?: boolean | undefined;
|
|
5064
5064
|
readonly inset?: boolean | undefined;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import { ComponentPropsWithRef, ElementType, ReactElement } from "react";
|
|
1
|
+
import { ComponentPropsWithRef, ElementType, MouseEvent, ReactElement } from "react";
|
|
2
2
|
type Props<T extends ElementType = "a"> = NoInfer<Omit<ComponentPropsWithRef<T>, "href">> & {
|
|
3
3
|
href?: string | null;
|
|
4
4
|
target?: string | null;
|
|
5
5
|
as?: T;
|
|
6
6
|
preferBack?: boolean | "exact";
|
|
7
7
|
};
|
|
8
|
+
export declare function useLinkProps<T extends ElementType = "a">(props: Exclude<Props<T>, "as">, ref?: React.Ref<HTMLAnchorElement>): ({
|
|
9
|
+
ref: import("react").Ref<HTMLAnchorElement> | undefined;
|
|
10
|
+
} & Exclude<Props<T>, "as"> & {
|
|
11
|
+
href: string | undefined;
|
|
12
|
+
onClick: (e: MouseEvent) => void;
|
|
13
|
+
}) | ({
|
|
14
|
+
ref: import("react").Ref<HTMLAnchorElement> | undefined;
|
|
15
|
+
"data-active": boolean | "path" | "query" | "exact" | undefined;
|
|
16
|
+
"data-child-active": boolean | undefined;
|
|
17
|
+
"data-pending": "path" | "query" | "exact" | undefined;
|
|
18
|
+
} & Exclude<Props<T>, "as"> & {
|
|
19
|
+
href: string;
|
|
20
|
+
onMouseEnter: (e: MouseEvent) => void;
|
|
21
|
+
onClick: (e: MouseEvent) => void;
|
|
22
|
+
});
|
|
8
23
|
export declare const Link: <T extends ElementType = "a">(props: Props<T>) => ReactElement;
|
|
9
24
|
/**
|
|
10
25
|
* Provides information about the given href parameter, such as whether it is active, whether a child page is active, or whether it is loading.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAsC,MAAM,OAAO,CAAA;AASxH,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG;IAC1F,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,EAAE,CAAC,EAAE,CAAC,CAAA;IACN,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC/B,CAAA;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,GAAG,EACtD,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAC9B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;;;;iBAOjB,UAAU;;;;;;;;sBAgBP,UAAU;iBASf,UAAU;GAK1B;AAED,eAAO,MAAM,IAAI,EAIX,CAAC,CAAC,SAAS,WAAW,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,YAAY,CAAA;AAKpE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;EA6BxC"}
|
|
@@ -1,35 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef, useMemo } from "react";
|
|
1
|
+
import { createElement, forwardRef, useMemo } from "react";
|
|
3
2
|
import { parseURL, resolveURL, withoutTrailingSlash } from "ufo";
|
|
4
3
|
import { useIsSSR } from "../hooks/useIsSSR.js";
|
|
5
4
|
import { useRouter } from "../hooks/useRouter.js";
|
|
6
5
|
import { addTrailingSlash, getLinkHandlerMode, isSameOrigin } from "../utils.js";
|
|
7
6
|
import { useRoute } from "../hooks/useRoute.js";
|
|
8
7
|
import { useRouterState } from "../hooks/useRouterState.js";
|
|
9
|
-
export
|
|
10
|
-
const Comp = as || "a";
|
|
8
|
+
export function useLinkProps(props, ref) {
|
|
11
9
|
if (env.admin) {
|
|
12
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
ref: ref,
|
|
12
|
+
...props,
|
|
13
|
+
href: props.href ?? undefined,
|
|
14
|
+
onClick: (e) => {
|
|
13
15
|
props.onClick?.(e);
|
|
14
16
|
e.preventDefault();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
else {
|
|
18
|
-
const router = useRouter();
|
|
19
|
-
const state = useLinkState(props.href ?? "");
|
|
20
|
-
return (_jsx(Comp, { ref: ref, "data-active": state.active ?? undefined, "data-child-active": state.childActive ?? undefined, "data-pending": state.pending ?? undefined, ...props, href: addTrailingSlash(props.href), onMouseEnter: (e) => {
|
|
21
|
-
if (props.onMouseEnter) {
|
|
22
|
-
props.onMouseEnter(e);
|
|
23
|
-
}
|
|
24
|
-
const mode = getLinkHandlerMode(e, props.href);
|
|
25
|
-
if (mode.mode === "navigate") {
|
|
26
|
-
router.preload(props.href);
|
|
27
|
-
}
|
|
28
|
-
}, onClick: (e) => {
|
|
29
|
-
props.onClick?.(e);
|
|
30
|
-
router.handleClickEvent(e, props.href ?? undefined, preferBack);
|
|
31
|
-
} }));
|
|
17
|
+
},
|
|
18
|
+
};
|
|
32
19
|
}
|
|
20
|
+
const router = useRouter();
|
|
21
|
+
const state = useLinkState(props.href ?? "");
|
|
22
|
+
return {
|
|
23
|
+
ref: ref,
|
|
24
|
+
"data-active": state.active ?? undefined,
|
|
25
|
+
"data-child-active": state.childActive ?? undefined,
|
|
26
|
+
"data-pending": state.pending ?? undefined,
|
|
27
|
+
...props,
|
|
28
|
+
href: addTrailingSlash(props.href),
|
|
29
|
+
onMouseEnter: (e) => {
|
|
30
|
+
if (props.onMouseEnter) {
|
|
31
|
+
props.onMouseEnter(e);
|
|
32
|
+
}
|
|
33
|
+
const mode = getLinkHandlerMode(e, props.href);
|
|
34
|
+
if (mode.mode === "navigate") {
|
|
35
|
+
router.preload(props.href);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onClick: (e) => {
|
|
39
|
+
props.onClick?.(e);
|
|
40
|
+
router.handleClickEvent(e, props.href ?? undefined, props.preferBack);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const Link = forwardRef(({ preferBack, as, ...props }, ref) => {
|
|
45
|
+
const Comp = as || "a";
|
|
46
|
+
const finalProps = useLinkProps(props, ref);
|
|
47
|
+
return createElement(Comp, finalProps);
|
|
33
48
|
});
|
|
34
49
|
// @ts-ignore
|
|
35
50
|
Link.displayName = "Link";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.156";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.156";
|