tinacms 0.0.0-942e18f-20250102010803 → 0.0.0-9931d5a-20250106011423
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/index.js +19 -11
- package/dist/index.mjs +19 -11
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +4 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -14585,7 +14585,12 @@ flowchart TD
|
|
|
14585
14585
|
const [itemsShown, setItemsShown] = React.useState(11);
|
|
14586
14586
|
const { overrides, templates } = useToolbarContext();
|
|
14587
14587
|
const showEmbedButton = templates.length > 0;
|
|
14588
|
-
let items2 =
|
|
14588
|
+
let items2 = [];
|
|
14589
|
+
if (Array.isArray(overrides)) {
|
|
14590
|
+
items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14591
|
+
} else {
|
|
14592
|
+
items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14593
|
+
}
|
|
14589
14594
|
if (!showEmbedButton) {
|
|
14590
14595
|
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14591
14596
|
}
|
|
@@ -14913,6 +14918,9 @@ flowchart TD
|
|
|
14913
14918
|
if (typeof string !== "string") {
|
|
14914
14919
|
return false;
|
|
14915
14920
|
}
|
|
14921
|
+
if (string.startsWith("#")) {
|
|
14922
|
+
return true;
|
|
14923
|
+
}
|
|
14916
14924
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
14917
14925
|
const emailLinkMatch = string.match(emailLintRE);
|
|
14918
14926
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -14934,12 +14942,12 @@ flowchart TD
|
|
|
14934
14942
|
}
|
|
14935
14943
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
14936
14944
|
};
|
|
14937
|
-
const RichEditor = (
|
|
14945
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
14938
14946
|
var _a;
|
|
14939
14947
|
const initialValue = React.useMemo(
|
|
14940
14948
|
() => {
|
|
14941
14949
|
var _a2, _b;
|
|
14942
|
-
return ((_b = (_a2 =
|
|
14950
|
+
return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
|
|
14943
14951
|
},
|
|
14944
14952
|
[]
|
|
14945
14953
|
);
|
|
@@ -14967,7 +14975,7 @@ flowchart TD
|
|
|
14967
14975
|
),
|
|
14968
14976
|
[]
|
|
14969
14977
|
);
|
|
14970
|
-
const tempId = [
|
|
14978
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
14971
14979
|
const id = React.useMemo(() => uuid() + tempId, [tempId]);
|
|
14972
14980
|
const ref = React.useRef(null);
|
|
14973
14981
|
React.useEffect(() => {
|
|
@@ -14977,13 +14985,13 @@ flowchart TD
|
|
|
14977
14985
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
14978
14986
|
'[role="textbox"]'
|
|
14979
14987
|
);
|
|
14980
|
-
if (
|
|
14988
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
14981
14989
|
if (plateElement)
|
|
14982
14990
|
plateElement.focus();
|
|
14983
14991
|
}
|
|
14984
14992
|
}, 100);
|
|
14985
14993
|
}
|
|
14986
|
-
}, [
|
|
14994
|
+
}, [field.experimental_focusIntent, ref]);
|
|
14987
14995
|
return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
|
|
14988
14996
|
plateCommon.Plate,
|
|
14989
14997
|
{
|
|
@@ -14991,7 +14999,7 @@ flowchart TD
|
|
|
14991
14999
|
initialValue,
|
|
14992
15000
|
plugins: plugins$2,
|
|
14993
15001
|
onChange: (value) => {
|
|
14994
|
-
|
|
15002
|
+
input.onChange({
|
|
14995
15003
|
type: "root",
|
|
14996
15004
|
children: value
|
|
14997
15005
|
});
|
|
@@ -15000,12 +15008,12 @@ flowchart TD
|
|
|
15000
15008
|
/* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
|
|
15001
15009
|
ToolbarProvider,
|
|
15002
15010
|
{
|
|
15003
|
-
tinaForm
|
|
15004
|
-
templates:
|
|
15005
|
-
overrides: (
|
|
15011
|
+
tinaForm,
|
|
15012
|
+
templates: field.templates,
|
|
15013
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
15006
15014
|
},
|
|
15007
15015
|
/* @__PURE__ */ React.createElement(FixedToolbar, null, /* @__PURE__ */ React.createElement(FixedToolbarButtons, null)),
|
|
15008
|
-
/* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null))
|
|
15016
|
+
((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null)) : null
|
|
15009
15017
|
), /* @__PURE__ */ React.createElement(Editor, null))
|
|
15010
15018
|
));
|
|
15011
15019
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -14612,7 +14612,12 @@ function FixedToolbarButtons() {
|
|
|
14612
14612
|
const [itemsShown, setItemsShown] = React__default.useState(11);
|
|
14613
14613
|
const { overrides, templates } = useToolbarContext();
|
|
14614
14614
|
const showEmbedButton = templates.length > 0;
|
|
14615
|
-
let items2 =
|
|
14615
|
+
let items2 = [];
|
|
14616
|
+
if (Array.isArray(overrides)) {
|
|
14617
|
+
items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14618
|
+
} else {
|
|
14619
|
+
items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14620
|
+
}
|
|
14616
14621
|
if (!showEmbedButton) {
|
|
14617
14622
|
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14618
14623
|
}
|
|
@@ -14940,6 +14945,9 @@ const isUrl = (string) => {
|
|
|
14940
14945
|
if (typeof string !== "string") {
|
|
14941
14946
|
return false;
|
|
14942
14947
|
}
|
|
14948
|
+
if (string.startsWith("#")) {
|
|
14949
|
+
return true;
|
|
14950
|
+
}
|
|
14943
14951
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
14944
14952
|
const emailLinkMatch = string.match(emailLintRE);
|
|
14945
14953
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -14961,12 +14969,12 @@ const isUrl = (string) => {
|
|
|
14961
14969
|
}
|
|
14962
14970
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
14963
14971
|
};
|
|
14964
|
-
const RichEditor = (
|
|
14972
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
14965
14973
|
var _a;
|
|
14966
14974
|
const initialValue = React__default.useMemo(
|
|
14967
14975
|
() => {
|
|
14968
14976
|
var _a2, _b;
|
|
14969
|
-
return ((_b = (_a2 =
|
|
14977
|
+
return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
|
|
14970
14978
|
},
|
|
14971
14979
|
[]
|
|
14972
14980
|
);
|
|
@@ -14994,7 +15002,7 @@ const RichEditor = (props) => {
|
|
|
14994
15002
|
),
|
|
14995
15003
|
[]
|
|
14996
15004
|
);
|
|
14997
|
-
const tempId = [
|
|
15005
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
14998
15006
|
const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
|
|
14999
15007
|
const ref = React__default.useRef(null);
|
|
15000
15008
|
React__default.useEffect(() => {
|
|
@@ -15004,13 +15012,13 @@ const RichEditor = (props) => {
|
|
|
15004
15012
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
15005
15013
|
'[role="textbox"]'
|
|
15006
15014
|
);
|
|
15007
|
-
if (
|
|
15015
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
15008
15016
|
if (plateElement)
|
|
15009
15017
|
plateElement.focus();
|
|
15010
15018
|
}
|
|
15011
15019
|
}, 100);
|
|
15012
15020
|
}
|
|
15013
|
-
}, [
|
|
15021
|
+
}, [field.experimental_focusIntent, ref]);
|
|
15014
15022
|
return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
|
|
15015
15023
|
Plate,
|
|
15016
15024
|
{
|
|
@@ -15018,7 +15026,7 @@ const RichEditor = (props) => {
|
|
|
15018
15026
|
initialValue,
|
|
15019
15027
|
plugins: plugins$2,
|
|
15020
15028
|
onChange: (value) => {
|
|
15021
|
-
|
|
15029
|
+
input.onChange({
|
|
15022
15030
|
type: "root",
|
|
15023
15031
|
children: value
|
|
15024
15032
|
});
|
|
@@ -15027,12 +15035,12 @@ const RichEditor = (props) => {
|
|
|
15027
15035
|
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
15028
15036
|
ToolbarProvider,
|
|
15029
15037
|
{
|
|
15030
|
-
tinaForm
|
|
15031
|
-
templates:
|
|
15032
|
-
overrides: (
|
|
15038
|
+
tinaForm,
|
|
15039
|
+
templates: field.templates,
|
|
15040
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
15033
15041
|
},
|
|
15034
15042
|
/* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
|
|
15035
|
-
/* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
|
|
15043
|
+
((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null)) : null
|
|
15036
15044
|
), /* @__PURE__ */ React__default.createElement(Editor, null))
|
|
15037
15045
|
));
|
|
15038
15046
|
};
|
|
@@ -2,16 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import { type InputFieldType } from '../wrap-field-with-meta';
|
|
3
3
|
import type { MdxTemplate } from './plate/types';
|
|
4
4
|
import type { InputProps } from '../../../fields/components';
|
|
5
|
-
import type { ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
|
|
5
|
+
import type { ToolbarOverrides, ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
|
|
6
6
|
export type RichTextType = React.PropsWithChildren<InputFieldType<InputProps, {
|
|
7
7
|
templates: MdxTemplate[];
|
|
8
8
|
toolbarOverride?: ToolbarOverrideType[];
|
|
9
|
+
overrides?: ToolbarOverrides;
|
|
9
10
|
}>>;
|
|
10
11
|
export declare const MdxFieldPlugin: {
|
|
11
12
|
name: string;
|
|
12
13
|
Component: (props: InputFieldType<InputProps, {
|
|
13
14
|
templates: MdxTemplate[];
|
|
14
15
|
toolbarOverride?: ToolbarOverrideType[];
|
|
16
|
+
overrides?: ToolbarOverrides;
|
|
15
17
|
}>) => React.JSX.Element;
|
|
16
18
|
};
|
|
17
19
|
export declare const MdxFieldPluginExtendible: {
|
|
@@ -20,5 +22,6 @@ export declare const MdxFieldPluginExtendible: {
|
|
|
20
22
|
Component: (props: InputFieldType<InputProps, {
|
|
21
23
|
templates: MdxTemplate[];
|
|
22
24
|
toolbarOverride?: ToolbarOverrideType[];
|
|
25
|
+
overrides?: ToolbarOverrides;
|
|
23
26
|
}>) => React.JSX.Element;
|
|
24
27
|
};
|
|
@@ -6,3 +6,7 @@ export declare const EMBED_ICON_WIDTH = 78;
|
|
|
6
6
|
export declare const CONTAINER_MD_BREAKPOINT = 448;
|
|
7
7
|
export declare const FLOAT_BUTTON_WIDTH = 25;
|
|
8
8
|
export declare const HEADING_LABEL = "Headings";
|
|
9
|
+
export type ToolbarOverrides = {
|
|
10
|
+
toolbar?: ToolbarOverrideType[];
|
|
11
|
+
showFloatingToolbar?: boolean;
|
|
12
|
+
};
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import type { Form } from '../../../../../forms';
|
|
4
4
|
import type { MdxTemplate } from '../types';
|
|
5
|
-
import type { ToolbarOverrideType } from './toolbar-overrides';
|
|
5
|
+
import type { ToolbarOverrides, ToolbarOverrideType } from './toolbar-overrides';
|
|
6
6
|
interface ToolbarContextProps {
|
|
7
7
|
tinaForm: Form;
|
|
8
8
|
templates: MdxTemplate[];
|
|
9
|
-
overrides: ToolbarOverrideType[];
|
|
9
|
+
overrides: ToolbarOverrideType[] | ToolbarOverrides;
|
|
10
10
|
}
|
|
11
11
|
interface ToolbarProviderProps extends ToolbarContextProps {
|
|
12
12
|
children: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-9931d5a-20250106011423",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -128,9 +128,9 @@
|
|
|
128
128
|
"webfontloader": "1.6.28",
|
|
129
129
|
"yup": "^1.4.0",
|
|
130
130
|
"zod": "^3.23.8",
|
|
131
|
-
"@tinacms/mdx": "0.0.0-
|
|
132
|
-
"@tinacms/schema-tools": "
|
|
133
|
-
"@tinacms/search": "0.0.0-
|
|
131
|
+
"@tinacms/mdx": "0.0.0-9931d5a-20250106011423",
|
|
132
|
+
"@tinacms/schema-tools": "0.0.0-9931d5a-20250106011423",
|
|
133
|
+
"@tinacms/search": "0.0.0-9931d5a-20250106011423"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@graphql-tools/utils": "^10.5.6",
|