tinacms 0.0.0-ecea7ac-20241011043815 → 0.0.0-ed3db71-20250205054832
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +90 -61
- package/dist/client.mjs +49 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.js +275 -304
- package/dist/index.mjs +287 -316
- package/dist/node-cache-5e8db9f0.mjs +63 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +4 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/dist/unifiedClient/index.d.ts +8 -1
- package/package.json +28 -28
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
- package/dist/node-cache-7fa2452c.mjs +0 -43
package/dist/index.mjs
CHANGED
|
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition
|
|
10
|
-
import { createPortal
|
|
9
|
+
import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
11
|
import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
|
|
12
12
|
import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
|
|
13
13
|
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
|
|
@@ -801,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
|
|
|
801
801
|
);
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
+
function wrapFieldWithNoHeader(Field2) {
|
|
805
|
+
return (props) => {
|
|
806
|
+
return /* @__PURE__ */ React.createElement(
|
|
807
|
+
FieldMeta,
|
|
808
|
+
{
|
|
809
|
+
name: props.input.name,
|
|
810
|
+
label: false,
|
|
811
|
+
description: "",
|
|
812
|
+
error: props.meta.error,
|
|
813
|
+
index: props.index,
|
|
814
|
+
tinaForm: props.tinaForm
|
|
815
|
+
},
|
|
816
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
817
|
+
);
|
|
818
|
+
};
|
|
819
|
+
}
|
|
804
820
|
function wrapFieldWithError(Field2) {
|
|
805
821
|
return (props) => {
|
|
806
822
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -873,6 +889,16 @@ const FieldDescription = ({
|
|
|
873
889
|
className,
|
|
874
890
|
...props
|
|
875
891
|
}) => {
|
|
892
|
+
if (typeof children === "string") {
|
|
893
|
+
return /* @__PURE__ */ React.createElement(
|
|
894
|
+
"span",
|
|
895
|
+
{
|
|
896
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
897
|
+
...props,
|
|
898
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
899
|
+
}
|
|
900
|
+
);
|
|
901
|
+
}
|
|
876
902
|
return /* @__PURE__ */ React.createElement(
|
|
877
903
|
"span",
|
|
878
904
|
{
|
|
@@ -1332,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
|
|
|
1332
1358
|
]);
|
|
1333
1359
|
const ListElement = withRef(
|
|
1334
1360
|
({ children, variant = "ul", ...props }, ref) => {
|
|
1335
|
-
const
|
|
1336
|
-
return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(
|
|
1361
|
+
const Component = variant;
|
|
1362
|
+
return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
|
|
1337
1363
|
}
|
|
1338
1364
|
);
|
|
1339
1365
|
const ELEMENT_MERMAID = "mermaid";
|
|
@@ -1348,7 +1374,7 @@ const MermaidElementWithRef = ({ config }) => {
|
|
|
1348
1374
|
useEffect(() => {
|
|
1349
1375
|
if (mermaidRef.current) {
|
|
1350
1376
|
mermaid.initialize({ startOnLoad: true });
|
|
1351
|
-
mermaid.
|
|
1377
|
+
mermaid.init();
|
|
1352
1378
|
}
|
|
1353
1379
|
}, [config]);
|
|
1354
1380
|
return /* @__PURE__ */ React__default.createElement("div", { contentEditable: false, className: "border-border border-b" }, /* @__PURE__ */ React__default.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React__default.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
|
|
@@ -1375,7 +1401,7 @@ flowchart TD
|
|
|
1375
1401
|
--> id2(modify me to see changes!)
|
|
1376
1402
|
id2
|
|
1377
1403
|
--> id3(Click the top button to preview the changes)
|
|
1378
|
-
--> id4(Learn about mermaid diagrams
|
|
1404
|
+
--> id4(Learn about mermaid diagrams - mermaid.js.org)`;
|
|
1379
1405
|
const MermaidElement = withRef(
|
|
1380
1406
|
({ children, nodeProps, element, ...props }, ref) => {
|
|
1381
1407
|
const [mermaidConfig, setMermaidConfig] = useState(
|
|
@@ -1391,7 +1417,7 @@ const MermaidElement = withRef(
|
|
|
1391
1417
|
children: [{ type: "text", text: "" }]
|
|
1392
1418
|
};
|
|
1393
1419
|
useEffect(() => {
|
|
1394
|
-
if (mermaid.parse(mermaidConfig
|
|
1420
|
+
if (mermaid.parse(mermaidConfig)) {
|
|
1395
1421
|
setMermaidError(null);
|
|
1396
1422
|
}
|
|
1397
1423
|
}, [mermaidConfig]);
|
|
@@ -3653,7 +3679,7 @@ function TinaForm({ form, children }) {
|
|
|
3653
3679
|
}));
|
|
3654
3680
|
}
|
|
3655
3681
|
function TinaField({
|
|
3656
|
-
Component
|
|
3682
|
+
Component,
|
|
3657
3683
|
children,
|
|
3658
3684
|
...fieldProps
|
|
3659
3685
|
}) {
|
|
@@ -3661,7 +3687,7 @@ function TinaField({
|
|
|
3661
3687
|
if (!isEditing)
|
|
3662
3688
|
return children || null;
|
|
3663
3689
|
return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
|
|
3664
|
-
return /* @__PURE__ */ React.createElement(
|
|
3690
|
+
return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
|
|
3665
3691
|
});
|
|
3666
3692
|
}
|
|
3667
3693
|
TinaField.propTypes = {
|
|
@@ -3703,7 +3729,7 @@ const Button$1 = ({
|
|
|
3703
3729
|
};
|
|
3704
3730
|
const sizeClasses = {
|
|
3705
3731
|
small: `text-xs h-8 px-3`,
|
|
3706
|
-
medium: `text-sm h-10 px-
|
|
3732
|
+
medium: `text-sm h-10 px-8`,
|
|
3707
3733
|
custom: ``
|
|
3708
3734
|
};
|
|
3709
3735
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -3831,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
|
|
|
3831
3857
|
function _objectWithoutProperties(source, excluded) {
|
|
3832
3858
|
if (source == null)
|
|
3833
3859
|
return {};
|
|
3834
|
-
var target = _objectWithoutPropertiesLoose
|
|
3860
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3835
3861
|
var key, i;
|
|
3836
3862
|
if (Object.getOwnPropertySymbols) {
|
|
3837
3863
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -3846,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
3846
3872
|
}
|
|
3847
3873
|
return target;
|
|
3848
3874
|
}
|
|
3849
|
-
function _objectWithoutPropertiesLoose
|
|
3875
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3850
3876
|
if (source == null)
|
|
3851
3877
|
return {};
|
|
3852
3878
|
var target = {};
|
|
@@ -4936,7 +4962,28 @@ const NumberInput = ({
|
|
|
4936
4962
|
onChange,
|
|
4937
4963
|
value,
|
|
4938
4964
|
step
|
|
4939
|
-
}) => /* @__PURE__ */ React.createElement(
|
|
4965
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
4966
|
+
Input,
|
|
4967
|
+
{
|
|
4968
|
+
type: "number",
|
|
4969
|
+
step,
|
|
4970
|
+
value,
|
|
4971
|
+
onChange: (event) => {
|
|
4972
|
+
const inputValue = event.target.value;
|
|
4973
|
+
const newValue = inputValue === "" ? void 0 : inputValue;
|
|
4974
|
+
if (onChange) {
|
|
4975
|
+
const syntheticEvent = {
|
|
4976
|
+
...event,
|
|
4977
|
+
target: {
|
|
4978
|
+
...event.target,
|
|
4979
|
+
value: newValue
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
onChange(syntheticEvent);
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
);
|
|
4940
4987
|
function useCMS() {
|
|
4941
4988
|
return useCMS$1();
|
|
4942
4989
|
}
|
|
@@ -5737,10 +5784,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
|
|
|
5737
5784
|
return /* @__PURE__ */ React__default.createElement(
|
|
5738
5785
|
"button",
|
|
5739
5786
|
{
|
|
5740
|
-
|
|
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"}`,
|
|
5741
5789
|
onClick
|
|
5742
5790
|
},
|
|
5743
|
-
/* @__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" })
|
|
5744
5792
|
);
|
|
5745
5793
|
};
|
|
5746
5794
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5818,27 +5866,35 @@ const BlockSelector = ({
|
|
|
5818
5866
|
))))
|
|
5819
5867
|
))));
|
|
5820
5868
|
};
|
|
5821
|
-
const Group =
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
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
|
+
});
|
|
5832
5885
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
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
|
+
);
|
|
5842
5898
|
const Header = ({ onClick, children }) => {
|
|
5843
5899
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5844
5900
|
"button",
|
|
@@ -7180,244 +7236,65 @@ function pad(type, value) {
|
|
|
7180
7236
|
str = "0" + str;
|
|
7181
7237
|
return str;
|
|
7182
7238
|
}
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
}
|
|
7195
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7196
|
-
if (source == null)
|
|
7197
|
-
return {};
|
|
7198
|
-
var target = {};
|
|
7199
|
-
var sourceKeys = Object.keys(source);
|
|
7200
|
-
var key, i;
|
|
7201
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
7202
|
-
key = sourceKeys[i];
|
|
7203
|
-
if (excluded.indexOf(key) >= 0)
|
|
7204
|
-
continue;
|
|
7205
|
-
target[key] = source[key];
|
|
7206
|
-
}
|
|
7207
|
-
return target;
|
|
7208
|
-
}
|
|
7209
|
-
function _assertThisInitialized(self) {
|
|
7210
|
-
if (self === void 0) {
|
|
7211
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7212
|
-
}
|
|
7213
|
-
return self;
|
|
7214
|
-
}
|
|
7215
|
-
function isNodeFound(current, componentNode, ignoreClass) {
|
|
7216
|
-
if (current === componentNode) {
|
|
7217
|
-
return true;
|
|
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];
|
|
7218
7250
|
}
|
|
7219
|
-
if (
|
|
7220
|
-
|
|
7251
|
+
if (obj && obj.addEventListener) {
|
|
7252
|
+
obj.addEventListener.apply(obj, args);
|
|
7221
7253
|
}
|
|
7222
|
-
return current.classList.contains(ignoreClass);
|
|
7223
7254
|
}
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
|
|
7230
|
-
return true;
|
|
7231
|
-
}
|
|
7232
|
-
current = current.parentNode || current.host;
|
|
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];
|
|
7233
7260
|
}
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
function clickedScrollbar(evt) {
|
|
7237
|
-
return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
|
|
7238
|
-
}
|
|
7239
|
-
var testPassiveEventSupport = function testPassiveEventSupport2() {
|
|
7240
|
-
if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
|
|
7241
|
-
return;
|
|
7242
|
-
}
|
|
7243
|
-
var passive = false;
|
|
7244
|
-
var options = Object.defineProperty({}, "passive", {
|
|
7245
|
-
get: function get2() {
|
|
7246
|
-
passive = true;
|
|
7247
|
-
}
|
|
7248
|
-
});
|
|
7249
|
-
var noop = function noop2() {
|
|
7250
|
-
};
|
|
7251
|
-
window.addEventListener("testPassiveEventSupport", noop, options);
|
|
7252
|
-
window.removeEventListener("testPassiveEventSupport", noop, options);
|
|
7253
|
-
return passive;
|
|
7254
|
-
};
|
|
7255
|
-
function autoInc(seed) {
|
|
7256
|
-
if (seed === void 0) {
|
|
7257
|
-
seed = 0;
|
|
7261
|
+
if (obj && obj.removeEventListener) {
|
|
7262
|
+
obj.removeEventListener.apply(obj, args);
|
|
7258
7263
|
}
|
|
7259
|
-
return function() {
|
|
7260
|
-
return ++seed;
|
|
7261
|
-
};
|
|
7262
|
-
}
|
|
7263
|
-
var uid = autoInc();
|
|
7264
|
-
var passiveEventSupport;
|
|
7265
|
-
var handlersMap = {};
|
|
7266
|
-
var enabledInstances = {};
|
|
7267
|
-
var touchEvents = ["touchstart", "touchmove"];
|
|
7268
|
-
var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
|
|
7269
|
-
function getEventHandlerOptions(instance, eventName) {
|
|
7270
|
-
var handlerOptions = {};
|
|
7271
|
-
var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
|
|
7272
|
-
if (isTouchEvent && passiveEventSupport) {
|
|
7273
|
-
handlerOptions.passive = !instance.props.preventDefault;
|
|
7274
|
-
}
|
|
7275
|
-
return handlerOptions;
|
|
7276
7264
|
}
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
instance.handleClickOutside(event);
|
|
7297
|
-
return;
|
|
7298
|
-
}
|
|
7299
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
|
|
7300
|
-
};
|
|
7301
|
-
_this.__getComponentNode = function() {
|
|
7302
|
-
var instance = _this.getInstance();
|
|
7303
|
-
if (config && typeof config.setClickOutsideRef === "function") {
|
|
7304
|
-
return config.setClickOutsideRef()(instance);
|
|
7305
|
-
}
|
|
7306
|
-
if (typeof instance.setClickOutsideRef === "function") {
|
|
7307
|
-
return instance.setClickOutsideRef();
|
|
7308
|
-
}
|
|
7309
|
-
return findDOMNode(instance);
|
|
7310
|
-
};
|
|
7311
|
-
_this.enableOnClickOutside = function() {
|
|
7312
|
-
if (typeof document === "undefined" || enabledInstances[_this._uid]) {
|
|
7313
|
-
return;
|
|
7314
|
-
}
|
|
7315
|
-
if (typeof passiveEventSupport === "undefined") {
|
|
7316
|
-
passiveEventSupport = testPassiveEventSupport();
|
|
7317
|
-
}
|
|
7318
|
-
enabledInstances[_this._uid] = true;
|
|
7319
|
-
var events = _this.props.eventTypes;
|
|
7320
|
-
if (!events.forEach) {
|
|
7321
|
-
events = [events];
|
|
7322
|
-
}
|
|
7323
|
-
handlersMap[_this._uid] = function(event) {
|
|
7324
|
-
if (_this.componentNode === null)
|
|
7325
|
-
return;
|
|
7326
|
-
if (_this.initTimeStamp > event.timeStamp)
|
|
7327
|
-
return;
|
|
7328
|
-
if (_this.props.preventDefault) {
|
|
7329
|
-
event.preventDefault();
|
|
7330
|
-
}
|
|
7331
|
-
if (_this.props.stopPropagation) {
|
|
7332
|
-
event.stopPropagation();
|
|
7333
|
-
}
|
|
7334
|
-
if (_this.props.excludeScrollbar && clickedScrollbar(event))
|
|
7335
|
-
return;
|
|
7336
|
-
var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
|
|
7337
|
-
if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
|
|
7338
|
-
return;
|
|
7339
|
-
}
|
|
7340
|
-
_this.__outsideClickHandler(event);
|
|
7341
|
-
};
|
|
7342
|
-
events.forEach(function(eventName) {
|
|
7343
|
-
document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
7344
|
-
});
|
|
7345
|
-
};
|
|
7346
|
-
_this.disableOnClickOutside = function() {
|
|
7347
|
-
delete enabledInstances[_this._uid];
|
|
7348
|
-
var fn = handlersMap[_this._uid];
|
|
7349
|
-
if (fn && typeof document !== "undefined") {
|
|
7350
|
-
var events = _this.props.eventTypes;
|
|
7351
|
-
if (!events.forEach) {
|
|
7352
|
-
events = [events];
|
|
7353
|
-
}
|
|
7354
|
-
events.forEach(function(eventName) {
|
|
7355
|
-
return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
|
|
7356
|
-
});
|
|
7357
|
-
delete handlersMap[_this._uid];
|
|
7358
|
-
}
|
|
7359
|
-
};
|
|
7360
|
-
_this.getRef = function(ref) {
|
|
7361
|
-
return _this.instanceRef = ref;
|
|
7362
|
-
};
|
|
7363
|
-
_this._uid = uid();
|
|
7364
|
-
_this.initTimeStamp = performance.now();
|
|
7365
|
-
return _this;
|
|
7366
|
-
}
|
|
7367
|
-
var _proto = onClickOutside.prototype;
|
|
7368
|
-
_proto.getInstance = function getInstance() {
|
|
7369
|
-
if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
|
|
7370
|
-
return this;
|
|
7371
|
-
}
|
|
7372
|
-
var ref = this.instanceRef;
|
|
7373
|
-
return ref.getInstance ? ref.getInstance() : ref;
|
|
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);
|
|
7374
7284
|
};
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
|
|
7384
|
-
}
|
|
7385
|
-
}
|
|
7386
|
-
this.componentNode = this.__getComponentNode();
|
|
7387
|
-
if (this.props.disableOnClickOutside)
|
|
7388
|
-
return;
|
|
7389
|
-
this.enableOnClickOutside();
|
|
7390
|
-
};
|
|
7391
|
-
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
7392
|
-
this.componentNode = this.__getComponentNode();
|
|
7393
|
-
};
|
|
7394
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
7395
|
-
this.disableOnClickOutside();
|
|
7396
|
-
};
|
|
7397
|
-
_proto.render = function render() {
|
|
7398
|
-
var _this$props = this.props;
|
|
7399
|
-
_this$props.excludeScrollbar;
|
|
7400
|
-
var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
|
|
7401
|
-
if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
|
|
7402
|
-
props.ref = this.getRef;
|
|
7403
|
-
} else {
|
|
7404
|
-
props.wrappedRef = this.getRef;
|
|
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);
|
|
7405
7293
|
}
|
|
7406
|
-
props.disableOnClickOutside = this.disableOnClickOutside;
|
|
7407
|
-
props.enableOnClickOutside = this.enableOnClickOutside;
|
|
7408
|
-
return createElement(WrappedComponent, props);
|
|
7409
7294
|
};
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
excludeScrollbar: config && config.excludeScrollbar || false,
|
|
7414
|
-
outsideClickIgnoreClass: IGNORE_CLASS_NAME,
|
|
7415
|
-
preventDefault: false,
|
|
7416
|
-
stopPropagation: false
|
|
7417
|
-
}, _class.getClass = function() {
|
|
7418
|
-
return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
|
|
7419
|
-
}, _temp;
|
|
7420
|
-
}
|
|
7295
|
+
}, [events, ref]);
|
|
7296
|
+
};
|
|
7297
|
+
var _default = useClickAway$1.default = useClickAway;
|
|
7421
7298
|
const viewModes = {
|
|
7422
7299
|
YEARS: "years",
|
|
7423
7300
|
MONTHS: "months",
|
|
@@ -7946,22 +7823,13 @@ function log(message, method) {
|
|
|
7946
7823
|
}
|
|
7947
7824
|
con[method]("***react-datetime:" + message);
|
|
7948
7825
|
}
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
}
|
|
7954
|
-
|
|
7955
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
|
|
7956
|
-
}
|
|
7957
|
-
handleClickOutside(e) {
|
|
7958
|
-
this.props.onClickOut(e);
|
|
7959
|
-
}
|
|
7960
|
-
setClickOutsideRef() {
|
|
7961
|
-
return this.container.current;
|
|
7962
|
-
}
|
|
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);
|
|
7963
7832
|
}
|
|
7964
|
-
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
7965
7833
|
const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
|
|
7966
7834
|
const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
|
|
7967
7835
|
const format$1 = (val, _name, field) => {
|
|
@@ -8004,7 +7872,10 @@ const DateField = wrapFieldsWithMeta(
|
|
|
8004
7872
|
ReactDateTimeWithStyles,
|
|
8005
7873
|
{
|
|
8006
7874
|
value: input.value,
|
|
8007
|
-
onChange:
|
|
7875
|
+
onChange: (value) => {
|
|
7876
|
+
const newValue = value === "" ? void 0 : value;
|
|
7877
|
+
input.onChange(newValue);
|
|
7878
|
+
},
|
|
8008
7879
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
8009
7880
|
timeFormat: timeFormat || false,
|
|
8010
7881
|
inputProps: { className: textFieldClasses },
|
|
@@ -9456,6 +9327,20 @@ class TinaMediaStore {
|
|
|
9456
9327
|
}
|
|
9457
9328
|
}
|
|
9458
9329
|
}
|
|
9330
|
+
const encodeUrlIfNeeded = (url) => {
|
|
9331
|
+
if (url) {
|
|
9332
|
+
try {
|
|
9333
|
+
const parsed = new URL(url);
|
|
9334
|
+
parsed.pathname = parsed.pathname.split("/").filter((part) => part !== "").map(encodeURIComponent).join("/");
|
|
9335
|
+
return parsed.toString();
|
|
9336
|
+
} catch (e) {
|
|
9337
|
+
console.error("Failed to parse URL:", e);
|
|
9338
|
+
return url;
|
|
9339
|
+
}
|
|
9340
|
+
} else {
|
|
9341
|
+
return url;
|
|
9342
|
+
}
|
|
9343
|
+
};
|
|
9459
9344
|
let MediaManager$1 = class MediaManager {
|
|
9460
9345
|
constructor(store, events) {
|
|
9461
9346
|
this.store = store;
|
|
@@ -9528,6 +9413,20 @@ let MediaManager$1 = class MediaManager {
|
|
|
9528
9413
|
try {
|
|
9529
9414
|
this.events.dispatch({ type: "media:list:start", ...options });
|
|
9530
9415
|
const media = await this.store.list(options);
|
|
9416
|
+
media.items = media.items.map((item) => {
|
|
9417
|
+
if (item.type === "dir") {
|
|
9418
|
+
return item;
|
|
9419
|
+
}
|
|
9420
|
+
if (item.thumbnails) {
|
|
9421
|
+
for (const [size, src] of Object.entries(item.thumbnails)) {
|
|
9422
|
+
item.thumbnails[size] = encodeUrlIfNeeded(src);
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9425
|
+
return {
|
|
9426
|
+
...item,
|
|
9427
|
+
src: encodeUrlIfNeeded(item.src)
|
|
9428
|
+
};
|
|
9429
|
+
});
|
|
9531
9430
|
this.events.dispatch({ type: "media:list:success", ...options, media });
|
|
9532
9431
|
return media;
|
|
9533
9432
|
} catch (error) {
|
|
@@ -9815,7 +9714,7 @@ class SidebarState {
|
|
|
9815
9714
|
}
|
|
9816
9715
|
}
|
|
9817
9716
|
function createScreen({
|
|
9818
|
-
Component
|
|
9717
|
+
Component,
|
|
9819
9718
|
props,
|
|
9820
9719
|
...options
|
|
9821
9720
|
}) {
|
|
@@ -9824,7 +9723,7 @@ function createScreen({
|
|
|
9824
9723
|
layout: "popup",
|
|
9825
9724
|
...options,
|
|
9826
9725
|
Component(screenProps) {
|
|
9827
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
9726
|
+
return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
|
|
9828
9727
|
}
|
|
9829
9728
|
};
|
|
9830
9729
|
}
|
|
@@ -10335,7 +10234,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10335
10234
|
"Event Log"
|
|
10336
10235
|
));
|
|
10337
10236
|
};
|
|
10338
|
-
const version = "2.2
|
|
10237
|
+
const version = "2.6.2";
|
|
10339
10238
|
const Nav = ({
|
|
10340
10239
|
isLocalMode,
|
|
10341
10240
|
className = "",
|
|
@@ -12866,15 +12765,14 @@ const FormBuilder = ({
|
|
|
12866
12765
|
fields: fieldGroup.fields
|
|
12867
12766
|
}
|
|
12868
12767
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12869
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12768
|
+
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
|
|
12870
12769
|
ResetForm,
|
|
12871
12770
|
{
|
|
12872
12771
|
pristine,
|
|
12873
12772
|
reset: async () => {
|
|
12874
12773
|
finalForm.reset();
|
|
12875
12774
|
await tinaForm.reset();
|
|
12876
|
-
}
|
|
12877
|
-
style: { flexGrow: 1 }
|
|
12775
|
+
}
|
|
12878
12776
|
},
|
|
12879
12777
|
tinaForm.buttons.reset
|
|
12880
12778
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12883,8 +12781,7 @@ const FormBuilder = ({
|
|
|
12883
12781
|
onClick: safeHandleSubmit,
|
|
12884
12782
|
disabled: !canSubmit,
|
|
12885
12783
|
busy: submitting,
|
|
12886
|
-
variant: "primary"
|
|
12887
|
-
style: { flexGrow: 3 }
|
|
12784
|
+
variant: "primary"
|
|
12888
12785
|
},
|
|
12889
12786
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12890
12787
|
!submitting && tinaForm.buttons.save
|
|
@@ -13266,9 +13163,9 @@ const EllipsisIcon = ({ title }) => {
|
|
|
13266
13163
|
));
|
|
13267
13164
|
};
|
|
13268
13165
|
const Wrapper$1 = ({ inline, children }) => {
|
|
13269
|
-
const
|
|
13166
|
+
const Component = inline ? "span" : "div";
|
|
13270
13167
|
return /* @__PURE__ */ React__default.createElement(
|
|
13271
|
-
|
|
13168
|
+
Component,
|
|
13272
13169
|
{
|
|
13273
13170
|
contentEditable: false,
|
|
13274
13171
|
style: { userSelect: "none" },
|
|
@@ -13854,6 +13751,7 @@ const unsupportedItemsInTable = /* @__PURE__ */ new Set([
|
|
|
13854
13751
|
"Unordered List",
|
|
13855
13752
|
"Ordered List",
|
|
13856
13753
|
"Quote",
|
|
13754
|
+
"Mermaid",
|
|
13857
13755
|
"Heading 1",
|
|
13858
13756
|
"Heading 2",
|
|
13859
13757
|
"Heading 3",
|
|
@@ -14055,13 +13953,13 @@ const TooltipContent = withCn(
|
|
|
14055
13953
|
}),
|
|
14056
13954
|
"z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
14057
13955
|
);
|
|
14058
|
-
function withTooltip(
|
|
13956
|
+
function withTooltip(Component) {
|
|
14059
13957
|
return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
|
|
14060
13958
|
const [mounted, setMounted] = React__default.useState(false);
|
|
14061
13959
|
React__default.useEffect(() => {
|
|
14062
13960
|
setMounted(true);
|
|
14063
13961
|
}, []);
|
|
14064
|
-
const component = /* @__PURE__ */ React__default.createElement(
|
|
13962
|
+
const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
|
|
14065
13963
|
if (tooltip && mounted) {
|
|
14066
13964
|
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)));
|
|
14067
13965
|
}
|
|
@@ -14453,6 +14351,7 @@ function OverflowMenu({
|
|
|
14453
14351
|
ToolbarButton,
|
|
14454
14352
|
{
|
|
14455
14353
|
showArrow: false,
|
|
14354
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14456
14355
|
className: "lg:min-w-[130px]",
|
|
14457
14356
|
isDropdown: true,
|
|
14458
14357
|
pressed: openState.open,
|
|
@@ -14506,7 +14405,17 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
14506
14405
|
};
|
|
14507
14406
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14508
14407
|
const { props } = useRawMarkdownToolbarButton();
|
|
14509
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14408
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14409
|
+
ToolbarButton,
|
|
14410
|
+
{
|
|
14411
|
+
ref,
|
|
14412
|
+
tooltip: "Link",
|
|
14413
|
+
...rest,
|
|
14414
|
+
...props,
|
|
14415
|
+
"data-testid": "markdown-button"
|
|
14416
|
+
},
|
|
14417
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14418
|
+
);
|
|
14510
14419
|
});
|
|
14511
14420
|
function TableDropdownMenu(props) {
|
|
14512
14421
|
const tableSelected = useEditorSelector(
|
|
@@ -14645,7 +14554,7 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
14645
14554
|
key: template.name,
|
|
14646
14555
|
onMouseDown: (e) => {
|
|
14647
14556
|
e.preventDefault();
|
|
14648
|
-
|
|
14557
|
+
setOpen(false);
|
|
14649
14558
|
insertMDX(editor, template);
|
|
14650
14559
|
},
|
|
14651
14560
|
className: ""
|
|
@@ -14731,7 +14640,12 @@ function FixedToolbarButtons() {
|
|
|
14731
14640
|
const [itemsShown, setItemsShown] = React__default.useState(11);
|
|
14732
14641
|
const { overrides, templates } = useToolbarContext();
|
|
14733
14642
|
const showEmbedButton = templates.length > 0;
|
|
14734
|
-
let items2 =
|
|
14643
|
+
let items2 = [];
|
|
14644
|
+
if (Array.isArray(overrides)) {
|
|
14645
|
+
items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14646
|
+
} else {
|
|
14647
|
+
items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
|
|
14648
|
+
}
|
|
14735
14649
|
if (!showEmbedButton) {
|
|
14736
14650
|
items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
|
|
14737
14651
|
}
|
|
@@ -15059,6 +14973,9 @@ const isUrl = (string) => {
|
|
|
15059
14973
|
if (typeof string !== "string") {
|
|
15060
14974
|
return false;
|
|
15061
14975
|
}
|
|
14976
|
+
if (string.startsWith("#")) {
|
|
14977
|
+
return true;
|
|
14978
|
+
}
|
|
15062
14979
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
15063
14980
|
const emailLinkMatch = string.match(emailLintRE);
|
|
15064
14981
|
const localUrlMatch = string.match(localUrlRE);
|
|
@@ -15080,12 +14997,12 @@ const isUrl = (string) => {
|
|
|
15080
14997
|
}
|
|
15081
14998
|
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
15082
14999
|
};
|
|
15083
|
-
const RichEditor = (
|
|
15000
|
+
const RichEditor = ({ input, tinaForm, field }) => {
|
|
15084
15001
|
var _a;
|
|
15085
15002
|
const initialValue = React__default.useMemo(
|
|
15086
15003
|
() => {
|
|
15087
15004
|
var _a2, _b;
|
|
15088
|
-
return ((_b = (_a2 =
|
|
15005
|
+
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: "" }] }];
|
|
15089
15006
|
},
|
|
15090
15007
|
[]
|
|
15091
15008
|
);
|
|
@@ -15113,7 +15030,7 @@ const RichEditor = (props) => {
|
|
|
15113
15030
|
),
|
|
15114
15031
|
[]
|
|
15115
15032
|
);
|
|
15116
|
-
const tempId = [
|
|
15033
|
+
const tempId = [tinaForm.id, input.name].join(".");
|
|
15117
15034
|
const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
|
|
15118
15035
|
const ref = React__default.useRef(null);
|
|
15119
15036
|
React__default.useEffect(() => {
|
|
@@ -15123,13 +15040,13 @@ const RichEditor = (props) => {
|
|
|
15123
15040
|
const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
|
|
15124
15041
|
'[role="textbox"]'
|
|
15125
15042
|
);
|
|
15126
|
-
if (
|
|
15043
|
+
if (field.experimental_focusIntent && plateElement) {
|
|
15127
15044
|
if (plateElement)
|
|
15128
15045
|
plateElement.focus();
|
|
15129
15046
|
}
|
|
15130
15047
|
}, 100);
|
|
15131
15048
|
}
|
|
15132
|
-
}, [
|
|
15049
|
+
}, [field.experimental_focusIntent, ref]);
|
|
15133
15050
|
return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
|
|
15134
15051
|
Plate,
|
|
15135
15052
|
{
|
|
@@ -15137,7 +15054,7 @@ const RichEditor = (props) => {
|
|
|
15137
15054
|
initialValue,
|
|
15138
15055
|
plugins: plugins$2,
|
|
15139
15056
|
onChange: (value) => {
|
|
15140
|
-
|
|
15057
|
+
input.onChange({
|
|
15141
15058
|
type: "root",
|
|
15142
15059
|
children: value
|
|
15143
15060
|
});
|
|
@@ -15146,12 +15063,12 @@ const RichEditor = (props) => {
|
|
|
15146
15063
|
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
15147
15064
|
ToolbarProvider,
|
|
15148
15065
|
{
|
|
15149
|
-
tinaForm
|
|
15150
|
-
templates:
|
|
15151
|
-
overrides: (
|
|
15066
|
+
tinaForm,
|
|
15067
|
+
templates: field.templates,
|
|
15068
|
+
overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
|
|
15152
15069
|
},
|
|
15153
15070
|
/* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
|
|
15154
|
-
/* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
|
|
15071
|
+
((_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
|
|
15155
15072
|
), /* @__PURE__ */ React__default.createElement(Editor, null))
|
|
15156
15073
|
));
|
|
15157
15074
|
};
|
|
@@ -30105,6 +30022,7 @@ class TinaAdminApi {
|
|
|
30105
30022
|
relativePath
|
|
30106
30023
|
filename
|
|
30107
30024
|
extension
|
|
30025
|
+
hasReferences
|
|
30108
30026
|
}
|
|
30109
30027
|
}
|
|
30110
30028
|
}
|
|
@@ -30196,6 +30114,9 @@ class TinaAdminApi {
|
|
|
30196
30114
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30197
30115
|
... on Document {
|
|
30198
30116
|
_values
|
|
30117
|
+
_sys {
|
|
30118
|
+
hasReferences
|
|
30119
|
+
}
|
|
30199
30120
|
}
|
|
30200
30121
|
}
|
|
30201
30122
|
}`;
|
|
@@ -31922,6 +31843,23 @@ const CollectionListPage = () => {
|
|
|
31922
31843
|
DeleteModal,
|
|
31923
31844
|
{
|
|
31924
31845
|
filename: vars.relativePath,
|
|
31846
|
+
checkRefsFunc: async () => {
|
|
31847
|
+
var _a2, _b2;
|
|
31848
|
+
try {
|
|
31849
|
+
const doc = await admin.fetchDocument(
|
|
31850
|
+
collection.name,
|
|
31851
|
+
vars.relativePath,
|
|
31852
|
+
true
|
|
31853
|
+
);
|
|
31854
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31855
|
+
} catch (error) {
|
|
31856
|
+
cms.alerts.error(
|
|
31857
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31858
|
+
);
|
|
31859
|
+
console.error(error);
|
|
31860
|
+
throw error;
|
|
31861
|
+
}
|
|
31862
|
+
},
|
|
31925
31863
|
deleteFunc: async () => {
|
|
31926
31864
|
try {
|
|
31927
31865
|
await admin.deleteDocument(vars);
|
|
@@ -31930,6 +31868,12 @@ const CollectionListPage = () => {
|
|
|
31930
31868
|
);
|
|
31931
31869
|
reFetchCollection();
|
|
31932
31870
|
} catch (error) {
|
|
31871
|
+
if (error.message.indexOf("has references")) {
|
|
31872
|
+
cms.alerts.error(
|
|
31873
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31874
|
+
);
|
|
31875
|
+
return;
|
|
31876
|
+
}
|
|
31933
31877
|
cms.alerts.warn(
|
|
31934
31878
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31935
31879
|
);
|
|
@@ -31981,6 +31925,12 @@ const CollectionListPage = () => {
|
|
|
31981
31925
|
cms.alerts.info("Document was successfully renamed");
|
|
31982
31926
|
reFetchCollection();
|
|
31983
31927
|
} catch (error) {
|
|
31928
|
+
if (error.message.indexOf("has references")) {
|
|
31929
|
+
cms.alerts.error(
|
|
31930
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31931
|
+
);
|
|
31932
|
+
return;
|
|
31933
|
+
}
|
|
31984
31934
|
cms.alerts.warn(
|
|
31985
31935
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31986
31936
|
);
|
|
@@ -32454,8 +32404,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32454
32404
|
const NoDocumentsPlaceholder = () => {
|
|
32455
32405
|
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."));
|
|
32456
32406
|
};
|
|
32457
|
-
const DeleteModal = ({
|
|
32458
|
-
|
|
32407
|
+
const DeleteModal = ({
|
|
32408
|
+
close: close2,
|
|
32409
|
+
deleteFunc,
|
|
32410
|
+
checkRefsFunc,
|
|
32411
|
+
filename
|
|
32412
|
+
}) => {
|
|
32413
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32414
|
+
useEffect(() => {
|
|
32415
|
+
checkRefsFunc().then((result) => {
|
|
32416
|
+
setHasRefs(result);
|
|
32417
|
+
});
|
|
32418
|
+
}, [filename, checkRefsFunc]);
|
|
32419
|
+
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(
|
|
32459
32420
|
Button$1,
|
|
32460
32421
|
{
|
|
32461
32422
|
style: { flexGrow: 3 },
|
|
@@ -33187,15 +33148,24 @@ const IndexingPage = () => {
|
|
|
33187
33148
|
}
|
|
33188
33149
|
}
|
|
33189
33150
|
if (state === "creatingPR") {
|
|
33190
|
-
|
|
33191
|
-
|
|
33192
|
-
|
|
33193
|
-
|
|
33194
|
-
|
|
33195
|
-
|
|
33196
|
-
|
|
33197
|
-
|
|
33198
|
-
|
|
33151
|
+
try {
|
|
33152
|
+
const foo = await tinaApi.createPullRequest({
|
|
33153
|
+
baseBranch,
|
|
33154
|
+
branch,
|
|
33155
|
+
title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
|
|
33156
|
+
});
|
|
33157
|
+
console.log("PR created", foo);
|
|
33158
|
+
cms.alerts.success("Pull request created.");
|
|
33159
|
+
localStorage.setItem("tina.createBranchState", "done");
|
|
33160
|
+
setState("done");
|
|
33161
|
+
} catch (e) {
|
|
33162
|
+
console.error(e);
|
|
33163
|
+
cms.alerts.error("Failed to create PR");
|
|
33164
|
+
setErrorMessage(
|
|
33165
|
+
"Failed to create PR, please try again. If the problem persists please contact support."
|
|
33166
|
+
);
|
|
33167
|
+
setState("error");
|
|
33168
|
+
}
|
|
33199
33169
|
}
|
|
33200
33170
|
if (state === "done") {
|
|
33201
33171
|
window.location.href = back;
|
|
@@ -33817,5 +33787,6 @@ export {
|
|
|
33817
33787
|
useScreenPlugin,
|
|
33818
33788
|
useTinaAuthRedirect,
|
|
33819
33789
|
wrapFieldWithError,
|
|
33790
|
+
wrapFieldWithNoHeader,
|
|
33820
33791
|
wrapFieldsWithMeta
|
|
33821
33792
|
};
|