tinacms 0.0.0-c8b1d84-20241003015733 → 0.0.0-cef656e-20250119001929
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 +23 -24
- package/dist/client.mjs +4 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1589 -1029
- package/dist/index.mjs +1579 -1015
- package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +45 -12
- package/dist/rich-text/index.mjs +45 -12
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +29 -28
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/index.mjs
CHANGED
|
@@ -6,32 +6,38 @@ 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, createContext, forwardRef, useContext,
|
|
10
|
-
import { createPortal
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
|
|
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
|
+
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";
|
|
13
14
|
import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
15
|
+
import { useSelected, useReadOnly, ReactEditor } from "slate-react";
|
|
16
|
+
import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
|
|
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";
|
|
17
19
|
import { cva } from "class-variance-authority";
|
|
18
|
-
import { 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,
|
|
19
|
-
import
|
|
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
|
+
import mermaid from "mermaid";
|
|
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$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
|
|
20
24
|
import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
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
|
+
import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
|
|
27
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
28
|
+
import { PopoverAnchor } from "@radix-ui/react-popover";
|
|
29
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
30
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
31
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
24
32
|
import arrayMutators from "final-form-arrays";
|
|
25
33
|
import setFieldData from "final-form-set-field-data";
|
|
26
34
|
import { FORM_ERROR, createForm, getIn } from "final-form";
|
|
27
35
|
import { Field, Form as Form$1 } from "react-final-form";
|
|
28
36
|
import PropTypes from "prop-types";
|
|
29
37
|
import { Droppable, Draggable, DragDropContext } from "react-beautiful-dnd";
|
|
30
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
31
38
|
import * as pkg$1 from "react-color";
|
|
32
39
|
import * as pkg from "color-string";
|
|
33
40
|
import * as dropzone from "react-dropzone";
|
|
34
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
35
41
|
import { clsx } from "clsx";
|
|
36
42
|
import { twMerge } from "tailwind-merge";
|
|
37
43
|
import { Command as Command$1 } from "cmdk";
|
|
@@ -42,10 +48,8 @@ import moment from "moment";
|
|
|
42
48
|
import { formatDistanceToNow } from "date-fns";
|
|
43
49
|
import { useLinkToolbarButtonState, useLinkToolbarButton, useFloatingLinkInsertState, useFloatingLinkInsert, useFloatingLinkEditState, useFloatingLinkEdit, FloatingLinkUrlInput, LinkOpenButton, createLinkPlugin } from "@udecode/plate-link";
|
|
44
50
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
45
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
46
51
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
47
52
|
import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragraph";
|
|
48
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
49
53
|
import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
|
|
50
54
|
import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
|
|
51
55
|
import { useWindowWidth } from "@react-hook/window-size";
|
|
@@ -797,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
|
|
|
797
801
|
);
|
|
798
802
|
};
|
|
799
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
|
+
}
|
|
800
820
|
function wrapFieldWithError(Field2) {
|
|
801
821
|
return (props) => {
|
|
802
822
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -869,6 +889,16 @@ const FieldDescription = ({
|
|
|
869
889
|
className,
|
|
870
890
|
...props
|
|
871
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
|
+
}
|
|
872
902
|
return /* @__PURE__ */ React.createElement(
|
|
873
903
|
"span",
|
|
874
904
|
{
|
|
@@ -905,6 +935,20 @@ const useEditorContext = () => {
|
|
|
905
935
|
const useTemplates = () => {
|
|
906
936
|
return React__default.useContext(EditorContext);
|
|
907
937
|
};
|
|
938
|
+
const BlockquoteElement = withRef(
|
|
939
|
+
({ children, className, ...props }, ref) => {
|
|
940
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
941
|
+
PlateElement,
|
|
942
|
+
{
|
|
943
|
+
asChild: true,
|
|
944
|
+
className: cn$1("my-1 border-l-2 pl-6 italic", className),
|
|
945
|
+
ref,
|
|
946
|
+
...props
|
|
947
|
+
},
|
|
948
|
+
/* @__PURE__ */ React__default.createElement("blockquote", null, children)
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
);
|
|
908
952
|
function classNames$1(...classes) {
|
|
909
953
|
return classes.filter(Boolean).join(" ");
|
|
910
954
|
}
|
|
@@ -914,6 +958,503 @@ const uuid = () => {
|
|
|
914
958
|
(c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
915
959
|
);
|
|
916
960
|
};
|
|
961
|
+
function ChevronDownIcon(props, svgRef) {
|
|
962
|
+
return /* @__PURE__ */ React.createElement("svg", Object.assign({
|
|
963
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
964
|
+
viewBox: "0 0 20 20",
|
|
965
|
+
fill: "currentColor",
|
|
966
|
+
"aria-hidden": "true",
|
|
967
|
+
ref: svgRef
|
|
968
|
+
}, props), /* @__PURE__ */ React.createElement("path", {
|
|
969
|
+
fillRule: "evenodd",
|
|
970
|
+
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
971
|
+
clipRule: "evenodd"
|
|
972
|
+
}));
|
|
973
|
+
}
|
|
974
|
+
const ForwardRef = React.forwardRef(ChevronDownIcon);
|
|
975
|
+
const ChevronDownIcon$1 = ForwardRef;
|
|
976
|
+
const Autocomplete = ({
|
|
977
|
+
value,
|
|
978
|
+
onChange,
|
|
979
|
+
defaultQuery,
|
|
980
|
+
items: items2
|
|
981
|
+
}) => {
|
|
982
|
+
const [query, setQuery] = React__default.useState(defaultQuery ?? "");
|
|
983
|
+
const filteredItems = React__default.useMemo(() => {
|
|
984
|
+
try {
|
|
985
|
+
const reFilter = new RegExp(query, "i");
|
|
986
|
+
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
987
|
+
if (_items.length === 0)
|
|
988
|
+
return items2;
|
|
989
|
+
return _items;
|
|
990
|
+
} catch (err) {
|
|
991
|
+
return items2;
|
|
992
|
+
}
|
|
993
|
+
}, [items2, query]);
|
|
994
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
995
|
+
Combobox,
|
|
996
|
+
{
|
|
997
|
+
value,
|
|
998
|
+
onChange,
|
|
999
|
+
as: "div",
|
|
1000
|
+
className: "relative inline-block text-left z-20"
|
|
1001
|
+
},
|
|
1002
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "mt-1" }, /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md sm:text-sm" }, /* @__PURE__ */ React__default.createElement(
|
|
1003
|
+
ComboboxInput,
|
|
1004
|
+
{
|
|
1005
|
+
className: "w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300",
|
|
1006
|
+
displayValue: (item) => (item == null ? void 0 : item.label) ?? "Plain Text",
|
|
1007
|
+
onChange: (event) => setQuery(event.target.value),
|
|
1008
|
+
onClick: (ev) => ev.stopPropagation()
|
|
1009
|
+
}
|
|
1010
|
+
), /* @__PURE__ */ React__default.createElement(ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center pr-2" }, /* @__PURE__ */ React__default.createElement(
|
|
1011
|
+
ChevronDownIcon$1,
|
|
1012
|
+
{
|
|
1013
|
+
className: "h-5 w-5 text-gray-400",
|
|
1014
|
+
"aria-hidden": "true"
|
|
1015
|
+
}
|
|
1016
|
+
)))),
|
|
1017
|
+
/* @__PURE__ */ React__default.createElement(
|
|
1018
|
+
Transition,
|
|
1019
|
+
{
|
|
1020
|
+
enter: "transition ease-out duration-100",
|
|
1021
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
1022
|
+
enterTo: "transform opacity-100 scale-100",
|
|
1023
|
+
leave: "transition ease-in duration-75",
|
|
1024
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
1025
|
+
leaveTo: "transform opacity-0 scale-95"
|
|
1026
|
+
},
|
|
1027
|
+
/* @__PURE__ */ React__default.createElement(ComboboxOptions, { className: "origin-top-right absolute right-0 mt-1 w-full max-h-[300px] overflow-y-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, filteredItems.map((item) => /* @__PURE__ */ React__default.createElement(ComboboxOption, { key: item.key, value: item }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
|
|
1028
|
+
"button",
|
|
1029
|
+
{
|
|
1030
|
+
className: classNames$1(
|
|
1031
|
+
focus ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
1032
|
+
"block px-4 py-2 text-xs w-full text-right"
|
|
1033
|
+
)
|
|
1034
|
+
},
|
|
1035
|
+
item.render(item)
|
|
1036
|
+
))))
|
|
1037
|
+
)
|
|
1038
|
+
);
|
|
1039
|
+
};
|
|
1040
|
+
loader.config({
|
|
1041
|
+
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1042
|
+
});
|
|
1043
|
+
let retryCount = 0;
|
|
1044
|
+
const retryFocus = (ref) => {
|
|
1045
|
+
if (ref.current) {
|
|
1046
|
+
ref.current.focus();
|
|
1047
|
+
} else {
|
|
1048
|
+
if (retryCount < 30) {
|
|
1049
|
+
setTimeout(() => {
|
|
1050
|
+
retryCount = retryCount + 1;
|
|
1051
|
+
retryFocus(ref);
|
|
1052
|
+
}, 100);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
const MINIMUM_HEIGHT = 75;
|
|
1057
|
+
const CodeBlock = ({
|
|
1058
|
+
attributes,
|
|
1059
|
+
editor,
|
|
1060
|
+
element,
|
|
1061
|
+
language: restrictLanguage,
|
|
1062
|
+
onChangeCallback,
|
|
1063
|
+
defaultValue,
|
|
1064
|
+
...props
|
|
1065
|
+
}) => {
|
|
1066
|
+
const [navigateAway, setNavigateAway] = React__default.useState(null);
|
|
1067
|
+
const monaco = useMonaco();
|
|
1068
|
+
const monacoEditorRef = React__default.useRef(null);
|
|
1069
|
+
const selected = useSelected();
|
|
1070
|
+
const [height, setHeight] = React__default.useState(MINIMUM_HEIGHT);
|
|
1071
|
+
React__default.useEffect(() => {
|
|
1072
|
+
if (selected && isCollapsed(editor.selection)) {
|
|
1073
|
+
retryFocus(monacoEditorRef);
|
|
1074
|
+
}
|
|
1075
|
+
}, [selected, monacoEditorRef.current]);
|
|
1076
|
+
const value = element.value || "";
|
|
1077
|
+
if (typeof value !== "string") {
|
|
1078
|
+
throw new Error("Element must be of type string for code block");
|
|
1079
|
+
}
|
|
1080
|
+
const language = restrictLanguage || element.lang;
|
|
1081
|
+
const id = React__default.useMemo(() => uuid(), []);
|
|
1082
|
+
const languages = React__default.useMemo(() => {
|
|
1083
|
+
const defaultLangSet = { "": "plain text" };
|
|
1084
|
+
if (!monaco)
|
|
1085
|
+
return defaultLangSet;
|
|
1086
|
+
return monaco.languages.getLanguages().reduce((ac, cv) => {
|
|
1087
|
+
if (cv.id === "plaintext")
|
|
1088
|
+
return ac;
|
|
1089
|
+
return { ...ac, [cv.id]: cv.id };
|
|
1090
|
+
}, defaultLangSet);
|
|
1091
|
+
}, [monaco]);
|
|
1092
|
+
React__default.useEffect(() => {
|
|
1093
|
+
if (monaco) {
|
|
1094
|
+
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1095
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1096
|
+
// disable errors
|
|
1097
|
+
noSemanticValidation: true,
|
|
1098
|
+
noSyntaxValidation: true
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
}, [monaco]);
|
|
1102
|
+
const items2 = Object.entries(languages).map(([key, label]) => ({
|
|
1103
|
+
key,
|
|
1104
|
+
label,
|
|
1105
|
+
render: (item) => item.label
|
|
1106
|
+
}));
|
|
1107
|
+
const currentItem = React__default.useMemo(() => {
|
|
1108
|
+
return items2.find((item) => item.key === language) ?? {
|
|
1109
|
+
key: "",
|
|
1110
|
+
label: "Plain Text"
|
|
1111
|
+
};
|
|
1112
|
+
}, [items2, language]);
|
|
1113
|
+
React__default.useEffect(() => {
|
|
1114
|
+
if (navigateAway) {
|
|
1115
|
+
setNavigateAway(null);
|
|
1116
|
+
switch (navigateAway) {
|
|
1117
|
+
case "remove":
|
|
1118
|
+
{
|
|
1119
|
+
focusEditor(editor);
|
|
1120
|
+
setNodes(
|
|
1121
|
+
editor,
|
|
1122
|
+
{
|
|
1123
|
+
type: "p",
|
|
1124
|
+
children: [{ text: "" }],
|
|
1125
|
+
lang: void 0,
|
|
1126
|
+
value: void 0
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
match: (n) => {
|
|
1130
|
+
if (isElement(n) && n.type === element.type) {
|
|
1131
|
+
return true;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
break;
|
|
1138
|
+
case "insertNext":
|
|
1139
|
+
{
|
|
1140
|
+
insertNodes(
|
|
1141
|
+
editor,
|
|
1142
|
+
[
|
|
1143
|
+
{
|
|
1144
|
+
type: ELEMENT_DEFAULT,
|
|
1145
|
+
children: [{ text: "" }],
|
|
1146
|
+
lang: void 0,
|
|
1147
|
+
value: void 0
|
|
1148
|
+
}
|
|
1149
|
+
],
|
|
1150
|
+
{ select: true }
|
|
1151
|
+
);
|
|
1152
|
+
focusEditor(editor);
|
|
1153
|
+
}
|
|
1154
|
+
break;
|
|
1155
|
+
case "up":
|
|
1156
|
+
{
|
|
1157
|
+
const path = findNodePath(editor, element);
|
|
1158
|
+
if (!path) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const previousNodePath = getPointBefore(editor, path);
|
|
1162
|
+
if (!previousNodePath) {
|
|
1163
|
+
focusEditor(editor);
|
|
1164
|
+
insertNodes(
|
|
1165
|
+
editor,
|
|
1166
|
+
[
|
|
1167
|
+
{
|
|
1168
|
+
type: ELEMENT_DEFAULT,
|
|
1169
|
+
children: [{ text: "" }],
|
|
1170
|
+
lang: void 0,
|
|
1171
|
+
value: void 0
|
|
1172
|
+
}
|
|
1173
|
+
],
|
|
1174
|
+
// Insert a new node at the current path, resulting in the code_block
|
|
1175
|
+
// moving down one block
|
|
1176
|
+
{ at: path, select: true }
|
|
1177
|
+
);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
focusEditor(editor, previousNodePath);
|
|
1181
|
+
}
|
|
1182
|
+
break;
|
|
1183
|
+
case "down": {
|
|
1184
|
+
const path = findNodePath(editor, element);
|
|
1185
|
+
if (!path) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
const nextNodePath = getPointAfter(editor, path);
|
|
1189
|
+
if (!nextNodePath) {
|
|
1190
|
+
insertNodes(
|
|
1191
|
+
editor,
|
|
1192
|
+
[
|
|
1193
|
+
{
|
|
1194
|
+
type: ELEMENT_DEFAULT,
|
|
1195
|
+
children: [{ text: "" }],
|
|
1196
|
+
lang: void 0,
|
|
1197
|
+
value: void 0
|
|
1198
|
+
}
|
|
1199
|
+
],
|
|
1200
|
+
{ select: true }
|
|
1201
|
+
);
|
|
1202
|
+
focusEditor(editor);
|
|
1203
|
+
} else {
|
|
1204
|
+
focusEditor(editor, nextNodePath);
|
|
1205
|
+
}
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}, [navigateAway]);
|
|
1211
|
+
function handleEditorDidMount(monacoEditor, monaco2) {
|
|
1212
|
+
monacoEditorRef.current = monacoEditor;
|
|
1213
|
+
monacoEditor.onDidContentSizeChange(() => {
|
|
1214
|
+
setHeight(
|
|
1215
|
+
monacoEditor.getContentHeight() > MINIMUM_HEIGHT ? monacoEditor.getContentHeight() : MINIMUM_HEIGHT
|
|
1216
|
+
);
|
|
1217
|
+
monacoEditor.layout();
|
|
1218
|
+
});
|
|
1219
|
+
setNodes(editor, { value: defaultValue, lang: language });
|
|
1220
|
+
monacoEditor.addCommand(monaco2.KeyMod.Shift | monaco2.KeyCode.Enter, () => {
|
|
1221
|
+
if (monacoEditor.hasTextFocus()) {
|
|
1222
|
+
setNavigateAway("insertNext");
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
monacoEditor.onKeyDown((l) => {
|
|
1226
|
+
if (l.code === "ArrowUp") {
|
|
1227
|
+
const selection = monacoEditor.getSelection();
|
|
1228
|
+
if (selection.endLineNumber === 1 && selection.startLineNumber === 1) {
|
|
1229
|
+
setNavigateAway("up");
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
if (l.code === "ArrowDown") {
|
|
1233
|
+
const selection = monacoEditor.getSelection();
|
|
1234
|
+
const totalLines = monacoEditor.getModel().getLineCount();
|
|
1235
|
+
if (selection.endLineNumber === totalLines && selection.startLineNumber === totalLines) {
|
|
1236
|
+
setNavigateAway("down");
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (l.code === "Backspace") {
|
|
1240
|
+
const selection = monacoEditor.getSelection();
|
|
1241
|
+
if (selection.endColumn === 1 && selection.endLineNumber === 1 && selection.positionColumn === 1 && selection.positionLineNumber === 1 && selection.selectionStartColumn === 1 && selection.selectionStartLineNumber === 1 && selection.startColumn === 1 && selection.startLineNumber === 1) {
|
|
1242
|
+
setNavigateAway("remove");
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
1248
|
+
"div",
|
|
1249
|
+
{
|
|
1250
|
+
...attributes,
|
|
1251
|
+
className: "relative mb-2 mt-0.5 rounded-lg shadow-md p-2 border-gray-200 border"
|
|
1252
|
+
},
|
|
1253
|
+
/* @__PURE__ */ React__default.createElement("style", null, `.monaco-editor .editor-widget {
|
|
1254
|
+
display: none !important;
|
|
1255
|
+
visibility: hidden !important;
|
|
1256
|
+
}`),
|
|
1257
|
+
props.children,
|
|
1258
|
+
/* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
|
|
1259
|
+
Autocomplete,
|
|
1260
|
+
{
|
|
1261
|
+
items: items2,
|
|
1262
|
+
value: currentItem,
|
|
1263
|
+
defaultQuery: "plaintext",
|
|
1264
|
+
onChange: (item) => setNodes(editor, { lang: item.key })
|
|
1265
|
+
}
|
|
1266
|
+
)), /* @__PURE__ */ React__default.createElement("div", { style: { height: `${height}px` } }, /* @__PURE__ */ React__default.createElement(
|
|
1267
|
+
MonacoEditor,
|
|
1268
|
+
{
|
|
1269
|
+
path: id,
|
|
1270
|
+
onMount: handleEditorDidMount,
|
|
1271
|
+
options: {
|
|
1272
|
+
scrollBeyondLastLine: false,
|
|
1273
|
+
// automaticLayout: true,
|
|
1274
|
+
tabSize: 2,
|
|
1275
|
+
disableLayerHinting: true,
|
|
1276
|
+
accessibilitySupport: "off",
|
|
1277
|
+
codeLens: false,
|
|
1278
|
+
wordWrap: "on",
|
|
1279
|
+
minimap: {
|
|
1280
|
+
enabled: false
|
|
1281
|
+
},
|
|
1282
|
+
fontSize: 14,
|
|
1283
|
+
lineHeight: 2,
|
|
1284
|
+
formatOnPaste: true,
|
|
1285
|
+
lineNumbers: "off",
|
|
1286
|
+
formatOnType: true,
|
|
1287
|
+
fixedOverflowWidgets: true,
|
|
1288
|
+
// Takes too much horizontal space for iframe
|
|
1289
|
+
folding: false,
|
|
1290
|
+
renderLineHighlight: "none",
|
|
1291
|
+
scrollbar: {
|
|
1292
|
+
verticalScrollbarSize: 1,
|
|
1293
|
+
horizontalScrollbarSize: 1,
|
|
1294
|
+
// https://github.com/microsoft/monaco-editor/issues/2007#issuecomment-644425664
|
|
1295
|
+
alwaysConsumeMouseWheel: false
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
language: String(language),
|
|
1299
|
+
value: String(element.value),
|
|
1300
|
+
onChange: (value2) => {
|
|
1301
|
+
onChangeCallback == null ? void 0 : onChangeCallback(value2);
|
|
1302
|
+
setNodes(editor, { value: value2, lang: language });
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
)))
|
|
1306
|
+
);
|
|
1307
|
+
};
|
|
1308
|
+
const CodeBlockElement = withRef(
|
|
1309
|
+
({ className, ...props }, ref) => {
|
|
1310
|
+
const { element } = props;
|
|
1311
|
+
const state = useCodeBlockElementState({ element });
|
|
1312
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
1313
|
+
PlateElement,
|
|
1314
|
+
{
|
|
1315
|
+
className: cn$1("relative py-1", state.className, className),
|
|
1316
|
+
ref,
|
|
1317
|
+
...props
|
|
1318
|
+
},
|
|
1319
|
+
/* @__PURE__ */ React__default.createElement(CodeBlock, { ...props })
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
);
|
|
1323
|
+
const CodeLeaf = withRef(
|
|
1324
|
+
({ children, className, ...props }, ref) => {
|
|
1325
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
1326
|
+
PlateLeaf,
|
|
1327
|
+
{
|
|
1328
|
+
asChild: true,
|
|
1329
|
+
className: cn$1(
|
|
1330
|
+
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1331
|
+
className
|
|
1332
|
+
),
|
|
1333
|
+
ref,
|
|
1334
|
+
...props
|
|
1335
|
+
},
|
|
1336
|
+
/* @__PURE__ */ React__default.createElement("code", null, children)
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
);
|
|
1340
|
+
const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
|
|
1341
|
+
const CodeSyntaxLeaf = withRef(
|
|
1342
|
+
({ children, ...props }, ref) => {
|
|
1343
|
+
const { leaf } = props;
|
|
1344
|
+
const { tokenProps } = useCodeSyntaxLeaf({ leaf });
|
|
1345
|
+
return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
|
|
1346
|
+
}
|
|
1347
|
+
);
|
|
1348
|
+
const listVariants = cva("m-0 ps-6", {
|
|
1349
|
+
variants: {
|
|
1350
|
+
variant: {
|
|
1351
|
+
ol: "list-decimal",
|
|
1352
|
+
ul: "list-disc [&_ul]:list-[circle] [&_ul_ul]:list-[square]"
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
const ListElementVariants = withVariants(PlateElement, listVariants, [
|
|
1357
|
+
"variant"
|
|
1358
|
+
]);
|
|
1359
|
+
const ListElement = withRef(
|
|
1360
|
+
({ children, variant = "ul", ...props }, ref) => {
|
|
1361
|
+
const Component = variant;
|
|
1362
|
+
return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1365
|
+
const ELEMENT_MERMAID = "mermaid";
|
|
1366
|
+
const createMermaidPlugin = createPluginFactory({
|
|
1367
|
+
isElement: true,
|
|
1368
|
+
isVoid: true,
|
|
1369
|
+
isInline: false,
|
|
1370
|
+
key: ELEMENT_MERMAID
|
|
1371
|
+
});
|
|
1372
|
+
const MermaidElementWithRef = ({ config }) => {
|
|
1373
|
+
const mermaidRef = useRef(null);
|
|
1374
|
+
useEffect(() => {
|
|
1375
|
+
if (mermaidRef.current) {
|
|
1376
|
+
mermaid.initialize({ startOnLoad: true });
|
|
1377
|
+
mermaid.init();
|
|
1378
|
+
}
|
|
1379
|
+
}, [config]);
|
|
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)));
|
|
1381
|
+
};
|
|
1382
|
+
const Bubble = ({ children }) => {
|
|
1383
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "bg-blue-600 rounded-full p-2 transition-transform duration-200 ease-in-out hover:scale-110" }, children);
|
|
1384
|
+
};
|
|
1385
|
+
const ErrorMsg = ({ error }) => {
|
|
1386
|
+
if (error) {
|
|
1387
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
1388
|
+
"div",
|
|
1389
|
+
{
|
|
1390
|
+
contentEditable: false,
|
|
1391
|
+
className: "font-mono bg-red-600 text-white p-2 rounded-md cursor-default"
|
|
1392
|
+
},
|
|
1393
|
+
error
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
return null;
|
|
1397
|
+
};
|
|
1398
|
+
const DEFAULT_MERMAID_CONFIG = `%% This won't render without implementing a rendering engine (e.g. mermaid on npm)
|
|
1399
|
+
flowchart TD
|
|
1400
|
+
id1(this is an example flow diagram)
|
|
1401
|
+
--> id2(modify me to see changes!)
|
|
1402
|
+
id2
|
|
1403
|
+
--> id3(Click the top button to preview the changes)
|
|
1404
|
+
--> id4(Learn about mermaid diagrams - mermaid.js.org)`;
|
|
1405
|
+
const MermaidElement = withRef(
|
|
1406
|
+
({ children, nodeProps, element, ...props }, ref) => {
|
|
1407
|
+
const [mermaidConfig, setMermaidConfig] = useState(
|
|
1408
|
+
element.value || DEFAULT_MERMAID_CONFIG
|
|
1409
|
+
);
|
|
1410
|
+
const [isEditing, setIsEditing] = useState(
|
|
1411
|
+
mermaidConfig === DEFAULT_MERMAID_CONFIG || false
|
|
1412
|
+
);
|
|
1413
|
+
const [mermaidError, setMermaidError] = useState(null);
|
|
1414
|
+
const node = {
|
|
1415
|
+
type: ELEMENT_MERMAID,
|
|
1416
|
+
value: mermaidConfig,
|
|
1417
|
+
children: [{ type: "text", text: "" }]
|
|
1418
|
+
};
|
|
1419
|
+
useEffect(() => {
|
|
1420
|
+
if (mermaid.parse(mermaidConfig)) {
|
|
1421
|
+
setMermaidError(null);
|
|
1422
|
+
}
|
|
1423
|
+
}, [mermaidConfig]);
|
|
1424
|
+
mermaid.parseError = (err) => {
|
|
1425
|
+
setMermaidError(
|
|
1426
|
+
String(err.message) || "An error occurred while parsing the diagram."
|
|
1427
|
+
);
|
|
1428
|
+
};
|
|
1429
|
+
return /* @__PURE__ */ React__default.createElement(PlateElement, { element, ref, ...props }, /* @__PURE__ */ React__default.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__default.createElement("div", { className: "absolute top-2 right-2 z-10 space-y-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-in-out" }, /* @__PURE__ */ React__default.createElement(Bubble, null, isEditing ? /* @__PURE__ */ React__default.createElement(
|
|
1430
|
+
Eye,
|
|
1431
|
+
{
|
|
1432
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1433
|
+
onClick: () => {
|
|
1434
|
+
setIsEditing(!isEditing);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
) : /* @__PURE__ */ React__default.createElement(
|
|
1438
|
+
SquarePen,
|
|
1439
|
+
{
|
|
1440
|
+
className: "w-5 h-5 fill-white cursor-pointer",
|
|
1441
|
+
onClick: () => {
|
|
1442
|
+
setIsEditing(!isEditing);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
))), isEditing ? /* @__PURE__ */ React__default.createElement(
|
|
1446
|
+
CodeBlock,
|
|
1447
|
+
{
|
|
1448
|
+
children: "",
|
|
1449
|
+
language: "yaml",
|
|
1450
|
+
...props,
|
|
1451
|
+
element: node,
|
|
1452
|
+
defaultValue: mermaidConfig,
|
|
1453
|
+
onChangeCallback: (value) => setMermaidConfig(value)
|
|
1454
|
+
}
|
|
1455
|
+
) : /* @__PURE__ */ React__default.createElement(MermaidElementWithRef, { config: mermaidConfig })), children, /* @__PURE__ */ React__default.createElement(ErrorMsg, { error: mermaidError }));
|
|
1456
|
+
}
|
|
1457
|
+
);
|
|
917
1458
|
const RawMarkdown = () => {
|
|
918
1459
|
return /* @__PURE__ */ React__default.createElement(
|
|
919
1460
|
"svg",
|
|
@@ -932,6 +1473,29 @@ const RawMarkdown = () => {
|
|
|
932
1473
|
/* @__PURE__ */ React__default.createElement("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
|
|
933
1474
|
);
|
|
934
1475
|
};
|
|
1476
|
+
const MermaidIcon = () => /* @__PURE__ */ React__default.createElement(
|
|
1477
|
+
"svg",
|
|
1478
|
+
{
|
|
1479
|
+
width: "100%",
|
|
1480
|
+
height: "100%",
|
|
1481
|
+
viewBox: "0 0 491 491",
|
|
1482
|
+
version: "1.1",
|
|
1483
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1484
|
+
fillRule: "evenodd",
|
|
1485
|
+
clipRule: "evenodd",
|
|
1486
|
+
strokeLinejoin: "round",
|
|
1487
|
+
strokeMiterlimit: 2
|
|
1488
|
+
},
|
|
1489
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M490.16,84.61C490.16,37.912 452.248,0 405.55,0L84.61,0C37.912,0 0,37.912 0,84.61L0,405.55C0,452.248 37.912,490.16 84.61,490.16L405.55,490.16C452.248,490.16 490.16,452.248 490.16,405.55L490.16,84.61Z" }),
|
|
1490
|
+
/* @__PURE__ */ React__default.createElement(
|
|
1491
|
+
"path",
|
|
1492
|
+
{
|
|
1493
|
+
d: "M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z",
|
|
1494
|
+
fill: "white",
|
|
1495
|
+
fillRule: "nonzero"
|
|
1496
|
+
}
|
|
1497
|
+
)
|
|
1498
|
+
);
|
|
935
1499
|
const borderAll = (props) => /* @__PURE__ */ React__default.createElement(
|
|
936
1500
|
"svg",
|
|
937
1501
|
{
|
|
@@ -1016,7 +1580,7 @@ const borderTop = (props) => /* @__PURE__ */ React__default.createElement(
|
|
|
1016
1580
|
},
|
|
1017
1581
|
/* @__PURE__ */ React__default.createElement("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" })
|
|
1018
1582
|
);
|
|
1019
|
-
cva("", {
|
|
1583
|
+
const iconVariants = cva("", {
|
|
1020
1584
|
variants: {
|
|
1021
1585
|
variant: {
|
|
1022
1586
|
toolbar: "size-5",
|
|
@@ -1172,6 +1736,7 @@ const Icons = {
|
|
|
1172
1736
|
clear: X,
|
|
1173
1737
|
close: X,
|
|
1174
1738
|
// code: Code2,
|
|
1739
|
+
paint: PaintBucket,
|
|
1175
1740
|
codeblock: FileCode,
|
|
1176
1741
|
color: Baseline,
|
|
1177
1742
|
column: RectangleVertical,
|
|
@@ -1197,6 +1762,7 @@ const Icons = {
|
|
|
1197
1762
|
lineHeight: WrapText,
|
|
1198
1763
|
// link: Link2,
|
|
1199
1764
|
minus: Minus,
|
|
1765
|
+
mermaid: MermaidIcon,
|
|
1200
1766
|
more: MoreHorizontal,
|
|
1201
1767
|
// ol: ListOrdered,
|
|
1202
1768
|
outdent: Outdent,
|
|
@@ -1607,7 +2173,7 @@ const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
|
|
|
1607
2173
|
},
|
|
1608
2174
|
value || ""
|
|
1609
2175
|
), /* @__PURE__ */ React__default.createElement(
|
|
1610
|
-
Combobox,
|
|
2176
|
+
Combobox$1,
|
|
1611
2177
|
{
|
|
1612
2178
|
autoSelect: true,
|
|
1613
2179
|
className: cn$1(
|
|
@@ -1767,417 +2333,482 @@ const SlashInputElement = withRef(
|
|
|
1767
2333
|
);
|
|
1768
2334
|
}
|
|
1769
2335
|
);
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
className: cn$1("my-1 border-l-2 pl-6 italic", className),
|
|
1794
|
-
ref,
|
|
1795
|
-
...props
|
|
1796
|
-
},
|
|
1797
|
-
/* @__PURE__ */ React__default.createElement("blockquote", null, children)
|
|
1798
|
-
);
|
|
1799
|
-
}
|
|
1800
|
-
);
|
|
1801
|
-
const CodeLeaf = withRef(
|
|
1802
|
-
({ children, className, ...props }, ref) => {
|
|
1803
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
1804
|
-
PlateLeaf,
|
|
1805
|
-
{
|
|
1806
|
-
asChild: true,
|
|
1807
|
-
className: cn$1(
|
|
1808
|
-
"whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm",
|
|
1809
|
-
className
|
|
1810
|
-
),
|
|
1811
|
-
ref,
|
|
1812
|
-
...props
|
|
1813
|
-
},
|
|
1814
|
-
/* @__PURE__ */ React__default.createElement("code", null, children)
|
|
1815
|
-
);
|
|
1816
|
-
}
|
|
1817
|
-
);
|
|
1818
|
-
const CodeLineElement = withRef((props, ref) => /* @__PURE__ */ React__default.createElement(PlateElement, { ref, ...props }));
|
|
1819
|
-
const CodeSyntaxLeaf = withRef(
|
|
1820
|
-
({ children, ...props }, ref) => {
|
|
1821
|
-
const { leaf } = props;
|
|
1822
|
-
const { tokenProps } = useCodeSyntaxLeaf({ leaf });
|
|
1823
|
-
return /* @__PURE__ */ React__default.createElement(PlateLeaf, { ref, ...props }, /* @__PURE__ */ React__default.createElement("span", { ...tokenProps }, children));
|
|
1824
|
-
}
|
|
1825
|
-
);
|
|
1826
|
-
function ChevronDownIcon(props, svgRef) {
|
|
1827
|
-
return /* @__PURE__ */ React.createElement("svg", Object.assign({
|
|
1828
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1829
|
-
viewBox: "0 0 20 20",
|
|
1830
|
-
fill: "currentColor",
|
|
1831
|
-
"aria-hidden": "true",
|
|
1832
|
-
ref: svgRef
|
|
1833
|
-
}, props), /* @__PURE__ */ React.createElement("path", {
|
|
1834
|
-
fillRule: "evenodd",
|
|
1835
|
-
d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
|
|
1836
|
-
clipRule: "evenodd"
|
|
1837
|
-
}));
|
|
1838
|
-
}
|
|
1839
|
-
const ForwardRef = React.forwardRef(ChevronDownIcon);
|
|
1840
|
-
const ChevronDownIcon$1 = ForwardRef;
|
|
1841
|
-
const Autocomplete = ({
|
|
1842
|
-
value,
|
|
1843
|
-
onChange,
|
|
1844
|
-
defaultQuery,
|
|
1845
|
-
items: items2
|
|
1846
|
-
}) => {
|
|
1847
|
-
const [query, setQuery] = React__default.useState(defaultQuery ?? "");
|
|
1848
|
-
const filteredItems = React__default.useMemo(() => {
|
|
1849
|
-
try {
|
|
1850
|
-
const reFilter = new RegExp(query, "i");
|
|
1851
|
-
const _items = items2.filter((item) => reFilter.test(item.label));
|
|
1852
|
-
if (_items.length === 0)
|
|
1853
|
-
return items2;
|
|
1854
|
-
return _items;
|
|
1855
|
-
} catch (err) {
|
|
1856
|
-
return items2;
|
|
1857
|
-
}
|
|
1858
|
-
}, [items2, query]);
|
|
2336
|
+
const TableCellElement = withRef(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
|
|
2337
|
+
var _a, _b, _c, _d;
|
|
2338
|
+
const { element } = props;
|
|
2339
|
+
const {
|
|
2340
|
+
borders,
|
|
2341
|
+
colIndex,
|
|
2342
|
+
colSpan,
|
|
2343
|
+
hovered,
|
|
2344
|
+
hoveredLeft,
|
|
2345
|
+
isSelectingCell,
|
|
2346
|
+
readOnly,
|
|
2347
|
+
rowIndex,
|
|
2348
|
+
rowSize,
|
|
2349
|
+
selected
|
|
2350
|
+
} = useTableCellElementState();
|
|
2351
|
+
const { props: cellProps } = useTableCellElement({ element: props.element });
|
|
2352
|
+
const resizableState = useTableCellElementResizableState({
|
|
2353
|
+
colIndex,
|
|
2354
|
+
colSpan,
|
|
2355
|
+
rowIndex
|
|
2356
|
+
});
|
|
2357
|
+
const { bottomProps, hiddenLeft, leftProps, rightProps } = useTableCellElementResizable(resizableState);
|
|
2358
|
+
const Cell = isHeader ? "th" : "td";
|
|
1859
2359
|
return /* @__PURE__ */ React__default.createElement(
|
|
1860
|
-
|
|
2360
|
+
PlateElement,
|
|
1861
2361
|
{
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
2362
|
+
asChild: true,
|
|
2363
|
+
className: cn$1(
|
|
2364
|
+
"relative h-full overflow-visible border-none bg-background p-0",
|
|
2365
|
+
hideBorder && "before:border-none",
|
|
2366
|
+
element.background ? "bg-[--cellBackground]" : "bg-background",
|
|
2367
|
+
!hideBorder && cn$1(
|
|
2368
|
+
isHeader && "text-left [&_>_*]:m-0",
|
|
2369
|
+
"before:size-full",
|
|
2370
|
+
selected && "before:z-10 before:bg-muted",
|
|
2371
|
+
"before:absolute before:box-border before:select-none before:content-['']",
|
|
2372
|
+
borders && cn$1(
|
|
2373
|
+
((_a = borders.bottom) == null ? void 0 : _a.size) && `before:border-b before:border-b-border`,
|
|
2374
|
+
((_b = borders.right) == null ? void 0 : _b.size) && `before:border-r before:border-r-border`,
|
|
2375
|
+
((_c = borders.left) == null ? void 0 : _c.size) && `before:border-l before:border-l-border`,
|
|
2376
|
+
((_d = borders.top) == null ? void 0 : _d.size) && `before:border-t before:border-t-border`
|
|
2377
|
+
)
|
|
2378
|
+
),
|
|
2379
|
+
className
|
|
2380
|
+
),
|
|
2381
|
+
ref,
|
|
2382
|
+
...cellProps,
|
|
2383
|
+
...props,
|
|
2384
|
+
style: {
|
|
2385
|
+
"--cellBackground": element.background,
|
|
2386
|
+
...style
|
|
1874
2387
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
2388
|
+
},
|
|
2389
|
+
/* @__PURE__ */ React__default.createElement(Cell, null, /* @__PURE__ */ React__default.createElement(
|
|
2390
|
+
"div",
|
|
1877
2391
|
{
|
|
1878
|
-
className: "h-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2392
|
+
className: "relative z-20 box-border h-full px-3 py-2",
|
|
2393
|
+
style: {
|
|
2394
|
+
minHeight: rowSize
|
|
2395
|
+
}
|
|
2396
|
+
},
|
|
2397
|
+
children
|
|
2398
|
+
), !isSelectingCell && /* @__PURE__ */ React__default.createElement(
|
|
2399
|
+
"div",
|
|
1884
2400
|
{
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
leave: "transition ease-in duration-75",
|
|
1889
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
1890
|
-
leaveTo: "transform opacity-0 scale-95"
|
|
2401
|
+
className: "group absolute top-0 size-full select-none",
|
|
2402
|
+
contentEditable: false,
|
|
2403
|
+
suppressContentEditableWarning: true
|
|
1891
2404
|
},
|
|
1892
|
-
|
|
1893
|
-
|
|
2405
|
+
!readOnly && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
2406
|
+
ResizeHandle$1,
|
|
1894
2407
|
{
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
2408
|
+
...rightProps,
|
|
2409
|
+
className: "-top-3 right-[-5px] w-[10px]"
|
|
2410
|
+
}
|
|
2411
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
2412
|
+
ResizeHandle$1,
|
|
2413
|
+
{
|
|
2414
|
+
...bottomProps,
|
|
2415
|
+
className: "bottom-[-5px] h-[10px]"
|
|
2416
|
+
}
|
|
2417
|
+
), !hiddenLeft && /* @__PURE__ */ React__default.createElement(
|
|
2418
|
+
ResizeHandle$1,
|
|
2419
|
+
{
|
|
2420
|
+
...leftProps,
|
|
2421
|
+
className: "-top-3 left-[-5px] w-[10px]"
|
|
2422
|
+
}
|
|
2423
|
+
), hovered && /* @__PURE__ */ React__default.createElement(
|
|
2424
|
+
"div",
|
|
2425
|
+
{
|
|
2426
|
+
className: cn$1(
|
|
2427
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2428
|
+
"right-[-1.5px]"
|
|
1898
2429
|
)
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
2430
|
+
}
|
|
2431
|
+
), hoveredLeft && /* @__PURE__ */ React__default.createElement(
|
|
2432
|
+
"div",
|
|
2433
|
+
{
|
|
2434
|
+
className: cn$1(
|
|
2435
|
+
"absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring",
|
|
2436
|
+
"left-[-1.5px]"
|
|
2437
|
+
)
|
|
2438
|
+
}
|
|
2439
|
+
))
|
|
2440
|
+
))
|
|
1903
2441
|
);
|
|
1904
|
-
};
|
|
1905
|
-
loader.config({
|
|
1906
|
-
paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs" }
|
|
1907
2442
|
});
|
|
1908
|
-
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
2443
|
+
TableCellElement.displayName = "TableCellElement";
|
|
2444
|
+
const TableCellHeaderElement = withProps(TableCellElement, {
|
|
2445
|
+
isHeader: true
|
|
2446
|
+
});
|
|
2447
|
+
const buttonVariants$1 = cva(
|
|
2448
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
2449
|
+
{
|
|
2450
|
+
defaultVariants: {
|
|
2451
|
+
size: "default",
|
|
2452
|
+
variant: "default"
|
|
2453
|
+
},
|
|
2454
|
+
variants: {
|
|
2455
|
+
isMenu: {
|
|
2456
|
+
true: "h-auto w-full cursor-pointer justify-start"
|
|
2457
|
+
},
|
|
2458
|
+
size: {
|
|
2459
|
+
default: "h-10 px-4 py-2",
|
|
2460
|
+
icon: "size-10",
|
|
2461
|
+
lg: "h-11 rounded-md px-8",
|
|
2462
|
+
none: "",
|
|
2463
|
+
sm: "h-9 rounded-md px-3",
|
|
2464
|
+
sms: "size-9 rounded-md px-0",
|
|
2465
|
+
xs: "h-8 rounded-md px-3"
|
|
2466
|
+
},
|
|
2467
|
+
variant: {
|
|
2468
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2469
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2470
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2471
|
+
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
2472
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
2473
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2474
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
2475
|
+
}
|
|
1936
2476
|
}
|
|
1937
|
-
}, [selected, monacoEditorRef.current]);
|
|
1938
|
-
const value = element.value || "";
|
|
1939
|
-
if (typeof value !== "string") {
|
|
1940
|
-
throw new Error("Element must be of type string for code block");
|
|
1941
2477
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
return { ...ac, [cv.id]: cv.id };
|
|
1952
|
-
}, defaultLangSet);
|
|
1953
|
-
}, [monaco]);
|
|
1954
|
-
React__default.useEffect(() => {
|
|
1955
|
-
if (monaco) {
|
|
1956
|
-
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
1957
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
1958
|
-
// disable errors
|
|
1959
|
-
noSemanticValidation: true,
|
|
1960
|
-
noSyntaxValidation: true
|
|
1961
|
-
});
|
|
2478
|
+
);
|
|
2479
|
+
const Button$2 = withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
2480
|
+
const Comp = asChild ? Slot : "button";
|
|
2481
|
+
return /* @__PURE__ */ React.createElement(
|
|
2482
|
+
Comp,
|
|
2483
|
+
{
|
|
2484
|
+
className: cn$1(buttonVariants$1({ className, isMenu, size, variant })),
|
|
2485
|
+
ref,
|
|
2486
|
+
...props
|
|
1962
2487
|
}
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
{
|
|
2006
|
-
type: ELEMENT_DEFAULT,
|
|
2007
|
-
children: [{ text: "" }],
|
|
2008
|
-
lang: void 0,
|
|
2009
|
-
value: void 0
|
|
2010
|
-
}
|
|
2011
|
-
],
|
|
2012
|
-
{ select: true }
|
|
2013
|
-
);
|
|
2014
|
-
focusEditor(editor);
|
|
2015
|
-
}
|
|
2016
|
-
break;
|
|
2017
|
-
case "up":
|
|
2018
|
-
{
|
|
2019
|
-
const path = findNodePath(editor, element);
|
|
2020
|
-
if (!path) {
|
|
2021
|
-
return;
|
|
2022
|
-
}
|
|
2023
|
-
const previousNodePath = getPointBefore(editor, path);
|
|
2024
|
-
if (!previousNodePath) {
|
|
2025
|
-
focusEditor(editor);
|
|
2026
|
-
insertNodes(
|
|
2027
|
-
editor,
|
|
2028
|
-
[
|
|
2029
|
-
{
|
|
2030
|
-
type: ELEMENT_DEFAULT,
|
|
2031
|
-
children: [{ text: "" }],
|
|
2032
|
-
lang: void 0,
|
|
2033
|
-
value: void 0
|
|
2034
|
-
}
|
|
2035
|
-
],
|
|
2036
|
-
// Insert a new node at the current path, resulting in the code_block
|
|
2037
|
-
// moving down one block
|
|
2038
|
-
{ at: path, select: true }
|
|
2039
|
-
);
|
|
2040
|
-
return;
|
|
2041
|
-
}
|
|
2042
|
-
focusEditor(editor, previousNodePath);
|
|
2043
|
-
}
|
|
2044
|
-
break;
|
|
2045
|
-
case "down": {
|
|
2046
|
-
const path = findNodePath(editor, element);
|
|
2047
|
-
if (!path) {
|
|
2048
|
-
return;
|
|
2049
|
-
}
|
|
2050
|
-
const nextNodePath = getPointAfter(editor, path);
|
|
2051
|
-
if (!nextNodePath) {
|
|
2052
|
-
insertNodes(
|
|
2053
|
-
editor,
|
|
2054
|
-
[
|
|
2055
|
-
{
|
|
2056
|
-
type: ELEMENT_DEFAULT,
|
|
2057
|
-
children: [{ text: "" }],
|
|
2058
|
-
lang: void 0,
|
|
2059
|
-
value: void 0
|
|
2060
|
-
}
|
|
2061
|
-
],
|
|
2062
|
-
{ select: true }
|
|
2063
|
-
);
|
|
2064
|
-
focusEditor(editor);
|
|
2065
|
-
} else {
|
|
2066
|
-
focusEditor(editor, nextNodePath);
|
|
2067
|
-
}
|
|
2068
|
-
break;
|
|
2069
|
-
}
|
|
2488
|
+
);
|
|
2489
|
+
});
|
|
2490
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2491
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
2492
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
2493
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
2494
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
2495
|
+
const DropdownMenuSubTrigger = withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
|
|
2496
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
2497
|
+
{
|
|
2498
|
+
className: cn$1(
|
|
2499
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
2500
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2501
|
+
inset && "pl-8",
|
|
2502
|
+
className
|
|
2503
|
+
),
|
|
2504
|
+
ref,
|
|
2505
|
+
...props
|
|
2506
|
+
},
|
|
2507
|
+
children,
|
|
2508
|
+
/* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
2509
|
+
));
|
|
2510
|
+
const DropdownMenuSubContent = withCn(
|
|
2511
|
+
DropdownMenuPrimitive.SubContent,
|
|
2512
|
+
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg 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"
|
|
2513
|
+
);
|
|
2514
|
+
const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
|
|
2515
|
+
className: cn$1(
|
|
2516
|
+
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md 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"
|
|
2517
|
+
),
|
|
2518
|
+
sideOffset: 4
|
|
2519
|
+
});
|
|
2520
|
+
const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
2521
|
+
const menuItemVariants = cva(
|
|
2522
|
+
cn$1(
|
|
2523
|
+
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
2524
|
+
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
2525
|
+
),
|
|
2526
|
+
{
|
|
2527
|
+
variants: {
|
|
2528
|
+
inset: {
|
|
2529
|
+
true: "pl-8"
|
|
2070
2530
|
}
|
|
2071
2531
|
}
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2532
|
+
}
|
|
2533
|
+
);
|
|
2534
|
+
const DropdownMenuItem = withVariants(
|
|
2535
|
+
DropdownMenuPrimitive.Item,
|
|
2536
|
+
menuItemVariants,
|
|
2537
|
+
["inset"]
|
|
2538
|
+
);
|
|
2539
|
+
const DropdownMenuCheckboxItem = withRef(({ children, className, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
|
|
2540
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
2541
|
+
{
|
|
2542
|
+
className: cn$1(
|
|
2543
|
+
"relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2544
|
+
"cursor-pointer",
|
|
2545
|
+
className
|
|
2546
|
+
),
|
|
2547
|
+
ref,
|
|
2548
|
+
...props
|
|
2549
|
+
},
|
|
2550
|
+
/* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
|
|
2551
|
+
children
|
|
2552
|
+
));
|
|
2553
|
+
const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
|
|
2554
|
+
DropdownMenuPrimitive.RadioItem,
|
|
2555
|
+
{
|
|
2556
|
+
className: cn$1(
|
|
2557
|
+
"relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2558
|
+
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
2559
|
+
className
|
|
2560
|
+
),
|
|
2561
|
+
ref,
|
|
2562
|
+
...props
|
|
2563
|
+
},
|
|
2564
|
+
!hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
|
|
2565
|
+
children
|
|
2566
|
+
));
|
|
2567
|
+
const dropdownMenuLabelVariants = cva(
|
|
2568
|
+
cn$1("select-none px-2 py-1.5 text-sm font-semibold"),
|
|
2569
|
+
{
|
|
2570
|
+
variants: {
|
|
2571
|
+
inset: {
|
|
2572
|
+
true: "pl-8"
|
|
2103
2573
|
}
|
|
2104
|
-
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
);
|
|
2577
|
+
const DropdownMenuLabel = withVariants(
|
|
2578
|
+
DropdownMenuPrimitive.Label,
|
|
2579
|
+
dropdownMenuLabelVariants,
|
|
2580
|
+
["inset"]
|
|
2581
|
+
);
|
|
2582
|
+
const DropdownMenuSeparator = withCn(
|
|
2583
|
+
DropdownMenuPrimitive.Separator,
|
|
2584
|
+
"-mx-1 my-1 h-px bg-muted"
|
|
2585
|
+
);
|
|
2586
|
+
withCn(
|
|
2587
|
+
createPrimitiveElement("span"),
|
|
2588
|
+
"ml-auto text-xs tracking-widest opacity-60"
|
|
2589
|
+
);
|
|
2590
|
+
const useOpenState = () => {
|
|
2591
|
+
const [open2, setOpen] = useState(false);
|
|
2592
|
+
const onOpenChange = useCallback(
|
|
2593
|
+
(_value = !open2) => {
|
|
2594
|
+
setOpen(_value);
|
|
2595
|
+
},
|
|
2596
|
+
[open2]
|
|
2597
|
+
);
|
|
2598
|
+
return {
|
|
2599
|
+
onOpenChange,
|
|
2600
|
+
open: open2
|
|
2601
|
+
};
|
|
2602
|
+
};
|
|
2603
|
+
const Popover$2 = PopoverPrimitive.Root;
|
|
2604
|
+
const popoverVariants = cva(
|
|
2605
|
+
"w-72 rounded-md border bg-popover 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 print:hidden"
|
|
2606
|
+
);
|
|
2607
|
+
const PopoverContent$1 = withRef(
|
|
2608
|
+
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
2609
|
+
PopoverPrimitive.Content,
|
|
2610
|
+
{
|
|
2611
|
+
align,
|
|
2612
|
+
className: cn$1(popoverVariants(), className),
|
|
2613
|
+
ref,
|
|
2614
|
+
sideOffset,
|
|
2615
|
+
style: { zIndex: 1e3, ...style },
|
|
2616
|
+
...props
|
|
2617
|
+
}
|
|
2618
|
+
))
|
|
2619
|
+
);
|
|
2620
|
+
const separatorVariants = cva("shrink-0 bg-border", {
|
|
2621
|
+
defaultVariants: {
|
|
2622
|
+
orientation: "horizontal"
|
|
2623
|
+
},
|
|
2624
|
+
variants: {
|
|
2625
|
+
orientation: {
|
|
2626
|
+
horizontal: "h-px w-full",
|
|
2627
|
+
vertical: "h-full w-px"
|
|
2628
|
+
}
|
|
2105
2629
|
}
|
|
2630
|
+
});
|
|
2631
|
+
const Separator = withVariants(
|
|
2632
|
+
withProps(SeparatorPrimitive.Root, {
|
|
2633
|
+
decorative: true,
|
|
2634
|
+
orientation: "horizontal"
|
|
2635
|
+
}),
|
|
2636
|
+
separatorVariants
|
|
2637
|
+
);
|
|
2638
|
+
const TableBordersDropdownMenuContent = withRef((props, ref) => {
|
|
2639
|
+
const {
|
|
2640
|
+
getOnSelectTableBorder,
|
|
2641
|
+
hasBottomBorder,
|
|
2642
|
+
hasLeftBorder,
|
|
2643
|
+
hasNoBorders,
|
|
2644
|
+
hasOuterBorders,
|
|
2645
|
+
hasRightBorder,
|
|
2646
|
+
hasTopBorder
|
|
2647
|
+
} = useTableBordersDropdownMenuContentState();
|
|
2106
2648
|
return /* @__PURE__ */ React__default.createElement(
|
|
2107
|
-
|
|
2649
|
+
DropdownMenuContent,
|
|
2108
2650
|
{
|
|
2109
|
-
|
|
2110
|
-
className: "
|
|
2651
|
+
align: "start",
|
|
2652
|
+
className: cn$1("min-w-[220px]"),
|
|
2653
|
+
ref,
|
|
2654
|
+
side: "right",
|
|
2655
|
+
sideOffset: 0,
|
|
2656
|
+
...props
|
|
2111
2657
|
},
|
|
2112
|
-
/* @__PURE__ */ React__default.createElement(
|
|
2113
|
-
|
|
2114
|
-
visibility: hidden !important;
|
|
2115
|
-
}`),
|
|
2116
|
-
props.children,
|
|
2117
|
-
/* @__PURE__ */ React__default.createElement("div", { contentEditable: false }, !restrictLanguage && /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between pb-2" }, /* @__PURE__ */ React__default.createElement("div", null), /* @__PURE__ */ React__default.createElement(
|
|
2118
|
-
Autocomplete,
|
|
2658
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2659
|
+
DropdownMenuCheckboxItem,
|
|
2119
2660
|
{
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
)
|
|
2126
|
-
|
|
2661
|
+
checked: hasBottomBorder,
|
|
2662
|
+
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
2663
|
+
},
|
|
2664
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderBottom, { className: iconVariants({ size: "sm" }) }),
|
|
2665
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Bottom Border")
|
|
2666
|
+
),
|
|
2667
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2668
|
+
DropdownMenuCheckboxItem,
|
|
2127
2669
|
{
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2670
|
+
checked: hasTopBorder,
|
|
2671
|
+
onCheckedChange: getOnSelectTableBorder("top")
|
|
2672
|
+
},
|
|
2673
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderTop, { className: iconVariants({ size: "sm" }) }),
|
|
2674
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Top Border")
|
|
2675
|
+
),
|
|
2676
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2677
|
+
DropdownMenuCheckboxItem,
|
|
2678
|
+
{
|
|
2679
|
+
checked: hasLeftBorder,
|
|
2680
|
+
onCheckedChange: getOnSelectTableBorder("left")
|
|
2681
|
+
},
|
|
2682
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderLeft, { className: iconVariants({ size: "sm" }) }),
|
|
2683
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Left Border")
|
|
2684
|
+
),
|
|
2685
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2686
|
+
DropdownMenuCheckboxItem,
|
|
2687
|
+
{
|
|
2688
|
+
checked: hasRightBorder,
|
|
2689
|
+
onCheckedChange: getOnSelectTableBorder("right")
|
|
2690
|
+
},
|
|
2691
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderRight, { className: iconVariants({ size: "sm" }) }),
|
|
2692
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Right Border")
|
|
2693
|
+
),
|
|
2694
|
+
/* @__PURE__ */ React__default.createElement(Separator, null),
|
|
2695
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2696
|
+
DropdownMenuCheckboxItem,
|
|
2697
|
+
{
|
|
2698
|
+
checked: hasNoBorders,
|
|
2699
|
+
onCheckedChange: getOnSelectTableBorder("none")
|
|
2700
|
+
},
|
|
2701
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderNone, { className: iconVariants({ size: "sm" }) }),
|
|
2702
|
+
/* @__PURE__ */ React__default.createElement("div", null, "No Border")
|
|
2703
|
+
),
|
|
2704
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2705
|
+
DropdownMenuCheckboxItem,
|
|
2706
|
+
{
|
|
2707
|
+
checked: hasOuterBorders,
|
|
2708
|
+
onCheckedChange: getOnSelectTableBorder("outer")
|
|
2709
|
+
},
|
|
2710
|
+
/* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: iconVariants({ size: "sm" }) }),
|
|
2711
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Outside Borders")
|
|
2712
|
+
)
|
|
2164
2713
|
);
|
|
2165
|
-
};
|
|
2166
|
-
const
|
|
2167
|
-
({
|
|
2168
|
-
const
|
|
2169
|
-
const
|
|
2170
|
-
|
|
2171
|
-
|
|
2714
|
+
});
|
|
2715
|
+
const TableFloatingToolbar = withRef(
|
|
2716
|
+
({ children, ...props }, ref) => {
|
|
2717
|
+
const element = useElement();
|
|
2718
|
+
const { props: buttonProps } = useRemoveNodeButton({ element });
|
|
2719
|
+
const selectionCollapsed = useEditorSelector(
|
|
2720
|
+
(editor2) => !isSelectionExpanded(editor2),
|
|
2721
|
+
[]
|
|
2722
|
+
);
|
|
2723
|
+
const readOnly = useReadOnly();
|
|
2724
|
+
const selected = useSelected();
|
|
2725
|
+
const editor = useEditorRef();
|
|
2726
|
+
const collapsed = !readOnly && selected && selectionCollapsed;
|
|
2727
|
+
const open2 = !readOnly && selected;
|
|
2728
|
+
const { canMerge, canUnmerge } = useTableMergeState();
|
|
2729
|
+
const mergeContent = canMerge && /* @__PURE__ */ React__default.createElement(
|
|
2730
|
+
Button$2,
|
|
2172
2731
|
{
|
|
2173
|
-
|
|
2732
|
+
contentEditable: false,
|
|
2733
|
+
isMenu: true,
|
|
2734
|
+
onClick: () => mergeTableCells(editor),
|
|
2735
|
+
variant: "ghost"
|
|
2736
|
+
},
|
|
2737
|
+
/* @__PURE__ */ React__default.createElement(Icons.combine, { className: "mr-2 size-4" }),
|
|
2738
|
+
"Merge"
|
|
2739
|
+
);
|
|
2740
|
+
const unmergeButton = canUnmerge && /* @__PURE__ */ React__default.createElement(
|
|
2741
|
+
Button$2,
|
|
2742
|
+
{
|
|
2743
|
+
contentEditable: false,
|
|
2744
|
+
isMenu: true,
|
|
2745
|
+
onClick: () => unmergeTableCells(editor),
|
|
2746
|
+
variant: "ghost"
|
|
2747
|
+
},
|
|
2748
|
+
/* @__PURE__ */ React__default.createElement(Icons.ungroup, { className: "mr-2 size-4" }),
|
|
2749
|
+
"Unmerge"
|
|
2750
|
+
);
|
|
2751
|
+
const bordersContent = collapsed && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button$2, { isMenu: true, variant: "ghost" }, /* @__PURE__ */ React__default.createElement(Icons.borderAll, { className: "mr-2 size-4" }), "Borders")), /* @__PURE__ */ React__default.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React__default.createElement(TableBordersDropdownMenuContent, null))), /* @__PURE__ */ React__default.createElement(Button$2, { contentEditable: false, isMenu: true, variant: "ghost", ...buttonProps }, /* @__PURE__ */ React__default.createElement(Icons.delete, { className: "mr-2 size-4" }), "Delete"));
|
|
2752
|
+
return /* @__PURE__ */ React__default.createElement(Popover$2, { modal: false, open: open2 }, /* @__PURE__ */ React__default.createElement(PopoverAnchor, { asChild: true }, children), (canMerge || canUnmerge || collapsed) && /* @__PURE__ */ React__default.createElement(
|
|
2753
|
+
PopoverContent$1,
|
|
2754
|
+
{
|
|
2755
|
+
className: cn$1(
|
|
2756
|
+
popoverVariants(),
|
|
2757
|
+
"flex w-[220px] flex-col gap-1 p-1"
|
|
2758
|
+
),
|
|
2759
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2174
2760
|
ref,
|
|
2175
2761
|
...props
|
|
2176
2762
|
},
|
|
2177
|
-
|
|
2178
|
-
|
|
2763
|
+
unmergeButton,
|
|
2764
|
+
mergeContent,
|
|
2765
|
+
bordersContent
|
|
2766
|
+
));
|
|
2179
2767
|
}
|
|
2180
2768
|
);
|
|
2769
|
+
const TableElement = withHOC(
|
|
2770
|
+
TableProvider,
|
|
2771
|
+
withRef(({ children, className, ...props }, ref) => {
|
|
2772
|
+
const { colSizes, isSelectingCell, marginLeft, minColumnWidth } = useTableElementState();
|
|
2773
|
+
const { colGroupProps, props: tableProps } = useTableElement();
|
|
2774
|
+
return /* @__PURE__ */ React__default.createElement(TableFloatingToolbar, null, /* @__PURE__ */ React__default.createElement("div", { style: { paddingLeft: marginLeft } }, /* @__PURE__ */ React__default.createElement(
|
|
2775
|
+
PlateElement,
|
|
2776
|
+
{
|
|
2777
|
+
asChild: true,
|
|
2778
|
+
className: cn$1(
|
|
2779
|
+
"my-4 ml-px mr-0 table h-px w-full table-fixed border-collapse",
|
|
2780
|
+
isSelectingCell && "[&_*::selection]:bg-none",
|
|
2781
|
+
className
|
|
2782
|
+
),
|
|
2783
|
+
ref,
|
|
2784
|
+
...tableProps,
|
|
2785
|
+
...props
|
|
2786
|
+
},
|
|
2787
|
+
/* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("colgroup", { ...colGroupProps }, colSizes.map((width, index) => /* @__PURE__ */ React__default.createElement(
|
|
2788
|
+
"col",
|
|
2789
|
+
{
|
|
2790
|
+
key: index,
|
|
2791
|
+
style: {
|
|
2792
|
+
minWidth: minColumnWidth,
|
|
2793
|
+
width: width || void 0
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
))), /* @__PURE__ */ React__default.createElement("tbody", { className: "min-w-full" }, children))
|
|
2797
|
+
)));
|
|
2798
|
+
})
|
|
2799
|
+
);
|
|
2800
|
+
const TableRowElement = withRef(({ children, hideBorder, ...props }, ref) => {
|
|
2801
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
2802
|
+
PlateElement,
|
|
2803
|
+
{
|
|
2804
|
+
asChild: true,
|
|
2805
|
+
className: cn$1("h-full", hideBorder && "border-none"),
|
|
2806
|
+
ref,
|
|
2807
|
+
...props
|
|
2808
|
+
},
|
|
2809
|
+
/* @__PURE__ */ React__default.createElement("tr", null, children)
|
|
2810
|
+
);
|
|
2811
|
+
});
|
|
2181
2812
|
const blockClasses = "mt-0.5";
|
|
2182
2813
|
const headerClasses = "font-normal";
|
|
2183
2814
|
const Components = () => {
|
|
@@ -2283,6 +2914,7 @@ const Components = () => {
|
|
|
2283
2914
|
}
|
|
2284
2915
|
)
|
|
2285
2916
|
),
|
|
2917
|
+
[ELEMENT_MERMAID]: MermaidElement,
|
|
2286
2918
|
[ELEMENT_BLOCKQUOTE]: BlockquoteElement,
|
|
2287
2919
|
[ELEMENT_CODE_BLOCK]: CodeBlockElement,
|
|
2288
2920
|
[ELEMENT_CODE_LINE]: CodeLineElement,
|
|
@@ -2363,7 +2995,11 @@ const Components = () => {
|
|
|
2363
2995
|
children,
|
|
2364
2996
|
selected && /* @__PURE__ */ React__default.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
|
|
2365
2997
|
);
|
|
2366
|
-
}
|
|
2998
|
+
},
|
|
2999
|
+
[ELEMENT_TABLE]: TableElement,
|
|
3000
|
+
[ELEMENT_TR]: TableRowElement,
|
|
3001
|
+
[ELEMENT_TD]: TableCellElement,
|
|
3002
|
+
[ELEMENT_TH]: TableCellHeaderElement
|
|
2367
3003
|
};
|
|
2368
3004
|
};
|
|
2369
3005
|
const createCodeBlockPlugin = createPluginFactory({
|
|
@@ -2773,7 +3409,9 @@ class Form {
|
|
|
2773
3409
|
{
|
|
2774
3410
|
type: "string",
|
|
2775
3411
|
label: "Caption",
|
|
2776
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3412
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
3413
|
+
"."
|
|
3414
|
+
),
|
|
2777
3415
|
component: "text"
|
|
2778
3416
|
}
|
|
2779
3417
|
]
|
|
@@ -3041,7 +3679,7 @@ function TinaForm({ form, children }) {
|
|
|
3041
3679
|
}));
|
|
3042
3680
|
}
|
|
3043
3681
|
function TinaField({
|
|
3044
|
-
Component
|
|
3682
|
+
Component,
|
|
3045
3683
|
children,
|
|
3046
3684
|
...fieldProps
|
|
3047
3685
|
}) {
|
|
@@ -3049,7 +3687,7 @@ function TinaField({
|
|
|
3049
3687
|
if (!isEditing)
|
|
3050
3688
|
return children || null;
|
|
3051
3689
|
return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
|
|
3052
|
-
return /* @__PURE__ */ React.createElement(
|
|
3690
|
+
return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
|
|
3053
3691
|
});
|
|
3054
3692
|
}
|
|
3055
3693
|
TinaField.propTypes = {
|
|
@@ -3091,7 +3729,7 @@ const Button$1 = ({
|
|
|
3091
3729
|
};
|
|
3092
3730
|
const sizeClasses = {
|
|
3093
3731
|
small: `text-xs h-8 px-3`,
|
|
3094
|
-
medium: `text-sm h-10 px-
|
|
3732
|
+
medium: `text-sm h-10 px-8`,
|
|
3095
3733
|
custom: ``
|
|
3096
3734
|
};
|
|
3097
3735
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -3219,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
|
|
|
3219
3857
|
function _objectWithoutProperties(source, excluded) {
|
|
3220
3858
|
if (source == null)
|
|
3221
3859
|
return {};
|
|
3222
|
-
var target = _objectWithoutPropertiesLoose
|
|
3860
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3223
3861
|
var key, i;
|
|
3224
3862
|
if (Object.getOwnPropertySymbols) {
|
|
3225
3863
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -3234,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
3234
3872
|
}
|
|
3235
3873
|
return target;
|
|
3236
3874
|
}
|
|
3237
|
-
function _objectWithoutPropertiesLoose
|
|
3875
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3238
3876
|
if (source == null)
|
|
3239
3877
|
return {};
|
|
3240
3878
|
var target = {};
|
|
@@ -4324,7 +4962,28 @@ const NumberInput = ({
|
|
|
4324
4962
|
onChange,
|
|
4325
4963
|
value,
|
|
4326
4964
|
step
|
|
4327
|
-
}) => /* @__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
|
+
);
|
|
4328
4987
|
function useCMS() {
|
|
4329
4988
|
return useCMS$1();
|
|
4330
4989
|
}
|
|
@@ -4433,7 +5092,7 @@ const ImageLoadingIndicator = () => /* @__PURE__ */ React.createElement("div", {
|
|
|
4433
5092
|
function cn(...inputs) {
|
|
4434
5093
|
return twMerge(clsx(inputs));
|
|
4435
5094
|
}
|
|
4436
|
-
const buttonVariants
|
|
5095
|
+
const buttonVariants = cva(
|
|
4437
5096
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
4438
5097
|
{
|
|
4439
5098
|
variants: {
|
|
@@ -4459,7 +5118,7 @@ const Button = React.forwardRef(
|
|
|
4459
5118
|
return /* @__PURE__ */ React.createElement(
|
|
4460
5119
|
Comp,
|
|
4461
5120
|
{
|
|
4462
|
-
className: cn(buttonVariants
|
|
5121
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
4463
5122
|
ref,
|
|
4464
5123
|
...props
|
|
4465
5124
|
}
|
|
@@ -5125,10 +5784,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
|
|
|
5125
5784
|
return /* @__PURE__ */ React__default.createElement(
|
|
5126
5785
|
"button",
|
|
5127
5786
|
{
|
|
5128
|
-
|
|
5787
|
+
type: "button",
|
|
5788
|
+
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"}`,
|
|
5129
5789
|
onClick
|
|
5130
5790
|
},
|
|
5131
|
-
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5791
|
+
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5132
5792
|
);
|
|
5133
5793
|
};
|
|
5134
5794
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5158,7 +5818,7 @@ const BlockSelector = ({
|
|
|
5158
5818
|
return template.label ? template.label.toLowerCase().includes(filter.toLowerCase()) || name.toLowerCase().includes(filter.toLowerCase()) : name.toLowerCase().includes(filter.toLowerCase());
|
|
5159
5819
|
});
|
|
5160
5820
|
}, [filter]);
|
|
5161
|
-
return /* @__PURE__ */ React.createElement(Popover$
|
|
5821
|
+
return /* @__PURE__ */ React.createElement(Popover$3, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
|
|
5162
5822
|
IconButton,
|
|
5163
5823
|
{
|
|
5164
5824
|
variant: open2 ? "secondary" : "primary",
|
|
@@ -5206,27 +5866,35 @@ const BlockSelector = ({
|
|
|
5206
5866
|
))))
|
|
5207
5867
|
))));
|
|
5208
5868
|
};
|
|
5209
|
-
const Group =
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5869
|
+
const Group = wrapFieldWithNoHeader(
|
|
5870
|
+
({ tinaForm, field }) => {
|
|
5871
|
+
const cms = useCMS$1();
|
|
5872
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5873
|
+
Header,
|
|
5874
|
+
{
|
|
5875
|
+
onClick: () => {
|
|
5876
|
+
const state = tinaForm.finalForm.getState();
|
|
5877
|
+
if (state.invalid === true) {
|
|
5878
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5879
|
+
return;
|
|
5880
|
+
}
|
|
5881
|
+
cms.dispatch({
|
|
5882
|
+
type: "forms:set-active-field-name",
|
|
5883
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5884
|
+
});
|
|
5220
5885
|
}
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5886
|
+
},
|
|
5887
|
+
field.label || field.name,
|
|
5888
|
+
field.description && /* @__PURE__ */ React.createElement(
|
|
5889
|
+
"span",
|
|
5890
|
+
{
|
|
5891
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5892
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5893
|
+
}
|
|
5894
|
+
)
|
|
5895
|
+
));
|
|
5896
|
+
}
|
|
5897
|
+
);
|
|
5230
5898
|
const Header = ({ onClick, children }) => {
|
|
5231
5899
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5232
5900
|
"button",
|
|
@@ -6568,244 +7236,65 @@ function pad(type, value) {
|
|
|
6568
7236
|
str = "0" + str;
|
|
6569
7237
|
return str;
|
|
6570
7238
|
}
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
}
|
|
6583
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
6584
|
-
if (source == null)
|
|
6585
|
-
return {};
|
|
6586
|
-
var target = {};
|
|
6587
|
-
var sourceKeys = Object.keys(source);
|
|
6588
|
-
var key, i;
|
|
6589
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
6590
|
-
key = sourceKeys[i];
|
|
6591
|
-
if (excluded.indexOf(key) >= 0)
|
|
6592
|
-
continue;
|
|
6593
|
-
target[key] = source[key];
|
|
6594
|
-
}
|
|
6595
|
-
return target;
|
|
6596
|
-
}
|
|
6597
|
-
function _assertThisInitialized(self) {
|
|
6598
|
-
if (self === void 0) {
|
|
6599
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
6600
|
-
}
|
|
6601
|
-
return self;
|
|
6602
|
-
}
|
|
6603
|
-
function isNodeFound(current, componentNode, ignoreClass) {
|
|
6604
|
-
if (current === componentNode) {
|
|
6605
|
-
return true;
|
|
6606
|
-
}
|
|
6607
|
-
if (current.correspondingElement) {
|
|
6608
|
-
return current.correspondingElement.classList.contains(ignoreClass);
|
|
6609
|
-
}
|
|
6610
|
-
return current.classList.contains(ignoreClass);
|
|
6611
|
-
}
|
|
6612
|
-
function findHighest(current, componentNode, ignoreClass) {
|
|
6613
|
-
if (current === componentNode) {
|
|
6614
|
-
return true;
|
|
7239
|
+
var useClickAway$1 = {};
|
|
7240
|
+
var util = {};
|
|
7241
|
+
Object.defineProperty(util, "__esModule", { value: true });
|
|
7242
|
+
util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
|
|
7243
|
+
var noop = function() {
|
|
7244
|
+
};
|
|
7245
|
+
util.noop = noop;
|
|
7246
|
+
function on(obj) {
|
|
7247
|
+
var args = [];
|
|
7248
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7249
|
+
args[_i - 1] = arguments[_i];
|
|
6615
7250
|
}
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
return true;
|
|
6619
|
-
}
|
|
6620
|
-
current = current.parentNode || current.host;
|
|
7251
|
+
if (obj && obj.addEventListener) {
|
|
7252
|
+
obj.addEventListener.apply(obj, args);
|
|
6621
7253
|
}
|
|
6622
|
-
return current;
|
|
6623
7254
|
}
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
var
|
|
6628
|
-
|
|
6629
|
-
return;
|
|
7255
|
+
util.on = on;
|
|
7256
|
+
function off(obj) {
|
|
7257
|
+
var args = [];
|
|
7258
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7259
|
+
args[_i - 1] = arguments[_i];
|
|
6630
7260
|
}
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
get: function get2() {
|
|
6634
|
-
passive = true;
|
|
6635
|
-
}
|
|
6636
|
-
});
|
|
6637
|
-
var noop = function noop2() {
|
|
6638
|
-
};
|
|
6639
|
-
window.addEventListener("testPassiveEventSupport", noop, options);
|
|
6640
|
-
window.removeEventListener("testPassiveEventSupport", noop, options);
|
|
6641
|
-
return passive;
|
|
6642
|
-
};
|
|
6643
|
-
function autoInc(seed) {
|
|
6644
|
-
if (seed === void 0) {
|
|
6645
|
-
seed = 0;
|
|
7261
|
+
if (obj && obj.removeEventListener) {
|
|
7262
|
+
obj.removeEventListener.apply(obj, args);
|
|
6646
7263
|
}
|
|
6647
|
-
return function() {
|
|
6648
|
-
return ++seed;
|
|
6649
|
-
};
|
|
6650
7264
|
}
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
var
|
|
6656
|
-
var
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
function onClickOutside(props) {
|
|
6671
|
-
var _this;
|
|
6672
|
-
_this = _Component.call(this, props) || this;
|
|
6673
|
-
_this.__outsideClickHandler = function(event) {
|
|
6674
|
-
if (typeof _this.__clickOutsideHandlerProp === "function") {
|
|
6675
|
-
_this.__clickOutsideHandlerProp(event);
|
|
6676
|
-
return;
|
|
6677
|
-
}
|
|
6678
|
-
var instance = _this.getInstance();
|
|
6679
|
-
if (typeof instance.props.handleClickOutside === "function") {
|
|
6680
|
-
instance.props.handleClickOutside(event);
|
|
6681
|
-
return;
|
|
6682
|
-
}
|
|
6683
|
-
if (typeof instance.handleClickOutside === "function") {
|
|
6684
|
-
instance.handleClickOutside(event);
|
|
6685
|
-
return;
|
|
6686
|
-
}
|
|
6687
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
|
|
6688
|
-
};
|
|
6689
|
-
_this.__getComponentNode = function() {
|
|
6690
|
-
var instance = _this.getInstance();
|
|
6691
|
-
if (config && typeof config.setClickOutsideRef === "function") {
|
|
6692
|
-
return config.setClickOutsideRef()(instance);
|
|
6693
|
-
}
|
|
6694
|
-
if (typeof instance.setClickOutsideRef === "function") {
|
|
6695
|
-
return instance.setClickOutsideRef();
|
|
6696
|
-
}
|
|
6697
|
-
return findDOMNode(instance);
|
|
6698
|
-
};
|
|
6699
|
-
_this.enableOnClickOutside = function() {
|
|
6700
|
-
if (typeof document === "undefined" || enabledInstances[_this._uid]) {
|
|
6701
|
-
return;
|
|
6702
|
-
}
|
|
6703
|
-
if (typeof passiveEventSupport === "undefined") {
|
|
6704
|
-
passiveEventSupport = testPassiveEventSupport();
|
|
6705
|
-
}
|
|
6706
|
-
enabledInstances[_this._uid] = true;
|
|
6707
|
-
var events = _this.props.eventTypes;
|
|
6708
|
-
if (!events.forEach) {
|
|
6709
|
-
events = [events];
|
|
6710
|
-
}
|
|
6711
|
-
handlersMap[_this._uid] = function(event) {
|
|
6712
|
-
if (_this.componentNode === null)
|
|
6713
|
-
return;
|
|
6714
|
-
if (_this.initTimeStamp > event.timeStamp)
|
|
6715
|
-
return;
|
|
6716
|
-
if (_this.props.preventDefault) {
|
|
6717
|
-
event.preventDefault();
|
|
6718
|
-
}
|
|
6719
|
-
if (_this.props.stopPropagation) {
|
|
6720
|
-
event.stopPropagation();
|
|
6721
|
-
}
|
|
6722
|
-
if (_this.props.excludeScrollbar && clickedScrollbar(event))
|
|
6723
|
-
return;
|
|
6724
|
-
var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
|
|
6725
|
-
if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
|
|
6726
|
-
return;
|
|
6727
|
-
}
|
|
6728
|
-
_this.__outsideClickHandler(event);
|
|
6729
|
-
};
|
|
6730
|
-
events.forEach(function(eventName) {
|
|
6731
|
-
document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
6732
|
-
});
|
|
6733
|
-
};
|
|
6734
|
-
_this.disableOnClickOutside = function() {
|
|
6735
|
-
delete enabledInstances[_this._uid];
|
|
6736
|
-
var fn = handlersMap[_this._uid];
|
|
6737
|
-
if (fn && typeof document !== "undefined") {
|
|
6738
|
-
var events = _this.props.eventTypes;
|
|
6739
|
-
if (!events.forEach) {
|
|
6740
|
-
events = [events];
|
|
6741
|
-
}
|
|
6742
|
-
events.forEach(function(eventName) {
|
|
6743
|
-
return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
6744
|
-
});
|
|
6745
|
-
delete handlersMap[_this._uid];
|
|
6746
|
-
}
|
|
6747
|
-
};
|
|
6748
|
-
_this.getRef = function(ref) {
|
|
6749
|
-
return _this.instanceRef = ref;
|
|
6750
|
-
};
|
|
6751
|
-
_this._uid = uid();
|
|
6752
|
-
_this.initTimeStamp = performance.now();
|
|
6753
|
-
return _this;
|
|
6754
|
-
}
|
|
6755
|
-
var _proto = onClickOutside.prototype;
|
|
6756
|
-
_proto.getInstance = function getInstance() {
|
|
6757
|
-
if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
|
|
6758
|
-
return this;
|
|
6759
|
-
}
|
|
6760
|
-
var ref = this.instanceRef;
|
|
6761
|
-
return ref.getInstance ? ref.getInstance() : ref;
|
|
6762
|
-
};
|
|
6763
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
6764
|
-
if (typeof document === "undefined" || !document.createElement) {
|
|
6765
|
-
return;
|
|
6766
|
-
}
|
|
6767
|
-
var instance = this.getInstance();
|
|
6768
|
-
if (config && typeof config.handleClickOutside === "function") {
|
|
6769
|
-
this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
|
|
6770
|
-
if (typeof this.__clickOutsideHandlerProp !== "function") {
|
|
6771
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
|
|
6772
|
-
}
|
|
6773
|
-
}
|
|
6774
|
-
this.componentNode = this.__getComponentNode();
|
|
6775
|
-
if (this.props.disableOnClickOutside)
|
|
6776
|
-
return;
|
|
6777
|
-
this.enableOnClickOutside();
|
|
6778
|
-
};
|
|
6779
|
-
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
6780
|
-
this.componentNode = this.__getComponentNode();
|
|
6781
|
-
};
|
|
6782
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
6783
|
-
this.disableOnClickOutside();
|
|
7265
|
+
util.off = off;
|
|
7266
|
+
util.isBrowser = typeof window !== "undefined";
|
|
7267
|
+
util.isNavigator = typeof navigator !== "undefined";
|
|
7268
|
+
Object.defineProperty(useClickAway$1, "__esModule", { value: true });
|
|
7269
|
+
var react_1 = React__default;
|
|
7270
|
+
var util_1 = util;
|
|
7271
|
+
var defaultEvents = ["mousedown", "touchstart"];
|
|
7272
|
+
var useClickAway = function(ref, onClickAway, events) {
|
|
7273
|
+
if (events === void 0) {
|
|
7274
|
+
events = defaultEvents;
|
|
7275
|
+
}
|
|
7276
|
+
var savedCallback = react_1.useRef(onClickAway);
|
|
7277
|
+
react_1.useEffect(function() {
|
|
7278
|
+
savedCallback.current = onClickAway;
|
|
7279
|
+
}, [onClickAway]);
|
|
7280
|
+
react_1.useEffect(function() {
|
|
7281
|
+
var handler = function(event) {
|
|
7282
|
+
var el = ref.current;
|
|
7283
|
+
el && !el.contains(event.target) && savedCallback.current(event);
|
|
6784
7284
|
};
|
|
6785
|
-
|
|
6786
|
-
var
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
7285
|
+
for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
|
|
7286
|
+
var eventName = events_1[_i];
|
|
7287
|
+
util_1.on(document, eventName, handler);
|
|
7288
|
+
}
|
|
7289
|
+
return function() {
|
|
7290
|
+
for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
|
|
7291
|
+
var eventName2 = events_2[_i2];
|
|
7292
|
+
util_1.off(document, eventName2, handler);
|
|
6793
7293
|
}
|
|
6794
|
-
props.disableOnClickOutside = this.disableOnClickOutside;
|
|
6795
|
-
props.enableOnClickOutside = this.enableOnClickOutside;
|
|
6796
|
-
return createElement(WrappedComponent, props);
|
|
6797
7294
|
};
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
excludeScrollbar: config && config.excludeScrollbar || false,
|
|
6802
|
-
outsideClickIgnoreClass: IGNORE_CLASS_NAME,
|
|
6803
|
-
preventDefault: false,
|
|
6804
|
-
stopPropagation: false
|
|
6805
|
-
}, _class.getClass = function() {
|
|
6806
|
-
return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
|
|
6807
|
-
}, _temp;
|
|
6808
|
-
}
|
|
7295
|
+
}, [events, ref]);
|
|
7296
|
+
};
|
|
7297
|
+
var _default = useClickAway$1.default = useClickAway;
|
|
6809
7298
|
const viewModes = {
|
|
6810
7299
|
YEARS: "years",
|
|
6811
7300
|
MONTHS: "months",
|
|
@@ -7334,22 +7823,13 @@ function log(message, method) {
|
|
|
7334
7823
|
}
|
|
7335
7824
|
con[method]("***react-datetime:" + message);
|
|
7336
7825
|
}
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
}
|
|
7342
|
-
|
|
7343
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
|
|
7344
|
-
}
|
|
7345
|
-
handleClickOutside(e) {
|
|
7346
|
-
this.props.onClickOut(e);
|
|
7347
|
-
}
|
|
7348
|
-
setClickOutsideRef() {
|
|
7349
|
-
return this.container.current;
|
|
7350
|
-
}
|
|
7826
|
+
function ClickableWrapper({ className, onClickOut, children }) {
|
|
7827
|
+
const containerRef = useRef(null);
|
|
7828
|
+
_default(containerRef, (event) => {
|
|
7829
|
+
onClickOut(event);
|
|
7830
|
+
});
|
|
7831
|
+
return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
|
|
7351
7832
|
}
|
|
7352
|
-
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
7353
7833
|
const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
|
|
7354
7834
|
const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
|
|
7355
7835
|
const format$1 = (val, _name, field) => {
|
|
@@ -7392,7 +7872,10 @@ const DateField = wrapFieldsWithMeta(
|
|
|
7392
7872
|
ReactDateTimeWithStyles,
|
|
7393
7873
|
{
|
|
7394
7874
|
value: input.value,
|
|
7395
|
-
onChange:
|
|
7875
|
+
onChange: (value) => {
|
|
7876
|
+
const newValue = value === "" ? void 0 : value;
|
|
7877
|
+
input.onChange(newValue);
|
|
7878
|
+
},
|
|
7396
7879
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
7397
7880
|
timeFormat: timeFormat || false,
|
|
7398
7881
|
inputProps: { className: textFieldClasses },
|
|
@@ -9203,7 +9686,7 @@ class SidebarState {
|
|
|
9203
9686
|
}
|
|
9204
9687
|
}
|
|
9205
9688
|
function createScreen({
|
|
9206
|
-
Component
|
|
9689
|
+
Component,
|
|
9207
9690
|
props,
|
|
9208
9691
|
...options
|
|
9209
9692
|
}) {
|
|
@@ -9212,7 +9695,7 @@ function createScreen({
|
|
|
9212
9695
|
layout: "popup",
|
|
9213
9696
|
...options,
|
|
9214
9697
|
Component(screenProps) {
|
|
9215
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
9698
|
+
return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
|
|
9216
9699
|
}
|
|
9217
9700
|
};
|
|
9218
9701
|
}
|
|
@@ -9723,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
9723
10206
|
"Event Log"
|
|
9724
10207
|
));
|
|
9725
10208
|
};
|
|
9726
|
-
const version = "2.
|
|
10209
|
+
const version = "2.6.0";
|
|
9727
10210
|
const Nav = ({
|
|
9728
10211
|
isLocalMode,
|
|
9729
10212
|
className = "",
|
|
@@ -12254,15 +12737,14 @@ const FormBuilder = ({
|
|
|
12254
12737
|
fields: fieldGroup.fields
|
|
12255
12738
|
}
|
|
12256
12739
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12257
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12740
|
+
)), !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(
|
|
12258
12741
|
ResetForm,
|
|
12259
12742
|
{
|
|
12260
12743
|
pristine,
|
|
12261
12744
|
reset: async () => {
|
|
12262
12745
|
finalForm.reset();
|
|
12263
12746
|
await tinaForm.reset();
|
|
12264
|
-
}
|
|
12265
|
-
style: { flexGrow: 1 }
|
|
12747
|
+
}
|
|
12266
12748
|
},
|
|
12267
12749
|
tinaForm.buttons.reset
|
|
12268
12750
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12271,8 +12753,7 @@ const FormBuilder = ({
|
|
|
12271
12753
|
onClick: safeHandleSubmit,
|
|
12272
12754
|
disabled: !canSubmit,
|
|
12273
12755
|
busy: submitting,
|
|
12274
|
-
variant: "primary"
|
|
12275
|
-
style: { flexGrow: 3 }
|
|
12756
|
+
variant: "primary"
|
|
12276
12757
|
},
|
|
12277
12758
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12278
12759
|
!submitting && tinaForm.buttons.save
|
|
@@ -12654,9 +13135,9 @@ const EllipsisIcon = ({ title }) => {
|
|
|
12654
13135
|
));
|
|
12655
13136
|
};
|
|
12656
13137
|
const Wrapper$1 = ({ inline, children }) => {
|
|
12657
|
-
const
|
|
13138
|
+
const Component = inline ? "span" : "div";
|
|
12658
13139
|
return /* @__PURE__ */ React__default.createElement(
|
|
12659
|
-
|
|
13140
|
+
Component,
|
|
12660
13141
|
{
|
|
12661
13142
|
contentEditable: false,
|
|
12662
13143
|
style: { userSelect: "none" },
|
|
@@ -12790,7 +13271,7 @@ const EmbedNestedForm = ({
|
|
|
12790
13271
|
);
|
|
12791
13272
|
};
|
|
12792
13273
|
const DotMenu = ({ onOpen, onRemove }) => {
|
|
12793
|
-
return /* @__PURE__ */ React__default.createElement(Popover$
|
|
13274
|
+
return /* @__PURE__ */ React__default.createElement(Popover$3, { as: "span", className: "-ml-px relative block" }, /* @__PURE__ */ React__default.createElement(
|
|
12794
13275
|
PopoverButton,
|
|
12795
13276
|
{
|
|
12796
13277
|
as: "span",
|
|
@@ -13230,13 +13711,26 @@ const plugins = [
|
|
|
13230
13711
|
createUnderlinePlugin(),
|
|
13231
13712
|
createCodePlugin(),
|
|
13232
13713
|
createListPlugin(),
|
|
13233
|
-
createIndentPlugin(),
|
|
13234
13714
|
createIndentListPlugin(),
|
|
13235
13715
|
createHorizontalRulePlugin(),
|
|
13236
13716
|
// Allows us to do things like copy/paste, remembering the state of the element (like mdx)
|
|
13237
13717
|
createNodeIdPlugin(),
|
|
13238
|
-
createSlashPlugin()
|
|
13718
|
+
createSlashPlugin(),
|
|
13719
|
+
createTablePlugin()
|
|
13239
13720
|
];
|
|
13721
|
+
const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
13722
|
+
"Code Block",
|
|
13723
|
+
"Unordered List",
|
|
13724
|
+
"Ordered List",
|
|
13725
|
+
"Quote",
|
|
13726
|
+
"Mermaid",
|
|
13727
|
+
"Heading 1",
|
|
13728
|
+
"Heading 2",
|
|
13729
|
+
"Heading 3",
|
|
13730
|
+
"Heading 4",
|
|
13731
|
+
"Heading 5",
|
|
13732
|
+
"Heading 6"
|
|
13733
|
+
]);
|
|
13240
13734
|
const isNodeActive = (editor, type) => {
|
|
13241
13735
|
const pluginType = getPluginType(editor, type);
|
|
13242
13736
|
return !!(editor == null ? void 0 : editor.selection) && someNode(editor, { match: { type: pluginType } });
|
|
@@ -13421,24 +13915,6 @@ const Editor = React__default.forwardRef(
|
|
|
13421
13915
|
}
|
|
13422
13916
|
);
|
|
13423
13917
|
Editor.displayName = "Editor";
|
|
13424
|
-
const separatorVariants = cva("shrink-0 bg-border", {
|
|
13425
|
-
defaultVariants: {
|
|
13426
|
-
orientation: "horizontal"
|
|
13427
|
-
},
|
|
13428
|
-
variants: {
|
|
13429
|
-
orientation: {
|
|
13430
|
-
horizontal: "h-px w-full",
|
|
13431
|
-
vertical: "h-full w-px"
|
|
13432
|
-
}
|
|
13433
|
-
}
|
|
13434
|
-
});
|
|
13435
|
-
const Separator = withVariants(
|
|
13436
|
-
withProps(SeparatorPrimitive.Root, {
|
|
13437
|
-
decorative: true,
|
|
13438
|
-
orientation: "horizontal"
|
|
13439
|
-
}),
|
|
13440
|
-
separatorVariants
|
|
13441
|
-
);
|
|
13442
13918
|
const TooltipProvider = TooltipPrimitive.Provider;
|
|
13443
13919
|
const Tooltip = TooltipPrimitive.Root;
|
|
13444
13920
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
@@ -13447,15 +13923,15 @@ const TooltipContent = withCn(
|
|
|
13447
13923
|
withProps(TooltipPrimitive.Content, {
|
|
13448
13924
|
sideOffset: 4
|
|
13449
13925
|
}),
|
|
13450
|
-
"z-
|
|
13926
|
+
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
13451
13927
|
);
|
|
13452
|
-
function withTooltip(
|
|
13928
|
+
function withTooltip(Component) {
|
|
13453
13929
|
return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
13454
13930
|
const [mounted, setMounted] = React__default.useState(false);
|
|
13455
13931
|
React__default.useEffect(() => {
|
|
13456
13932
|
setMounted(true);
|
|
13457
13933
|
}, []);
|
|
13458
|
-
const component = /* @__PURE__ */ React__default.createElement(
|
|
13934
|
+
const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
|
|
13459
13935
|
if (tooltip && mounted) {
|
|
13460
13936
|
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)));
|
|
13461
13937
|
}
|
|
@@ -13573,140 +14049,41 @@ const FixedToolbar = withCn(
|
|
|
13573
14049
|
Toolbar,
|
|
13574
14050
|
"p-1 sticky left-0 top-0 z-50 w-full justify-between overflow-x-auto border border-border bg-background"
|
|
13575
14051
|
);
|
|
13576
|
-
const
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
|
|
13582
|
-
const editor = useEditorState();
|
|
13583
|
-
const state = useListToolbarButtonState({ nodeType });
|
|
13584
|
-
const { props } = useListToolbarButton(state);
|
|
13585
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
13586
|
-
ToolbarButton,
|
|
13587
|
-
{
|
|
13588
|
-
ref,
|
|
13589
|
-
tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
13590
|
-
...props,
|
|
13591
|
-
onClick: (e) => {
|
|
13592
|
-
e.preventDefault();
|
|
13593
|
-
e.stopPropagation();
|
|
13594
|
-
toggleList(editor, { type: nodeType });
|
|
13595
|
-
}
|
|
13596
|
-
},
|
|
13597
|
-
nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
13598
|
-
);
|
|
13599
|
-
});
|
|
13600
|
-
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
13601
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
13602
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
13603
|
-
withRef(({ children, className, inset, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
|
|
13604
|
-
DropdownMenuPrimitive.SubTrigger,
|
|
13605
|
-
{
|
|
13606
|
-
className: cn$1(
|
|
13607
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
13608
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13609
|
-
inset && "pl-8",
|
|
13610
|
-
className
|
|
13611
|
-
),
|
|
13612
|
-
ref,
|
|
13613
|
-
...props
|
|
13614
|
-
},
|
|
13615
|
-
children,
|
|
13616
|
-
/* @__PURE__ */ React__default.createElement(Icons.chevronRight, { className: "ml-auto size-4" })
|
|
13617
|
-
));
|
|
13618
|
-
withCn(
|
|
13619
|
-
DropdownMenuPrimitive.SubContent,
|
|
13620
|
-
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-lg 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"
|
|
13621
|
-
);
|
|
13622
|
-
const DropdownMenuContentVariants = withProps(DropdownMenuPrimitive.Content, {
|
|
13623
|
-
className: cn$1(
|
|
13624
|
-
"z-[99999] min-w-32 overflow-hidden rounded-md border bg-white p-1 text-black shadow-md 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"
|
|
13625
|
-
),
|
|
13626
|
-
sideOffset: 4
|
|
13627
|
-
});
|
|
13628
|
-
const DropdownMenuContent = withRef(({ ...props }, ref) => /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(DropdownMenuContentVariants, { ref, ...props })));
|
|
13629
|
-
const menuItemVariants = cva(
|
|
13630
|
-
cn$1(
|
|
13631
|
-
"relative flex h-9 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
13632
|
-
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
13633
|
-
),
|
|
13634
|
-
{
|
|
13635
|
-
variants: {
|
|
13636
|
-
inset: {
|
|
13637
|
-
true: "pl-8"
|
|
14052
|
+
const useResize = (ref, callback) => {
|
|
14053
|
+
React__default.useEffect(() => {
|
|
14054
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
14055
|
+
for (const entry of entries) {
|
|
14056
|
+
callback(entry);
|
|
13638
14057
|
}
|
|
14058
|
+
});
|
|
14059
|
+
if (ref.current) {
|
|
14060
|
+
resizeObserver.observe(ref.current);
|
|
13639
14061
|
}
|
|
13640
|
-
|
|
13641
|
-
);
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
ref,
|
|
13656
|
-
...props
|
|
13657
|
-
},
|
|
13658
|
-
/* @__PURE__ */ React__default.createElement("span", { className: "absolute left-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
|
|
13659
|
-
children
|
|
13660
|
-
));
|
|
13661
|
-
const DropdownMenuRadioItem = withRef(({ children, className, hideIcon, ...props }, ref) => /* @__PURE__ */ React__default.createElement(
|
|
13662
|
-
DropdownMenuPrimitive.RadioItem,
|
|
13663
|
-
{
|
|
13664
|
-
className: cn$1(
|
|
13665
|
-
"relative flex select-none items-center rounded-sm pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
13666
|
-
"h-9 cursor-pointer px-2 data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground",
|
|
13667
|
-
className
|
|
13668
|
-
),
|
|
13669
|
-
ref,
|
|
13670
|
-
...props
|
|
13671
|
-
},
|
|
13672
|
-
!hideIcon && /* @__PURE__ */ React__default.createElement("span", { className: "absolute right-2 flex size-3.5 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React__default.createElement(Icons.check, { className: "size-4" }))),
|
|
14062
|
+
return () => resizeObserver.disconnect();
|
|
14063
|
+
}, [ref.current]);
|
|
14064
|
+
};
|
|
14065
|
+
const STANDARD_ICON_WIDTH = 32;
|
|
14066
|
+
const HEADING_ICON_WITH_TEXT = 127;
|
|
14067
|
+
const HEADING_ICON_ONLY = 58;
|
|
14068
|
+
const EMBED_ICON_WIDTH = 78;
|
|
14069
|
+
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14070
|
+
const FLOAT_BUTTON_WIDTH = 25;
|
|
14071
|
+
const HEADING_LABEL = "Headings";
|
|
14072
|
+
const ToolbarContext = createContext(void 0);
|
|
14073
|
+
const ToolbarProvider = ({
|
|
14074
|
+
tinaForm,
|
|
14075
|
+
templates,
|
|
14076
|
+
overrides,
|
|
13673
14077
|
children
|
|
13674
|
-
)
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
}
|
|
13682
|
-
}
|
|
14078
|
+
}) => {
|
|
14079
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarContext.Provider, { value: { tinaForm, templates, overrides } }, children);
|
|
14080
|
+
};
|
|
14081
|
+
const useToolbarContext = () => {
|
|
14082
|
+
const context = useContext(ToolbarContext);
|
|
14083
|
+
if (!context) {
|
|
14084
|
+
throw new Error("useToolbarContext must be used within a ToolbarProvider");
|
|
13683
14085
|
}
|
|
13684
|
-
|
|
13685
|
-
const DropdownMenuLabel = withVariants(
|
|
13686
|
-
DropdownMenuPrimitive.Label,
|
|
13687
|
-
dropdownMenuLabelVariants,
|
|
13688
|
-
["inset"]
|
|
13689
|
-
);
|
|
13690
|
-
const DropdownMenuSeparator = withCn(
|
|
13691
|
-
DropdownMenuPrimitive.Separator,
|
|
13692
|
-
"-mx-1 my-1 h-px bg-muted"
|
|
13693
|
-
);
|
|
13694
|
-
withCn(
|
|
13695
|
-
createPrimitiveElement("span"),
|
|
13696
|
-
"ml-auto text-xs tracking-widest opacity-60"
|
|
13697
|
-
);
|
|
13698
|
-
const useOpenState = () => {
|
|
13699
|
-
const [open2, setOpen] = useState(false);
|
|
13700
|
-
const onOpenChange = useCallback(
|
|
13701
|
-
(_value = !open2) => {
|
|
13702
|
-
setOpen(_value);
|
|
13703
|
-
},
|
|
13704
|
-
[open2]
|
|
13705
|
-
);
|
|
13706
|
-
return {
|
|
13707
|
-
onOpenChange,
|
|
13708
|
-
open: open2
|
|
13709
|
-
};
|
|
14086
|
+
return context;
|
|
13710
14087
|
};
|
|
13711
14088
|
const items$1 = [
|
|
13712
14089
|
{
|
|
@@ -13772,7 +14149,9 @@ function HeadingsMenu(props) {
|
|
|
13772
14149
|
return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH$1;
|
|
13773
14150
|
}, []);
|
|
13774
14151
|
const editor = useEditorRef();
|
|
14152
|
+
const editorState = useEditorState();
|
|
13775
14153
|
const openState = useOpenState();
|
|
14154
|
+
const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
|
|
13776
14155
|
const selectedItem = items$1.find((item) => item.value === value) ?? defaultItem$1;
|
|
13777
14156
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
13778
14157
|
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -13784,7 +14163,7 @@ function HeadingsMenu(props) {
|
|
|
13784
14163
|
tooltip: "Headings"
|
|
13785
14164
|
},
|
|
13786
14165
|
/* @__PURE__ */ React__default.createElement(SelectedItemIcon, { className: "size-5" }),
|
|
13787
|
-
/* @__PURE__ */ React__default.createElement("span", { className: "
|
|
14166
|
+
/* @__PURE__ */ React__default.createElement("span", { className: "@md/toolbar:flex hidden" }, selectedItemLabel)
|
|
13788
14167
|
)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0" }, /* @__PURE__ */ React__default.createElement(
|
|
13789
14168
|
DropdownMenuRadioGroup,
|
|
13790
14169
|
{
|
|
@@ -13796,7 +14175,12 @@ function HeadingsMenu(props) {
|
|
|
13796
14175
|
},
|
|
13797
14176
|
value
|
|
13798
14177
|
},
|
|
13799
|
-
items$1.
|
|
14178
|
+
items$1.filter((item) => {
|
|
14179
|
+
if (userInTable) {
|
|
14180
|
+
return !unsupportedItemsInTable.has(item.label);
|
|
14181
|
+
}
|
|
14182
|
+
return true;
|
|
14183
|
+
}).map(({ icon: Icon, label, value: itemValue }) => /* @__PURE__ */ React__default.createElement(
|
|
13800
14184
|
DropdownMenuRadioItem,
|
|
13801
14185
|
{
|
|
13802
14186
|
className: "min-w-[180px]",
|
|
@@ -13808,42 +14192,6 @@ function HeadingsMenu(props) {
|
|
|
13808
14192
|
))
|
|
13809
14193
|
)));
|
|
13810
14194
|
}
|
|
13811
|
-
const LinkToolbarButton = withRef((rest, ref) => {
|
|
13812
|
-
const state = useLinkToolbarButtonState();
|
|
13813
|
-
const { props } = useLinkToolbarButton(state);
|
|
13814
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
|
|
13815
|
-
});
|
|
13816
|
-
const useBlockQuoteToolbarButtonState = () => {
|
|
13817
|
-
const editor = useEditorState();
|
|
13818
|
-
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
|
|
13819
|
-
return {
|
|
13820
|
-
pressed: isBlockActive()
|
|
13821
|
-
};
|
|
13822
|
-
};
|
|
13823
|
-
const useBlockQuoteToolbarButton = (state) => {
|
|
13824
|
-
const editor = useEditorState();
|
|
13825
|
-
const onClick = () => {
|
|
13826
|
-
toggleNodeType(editor, {
|
|
13827
|
-
activeType: ELEMENT_BLOCKQUOTE$1
|
|
13828
|
-
});
|
|
13829
|
-
};
|
|
13830
|
-
const onMouseDown = (e) => {
|
|
13831
|
-
e.preventDefault();
|
|
13832
|
-
e.stopPropagation();
|
|
13833
|
-
};
|
|
13834
|
-
return {
|
|
13835
|
-
props: {
|
|
13836
|
-
onClick,
|
|
13837
|
-
onMouseDown,
|
|
13838
|
-
pressed: state.pressed
|
|
13839
|
-
}
|
|
13840
|
-
};
|
|
13841
|
-
};
|
|
13842
|
-
const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
13843
|
-
const state = useBlockQuoteToolbarButtonState();
|
|
13844
|
-
const { props } = useBlockQuoteToolbarButton(state);
|
|
13845
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
|
|
13846
|
-
});
|
|
13847
14195
|
const useCodeBlockToolbarButtonState = () => {
|
|
13848
14196
|
const editor = useEditorState();
|
|
13849
14197
|
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_CODE_BLOCK$1);
|
|
@@ -13905,6 +14253,116 @@ const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
|
13905
14253
|
const { props } = useImageToolbarButton(state);
|
|
13906
14254
|
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
|
|
13907
14255
|
});
|
|
14256
|
+
const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
|
|
14257
|
+
const editor = useEditorState();
|
|
14258
|
+
const state = useListToolbarButtonState({ nodeType });
|
|
14259
|
+
const { props } = useListToolbarButton(state);
|
|
14260
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14261
|
+
ToolbarButton,
|
|
14262
|
+
{
|
|
14263
|
+
ref,
|
|
14264
|
+
tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14265
|
+
...props,
|
|
14266
|
+
onClick: (e) => {
|
|
14267
|
+
e.preventDefault();
|
|
14268
|
+
e.stopPropagation();
|
|
14269
|
+
toggleList(editor, { type: nodeType });
|
|
14270
|
+
}
|
|
14271
|
+
},
|
|
14272
|
+
nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14273
|
+
);
|
|
14274
|
+
});
|
|
14275
|
+
const LinkToolbarButton = withRef((rest, ref) => {
|
|
14276
|
+
const state = useLinkToolbarButtonState();
|
|
14277
|
+
const { props } = useLinkToolbarButton(state);
|
|
14278
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
|
|
14279
|
+
});
|
|
14280
|
+
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14281
|
+
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14282
|
+
const { props } = useMarkToolbarButton(state);
|
|
14283
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14284
|
+
});
|
|
14285
|
+
const useMermaidToolbarButtonState = () => {
|
|
14286
|
+
const editor = useEditorState();
|
|
14287
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_MERMAID);
|
|
14288
|
+
return {
|
|
14289
|
+
pressed: isBlockActive()
|
|
14290
|
+
};
|
|
14291
|
+
};
|
|
14292
|
+
const useMermaidToolbarButton = (state) => {
|
|
14293
|
+
const editor = useEditorState();
|
|
14294
|
+
const onClick = () => {
|
|
14295
|
+
insertEmptyElement(editor, ELEMENT_MERMAID, {
|
|
14296
|
+
nextBlock: true,
|
|
14297
|
+
select: true
|
|
14298
|
+
});
|
|
14299
|
+
};
|
|
14300
|
+
const onMouseDown = (e) => {
|
|
14301
|
+
e.preventDefault();
|
|
14302
|
+
e.stopPropagation();
|
|
14303
|
+
};
|
|
14304
|
+
return {
|
|
14305
|
+
props: {
|
|
14306
|
+
onClick,
|
|
14307
|
+
onMouseDown,
|
|
14308
|
+
pressed: state.pressed
|
|
14309
|
+
}
|
|
14310
|
+
};
|
|
14311
|
+
};
|
|
14312
|
+
const MermaidToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14313
|
+
const state = useMermaidToolbarButtonState();
|
|
14314
|
+
const { props } = useMermaidToolbarButton(state);
|
|
14315
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Mermaid", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.mermaid, null));
|
|
14316
|
+
});
|
|
14317
|
+
function OverflowMenu({
|
|
14318
|
+
children,
|
|
14319
|
+
...props
|
|
14320
|
+
}) {
|
|
14321
|
+
const openState = useOpenState();
|
|
14322
|
+
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
|
|
14323
|
+
ToolbarButton,
|
|
14324
|
+
{
|
|
14325
|
+
showArrow: false,
|
|
14326
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14327
|
+
className: "lg:min-w-[130px]",
|
|
14328
|
+
isDropdown: true,
|
|
14329
|
+
pressed: openState.open,
|
|
14330
|
+
tooltip: "Headings"
|
|
14331
|
+
},
|
|
14332
|
+
/* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
|
|
14333
|
+
)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14334
|
+
}
|
|
14335
|
+
const useBlockQuoteToolbarButtonState = () => {
|
|
14336
|
+
const editor = useEditorState();
|
|
14337
|
+
const isBlockActive = () => helpers.isNodeActive(editor, ELEMENT_BLOCKQUOTE$1);
|
|
14338
|
+
return {
|
|
14339
|
+
pressed: isBlockActive()
|
|
14340
|
+
};
|
|
14341
|
+
};
|
|
14342
|
+
const useBlockQuoteToolbarButton = (state) => {
|
|
14343
|
+
const editor = useEditorState();
|
|
14344
|
+
const onClick = () => {
|
|
14345
|
+
toggleNodeType(editor, {
|
|
14346
|
+
activeType: ELEMENT_BLOCKQUOTE$1
|
|
14347
|
+
});
|
|
14348
|
+
};
|
|
14349
|
+
const onMouseDown = (e) => {
|
|
14350
|
+
e.preventDefault();
|
|
14351
|
+
e.stopPropagation();
|
|
14352
|
+
};
|
|
14353
|
+
return {
|
|
14354
|
+
props: {
|
|
14355
|
+
onClick,
|
|
14356
|
+
onMouseDown,
|
|
14357
|
+
pressed: state.pressed
|
|
14358
|
+
}
|
|
14359
|
+
};
|
|
14360
|
+
};
|
|
14361
|
+
const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14362
|
+
const state = useBlockQuoteToolbarButtonState();
|
|
14363
|
+
const { props } = useBlockQuoteToolbarButton(state);
|
|
14364
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
|
|
14365
|
+
});
|
|
13908
14366
|
const useRawMarkdownToolbarButton = () => {
|
|
13909
14367
|
const { setRawMode } = useEditorContext();
|
|
13910
14368
|
const onMouseDown = (e) => {
|
|
@@ -13919,31 +14377,123 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
13919
14377
|
};
|
|
13920
14378
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
13921
14379
|
const { props } = useRawMarkdownToolbarButton();
|
|
13922
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14380
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14381
|
+
ToolbarButton,
|
|
14382
|
+
{
|
|
14383
|
+
ref,
|
|
14384
|
+
tooltip: "Link",
|
|
14385
|
+
...rest,
|
|
14386
|
+
...props,
|
|
14387
|
+
"data-testid": "markdown-button"
|
|
14388
|
+
},
|
|
14389
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14390
|
+
);
|
|
13923
14391
|
});
|
|
13924
|
-
|
|
13925
|
-
const
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
const
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
};
|
|
14392
|
+
function TableDropdownMenu(props) {
|
|
14393
|
+
const tableSelected = useEditorSelector(
|
|
14394
|
+
(editor2) => someNode(editor2, { match: { type: ELEMENT_TABLE$1 } }),
|
|
14395
|
+
[]
|
|
14396
|
+
);
|
|
14397
|
+
const [enableDeleteColumn, enableDeleteRow] = useEditorSelector((editor2) => {
|
|
14398
|
+
const tableNodeEntry = findNode(editor2, { match: { type: ELEMENT_TABLE$1 } });
|
|
14399
|
+
if (!tableNodeEntry)
|
|
14400
|
+
return [false, false];
|
|
14401
|
+
const [tableNode] = tableNodeEntry;
|
|
14402
|
+
if (!isElement(tableNode))
|
|
14403
|
+
return [false, false];
|
|
14404
|
+
const columnCount = getTableColumnCount(tableNode);
|
|
14405
|
+
const rowCount = tableNode.children.length;
|
|
14406
|
+
return [columnCount > 1, rowCount > 1];
|
|
14407
|
+
}, []);
|
|
14408
|
+
const editor = useEditorRef();
|
|
14409
|
+
const openState = useOpenState();
|
|
14410
|
+
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { isDropdown: true, pressed: openState.open, tooltip: "Table" }, /* @__PURE__ */ React__default.createElement(Icons.table, null))), /* @__PURE__ */ React__default.createElement(
|
|
14411
|
+
DropdownMenuContent,
|
|
14412
|
+
{
|
|
14413
|
+
align: "start",
|
|
14414
|
+
className: "flex w-[180px] min-w-0 flex-col gap-0.5"
|
|
14415
|
+
},
|
|
14416
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14417
|
+
DropdownMenuItem,
|
|
14418
|
+
{
|
|
14419
|
+
className: "min-w-[180px]",
|
|
14420
|
+
disabled: tableSelected,
|
|
14421
|
+
onSelect: () => {
|
|
14422
|
+
insertTable(editor);
|
|
14423
|
+
focusEditor(editor);
|
|
14424
|
+
}
|
|
14425
|
+
},
|
|
14426
|
+
/* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14427
|
+
"Insert table"
|
|
14428
|
+
),
|
|
14429
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14430
|
+
DropdownMenuItem,
|
|
14431
|
+
{
|
|
14432
|
+
className: "min-w-[180px]",
|
|
14433
|
+
disabled: !tableSelected,
|
|
14434
|
+
onSelect: () => {
|
|
14435
|
+
deleteTable(editor);
|
|
14436
|
+
focusEditor(editor);
|
|
14437
|
+
}
|
|
14438
|
+
},
|
|
14439
|
+
/* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14440
|
+
"Delete table"
|
|
14441
|
+
),
|
|
14442
|
+
/* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.column, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Column")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
|
|
14443
|
+
DropdownMenuItem,
|
|
14444
|
+
{
|
|
14445
|
+
className: "min-w-[180px]",
|
|
14446
|
+
disabled: !tableSelected,
|
|
14447
|
+
onSelect: () => {
|
|
14448
|
+
insertTableColumn(editor);
|
|
14449
|
+
focusEditor(editor);
|
|
14450
|
+
}
|
|
14451
|
+
},
|
|
14452
|
+
/* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14453
|
+
"Insert column after"
|
|
14454
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
14455
|
+
DropdownMenuItem,
|
|
14456
|
+
{
|
|
14457
|
+
className: "min-w-[180px]",
|
|
14458
|
+
disabled: !enableDeleteColumn,
|
|
14459
|
+
onSelect: () => {
|
|
14460
|
+
deleteColumn(editor);
|
|
14461
|
+
focusEditor(editor);
|
|
14462
|
+
}
|
|
14463
|
+
},
|
|
14464
|
+
/* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14465
|
+
"Delete column"
|
|
14466
|
+
))),
|
|
14467
|
+
/* @__PURE__ */ React__default.createElement(DropdownMenuSub, null, /* @__PURE__ */ React__default.createElement(DropdownMenuSubTrigger, { disabled: !tableSelected }, /* @__PURE__ */ React__default.createElement(Icons.row, { className: iconVariants({ variant: "menuItem" }) }), /* @__PURE__ */ React__default.createElement("span", null, "Row")), /* @__PURE__ */ React__default.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React__default.createElement(
|
|
14468
|
+
DropdownMenuItem,
|
|
14469
|
+
{
|
|
14470
|
+
className: "min-w-[180px]",
|
|
14471
|
+
disabled: !tableSelected,
|
|
14472
|
+
onSelect: () => {
|
|
14473
|
+
insertTableRow(editor);
|
|
14474
|
+
focusEditor(editor);
|
|
14475
|
+
}
|
|
14476
|
+
},
|
|
14477
|
+
/* @__PURE__ */ React__default.createElement(Icons.add, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14478
|
+
"Insert row after"
|
|
14479
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
14480
|
+
DropdownMenuItem,
|
|
14481
|
+
{
|
|
14482
|
+
className: "min-w-[180px]",
|
|
14483
|
+
disabled: !enableDeleteRow,
|
|
14484
|
+
onSelect: () => {
|
|
14485
|
+
deleteRow(editor);
|
|
14486
|
+
focusEditor(editor);
|
|
14487
|
+
}
|
|
14488
|
+
},
|
|
14489
|
+
/* @__PURE__ */ React__default.createElement(Icons.minus, { className: iconVariants({ variant: "menuItem" }) }),
|
|
14490
|
+
"Delete row"
|
|
14491
|
+
)))
|
|
14492
|
+
));
|
|
14493
|
+
}
|
|
13940
14494
|
function TemplatesToolbarButton() {
|
|
13941
14495
|
const { templates } = useToolbarContext();
|
|
13942
|
-
const showEmbed = templates.length > 0;
|
|
13943
14496
|
const editor = useEditorState();
|
|
13944
|
-
if (!showEmbed) {
|
|
13945
|
-
return null;
|
|
13946
|
-
}
|
|
13947
14497
|
return /* @__PURE__ */ React__default.createElement(EmbedButton, { templates, editor });
|
|
13948
14498
|
}
|
|
13949
14499
|
const EmbedButton = ({ editor, templates }) => {
|
|
@@ -13984,99 +14534,118 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
13984
14534
|
template.label || template.name
|
|
13985
14535
|
))));
|
|
13986
14536
|
};
|
|
13987
|
-
const ICON_WIDTH = 32;
|
|
13988
|
-
const EMBED_ICON_WIDTH = 78;
|
|
13989
|
-
const useResize = (ref, callback) => {
|
|
13990
|
-
React__default.useEffect(() => {
|
|
13991
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
13992
|
-
for (const entry of entries) {
|
|
13993
|
-
callback(entry);
|
|
13994
|
-
}
|
|
13995
|
-
});
|
|
13996
|
-
if (ref.current) {
|
|
13997
|
-
resizeObserver.observe(ref.current);
|
|
13998
|
-
}
|
|
13999
|
-
return () => resizeObserver.disconnect();
|
|
14000
|
-
}, [ref.current]);
|
|
14001
|
-
};
|
|
14002
|
-
function OverflowMenu({
|
|
14003
|
-
children,
|
|
14004
|
-
...props
|
|
14005
|
-
}) {
|
|
14006
|
-
const openState = useOpenState();
|
|
14007
|
-
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
|
|
14008
|
-
ToolbarButton,
|
|
14009
|
-
{
|
|
14010
|
-
showArrow: false,
|
|
14011
|
-
className: "lg:min-w-[130px]",
|
|
14012
|
-
isDropdown: true,
|
|
14013
|
-
pressed: openState.open,
|
|
14014
|
-
tooltip: "Headings"
|
|
14015
|
-
},
|
|
14016
|
-
/* @__PURE__ */ React__default.createElement(Icons.overflow, { className: "size-5" })
|
|
14017
|
-
)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { align: "start", className: "min-w-0 flex flex-grow" }, children));
|
|
14018
|
-
}
|
|
14019
14537
|
const toolbarItems = {
|
|
14020
14538
|
heading: {
|
|
14021
|
-
label:
|
|
14539
|
+
label: HEADING_LABEL,
|
|
14540
|
+
width: (paragraphIconExists) => paragraphIconExists ? HEADING_ICON_WITH_TEXT : HEADING_ICON_ONLY,
|
|
14541
|
+
// Dynamically handle width based on paragraph icon
|
|
14022
14542
|
Component: /* @__PURE__ */ React__default.createElement(ToolbarGroup, { noSeparator: true }, /* @__PURE__ */ React__default.createElement(HeadingsMenu, null))
|
|
14023
14543
|
},
|
|
14024
14544
|
link: {
|
|
14025
14545
|
label: "Link",
|
|
14546
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14026
14547
|
Component: /* @__PURE__ */ React__default.createElement(LinkToolbarButton, null)
|
|
14027
14548
|
},
|
|
14028
14549
|
image: {
|
|
14029
14550
|
label: "Image",
|
|
14551
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14030
14552
|
Component: /* @__PURE__ */ React__default.createElement(ImageToolbarButton, null)
|
|
14031
14553
|
},
|
|
14032
14554
|
quote: {
|
|
14033
14555
|
label: "Quote",
|
|
14556
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14034
14557
|
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
|
|
14035
14558
|
},
|
|
14036
14559
|
ul: {
|
|
14037
14560
|
label: "Unordered List",
|
|
14561
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14038
14562
|
Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_UL })
|
|
14039
14563
|
},
|
|
14040
14564
|
ol: {
|
|
14041
14565
|
label: "Ordered List",
|
|
14566
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14042
14567
|
Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_OL })
|
|
14043
14568
|
},
|
|
14044
14569
|
bold: {
|
|
14045
14570
|
label: "Bold",
|
|
14571
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14046
14572
|
Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null))
|
|
14047
14573
|
},
|
|
14048
14574
|
italic: {
|
|
14049
14575
|
label: "Italic",
|
|
14576
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14050
14577
|
Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null))
|
|
14051
14578
|
},
|
|
14052
14579
|
code: {
|
|
14053
14580
|
label: "Code",
|
|
14581
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14054
14582
|
Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null))
|
|
14055
14583
|
},
|
|
14056
14584
|
codeBlock: {
|
|
14057
14585
|
label: "Code Block",
|
|
14586
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14058
14587
|
Component: /* @__PURE__ */ React__default.createElement(CodeBlockToolbarButton, null)
|
|
14059
14588
|
},
|
|
14589
|
+
mermaid: {
|
|
14590
|
+
label: "Mermaid",
|
|
14591
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14592
|
+
Component: /* @__PURE__ */ React__default.createElement(MermaidToolbarButton, null)
|
|
14593
|
+
},
|
|
14594
|
+
table: {
|
|
14595
|
+
label: "Table",
|
|
14596
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14597
|
+
Component: /* @__PURE__ */ React__default.createElement(TableDropdownMenu, null)
|
|
14598
|
+
},
|
|
14060
14599
|
raw: {
|
|
14061
14600
|
label: "Raw Markdown",
|
|
14601
|
+
width: () => STANDARD_ICON_WIDTH,
|
|
14062
14602
|
Component: /* @__PURE__ */ React__default.createElement(RawMarkdownToolbarButton, null)
|
|
14063
14603
|
},
|
|
14064
14604
|
embed: {
|
|
14065
14605
|
label: "Templates",
|
|
14606
|
+
width: () => EMBED_ICON_WIDTH,
|
|
14066
14607
|
Component: /* @__PURE__ */ React__default.createElement(TemplatesToolbarButton, null)
|
|
14067
14608
|
}
|
|
14068
14609
|
};
|
|
14069
14610
|
function FixedToolbarButtons() {
|
|
14070
14611
|
const toolbarRef = React__default.useRef(null);
|
|
14071
14612
|
const [itemsShown, setItemsShown] = React__default.useState(11);
|
|
14072
|
-
const { overrides } = useToolbarContext();
|
|
14613
|
+
const { overrides, templates } = useToolbarContext();
|
|
14614
|
+
const showEmbedButton = templates.length > 0;
|
|
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
|
+
}
|
|
14621
|
+
if (!showEmbedButton) {
|
|
14622
|
+
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14623
|
+
}
|
|
14624
|
+
const editorState = useEditorState();
|
|
14625
|
+
const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE);
|
|
14626
|
+
if (userInTable) {
|
|
14627
|
+
items2 = items2.filter((item) => !unsupportedItemsInTable.has(item.label));
|
|
14628
|
+
}
|
|
14073
14629
|
useResize(toolbarRef, (entry) => {
|
|
14074
14630
|
const width = entry.target.getBoundingClientRect().width;
|
|
14075
|
-
const
|
|
14076
|
-
|
|
14631
|
+
const headingButton = items2.find((item) => item.label === HEADING_LABEL);
|
|
14632
|
+
const headingWidth = headingButton ? headingButton.width(width > CONTAINER_MD_BREAKPOINT) : 0;
|
|
14633
|
+
const availableWidth = width - headingWidth - FLOAT_BUTTON_WIDTH;
|
|
14634
|
+
const { itemFitCount } = items2.reduce(
|
|
14635
|
+
(acc, item) => {
|
|
14636
|
+
if (item.label !== HEADING_LABEL && acc.totalItemsWidth + item.width() <= availableWidth) {
|
|
14637
|
+
return {
|
|
14638
|
+
totalItemsWidth: acc.totalItemsWidth + item.width(),
|
|
14639
|
+
itemFitCount: acc.itemFitCount + 1
|
|
14640
|
+
};
|
|
14641
|
+
}
|
|
14642
|
+
return acc;
|
|
14643
|
+
},
|
|
14644
|
+
{ totalItemsWidth: 0, itemFitCount: 1 }
|
|
14645
|
+
);
|
|
14646
|
+
setItemsShown(itemFitCount);
|
|
14077
14647
|
});
|
|
14078
|
-
|
|
14079
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full overflow-hidden", ref: toolbarRef }, /* @__PURE__ */ React__default.createElement(
|
|
14648
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full overflow-hidden @container/toolbar", ref: toolbarRef }, /* @__PURE__ */ React__default.createElement(
|
|
14080
14649
|
"div",
|
|
14081
14650
|
{
|
|
14082
14651
|
className: "flex",
|
|
@@ -14084,7 +14653,7 @@ function FixedToolbarButtons() {
|
|
|
14084
14653
|
transform: "translateX(calc(-1px))"
|
|
14085
14654
|
}
|
|
14086
14655
|
},
|
|
14087
|
-
/* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
14656
|
+
/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, items2.slice(0, itemsShown).map((item) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: item.label }, item.Component)), items2.length > itemsShown && /* @__PURE__ */ React__default.createElement(OverflowMenu, null, items2.slice(itemsShown).flatMap((c) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: c.label }, c.Component))))
|
|
14088
14657
|
));
|
|
14089
14658
|
}
|
|
14090
14659
|
const FloatingToolbar = withRef(({ children, state, ...props }, componentRef) => {
|
|
@@ -14199,6 +14768,10 @@ function TurnIntoDropdownMenu(props) {
|
|
|
14199
14768
|
const openState = useOpenState();
|
|
14200
14769
|
const selectedItem = items.find((item) => item.value === value) ?? defaultItem;
|
|
14201
14770
|
const { icon: SelectedItemIcon, label: selectedItemLabel } = selectedItem;
|
|
14771
|
+
const editorState = useEditorState();
|
|
14772
|
+
const userInTable = helpers.isNodeActive(editorState, ELEMENT_TABLE$1);
|
|
14773
|
+
if (userInTable)
|
|
14774
|
+
return null;
|
|
14202
14775
|
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { modal: false, ...openState, ...props }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(
|
|
14203
14776
|
ToolbarButton,
|
|
14204
14777
|
{
|
|
@@ -14240,49 +14813,6 @@ function TurnIntoDropdownMenu(props) {
|
|
|
14240
14813
|
function FloatingToolbarButtons() {
|
|
14241
14814
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TurnIntoDropdownMenu, null));
|
|
14242
14815
|
}
|
|
14243
|
-
const buttonVariants = cva(
|
|
14244
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
14245
|
-
{
|
|
14246
|
-
defaultVariants: {
|
|
14247
|
-
size: "default",
|
|
14248
|
-
variant: "default"
|
|
14249
|
-
},
|
|
14250
|
-
variants: {
|
|
14251
|
-
isMenu: {
|
|
14252
|
-
true: "h-auto w-full cursor-pointer justify-start"
|
|
14253
|
-
},
|
|
14254
|
-
size: {
|
|
14255
|
-
default: "h-10 px-4 py-2",
|
|
14256
|
-
icon: "size-10",
|
|
14257
|
-
lg: "h-11 rounded-md px-8",
|
|
14258
|
-
none: "",
|
|
14259
|
-
sm: "h-9 rounded-md px-3",
|
|
14260
|
-
sms: "size-9 rounded-md px-0",
|
|
14261
|
-
xs: "h-8 rounded-md px-3"
|
|
14262
|
-
},
|
|
14263
|
-
variant: {
|
|
14264
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14265
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14266
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14267
|
-
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
14268
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14269
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14270
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
14271
|
-
}
|
|
14272
|
-
}
|
|
14273
|
-
}
|
|
14274
|
-
);
|
|
14275
|
-
withRef(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {
|
|
14276
|
-
const Comp = asChild ? Slot : "button";
|
|
14277
|
-
return /* @__PURE__ */ React.createElement(
|
|
14278
|
-
Comp,
|
|
14279
|
-
{
|
|
14280
|
-
className: cn$1(buttonVariants({ className, isMenu, size, variant })),
|
|
14281
|
-
ref,
|
|
14282
|
-
...props
|
|
14283
|
-
}
|
|
14284
|
-
);
|
|
14285
|
-
});
|
|
14286
14816
|
const inputVariants = cva(
|
|
14287
14817
|
"flex w-full rounded-md bg-transparent text-sm file:border-0 file:bg-background file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
14288
14818
|
{
|
|
@@ -14303,22 +14833,6 @@ const inputVariants = cva(
|
|
|
14303
14833
|
}
|
|
14304
14834
|
);
|
|
14305
14835
|
withVariants("input", inputVariants, ["variant", "h"]);
|
|
14306
|
-
const popoverVariants = cva(
|
|
14307
|
-
"w-72 rounded-md border bg-popover 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 print:hidden"
|
|
14308
|
-
);
|
|
14309
|
-
withRef(
|
|
14310
|
-
({ align = "center", className, sideOffset = 4, style, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
14311
|
-
PopoverPrimitive.Content,
|
|
14312
|
-
{
|
|
14313
|
-
align,
|
|
14314
|
-
className: cn$1(popoverVariants(), className),
|
|
14315
|
-
ref,
|
|
14316
|
-
sideOffset,
|
|
14317
|
-
style: { zIndex: 1e3, ...style },
|
|
14318
|
-
...props
|
|
14319
|
-
}
|
|
14320
|
-
))
|
|
14321
|
-
);
|
|
14322
14836
|
const floatingOptions = {
|
|
14323
14837
|
middleware: [
|
|
14324
14838
|
offset(12),
|
|
@@ -14378,7 +14892,7 @@ function LinkFloatingToolbar({ state }) {
|
|
|
14378
14892
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React__default.createElement("div", { className: "box-content flex h-9 items-center gap-1" }, /* @__PURE__ */ React__default.createElement(
|
|
14379
14893
|
"button",
|
|
14380
14894
|
{
|
|
14381
|
-
className: buttonVariants({ size: "sm", variant: "ghost" }),
|
|
14895
|
+
className: buttonVariants$1({ size: "sm", variant: "ghost" }),
|
|
14382
14896
|
type: "button",
|
|
14383
14897
|
...editButtonProps
|
|
14384
14898
|
},
|
|
@@ -14386,7 +14900,7 @@ function LinkFloatingToolbar({ state }) {
|
|
|
14386
14900
|
), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
|
|
14387
14901
|
LinkOpenButton,
|
|
14388
14902
|
{
|
|
14389
|
-
className: buttonVariants({
|
|
14903
|
+
className: buttonVariants$1({
|
|
14390
14904
|
size: "sms",
|
|
14391
14905
|
variant: "ghost"
|
|
14392
14906
|
})
|
|
@@ -14395,7 +14909,7 @@ function LinkFloatingToolbar({ state }) {
|
|
|
14395
14909
|
), /* @__PURE__ */ React__default.createElement(Separator, { orientation: "vertical" }), /* @__PURE__ */ React__default.createElement(
|
|
14396
14910
|
"button",
|
|
14397
14911
|
{
|
|
14398
|
-
className: buttonVariants({
|
|
14912
|
+
className: buttonVariants$1({
|
|
14399
14913
|
size: "sms",
|
|
14400
14914
|
variant: "ghost"
|
|
14401
14915
|
}),
|
|
@@ -14431,6 +14945,9 @@ const isUrl = (string) => {
|
|
|
14431
14945
|
if (typeof string !== "string") {
|
|
14432
14946
|
return false;
|
|
14433
14947
|
}
|
|
14948
|
+
if (string.startsWith("#")) {
|
|
14949
|
+
return true;
|
|
14950
|
+
}
|
|
14434
14951
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
14435
14952
|
const emailLinkMatch = string.match(emailLintRE);
|
|
14436
14953
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -14452,12 +14969,12 @@ const isUrl = (string) => {
|
|
|
14452
14969
|
}
|
|
14453
14970
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
14454
14971
|
};
|
|
14455
|
-
const RichEditor = (
|
|
14972
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
14456
14973
|
var _a;
|
|
14457
14974
|
const initialValue = React__default.useMemo(
|
|
14458
14975
|
() => {
|
|
14459
14976
|
var _a2, _b;
|
|
14460
|
-
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: "" }] }];
|
|
14461
14978
|
},
|
|
14462
14979
|
[]
|
|
14463
14980
|
);
|
|
@@ -14469,6 +14986,7 @@ const RichEditor = (props) => {
|
|
|
14469
14986
|
createMdxBlockPlugin(),
|
|
14470
14987
|
createMdxInlinePlugin(),
|
|
14471
14988
|
createImgPlugin(),
|
|
14989
|
+
createMermaidPlugin(),
|
|
14472
14990
|
createInvalidMarkdownPlugin(),
|
|
14473
14991
|
createLinkPlugin({
|
|
14474
14992
|
options: {
|
|
@@ -14484,7 +15002,7 @@ const RichEditor = (props) => {
|
|
|
14484
15002
|
),
|
|
14485
15003
|
[]
|
|
14486
15004
|
);
|
|
14487
|
-
const tempId = [
|
|
15005
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
14488
15006
|
const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
|
|
14489
15007
|
const ref = React__default.useRef(null);
|
|
14490
15008
|
React__default.useEffect(() => {
|
|
@@ -14494,13 +15012,13 @@ const RichEditor = (props) => {
|
|
|
14494
15012
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
14495
15013
|
'[role="textbox"]'
|
|
14496
15014
|
);
|
|
14497
|
-
if (
|
|
15015
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
14498
15016
|
if (plateElement)
|
|
14499
15017
|
plateElement.focus();
|
|
14500
15018
|
}
|
|
14501
15019
|
}, 100);
|
|
14502
15020
|
}
|
|
14503
|
-
}, [
|
|
15021
|
+
}, [field.experimental_focusIntent, ref]);
|
|
14504
15022
|
return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
|
|
14505
15023
|
Plate,
|
|
14506
15024
|
{
|
|
@@ -14508,21 +15026,22 @@ const RichEditor = (props) => {
|
|
|
14508
15026
|
initialValue,
|
|
14509
15027
|
plugins: plugins$2,
|
|
14510
15028
|
onChange: (value) => {
|
|
14511
|
-
|
|
15029
|
+
input.onChange({
|
|
14512
15030
|
type: "root",
|
|
14513
|
-
children: value
|
|
15031
|
+
children: value,
|
|
15032
|
+
embedCode: input.value.embedCode
|
|
14514
15033
|
});
|
|
14515
15034
|
}
|
|
14516
15035
|
},
|
|
14517
15036
|
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
14518
15037
|
ToolbarProvider,
|
|
14519
15038
|
{
|
|
14520
|
-
tinaForm
|
|
14521
|
-
templates:
|
|
14522
|
-
overrides: (
|
|
15039
|
+
tinaForm,
|
|
15040
|
+
templates: field.templates,
|
|
15041
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
14523
15042
|
},
|
|
14524
15043
|
/* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
|
|
14525
|
-
/* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
|
|
15044
|
+
((_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
|
|
14526
15045
|
), /* @__PURE__ */ React__default.createElement(Editor, null))
|
|
14527
15046
|
));
|
|
14528
15047
|
};
|
|
@@ -29476,6 +29995,7 @@ class TinaAdminApi {
|
|
|
29476
29995
|
relativePath
|
|
29477
29996
|
filename
|
|
29478
29997
|
extension
|
|
29998
|
+
hasReferences
|
|
29479
29999
|
}
|
|
29480
30000
|
}
|
|
29481
30001
|
}
|
|
@@ -29567,6 +30087,9 @@ class TinaAdminApi {
|
|
|
29567
30087
|
document(collection:$collection, relativePath:$relativePath) {
|
|
29568
30088
|
... on Document {
|
|
29569
30089
|
_values
|
|
30090
|
+
_sys {
|
|
30091
|
+
hasReferences
|
|
30092
|
+
}
|
|
29570
30093
|
}
|
|
29571
30094
|
}
|
|
29572
30095
|
}`;
|
|
@@ -31293,6 +31816,23 @@ const CollectionListPage = () => {
|
|
|
31293
31816
|
DeleteModal,
|
|
31294
31817
|
{
|
|
31295
31818
|
filename: vars.relativePath,
|
|
31819
|
+
checkRefsFunc: async () => {
|
|
31820
|
+
var _a2, _b2;
|
|
31821
|
+
try {
|
|
31822
|
+
const doc = await admin.fetchDocument(
|
|
31823
|
+
collection.name,
|
|
31824
|
+
vars.relativePath,
|
|
31825
|
+
true
|
|
31826
|
+
);
|
|
31827
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31828
|
+
} catch (error) {
|
|
31829
|
+
cms.alerts.error(
|
|
31830
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31831
|
+
);
|
|
31832
|
+
console.error(error);
|
|
31833
|
+
throw error;
|
|
31834
|
+
}
|
|
31835
|
+
},
|
|
31296
31836
|
deleteFunc: async () => {
|
|
31297
31837
|
try {
|
|
31298
31838
|
await admin.deleteDocument(vars);
|
|
@@ -31301,6 +31841,12 @@ const CollectionListPage = () => {
|
|
|
31301
31841
|
);
|
|
31302
31842
|
reFetchCollection();
|
|
31303
31843
|
} catch (error) {
|
|
31844
|
+
if (error.message.indexOf("has references")) {
|
|
31845
|
+
cms.alerts.error(
|
|
31846
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31847
|
+
);
|
|
31848
|
+
return;
|
|
31849
|
+
}
|
|
31304
31850
|
cms.alerts.warn(
|
|
31305
31851
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31306
31852
|
);
|
|
@@ -31352,6 +31898,12 @@ const CollectionListPage = () => {
|
|
|
31352
31898
|
cms.alerts.info("Document was successfully renamed");
|
|
31353
31899
|
reFetchCollection();
|
|
31354
31900
|
} catch (error) {
|
|
31901
|
+
if (error.message.indexOf("has references")) {
|
|
31902
|
+
cms.alerts.error(
|
|
31903
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31904
|
+
);
|
|
31905
|
+
return;
|
|
31906
|
+
}
|
|
31355
31907
|
cms.alerts.warn(
|
|
31356
31908
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31357
31909
|
);
|
|
@@ -31825,8 +32377,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
31825
32377
|
const NoDocumentsPlaceholder = () => {
|
|
31826
32378
|
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."));
|
|
31827
32379
|
};
|
|
31828
|
-
const DeleteModal = ({
|
|
31829
|
-
|
|
32380
|
+
const DeleteModal = ({
|
|
32381
|
+
close: close2,
|
|
32382
|
+
deleteFunc,
|
|
32383
|
+
checkRefsFunc,
|
|
32384
|
+
filename
|
|
32385
|
+
}) => {
|
|
32386
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32387
|
+
useEffect(() => {
|
|
32388
|
+
checkRefsFunc().then((result) => {
|
|
32389
|
+
setHasRefs(result);
|
|
32390
|
+
});
|
|
32391
|
+
}, [filename, checkRefsFunc]);
|
|
32392
|
+
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(
|
|
31830
32393
|
Button$1,
|
|
31831
32394
|
{
|
|
31832
32395
|
style: { flexGrow: 3 },
|
|
@@ -33188,5 +33751,6 @@ export {
|
|
|
33188
33751
|
useScreenPlugin,
|
|
33189
33752
|
useTinaAuthRedirect,
|
|
33190
33753
|
wrapFieldWithError,
|
|
33754
|
+
wrapFieldWithNoHeader,
|
|
33191
33755
|
wrapFieldsWithMeta
|
|
33192
33756
|
};
|