tinacms 0.0.0-eb519f2-20241015053224 → 0.0.0-ebe1b69-20250211022853
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/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +90 -61
- package/dist/client.mjs +49 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.js +297 -339
- package/dist/index.mjs +313 -355
- package/dist/node-cache-5e8db9f0.mjs +63 -0
- package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
- 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/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/dist/unifiedClient/index.d.ts +8 -1
- package/package.json +28 -28
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
- package/dist/node-cache-7fa2452c.mjs +0 -43
package/dist/index.mjs
CHANGED
|
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition
|
|
10
|
-
import { createPortal
|
|
9
|
+
import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
11
|
import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
|
|
12
12
|
import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
|
|
13
13
|
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
|
|
@@ -15,12 +15,12 @@ import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-com
|
|
|
15
15
|
import { useSelected, useReadOnly, ReactEditor } from "slate-react";
|
|
16
16
|
import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
|
|
17
17
|
import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
|
|
18
|
-
import { Combobox, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
|
|
18
|
+
import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
|
|
19
19
|
import { cva } from "class-variance-authority";
|
|
20
20
|
import { Eye, SquarePen, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Moon, SunMedium, Twitter } from "lucide-react";
|
|
21
21
|
import mermaid from "mermaid";
|
|
22
22
|
import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
|
|
23
|
-
import { useComboboxContext, Combobox as Combobox$
|
|
23
|
+
import { useComboboxContext, Combobox as Combobox$2, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
|
|
24
24
|
import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
|
|
25
25
|
import { useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
|
|
26
26
|
import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
|
|
@@ -801,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
|
|
|
801
801
|
);
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
+
function wrapFieldWithNoHeader(Field2) {
|
|
805
|
+
return (props) => {
|
|
806
|
+
return /* @__PURE__ */ React.createElement(
|
|
807
|
+
FieldMeta,
|
|
808
|
+
{
|
|
809
|
+
name: props.input.name,
|
|
810
|
+
label: false,
|
|
811
|
+
description: "",
|
|
812
|
+
error: props.meta.error,
|
|
813
|
+
index: props.index,
|
|
814
|
+
tinaForm: props.tinaForm
|
|
815
|
+
},
|
|
816
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
817
|
+
);
|
|
818
|
+
};
|
|
819
|
+
}
|
|
804
820
|
function wrapFieldWithError(Field2) {
|
|
805
821
|
return (props) => {
|
|
806
822
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -873,6 +889,16 @@ const FieldDescription = ({
|
|
|
873
889
|
className,
|
|
874
890
|
...props
|
|
875
891
|
}) => {
|
|
892
|
+
if (typeof children === "string") {
|
|
893
|
+
return /* @__PURE__ */ React.createElement(
|
|
894
|
+
"span",
|
|
895
|
+
{
|
|
896
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
897
|
+
...props,
|
|
898
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
899
|
+
}
|
|
900
|
+
);
|
|
901
|
+
}
|
|
876
902
|
return /* @__PURE__ */ React.createElement(
|
|
877
903
|
"span",
|
|
878
904
|
{
|
|
@@ -966,7 +992,7 @@ const Autocomplete = ({
|
|
|
966
992
|
}
|
|
967
993
|
}, [items2, query]);
|
|
968
994
|
return /* @__PURE__ */ React__default.createElement(
|
|
969
|
-
Combobox,
|
|
995
|
+
Combobox$1,
|
|
970
996
|
{
|
|
971
997
|
value,
|
|
972
998
|
onChange,
|
|
@@ -1332,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
|
|
|
1332
1358
|
]);
|
|
1333
1359
|
const ListElement = withRef(
|
|
1334
1360
|
({ children, variant = "ul", ...props }, ref) => {
|
|
1335
|
-
const
|
|
1336
|
-
return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(
|
|
1361
|
+
const Component = variant;
|
|
1362
|
+
return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
|
|
1337
1363
|
}
|
|
1338
1364
|
);
|
|
1339
1365
|
const ELEMENT_MERMAID = "mermaid";
|
|
@@ -1348,7 +1374,7 @@ const MermaidElementWithRef = ({ config }) => {
|
|
|
1348
1374
|
useEffect(() => {
|
|
1349
1375
|
if (mermaidRef.current) {
|
|
1350
1376
|
mermaid.initialize({ startOnLoad: true });
|
|
1351
|
-
mermaid.
|
|
1377
|
+
mermaid.init();
|
|
1352
1378
|
}
|
|
1353
1379
|
}, [config]);
|
|
1354
1380
|
return /* @__PURE__ */ React__default.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React__default.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React__default.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
|
|
@@ -1375,7 +1401,7 @@ flowchart TD
|
|
|
1375
1401
|
--> id2(modify me to see changes!)
|
|
1376
1402
|
id2
|
|
1377
1403
|
--> id3(Click the top button to preview the changes)
|
|
1378
|
-
--> id4(Learn about mermaid diagrams
|
|
1404
|
+
--> id4(Learn about mermaid diagrams - mermaid.js.org)`;
|
|
1379
1405
|
const MermaidElement = withRef(
|
|
1380
1406
|
({ children, nodeProps, element, ...props }, ref) => {
|
|
1381
1407
|
const [mermaidConfig, setMermaidConfig] = useState(
|
|
@@ -1391,7 +1417,7 @@ const MermaidElement = withRef(
|
|
|
1391
1417
|
children: [{ type: "text", text: "" }]
|
|
1392
1418
|
};
|
|
1393
1419
|
useEffect(() => {
|
|
1394
|
-
if (mermaid.parse(mermaidConfig
|
|
1420
|
+
if (mermaid.parse(mermaidConfig)) {
|
|
1395
1421
|
setMermaidError(null);
|
|
1396
1422
|
}
|
|
1397
1423
|
}, [mermaidConfig]);
|
|
@@ -2147,7 +2173,7 @@ const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
|
|
|
2147
2173
|
},
|
|
2148
2174
|
value || ""
|
|
2149
2175
|
), /* @__PURE__ */ React__default.createElement(
|
|
2150
|
-
Combobox$
|
|
2176
|
+
Combobox$2,
|
|
2151
2177
|
{
|
|
2152
2178
|
autoSelect: true,
|
|
2153
2179
|
className: cn$1(
|
|
@@ -3653,7 +3679,7 @@ function TinaForm({ form, children }) {
|
|
|
3653
3679
|
}));
|
|
3654
3680
|
}
|
|
3655
3681
|
function TinaField({
|
|
3656
|
-
Component
|
|
3682
|
+
Component,
|
|
3657
3683
|
children,
|
|
3658
3684
|
...fieldProps
|
|
3659
3685
|
}) {
|
|
@@ -3661,7 +3687,7 @@ function TinaField({
|
|
|
3661
3687
|
if (!isEditing)
|
|
3662
3688
|
return children || null;
|
|
3663
3689
|
return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
|
|
3664
|
-
return /* @__PURE__ */ React.createElement(
|
|
3690
|
+
return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
|
|
3665
3691
|
});
|
|
3666
3692
|
}
|
|
3667
3693
|
TinaField.propTypes = {
|
|
@@ -3703,7 +3729,7 @@ const Button$1 = ({
|
|
|
3703
3729
|
};
|
|
3704
3730
|
const sizeClasses = {
|
|
3705
3731
|
small: `text-xs h-8 px-3`,
|
|
3706
|
-
medium: `text-sm h-10 px-
|
|
3732
|
+
medium: `text-sm h-10 px-8`,
|
|
3707
3733
|
custom: ``
|
|
3708
3734
|
};
|
|
3709
3735
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -3831,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
|
|
|
3831
3857
|
function _objectWithoutProperties(source, excluded) {
|
|
3832
3858
|
if (source == null)
|
|
3833
3859
|
return {};
|
|
3834
|
-
var target = _objectWithoutPropertiesLoose
|
|
3860
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3835
3861
|
var key, i;
|
|
3836
3862
|
if (Object.getOwnPropertySymbols) {
|
|
3837
3863
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -3846,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
3846
3872
|
}
|
|
3847
3873
|
return target;
|
|
3848
3874
|
}
|
|
3849
|
-
function _objectWithoutPropertiesLoose
|
|
3875
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3850
3876
|
if (source == null)
|
|
3851
3877
|
return {};
|
|
3852
3878
|
var target = {};
|
|
@@ -4936,7 +4962,28 @@ const NumberInput = ({
|
|
|
4936
4962
|
onChange,
|
|
4937
4963
|
value,
|
|
4938
4964
|
step
|
|
4939
|
-
}) => /* @__PURE__ */ React.createElement(
|
|
4965
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
4966
|
+
Input,
|
|
4967
|
+
{
|
|
4968
|
+
type: "number",
|
|
4969
|
+
step,
|
|
4970
|
+
value,
|
|
4971
|
+
onChange: (event) => {
|
|
4972
|
+
const inputValue = event.target.value;
|
|
4973
|
+
const newValue = inputValue === "" ? void 0 : inputValue;
|
|
4974
|
+
if (onChange) {
|
|
4975
|
+
const syntheticEvent = {
|
|
4976
|
+
...event,
|
|
4977
|
+
target: {
|
|
4978
|
+
...event.target,
|
|
4979
|
+
value: newValue
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
onChange(syntheticEvent);
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
);
|
|
4940
4987
|
function useCMS() {
|
|
4941
4988
|
return useCMS$1();
|
|
4942
4989
|
}
|
|
@@ -5177,7 +5224,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
|
|
|
5177
5224
|
side: "bottom",
|
|
5178
5225
|
className: cn(
|
|
5179
5226
|
"rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
5180
|
-
"max-h-[30vh] max-w-[
|
|
5227
|
+
"max-h-[30vh] max-w-[30vw] overflow-y-auto",
|
|
5181
5228
|
className
|
|
5182
5229
|
),
|
|
5183
5230
|
...props
|
|
@@ -5269,11 +5316,7 @@ const getFilename = (optionSets, value) => {
|
|
|
5269
5316
|
const node = nodes.find((node2) => node2.id === value);
|
|
5270
5317
|
return node ? node._internalSys.filename : null;
|
|
5271
5318
|
};
|
|
5272
|
-
const
|
|
5273
|
-
cms,
|
|
5274
|
-
input,
|
|
5275
|
-
field
|
|
5276
|
-
}) => {
|
|
5319
|
+
const Combobox = ({ cms, input, field }) => {
|
|
5277
5320
|
const [open2, setOpen] = React.useState(false);
|
|
5278
5321
|
const [value, setValue] = React.useState(input.value);
|
|
5279
5322
|
const [displayText, setDisplayText] = React.useState(null);
|
|
@@ -5297,17 +5340,17 @@ const ComboboxDemo = ({
|
|
|
5297
5340
|
if (loading === true) {
|
|
5298
5341
|
return /* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
|
|
5299
5342
|
}
|
|
5300
|
-
return /* @__PURE__ */ React.createElement(
|
|
5343
|
+
return /* @__PURE__ */ React.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
5301
5344
|
Button,
|
|
5302
5345
|
{
|
|
5303
5346
|
variant: "outline",
|
|
5304
5347
|
role: "combobox",
|
|
5305
5348
|
"aria-expanded": open2,
|
|
5306
|
-
className: "w-
|
|
5349
|
+
className: "w-full justify-between"
|
|
5307
5350
|
},
|
|
5308
5351
|
/* @__PURE__ */ React.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
|
|
5309
5352
|
open2 ? /* @__PURE__ */ React.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React.createElement(IoMdArrowDropdown, { size: 20 })
|
|
5310
|
-
)), /* @__PURE__ */ React.createElement(PopoverContent, { className: "p-0 relative" }, /* @__PURE__ */ React.createElement(
|
|
5353
|
+
)), /* @__PURE__ */ React.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React.createElement(
|
|
5311
5354
|
Command,
|
|
5312
5355
|
{
|
|
5313
5356
|
shouldFilter: !field.experimental___filter,
|
|
@@ -5331,32 +5374,25 @@ const ComboboxDemo = ({
|
|
|
5331
5374
|
}
|
|
5332
5375
|
),
|
|
5333
5376
|
/* @__PURE__ */ React.createElement(CommandEmpty, null, "No reference found"),
|
|
5334
|
-
/* @__PURE__ */ React.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React.createElement(
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
field,
|
|
5349
|
-
_values,
|
|
5350
|
-
node,
|
|
5351
|
-
onSelect: (currentValue) => {
|
|
5352
|
-
setValue(currentValue);
|
|
5353
|
-
setOpen(false);
|
|
5354
|
-
}
|
|
5377
|
+
/* @__PURE__ */ React.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React.createElement(CommandGroup, { key: `${collection}-group`, heading: collection }, /* @__PURE__ */ React.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
|
|
5378
|
+
const { id, _values } = node;
|
|
5379
|
+
return /* @__PURE__ */ React.createElement(
|
|
5380
|
+
OptionComponent,
|
|
5381
|
+
{
|
|
5382
|
+
id,
|
|
5383
|
+
key: id,
|
|
5384
|
+
value,
|
|
5385
|
+
field,
|
|
5386
|
+
_values,
|
|
5387
|
+
node,
|
|
5388
|
+
onSelect: (currentValue) => {
|
|
5389
|
+
setValue(currentValue);
|
|
5390
|
+
setOpen(false);
|
|
5355
5391
|
}
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
))))
|
|
5359
|
-
)))
|
|
5392
|
+
}
|
|
5393
|
+
);
|
|
5394
|
+
}))))))
|
|
5395
|
+
)));
|
|
5360
5396
|
};
|
|
5361
5397
|
const useGetNode = (cms, id) => {
|
|
5362
5398
|
const [document2, setDocument] = React.useState(
|
|
@@ -5429,7 +5465,7 @@ const ReferenceLink = ({ cms, input }) => {
|
|
|
5429
5465
|
};
|
|
5430
5466
|
const Reference = ({ input, field }) => {
|
|
5431
5467
|
const cms = useCMS();
|
|
5432
|
-
return /* @__PURE__ */ React.createElement(
|
|
5468
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.createElement(Combobox, { cms, input, field })), /* @__PURE__ */ React.createElement(ReferenceLink, { cms, input }));
|
|
5433
5469
|
};
|
|
5434
5470
|
const ButtonToggle = ({
|
|
5435
5471
|
input,
|
|
@@ -5737,10 +5773,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
|
|
|
5737
5773
|
return /* @__PURE__ */ React__default.createElement(
|
|
5738
5774
|
"button",
|
|
5739
5775
|
{
|
|
5740
|
-
|
|
5776
|
+
type: "button",
|
|
5777
|
+
className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
|
|
5741
5778
|
onClick
|
|
5742
5779
|
},
|
|
5743
|
-
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5780
|
+
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5744
5781
|
);
|
|
5745
5782
|
};
|
|
5746
5783
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5818,27 +5855,35 @@ const BlockSelector = ({
|
|
|
5818
5855
|
))))
|
|
5819
5856
|
))));
|
|
5820
5857
|
};
|
|
5821
|
-
const Group =
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5858
|
+
const Group = wrapFieldWithNoHeader(
|
|
5859
|
+
({ tinaForm, field }) => {
|
|
5860
|
+
const cms = useCMS$1();
|
|
5861
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5862
|
+
Header,
|
|
5863
|
+
{
|
|
5864
|
+
onClick: () => {
|
|
5865
|
+
const state = tinaForm.finalForm.getState();
|
|
5866
|
+
if (state.invalid === true) {
|
|
5867
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5868
|
+
return;
|
|
5869
|
+
}
|
|
5870
|
+
cms.dispatch({
|
|
5871
|
+
type: "forms:set-active-field-name",
|
|
5872
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5873
|
+
});
|
|
5832
5874
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5875
|
+
},
|
|
5876
|
+
field.label || field.name,
|
|
5877
|
+
field.description && /* @__PURE__ */ React.createElement(
|
|
5878
|
+
"span",
|
|
5879
|
+
{
|
|
5880
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5881
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5882
|
+
}
|
|
5883
|
+
)
|
|
5884
|
+
));
|
|
5885
|
+
}
|
|
5886
|
+
);
|
|
5842
5887
|
const Header = ({ onClick, children }) => {
|
|
5843
5888
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5844
5889
|
"button",
|
|
@@ -7180,244 +7225,65 @@ function pad(type, value) {
|
|
|
7180
7225
|
str = "0" + str;
|
|
7181
7226
|
return str;
|
|
7182
7227
|
}
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
}
|
|
7195
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7196
|
-
if (source == null)
|
|
7197
|
-
return {};
|
|
7198
|
-
var target = {};
|
|
7199
|
-
var sourceKeys = Object.keys(source);
|
|
7200
|
-
var key, i;
|
|
7201
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
7202
|
-
key = sourceKeys[i];
|
|
7203
|
-
if (excluded.indexOf(key) >= 0)
|
|
7204
|
-
continue;
|
|
7205
|
-
target[key] = source[key];
|
|
7206
|
-
}
|
|
7207
|
-
return target;
|
|
7208
|
-
}
|
|
7209
|
-
function _assertThisInitialized(self) {
|
|
7210
|
-
if (self === void 0) {
|
|
7211
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7212
|
-
}
|
|
7213
|
-
return self;
|
|
7214
|
-
}
|
|
7215
|
-
function isNodeFound(current, componentNode, ignoreClass) {
|
|
7216
|
-
if (current === componentNode) {
|
|
7217
|
-
return true;
|
|
7218
|
-
}
|
|
7219
|
-
if (current.correspondingElement) {
|
|
7220
|
-
return current.correspondingElement.classList.contains(ignoreClass);
|
|
7221
|
-
}
|
|
7222
|
-
return current.classList.contains(ignoreClass);
|
|
7223
|
-
}
|
|
7224
|
-
function findHighest(current, componentNode, ignoreClass) {
|
|
7225
|
-
if (current === componentNode) {
|
|
7226
|
-
return true;
|
|
7228
|
+
var useClickAway$1 = {};
|
|
7229
|
+
var util = {};
|
|
7230
|
+
Object.defineProperty(util, "__esModule", { value: true });
|
|
7231
|
+
util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
|
|
7232
|
+
var noop = function() {
|
|
7233
|
+
};
|
|
7234
|
+
util.noop = noop;
|
|
7235
|
+
function on(obj) {
|
|
7236
|
+
var args = [];
|
|
7237
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7238
|
+
args[_i - 1] = arguments[_i];
|
|
7227
7239
|
}
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
return true;
|
|
7231
|
-
}
|
|
7232
|
-
current = current.parentNode || current.host;
|
|
7240
|
+
if (obj && obj.addEventListener) {
|
|
7241
|
+
obj.addEventListener.apply(obj, args);
|
|
7233
7242
|
}
|
|
7234
|
-
return current;
|
|
7235
7243
|
}
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
var
|
|
7240
|
-
|
|
7241
|
-
return;
|
|
7244
|
+
util.on = on;
|
|
7245
|
+
function off(obj) {
|
|
7246
|
+
var args = [];
|
|
7247
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7248
|
+
args[_i - 1] = arguments[_i];
|
|
7242
7249
|
}
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
get: function get2() {
|
|
7246
|
-
passive = true;
|
|
7247
|
-
}
|
|
7248
|
-
});
|
|
7249
|
-
var noop = function noop2() {
|
|
7250
|
-
};
|
|
7251
|
-
window.addEventListener("testPassiveEventSupport", noop, options);
|
|
7252
|
-
window.removeEventListener("testPassiveEventSupport", noop, options);
|
|
7253
|
-
return passive;
|
|
7254
|
-
};
|
|
7255
|
-
function autoInc(seed) {
|
|
7256
|
-
if (seed === void 0) {
|
|
7257
|
-
seed = 0;
|
|
7250
|
+
if (obj && obj.removeEventListener) {
|
|
7251
|
+
obj.removeEventListener.apply(obj, args);
|
|
7258
7252
|
}
|
|
7259
|
-
return function() {
|
|
7260
|
-
return ++seed;
|
|
7261
|
-
};
|
|
7262
7253
|
}
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
var
|
|
7268
|
-
var
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
function onClickOutside(props) {
|
|
7283
|
-
var _this;
|
|
7284
|
-
_this = _Component.call(this, props) || this;
|
|
7285
|
-
_this.__outsideClickHandler = function(event) {
|
|
7286
|
-
if (typeof _this.__clickOutsideHandlerProp === "function") {
|
|
7287
|
-
_this.__clickOutsideHandlerProp(event);
|
|
7288
|
-
return;
|
|
7289
|
-
}
|
|
7290
|
-
var instance = _this.getInstance();
|
|
7291
|
-
if (typeof instance.props.handleClickOutside === "function") {
|
|
7292
|
-
instance.props.handleClickOutside(event);
|
|
7293
|
-
return;
|
|
7294
|
-
}
|
|
7295
|
-
if (typeof instance.handleClickOutside === "function") {
|
|
7296
|
-
instance.handleClickOutside(event);
|
|
7297
|
-
return;
|
|
7298
|
-
}
|
|
7299
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
|
|
7300
|
-
};
|
|
7301
|
-
_this.__getComponentNode = function() {
|
|
7302
|
-
var instance = _this.getInstance();
|
|
7303
|
-
if (config && typeof config.setClickOutsideRef === "function") {
|
|
7304
|
-
return config.setClickOutsideRef()(instance);
|
|
7305
|
-
}
|
|
7306
|
-
if (typeof instance.setClickOutsideRef === "function") {
|
|
7307
|
-
return instance.setClickOutsideRef();
|
|
7308
|
-
}
|
|
7309
|
-
return findDOMNode(instance);
|
|
7310
|
-
};
|
|
7311
|
-
_this.enableOnClickOutside = function() {
|
|
7312
|
-
if (typeof document === "undefined" || enabledInstances[_this._uid]) {
|
|
7313
|
-
return;
|
|
7314
|
-
}
|
|
7315
|
-
if (typeof passiveEventSupport === "undefined") {
|
|
7316
|
-
passiveEventSupport = testPassiveEventSupport();
|
|
7317
|
-
}
|
|
7318
|
-
enabledInstances[_this._uid] = true;
|
|
7319
|
-
var events = _this.props.eventTypes;
|
|
7320
|
-
if (!events.forEach) {
|
|
7321
|
-
events = [events];
|
|
7322
|
-
}
|
|
7323
|
-
handlersMap[_this._uid] = function(event) {
|
|
7324
|
-
if (_this.componentNode === null)
|
|
7325
|
-
return;
|
|
7326
|
-
if (_this.initTimeStamp > event.timeStamp)
|
|
7327
|
-
return;
|
|
7328
|
-
if (_this.props.preventDefault) {
|
|
7329
|
-
event.preventDefault();
|
|
7330
|
-
}
|
|
7331
|
-
if (_this.props.stopPropagation) {
|
|
7332
|
-
event.stopPropagation();
|
|
7333
|
-
}
|
|
7334
|
-
if (_this.props.excludeScrollbar && clickedScrollbar(event))
|
|
7335
|
-
return;
|
|
7336
|
-
var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
|
|
7337
|
-
if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
|
|
7338
|
-
return;
|
|
7339
|
-
}
|
|
7340
|
-
_this.__outsideClickHandler(event);
|
|
7341
|
-
};
|
|
7342
|
-
events.forEach(function(eventName) {
|
|
7343
|
-
document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
7344
|
-
});
|
|
7345
|
-
};
|
|
7346
|
-
_this.disableOnClickOutside = function() {
|
|
7347
|
-
delete enabledInstances[_this._uid];
|
|
7348
|
-
var fn = handlersMap[_this._uid];
|
|
7349
|
-
if (fn && typeof document !== "undefined") {
|
|
7350
|
-
var events = _this.props.eventTypes;
|
|
7351
|
-
if (!events.forEach) {
|
|
7352
|
-
events = [events];
|
|
7353
|
-
}
|
|
7354
|
-
events.forEach(function(eventName) {
|
|
7355
|
-
return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
7356
|
-
});
|
|
7357
|
-
delete handlersMap[_this._uid];
|
|
7358
|
-
}
|
|
7359
|
-
};
|
|
7360
|
-
_this.getRef = function(ref) {
|
|
7361
|
-
return _this.instanceRef = ref;
|
|
7362
|
-
};
|
|
7363
|
-
_this._uid = uid();
|
|
7364
|
-
_this.initTimeStamp = performance.now();
|
|
7365
|
-
return _this;
|
|
7366
|
-
}
|
|
7367
|
-
var _proto = onClickOutside.prototype;
|
|
7368
|
-
_proto.getInstance = function getInstance() {
|
|
7369
|
-
if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
|
|
7370
|
-
return this;
|
|
7371
|
-
}
|
|
7372
|
-
var ref = this.instanceRef;
|
|
7373
|
-
return ref.getInstance ? ref.getInstance() : ref;
|
|
7254
|
+
util.off = off;
|
|
7255
|
+
util.isBrowser = typeof window !== "undefined";
|
|
7256
|
+
util.isNavigator = typeof navigator !== "undefined";
|
|
7257
|
+
Object.defineProperty(useClickAway$1, "__esModule", { value: true });
|
|
7258
|
+
var react_1 = React__default;
|
|
7259
|
+
var util_1 = util;
|
|
7260
|
+
var defaultEvents = ["mousedown", "touchstart"];
|
|
7261
|
+
var useClickAway = function(ref, onClickAway, events) {
|
|
7262
|
+
if (events === void 0) {
|
|
7263
|
+
events = defaultEvents;
|
|
7264
|
+
}
|
|
7265
|
+
var savedCallback = react_1.useRef(onClickAway);
|
|
7266
|
+
react_1.useEffect(function() {
|
|
7267
|
+
savedCallback.current = onClickAway;
|
|
7268
|
+
}, [onClickAway]);
|
|
7269
|
+
react_1.useEffect(function() {
|
|
7270
|
+
var handler = function(event) {
|
|
7271
|
+
var el = ref.current;
|
|
7272
|
+
el && !el.contains(event.target) && savedCallback.current(event);
|
|
7374
7273
|
};
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
|
|
7384
|
-
}
|
|
7385
|
-
}
|
|
7386
|
-
this.componentNode = this.__getComponentNode();
|
|
7387
|
-
if (this.props.disableOnClickOutside)
|
|
7388
|
-
return;
|
|
7389
|
-
this.enableOnClickOutside();
|
|
7390
|
-
};
|
|
7391
|
-
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
7392
|
-
this.componentNode = this.__getComponentNode();
|
|
7393
|
-
};
|
|
7394
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
7395
|
-
this.disableOnClickOutside();
|
|
7396
|
-
};
|
|
7397
|
-
_proto.render = function render() {
|
|
7398
|
-
var _this$props = this.props;
|
|
7399
|
-
_this$props.excludeScrollbar;
|
|
7400
|
-
var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
|
|
7401
|
-
if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
|
|
7402
|
-
props.ref = this.getRef;
|
|
7403
|
-
} else {
|
|
7404
|
-
props.wrappedRef = this.getRef;
|
|
7274
|
+
for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
|
|
7275
|
+
var eventName = events_1[_i];
|
|
7276
|
+
util_1.on(document, eventName, handler);
|
|
7277
|
+
}
|
|
7278
|
+
return function() {
|
|
7279
|
+
for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
|
|
7280
|
+
var eventName2 = events_2[_i2];
|
|
7281
|
+
util_1.off(document, eventName2, handler);
|
|
7405
7282
|
}
|
|
7406
|
-
props.disableOnClickOutside = this.disableOnClickOutside;
|
|
7407
|
-
props.enableOnClickOutside = this.enableOnClickOutside;
|
|
7408
|
-
return createElement(WrappedComponent, props);
|
|
7409
7283
|
};
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
excludeScrollbar: config && config.excludeScrollbar || false,
|
|
7414
|
-
outsideClickIgnoreClass: IGNORE_CLASS_NAME,
|
|
7415
|
-
preventDefault: false,
|
|
7416
|
-
stopPropagation: false
|
|
7417
|
-
}, _class.getClass = function() {
|
|
7418
|
-
return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
|
|
7419
|
-
}, _temp;
|
|
7420
|
-
}
|
|
7284
|
+
}, [events, ref]);
|
|
7285
|
+
};
|
|
7286
|
+
var _default = useClickAway$1.default = useClickAway;
|
|
7421
7287
|
const viewModes = {
|
|
7422
7288
|
YEARS: "years",
|
|
7423
7289
|
MONTHS: "months",
|
|
@@ -7946,22 +7812,13 @@ function log(message, method) {
|
|
|
7946
7812
|
}
|
|
7947
7813
|
con[method]("***react-datetime:" + message);
|
|
7948
7814
|
}
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
}
|
|
7954
|
-
|
|
7955
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
|
|
7956
|
-
}
|
|
7957
|
-
handleClickOutside(e) {
|
|
7958
|
-
this.props.onClickOut(e);
|
|
7959
|
-
}
|
|
7960
|
-
setClickOutsideRef() {
|
|
7961
|
-
return this.container.current;
|
|
7962
|
-
}
|
|
7815
|
+
function ClickableWrapper({ className, onClickOut, children }) {
|
|
7816
|
+
const containerRef = useRef(null);
|
|
7817
|
+
_default(containerRef, (event) => {
|
|
7818
|
+
onClickOut(event);
|
|
7819
|
+
});
|
|
7820
|
+
return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
|
|
7963
7821
|
}
|
|
7964
|
-
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
7965
7822
|
const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
|
|
7966
7823
|
const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
|
|
7967
7824
|
const format$1 = (val, _name, field) => {
|
|
@@ -8004,7 +7861,10 @@ const DateField = wrapFieldsWithMeta(
|
|
|
8004
7861
|
ReactDateTimeWithStyles,
|
|
8005
7862
|
{
|
|
8006
7863
|
value: input.value,
|
|
8007
|
-
onChange:
|
|
7864
|
+
onChange: (value) => {
|
|
7865
|
+
const newValue = value === "" ? void 0 : value;
|
|
7866
|
+
input.onChange(newValue);
|
|
7867
|
+
},
|
|
8008
7868
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
8009
7869
|
timeFormat: timeFormat || false,
|
|
8010
7870
|
inputProps: { className: textFieldClasses },
|
|
@@ -9456,6 +9316,19 @@ class TinaMediaStore {
|
|
|
9456
9316
|
}
|
|
9457
9317
|
}
|
|
9458
9318
|
}
|
|
9319
|
+
const encodeUrlIfNeeded = (url) => {
|
|
9320
|
+
if (url) {
|
|
9321
|
+
try {
|
|
9322
|
+
const parsed = new URL(url);
|
|
9323
|
+
parsed.pathname = parsed.pathname.split("/").filter((part) => part !== "").map(encodeURIComponent).join("/");
|
|
9324
|
+
return parsed.toString();
|
|
9325
|
+
} catch (e) {
|
|
9326
|
+
return url;
|
|
9327
|
+
}
|
|
9328
|
+
} else {
|
|
9329
|
+
return url;
|
|
9330
|
+
}
|
|
9331
|
+
};
|
|
9459
9332
|
let MediaManager$1 = class MediaManager {
|
|
9460
9333
|
constructor(store, events) {
|
|
9461
9334
|
this.store = store;
|
|
@@ -9528,6 +9401,20 @@ let MediaManager$1 = class MediaManager {
|
|
|
9528
9401
|
try {
|
|
9529
9402
|
this.events.dispatch({ type: "media:list:start", ...options });
|
|
9530
9403
|
const media = await this.store.list(options);
|
|
9404
|
+
media.items = media.items.map((item) => {
|
|
9405
|
+
if (item.type === "dir") {
|
|
9406
|
+
return item;
|
|
9407
|
+
}
|
|
9408
|
+
if (item.thumbnails) {
|
|
9409
|
+
for (const [size, src] of Object.entries(item.thumbnails)) {
|
|
9410
|
+
item.thumbnails[size] = encodeUrlIfNeeded(src);
|
|
9411
|
+
}
|
|
9412
|
+
}
|
|
9413
|
+
return {
|
|
9414
|
+
...item,
|
|
9415
|
+
src: encodeUrlIfNeeded(item.src)
|
|
9416
|
+
};
|
|
9417
|
+
});
|
|
9531
9418
|
this.events.dispatch({ type: "media:list:success", ...options, media });
|
|
9532
9419
|
return media;
|
|
9533
9420
|
} catch (error) {
|
|
@@ -9815,7 +9702,7 @@ class SidebarState {
|
|
|
9815
9702
|
}
|
|
9816
9703
|
}
|
|
9817
9704
|
function createScreen({
|
|
9818
|
-
Component
|
|
9705
|
+
Component,
|
|
9819
9706
|
props,
|
|
9820
9707
|
...options
|
|
9821
9708
|
}) {
|
|
@@ -9824,7 +9711,7 @@ function createScreen({
|
|
|
9824
9711
|
layout: "popup",
|
|
9825
9712
|
...options,
|
|
9826
9713
|
Component(screenProps) {
|
|
9827
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
9714
|
+
return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
|
|
9828
9715
|
}
|
|
9829
9716
|
};
|
|
9830
9717
|
}
|
|
@@ -10335,7 +10222,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10335
10222
|
"Event Log"
|
|
10336
10223
|
));
|
|
10337
10224
|
};
|
|
10338
|
-
const version = "2.
|
|
10225
|
+
const version = "2.6.3";
|
|
10339
10226
|
const Nav = ({
|
|
10340
10227
|
isLocalMode,
|
|
10341
10228
|
className = "",
|
|
@@ -12866,15 +12753,14 @@ const FormBuilder = ({
|
|
|
12866
12753
|
fields: fieldGroup.fields
|
|
12867
12754
|
}
|
|
12868
12755
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12869
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12756
|
+
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
|
|
12870
12757
|
ResetForm,
|
|
12871
12758
|
{
|
|
12872
12759
|
pristine,
|
|
12873
12760
|
reset: async () => {
|
|
12874
12761
|
finalForm.reset();
|
|
12875
12762
|
await tinaForm.reset();
|
|
12876
|
-
}
|
|
12877
|
-
style: { flexGrow: 1 }
|
|
12763
|
+
}
|
|
12878
12764
|
},
|
|
12879
12765
|
tinaForm.buttons.reset
|
|
12880
12766
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12883,8 +12769,7 @@ const FormBuilder = ({
|
|
|
12883
12769
|
onClick: safeHandleSubmit,
|
|
12884
12770
|
disabled: !canSubmit,
|
|
12885
12771
|
busy: submitting,
|
|
12886
|
-
variant: "primary"
|
|
12887
|
-
style: { flexGrow: 3 }
|
|
12772
|
+
variant: "primary"
|
|
12888
12773
|
},
|
|
12889
12774
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12890
12775
|
!submitting && tinaForm.buttons.save
|
|
@@ -13266,9 +13151,9 @@ const EllipsisIcon = ({ title }) => {
|
|
|
13266
13151
|
));
|
|
13267
13152
|
};
|
|
13268
13153
|
const Wrapper$1 = ({ inline, children }) => {
|
|
13269
|
-
const
|
|
13154
|
+
const Component = inline ? "span" : "div";
|
|
13270
13155
|
return /* @__PURE__ */ React__default.createElement(
|
|
13271
|
-
|
|
13156
|
+
Component,
|
|
13272
13157
|
{
|
|
13273
13158
|
contentEditable: false,
|
|
13274
13159
|
style: { userSelect: "none" },
|
|
@@ -14056,13 +13941,13 @@ const TooltipContent = withCn(
|
|
|
14056
13941
|
}),
|
|
14057
13942
|
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
14058
13943
|
);
|
|
14059
|
-
function withTooltip(
|
|
13944
|
+
function withTooltip(Component) {
|
|
14060
13945
|
return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
14061
13946
|
const [mounted, setMounted] = React__default.useState(false);
|
|
14062
13947
|
React__default.useEffect(() => {
|
|
14063
13948
|
setMounted(true);
|
|
14064
13949
|
}, []);
|
|
14065
|
-
const component = /* @__PURE__ */ React__default.createElement(
|
|
13950
|
+
const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
|
|
14066
13951
|
if (tooltip && mounted) {
|
|
14067
13952
|
return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
|
|
14068
13953
|
}
|
|
@@ -14454,6 +14339,7 @@ function OverflowMenu({
|
|
|
14454
14339
|
ToolbarButton,
|
|
14455
14340
|
{
|
|
14456
14341
|
showArrow: false,
|
|
14342
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14457
14343
|
className: "lg:min-w-[130px]",
|
|
14458
14344
|
isDropdown: true,
|
|
14459
14345
|
pressed: openState.open,
|
|
@@ -14507,7 +14393,17 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
14507
14393
|
};
|
|
14508
14394
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14509
14395
|
const { props } = useRawMarkdownToolbarButton();
|
|
14510
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14396
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14397
|
+
ToolbarButton,
|
|
14398
|
+
{
|
|
14399
|
+
ref,
|
|
14400
|
+
tooltip: "Link",
|
|
14401
|
+
...rest,
|
|
14402
|
+
...props,
|
|
14403
|
+
"data-testid": "markdown-button"
|
|
14404
|
+
},
|
|
14405
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14406
|
+
);
|
|
14511
14407
|
});
|
|
14512
14408
|
function TableDropdownMenu(props) {
|
|
14513
14409
|
const tableSelected = useEditorSelector(
|
|
@@ -14646,7 +14542,7 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
14646
14542
|
key: template.name,
|
|
14647
14543
|
onMouseDown: (e) => {
|
|
14648
14544
|
e.preventDefault();
|
|
14649
|
-
|
|
14545
|
+
setOpen(false);
|
|
14650
14546
|
insertMDX(editor, template);
|
|
14651
14547
|
},
|
|
14652
14548
|
className: ""
|
|
@@ -14732,7 +14628,12 @@ function FixedToolbarButtons() {
|
|
|
14732
14628
|
const [itemsShown, setItemsShown] = React__default.useState(11);
|
|
14733
14629
|
const { overrides, templates } = useToolbarContext();
|
|
14734
14630
|
const showEmbedButton = templates.length > 0;
|
|
14735
|
-
let items2 =
|
|
14631
|
+
let items2 = [];
|
|
14632
|
+
if (Array.isArray(overrides)) {
|
|
14633
|
+
items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14634
|
+
} else {
|
|
14635
|
+
items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14636
|
+
}
|
|
14736
14637
|
if (!showEmbedButton) {
|
|
14737
14638
|
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14738
14639
|
}
|
|
@@ -15060,6 +14961,9 @@ const isUrl = (string) => {
|
|
|
15060
14961
|
if (typeof string !== "string") {
|
|
15061
14962
|
return false;
|
|
15062
14963
|
}
|
|
14964
|
+
if (string.startsWith("#")) {
|
|
14965
|
+
return true;
|
|
14966
|
+
}
|
|
15063
14967
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
15064
14968
|
const emailLinkMatch = string.match(emailLintRE);
|
|
15065
14969
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -15081,12 +14985,12 @@ const isUrl = (string) => {
|
|
|
15081
14985
|
}
|
|
15082
14986
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
15083
14987
|
};
|
|
15084
|
-
const RichEditor = (
|
|
14988
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
15085
14989
|
var _a;
|
|
15086
14990
|
const initialValue = React__default.useMemo(
|
|
15087
14991
|
() => {
|
|
15088
14992
|
var _a2, _b;
|
|
15089
|
-
return ((_b = (_a2 =
|
|
14993
|
+
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: "" }] }];
|
|
15090
14994
|
},
|
|
15091
14995
|
[]
|
|
15092
14996
|
);
|
|
@@ -15114,7 +15018,7 @@ const RichEditor = (props) => {
|
|
|
15114
15018
|
),
|
|
15115
15019
|
[]
|
|
15116
15020
|
);
|
|
15117
|
-
const tempId = [
|
|
15021
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
15118
15022
|
const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
|
|
15119
15023
|
const ref = React__default.useRef(null);
|
|
15120
15024
|
React__default.useEffect(() => {
|
|
@@ -15124,13 +15028,13 @@ const RichEditor = (props) => {
|
|
|
15124
15028
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
15125
15029
|
'[role="textbox"]'
|
|
15126
15030
|
);
|
|
15127
|
-
if (
|
|
15031
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
15128
15032
|
if (plateElement)
|
|
15129
15033
|
plateElement.focus();
|
|
15130
15034
|
}
|
|
15131
15035
|
}, 100);
|
|
15132
15036
|
}
|
|
15133
|
-
}, [
|
|
15037
|
+
}, [field.experimental_focusIntent, ref]);
|
|
15134
15038
|
return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
|
|
15135
15039
|
Plate,
|
|
15136
15040
|
{
|
|
@@ -15138,7 +15042,7 @@ const RichEditor = (props) => {
|
|
|
15138
15042
|
initialValue,
|
|
15139
15043
|
plugins: plugins$2,
|
|
15140
15044
|
onChange: (value) => {
|
|
15141
|
-
|
|
15045
|
+
input.onChange({
|
|
15142
15046
|
type: "root",
|
|
15143
15047
|
children: value
|
|
15144
15048
|
});
|
|
@@ -15147,12 +15051,12 @@ const RichEditor = (props) => {
|
|
|
15147
15051
|
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
15148
15052
|
ToolbarProvider,
|
|
15149
15053
|
{
|
|
15150
|
-
tinaForm
|
|
15151
|
-
templates:
|
|
15152
|
-
overrides: (
|
|
15054
|
+
tinaForm,
|
|
15055
|
+
templates: field.templates,
|
|
15056
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
15153
15057
|
},
|
|
15154
15058
|
/* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
|
|
15155
|
-
/* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
|
|
15059
|
+
((_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
|
|
15156
15060
|
), /* @__PURE__ */ React__default.createElement(Editor, null))
|
|
15157
15061
|
));
|
|
15158
15062
|
};
|
|
@@ -30106,6 +30010,7 @@ class TinaAdminApi {
|
|
|
30106
30010
|
relativePath
|
|
30107
30011
|
filename
|
|
30108
30012
|
extension
|
|
30013
|
+
hasReferences
|
|
30109
30014
|
}
|
|
30110
30015
|
}
|
|
30111
30016
|
}
|
|
@@ -30197,6 +30102,9 @@ class TinaAdminApi {
|
|
|
30197
30102
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30198
30103
|
... on Document {
|
|
30199
30104
|
_values
|
|
30105
|
+
_sys {
|
|
30106
|
+
hasReferences
|
|
30107
|
+
}
|
|
30200
30108
|
}
|
|
30201
30109
|
}
|
|
30202
30110
|
}`;
|
|
@@ -31923,6 +31831,23 @@ const CollectionListPage = () => {
|
|
|
31923
31831
|
DeleteModal,
|
|
31924
31832
|
{
|
|
31925
31833
|
filename: vars.relativePath,
|
|
31834
|
+
checkRefsFunc: async () => {
|
|
31835
|
+
var _a2, _b2;
|
|
31836
|
+
try {
|
|
31837
|
+
const doc = await admin.fetchDocument(
|
|
31838
|
+
collection.name,
|
|
31839
|
+
vars.relativePath,
|
|
31840
|
+
true
|
|
31841
|
+
);
|
|
31842
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31843
|
+
} catch (error) {
|
|
31844
|
+
cms.alerts.error(
|
|
31845
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31846
|
+
);
|
|
31847
|
+
console.error(error);
|
|
31848
|
+
throw error;
|
|
31849
|
+
}
|
|
31850
|
+
},
|
|
31926
31851
|
deleteFunc: async () => {
|
|
31927
31852
|
try {
|
|
31928
31853
|
await admin.deleteDocument(vars);
|
|
@@ -31931,6 +31856,12 @@ const CollectionListPage = () => {
|
|
|
31931
31856
|
);
|
|
31932
31857
|
reFetchCollection();
|
|
31933
31858
|
} catch (error) {
|
|
31859
|
+
if (error.message.indexOf("has references")) {
|
|
31860
|
+
cms.alerts.error(
|
|
31861
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31862
|
+
);
|
|
31863
|
+
return;
|
|
31864
|
+
}
|
|
31934
31865
|
cms.alerts.warn(
|
|
31935
31866
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31936
31867
|
);
|
|
@@ -31982,6 +31913,12 @@ const CollectionListPage = () => {
|
|
|
31982
31913
|
cms.alerts.info("Document was successfully renamed");
|
|
31983
31914
|
reFetchCollection();
|
|
31984
31915
|
} catch (error) {
|
|
31916
|
+
if (error.message.indexOf("has references")) {
|
|
31917
|
+
cms.alerts.error(
|
|
31918
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31919
|
+
);
|
|
31920
|
+
return;
|
|
31921
|
+
}
|
|
31985
31922
|
cms.alerts.warn(
|
|
31986
31923
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31987
31924
|
);
|
|
@@ -32455,8 +32392,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32455
32392
|
const NoDocumentsPlaceholder = () => {
|
|
32456
32393
|
return /* @__PURE__ */ React__default.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
|
|
32457
32394
|
};
|
|
32458
|
-
const DeleteModal = ({
|
|
32459
|
-
|
|
32395
|
+
const DeleteModal = ({
|
|
32396
|
+
close: close2,
|
|
32397
|
+
deleteFunc,
|
|
32398
|
+
checkRefsFunc,
|
|
32399
|
+
filename
|
|
32400
|
+
}) => {
|
|
32401
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32402
|
+
useEffect(() => {
|
|
32403
|
+
checkRefsFunc().then((result) => {
|
|
32404
|
+
setHasRefs(result);
|
|
32405
|
+
});
|
|
32406
|
+
}, [filename, checkRefsFunc]);
|
|
32407
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
|
|
32460
32408
|
Button$1,
|
|
32461
32409
|
{
|
|
32462
32410
|
style: { flexGrow: 3 },
|
|
@@ -33188,15 +33136,24 @@ const IndexingPage = () => {
|
|
|
33188
33136
|
}
|
|
33189
33137
|
}
|
|
33190
33138
|
if (state === "creatingPR") {
|
|
33191
|
-
|
|
33192
|
-
|
|
33193
|
-
|
|
33194
|
-
|
|
33195
|
-
|
|
33196
|
-
|
|
33197
|
-
|
|
33198
|
-
|
|
33199
|
-
|
|
33139
|
+
try {
|
|
33140
|
+
const foo = await tinaApi.createPullRequest({
|
|
33141
|
+
baseBranch,
|
|
33142
|
+
branch,
|
|
33143
|
+
title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
|
|
33144
|
+
});
|
|
33145
|
+
console.log("PR created", foo);
|
|
33146
|
+
cms.alerts.success("Pull request created.");
|
|
33147
|
+
localStorage.setItem("tina.createBranchState", "done");
|
|
33148
|
+
setState("done");
|
|
33149
|
+
} catch (e) {
|
|
33150
|
+
console.error(e);
|
|
33151
|
+
cms.alerts.error("Failed to create PR");
|
|
33152
|
+
setErrorMessage(
|
|
33153
|
+
"Failed to create PR, please try again. If the problem persists please contact support."
|
|
33154
|
+
);
|
|
33155
|
+
setState("error");
|
|
33156
|
+
}
|
|
33200
33157
|
}
|
|
33201
33158
|
if (state === "done") {
|
|
33202
33159
|
window.location.href = back;
|
|
@@ -33818,5 +33775,6 @@ export {
|
|
|
33818
33775
|
useScreenPlugin,
|
|
33819
33776
|
useTinaAuthRedirect,
|
|
33820
33777
|
wrapFieldWithError,
|
|
33778
|
+
wrapFieldWithNoHeader,
|
|
33821
33779
|
wrapFieldsWithMeta
|
|
33822
33780
|
};
|