tinacms 3.7.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +144 -126
- package/dist/lib/posthog/posthog.d.ts +6 -0
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import { Command as Command$2 } from "cmdk";
|
|
|
23
23
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
24
24
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
25
25
|
import { PopoverAnchor } from "@radix-ui/react-popover";
|
|
26
|
+
import posthog from "posthog-js";
|
|
26
27
|
import { createSlatePlugin as createSlatePlugin$1, someHtmlElement, findHtmlParentElement, createTSlatePlugin as createTSlatePlugin$1, RangeApi as RangeApi$1, TextApi as TextApi$1, HtmlPlugin as HtmlPlugin$1, NodeApi as NodeApi$1, ElementApi as ElementApi$1, Hotkeys, isHotkey as isHotkey$1, isUrl as isUrl$1, getEditorPlugin as getEditorPlugin$1, bindFirst as bindFirst$1, sanitizeUrl, PathApi as PathApi$1, isDefined as isDefined$1, PointApi as PointApi$1, BaseParagraphPlugin as BaseParagraphPlugin$1, match as match$2, deleteMerge, getPluginTypes, queryNode as queryNode$1, isType, getInjectMatch as getInjectMatch$1, traverseHtmlElements, isHtmlBlockElement as isHtmlBlockElement$1, postCleanHtml, mergeProps } from "@udecode/plate";
|
|
27
28
|
import { useComboboxContext, Combobox as Combobox$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
|
|
28
29
|
import { withTriggerCombobox, filterWords } from "@udecode/plate-combobox";
|
|
@@ -46,7 +47,6 @@ import { sortableKeyboardCoordinates, useSortable, SortableContext, verticalList
|
|
|
46
47
|
import { CSS } from "@dnd-kit/utilities";
|
|
47
48
|
import { buildSchema, print, getIntrospectionQuery, buildClientSchema, parse as parse$4 } from "graphql";
|
|
48
49
|
import { diff as diff$1 } from "@graphql-inspector/core";
|
|
49
|
-
import posthog from "posthog-js";
|
|
50
50
|
import { HexColorPicker } from "react-colorful";
|
|
51
51
|
import * as dropzone from "react-dropzone";
|
|
52
52
|
import { Command as Command$3 } from "@udecode/cmdk";
|
|
@@ -34754,6 +34754,101 @@ function ItalicIcon(props) {
|
|
|
34754
34754
|
))
|
|
34755
34755
|
);
|
|
34756
34756
|
}
|
|
34757
|
+
const BranchSwitchedEvent = "branch-switched";
|
|
34758
|
+
const BranchSwitcherOpenedEvent = "branch-switcher-opened";
|
|
34759
|
+
const BranchSwitcherSearchEvent = "branch-switcher-search";
|
|
34760
|
+
const BranchSwitcherDropDownEvent = "branch-switcher-dropdown";
|
|
34761
|
+
const BranchSwitcherPRClickedEvent = "branch-switcher-pr-clicked";
|
|
34762
|
+
const SavedContentEvent = "saved-content";
|
|
34763
|
+
const SaveContentErrorEvent = "save-content-error";
|
|
34764
|
+
const FormResetEvent = "form-reset";
|
|
34765
|
+
const MediaManagerContentUploadedEvent = "media-manager-content-uploaded";
|
|
34766
|
+
const MediaManagerContentDeletedEvent = "media-manager-content-deleted";
|
|
34767
|
+
const RichTextEditorSwitchedEvent = "rich-text-editor-switched";
|
|
34768
|
+
const EventLogPageViewedEvent = "event-log-page-viewed";
|
|
34769
|
+
const TinaCMSStartedEvent = "tina-cms-started";
|
|
34770
|
+
const CollectionListPageItemClickedEvent = "collection-list-page-item-clicked";
|
|
34771
|
+
const CollectionListPageSortEvent = "collection-list-page-sort";
|
|
34772
|
+
const CollectionListPageSearchEvent = "collection-list-page-search";
|
|
34773
|
+
const CloudConfigNavComponentClickedEvent = "cloud-config-nav-component-clicked";
|
|
34774
|
+
const SlashCommandOpenedEvent = "slash-command-opened";
|
|
34775
|
+
const SlashCommandUsedEvent = "slash-command-used";
|
|
34776
|
+
let posthogClient = null;
|
|
34777
|
+
let isInitialized = false;
|
|
34778
|
+
let initializationPromise = null;
|
|
34779
|
+
const POSTHOG_CONFIG_ENDPOINT = "https://identity-v2.tinajs.io/v2/posthog-token";
|
|
34780
|
+
async function fetchPostHogConfig() {
|
|
34781
|
+
try {
|
|
34782
|
+
const response = await fetch(POSTHOG_CONFIG_ENDPOINT, {
|
|
34783
|
+
method: "GET",
|
|
34784
|
+
headers: {
|
|
34785
|
+
"Content-Type": "application/json"
|
|
34786
|
+
}
|
|
34787
|
+
});
|
|
34788
|
+
if (!response.ok) {
|
|
34789
|
+
console.warn(`Failed to fetch PostHog config: ${response.statusText}`);
|
|
34790
|
+
return {};
|
|
34791
|
+
}
|
|
34792
|
+
return await response.json();
|
|
34793
|
+
} catch (error2) {
|
|
34794
|
+
console.warn(
|
|
34795
|
+
"Failed to fetch PostHog config:",
|
|
34796
|
+
error2 instanceof Error ? error2.message : "Unknown error"
|
|
34797
|
+
);
|
|
34798
|
+
return {};
|
|
34799
|
+
}
|
|
34800
|
+
}
|
|
34801
|
+
async function initializePostHog(mode = "anonymous") {
|
|
34802
|
+
if (isInitialized) {
|
|
34803
|
+
return posthogClient;
|
|
34804
|
+
}
|
|
34805
|
+
if (initializationPromise) {
|
|
34806
|
+
return initializationPromise;
|
|
34807
|
+
}
|
|
34808
|
+
if (mode === "disabled") {
|
|
34809
|
+
isInitialized = true;
|
|
34810
|
+
return null;
|
|
34811
|
+
}
|
|
34812
|
+
if (process.env.TINA_DEV === "true") {
|
|
34813
|
+
isInitialized = true;
|
|
34814
|
+
return null;
|
|
34815
|
+
}
|
|
34816
|
+
initializationPromise = (async () => {
|
|
34817
|
+
const config = await fetchPostHogConfig();
|
|
34818
|
+
if (!config.api_key) {
|
|
34819
|
+
console.warn(
|
|
34820
|
+
"PostHog API key not found. PostHog tracking will be disabled."
|
|
34821
|
+
);
|
|
34822
|
+
isInitialized = true;
|
|
34823
|
+
return null;
|
|
34824
|
+
}
|
|
34825
|
+
posthog.init(config.api_key, {
|
|
34826
|
+
api_host: config.host || "https://us.i.posthog.com",
|
|
34827
|
+
persistence: "localStorage",
|
|
34828
|
+
autocapture: false,
|
|
34829
|
+
capture_pageview: false,
|
|
34830
|
+
disable_session_recording: true,
|
|
34831
|
+
disable_compression: true
|
|
34832
|
+
});
|
|
34833
|
+
posthogClient = posthog;
|
|
34834
|
+
isInitialized = true;
|
|
34835
|
+
return posthogClient;
|
|
34836
|
+
})();
|
|
34837
|
+
return initializationPromise;
|
|
34838
|
+
}
|
|
34839
|
+
function captureEvent(event, properties2) {
|
|
34840
|
+
if (!posthogClient) {
|
|
34841
|
+
return;
|
|
34842
|
+
}
|
|
34843
|
+
try {
|
|
34844
|
+
posthogClient.capture(event, {
|
|
34845
|
+
...properties2,
|
|
34846
|
+
system: "tinacms/tinacms"
|
|
34847
|
+
});
|
|
34848
|
+
} catch (error2) {
|
|
34849
|
+
console.error("Error capturing PostHog event:", error2);
|
|
34850
|
+
}
|
|
34851
|
+
}
|
|
34757
34852
|
var useComboboxInput = ({
|
|
34758
34853
|
autoFocus = true,
|
|
34759
34854
|
cancelInputOnArrowLeftRight = true,
|
|
@@ -34903,7 +34998,7 @@ const InlineCombobox = ({
|
|
|
34903
34998
|
},
|
|
34904
34999
|
[setValueProp, hasValueProp]
|
|
34905
35000
|
);
|
|
34906
|
-
const
|
|
35001
|
+
const insertPoint = React__default.useRef(null);
|
|
34907
35002
|
useEffect(() => {
|
|
34908
35003
|
const path3 = editor.api.findPath(element);
|
|
34909
35004
|
if (!path3)
|
|
@@ -34912,7 +35007,7 @@ const InlineCombobox = ({
|
|
|
34912
35007
|
if (!point3)
|
|
34913
35008
|
return;
|
|
34914
35009
|
const pointRef3 = editor.api.pointRef(point3);
|
|
34915
|
-
|
|
35010
|
+
insertPoint.current = pointRef3.current;
|
|
34916
35011
|
return () => {
|
|
34917
35012
|
pointRef3.unref();
|
|
34918
35013
|
};
|
|
@@ -34926,12 +35021,6 @@ const InlineCombobox = ({
|
|
|
34926
35021
|
at: (insertPoint == null ? void 0 : insertPoint.current) ?? void 0
|
|
34927
35022
|
});
|
|
34928
35023
|
}
|
|
34929
|
-
if (cause === "arrowLeft" || cause === "arrowRight") {
|
|
34930
|
-
editor.tf.move({
|
|
34931
|
-
distance: 1,
|
|
34932
|
-
reverse: cause === "arrowLeft"
|
|
34933
|
-
});
|
|
34934
|
-
}
|
|
34935
35024
|
},
|
|
34936
35025
|
ref: inputRef
|
|
34937
35026
|
});
|
|
@@ -35129,6 +35218,9 @@ const rules = [
|
|
|
35129
35218
|
const SlashInputElement = withRef$1(
|
|
35130
35219
|
({ className, ...props }, ref) => {
|
|
35131
35220
|
const { children, editor, element } = props;
|
|
35221
|
+
useEffect(() => {
|
|
35222
|
+
captureEvent(SlashCommandOpenedEvent);
|
|
35223
|
+
}, []);
|
|
35132
35224
|
return /* @__PURE__ */ React__default.createElement(
|
|
35133
35225
|
PlateElement,
|
|
35134
35226
|
{
|
|
@@ -35142,7 +35234,12 @@ const SlashInputElement = withRef$1(
|
|
|
35142
35234
|
{
|
|
35143
35235
|
key: value,
|
|
35144
35236
|
keywords: keywords2,
|
|
35145
|
-
onClick: () =>
|
|
35237
|
+
onClick: () => {
|
|
35238
|
+
onSelect(editor);
|
|
35239
|
+
captureEvent(SlashCommandUsedEvent, {
|
|
35240
|
+
command: value
|
|
35241
|
+
});
|
|
35242
|
+
},
|
|
35146
35243
|
value
|
|
35147
35244
|
},
|
|
35148
35245
|
/* @__PURE__ */ React__default.createElement(Icon, { "aria-hidden": true, className: "mr-2 size-4" }),
|
|
@@ -41516,7 +41613,15 @@ const Blocks = ({
|
|
|
41516
41613
|
meta,
|
|
41517
41614
|
index
|
|
41518
41615
|
}) => {
|
|
41519
|
-
const
|
|
41616
|
+
const [newObjects, setNewObjects] = useState(/* @__PURE__ */ new Set());
|
|
41617
|
+
const prevPristine = useRef(meta.pristine);
|
|
41618
|
+
useEffect(() => {
|
|
41619
|
+
if (!prevPristine.current && meta.pristine) {
|
|
41620
|
+
setNewObjects(/* @__PURE__ */ new Set());
|
|
41621
|
+
}
|
|
41622
|
+
prevPristine.current = meta.pristine;
|
|
41623
|
+
}, [meta.pristine]);
|
|
41624
|
+
const addItem = useCallback(
|
|
41520
41625
|
(name2, template) => {
|
|
41521
41626
|
let obj = {};
|
|
41522
41627
|
if (typeof template.defaultItem === "function") {
|
|
@@ -41525,6 +41630,7 @@ const Blocks = ({
|
|
|
41525
41630
|
obj = template.defaultItem || {};
|
|
41526
41631
|
}
|
|
41527
41632
|
obj._template = name2;
|
|
41633
|
+
setNewObjects((prev) => new Set(prev).add(obj));
|
|
41528
41634
|
form.mutators.push(field.name, obj);
|
|
41529
41635
|
},
|
|
41530
41636
|
[field.name, form.mutators]
|
|
@@ -41587,6 +41693,7 @@ const Blocks = ({
|
|
|
41587
41693
|
tinaForm,
|
|
41588
41694
|
isMin,
|
|
41589
41695
|
fixedLength,
|
|
41696
|
+
isNew: newObjects.has(block2),
|
|
41590
41697
|
...itemProps(block2)
|
|
41591
41698
|
}
|
|
41592
41699
|
);
|
|
@@ -41601,7 +41708,8 @@ const BlockListItem = ({
|
|
|
41601
41708
|
index,
|
|
41602
41709
|
template,
|
|
41603
41710
|
isMin,
|
|
41604
|
-
fixedLength
|
|
41711
|
+
fixedLength,
|
|
41712
|
+
isNew
|
|
41605
41713
|
}) => {
|
|
41606
41714
|
const cms = useCMS$1();
|
|
41607
41715
|
const removeItem = React.useCallback(() => {
|
|
@@ -41645,6 +41753,7 @@ const BlockListItem = ({
|
|
|
41645
41753
|
onMouseOut: () => setHoveredField({ id: null, fieldName: null })
|
|
41646
41754
|
},
|
|
41647
41755
|
/* @__PURE__ */ React.createElement(GroupLabel, null, label || template.label),
|
|
41756
|
+
isNew && /* @__PURE__ */ React.createElement("span", { className: "mr-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] border-[0.5px] border-tina-orange/50 font-semibold bg-tina-orange/10 text-tina-orange leading-none" }, "NEW"),
|
|
41648
41757
|
/* @__PURE__ */ React.createElement(BiPencil, { className: "h-5 w-auto fill-current text-gray-200 group-hover:text-inherit transition-colors duration-150 ease-out" })
|
|
41649
41758
|
), (!fixedLength || fixedLength && !isMin) && /* @__PURE__ */ React.createElement(ItemDeleteButton, { disabled: isMin, onClick: removeItem }))));
|
|
41650
41759
|
};
|
|
@@ -44016,99 +44125,6 @@ const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
44016
44125
|
}
|
|
44017
44126
|
));
|
|
44018
44127
|
TableCaption.displayName = "TableCaption";
|
|
44019
|
-
let posthogClient = null;
|
|
44020
|
-
let isInitialized = false;
|
|
44021
|
-
let initializationPromise = null;
|
|
44022
|
-
const POSTHOG_CONFIG_ENDPOINT = "https://identity-v2.tinajs.io/v2/posthog-token";
|
|
44023
|
-
async function fetchPostHogConfig() {
|
|
44024
|
-
try {
|
|
44025
|
-
const response = await fetch(POSTHOG_CONFIG_ENDPOINT, {
|
|
44026
|
-
method: "GET",
|
|
44027
|
-
headers: {
|
|
44028
|
-
"Content-Type": "application/json"
|
|
44029
|
-
}
|
|
44030
|
-
});
|
|
44031
|
-
if (!response.ok) {
|
|
44032
|
-
console.warn(`Failed to fetch PostHog config: ${response.statusText}`);
|
|
44033
|
-
return {};
|
|
44034
|
-
}
|
|
44035
|
-
return await response.json();
|
|
44036
|
-
} catch (error2) {
|
|
44037
|
-
console.warn(
|
|
44038
|
-
"Failed to fetch PostHog config:",
|
|
44039
|
-
error2 instanceof Error ? error2.message : "Unknown error"
|
|
44040
|
-
);
|
|
44041
|
-
return {};
|
|
44042
|
-
}
|
|
44043
|
-
}
|
|
44044
|
-
async function initializePostHog(mode = "anonymous") {
|
|
44045
|
-
if (isInitialized) {
|
|
44046
|
-
return posthogClient;
|
|
44047
|
-
}
|
|
44048
|
-
if (initializationPromise) {
|
|
44049
|
-
return initializationPromise;
|
|
44050
|
-
}
|
|
44051
|
-
if (mode === "disabled") {
|
|
44052
|
-
isInitialized = true;
|
|
44053
|
-
return null;
|
|
44054
|
-
}
|
|
44055
|
-
if (process.env.TINA_DEV === "true") {
|
|
44056
|
-
isInitialized = true;
|
|
44057
|
-
return null;
|
|
44058
|
-
}
|
|
44059
|
-
initializationPromise = (async () => {
|
|
44060
|
-
const config = await fetchPostHogConfig();
|
|
44061
|
-
if (!config.api_key) {
|
|
44062
|
-
console.warn(
|
|
44063
|
-
"PostHog API key not found. PostHog tracking will be disabled."
|
|
44064
|
-
);
|
|
44065
|
-
isInitialized = true;
|
|
44066
|
-
return null;
|
|
44067
|
-
}
|
|
44068
|
-
posthog.init(config.api_key, {
|
|
44069
|
-
api_host: config.host || "https://us.i.posthog.com",
|
|
44070
|
-
persistence: "localStorage",
|
|
44071
|
-
autocapture: false,
|
|
44072
|
-
capture_pageview: false,
|
|
44073
|
-
disable_session_recording: true,
|
|
44074
|
-
disable_compression: true
|
|
44075
|
-
});
|
|
44076
|
-
posthogClient = posthog;
|
|
44077
|
-
isInitialized = true;
|
|
44078
|
-
return posthogClient;
|
|
44079
|
-
})();
|
|
44080
|
-
return initializationPromise;
|
|
44081
|
-
}
|
|
44082
|
-
function captureEvent(event, properties2) {
|
|
44083
|
-
if (!posthogClient) {
|
|
44084
|
-
return;
|
|
44085
|
-
}
|
|
44086
|
-
try {
|
|
44087
|
-
posthogClient.capture(event, {
|
|
44088
|
-
...properties2,
|
|
44089
|
-
system: "tinacms/tinacms"
|
|
44090
|
-
});
|
|
44091
|
-
} catch (error2) {
|
|
44092
|
-
console.error("Error capturing PostHog event:", error2);
|
|
44093
|
-
}
|
|
44094
|
-
}
|
|
44095
|
-
const BranchSwitchedEvent = "branch-switched";
|
|
44096
|
-
const BranchSwitcherOpenedEvent = "branch-switcher-opened";
|
|
44097
|
-
const BranchSwitcherSearchEvent = "branch-switcher-search";
|
|
44098
|
-
const BranchSwitcherDropDownEvent = "branch-switcher-dropdown";
|
|
44099
|
-
const BranchSwitcherPRClickedEvent = "branch-switcher-pr-clicked";
|
|
44100
|
-
const SavedContentEvent = "saved-content";
|
|
44101
|
-
const SaveContentErrorEvent = "save-content-error";
|
|
44102
|
-
const FormResetEvent = "form-reset";
|
|
44103
|
-
const MediaManagerContentUploadedEvent = "media-manager-content-uploaded";
|
|
44104
|
-
const MediaManagerContentDeletedEvent = "media-manager-content-deleted";
|
|
44105
|
-
const RichTextEditorSwitchedEvent = "rich-text-editor-switched";
|
|
44106
|
-
const EventLogPageViewedEvent = "event-log-page-viewed";
|
|
44107
|
-
const TinaCMSStartedEvent = "tina-cms-started";
|
|
44108
|
-
const CollectionListPageItemClickedEvent = "collection-list-page-item-clicked";
|
|
44109
|
-
const CollectionListPageSortEvent = "collection-list-page-sort";
|
|
44110
|
-
const CollectionListPageSearchEvent = "collection-list-page-search";
|
|
44111
|
-
const CloudConfigNavComponentClickedEvent = "cloud-config-nav-component-clicked";
|
|
44112
44128
|
const IndexStatus$1 = ({ indexingStatus }) => {
|
|
44113
44129
|
const styles = {
|
|
44114
44130
|
complete: {
|
|
@@ -46908,7 +46924,7 @@ const getDocumentEditUrl = async (cms, document2) => {
|
|
|
46908
46924
|
return editUrl;
|
|
46909
46925
|
};
|
|
46910
46926
|
const scanDocumentForMedia = (documentContent, mediaUsages) => {
|
|
46911
|
-
const
|
|
46927
|
+
const matchedSrcs = /* @__PURE__ */ new Set();
|
|
46912
46928
|
for (const mediaUsage of mediaUsages) {
|
|
46913
46929
|
const src = JSON.stringify(mediaUsage.media.src).slice(1, -1);
|
|
46914
46930
|
let index = documentContent.indexOf(src);
|
|
@@ -46918,18 +46934,18 @@ const scanDocumentForMedia = (documentContent, mediaUsages) => {
|
|
|
46918
46934
|
const isPrevValid = !prevChar || !/[a-zA-Z0-9_.%~+-]/.test(prevChar);
|
|
46919
46935
|
const isNextValid = !nextChar || !/[a-zA-Z0-9_.%~+-]/.test(nextChar);
|
|
46920
46936
|
if (isPrevValid && isNextValid) {
|
|
46921
|
-
|
|
46937
|
+
matchedSrcs.add(mediaUsage.media.src);
|
|
46922
46938
|
break;
|
|
46923
46939
|
}
|
|
46924
46940
|
index = documentContent.indexOf(src, index + 1);
|
|
46925
46941
|
}
|
|
46926
46942
|
}
|
|
46927
|
-
return
|
|
46943
|
+
return matchedSrcs;
|
|
46928
46944
|
};
|
|
46929
46945
|
const THUMBNAIL_SIZES = [MEDIA_USAGE_THUMBNAIL_SIZE];
|
|
46930
46946
|
const BATCH_SIZE = 100;
|
|
46931
46947
|
const UI_YIELD_INTERVAL = 50;
|
|
46932
|
-
const collectAllMedia = async (cms,
|
|
46948
|
+
const collectAllMedia = async (cms, mediaSrcToUsageMap, currentDirectory) => {
|
|
46933
46949
|
const subDirectories = [];
|
|
46934
46950
|
let currentOffset = void 0;
|
|
46935
46951
|
let moreOffsetsAvailable = true;
|
|
@@ -46945,7 +46961,7 @@ const collectAllMedia = async (cms, mediaIdToUsageMap, currentDirectory) => {
|
|
|
46945
46961
|
const isImg = isImage(item.filename);
|
|
46946
46962
|
const isVid = isVideo(item.filename);
|
|
46947
46963
|
const type2 = isImg ? "image" : isVid ? "video" : "other";
|
|
46948
|
-
|
|
46964
|
+
mediaSrcToUsageMap[item.src] = {
|
|
46949
46965
|
media: item,
|
|
46950
46966
|
type: type2,
|
|
46951
46967
|
usedIn: []
|
|
@@ -46965,15 +46981,15 @@ const collectAllMedia = async (cms, mediaIdToUsageMap, currentDirectory) => {
|
|
|
46965
46981
|
}
|
|
46966
46982
|
if (subDirectories.length > 0) {
|
|
46967
46983
|
await Promise.all(
|
|
46968
|
-
subDirectories.map((dir) => collectAllMedia(cms,
|
|
46984
|
+
subDirectories.map((dir) => collectAllMedia(cms, mediaSrcToUsageMap, dir))
|
|
46969
46985
|
);
|
|
46970
46986
|
}
|
|
46971
46987
|
};
|
|
46972
|
-
const scanCollectionForMediaUsage = async (cms, collectionMeta,
|
|
46988
|
+
const scanCollectionForMediaUsage = async (cms, collectionMeta, mediaSrcToUsageMap) => {
|
|
46973
46989
|
var _a2, _b;
|
|
46974
46990
|
let hasNextPage = true;
|
|
46975
46991
|
let after3 = void 0;
|
|
46976
|
-
const mediaUsages = Object.values(
|
|
46992
|
+
const mediaUsages = Object.values(mediaSrcToUsageMap);
|
|
46977
46993
|
const listQuery = `
|
|
46978
46994
|
query($after: String, $first: Float) {
|
|
46979
46995
|
collectionConnection: ${collectionMeta.name}Connection(first: $first, after: $after) {
|
|
@@ -47019,15 +47035,15 @@ const scanCollectionForMediaUsage = async (cms, collectionMeta, mediaIdToUsageMa
|
|
|
47019
47035
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
47020
47036
|
}
|
|
47021
47037
|
const edge = edges2[i2];
|
|
47022
|
-
const
|
|
47038
|
+
const matchedSrcs = scanDocumentForMedia(
|
|
47023
47039
|
JSON.stringify(edge.node._values),
|
|
47024
47040
|
mediaUsages
|
|
47025
47041
|
);
|
|
47026
|
-
if (
|
|
47042
|
+
if (matchedSrcs.size === 0)
|
|
47027
47043
|
continue;
|
|
47028
47044
|
const editUrl = await getDocumentEditUrl(cms, edge.node);
|
|
47029
|
-
|
|
47030
|
-
const usage =
|
|
47045
|
+
matchedSrcs.forEach((mediaSrc) => {
|
|
47046
|
+
const usage = mediaSrcToUsageMap[mediaSrc];
|
|
47031
47047
|
if (usage) {
|
|
47032
47048
|
usage.usedIn.push({
|
|
47033
47049
|
collectionName: collectionMeta.name,
|
|
@@ -47046,18 +47062,18 @@ const scanCollectionForMediaUsage = async (cms, collectionMeta, mediaIdToUsageMa
|
|
|
47046
47062
|
}
|
|
47047
47063
|
};
|
|
47048
47064
|
const scanAllMedia = async (cms, onProgress) => {
|
|
47049
|
-
const
|
|
47050
|
-
await collectAllMedia(cms,
|
|
47065
|
+
const mediaSrcToUsageMap = {};
|
|
47066
|
+
await collectAllMedia(cms, mediaSrcToUsageMap, "");
|
|
47051
47067
|
const collectionMetas = cms.api.tina.schema.getCollections();
|
|
47052
47068
|
for (let i2 = 0; i2 < collectionMetas.length; i2++) {
|
|
47053
47069
|
await scanCollectionForMediaUsage(
|
|
47054
47070
|
cms,
|
|
47055
47071
|
collectionMetas[i2],
|
|
47056
|
-
|
|
47072
|
+
mediaSrcToUsageMap
|
|
47057
47073
|
);
|
|
47058
47074
|
onProgress == null ? void 0 : onProgress((i2 + 1) / collectionMetas.length * 100);
|
|
47059
47075
|
}
|
|
47060
|
-
return Object.values(
|
|
47076
|
+
return Object.values(mediaSrcToUsageMap);
|
|
47061
47077
|
};
|
|
47062
47078
|
const useMediaUsageScanner = () => {
|
|
47063
47079
|
const cms = useCMS$1();
|
|
@@ -47432,7 +47448,7 @@ const MediaUsageTable = ({
|
|
|
47432
47448
|
const table = useReactTable({
|
|
47433
47449
|
data: mediaItems,
|
|
47434
47450
|
columns,
|
|
47435
|
-
getRowId: (row) => row.media.
|
|
47451
|
+
getRowId: (row) => row.media.src,
|
|
47436
47452
|
initialState: { columnVisibility: { type: false } },
|
|
47437
47453
|
state: { sorting, columnFilters, expanded },
|
|
47438
47454
|
onColumnFiltersChange: setColumnFilters,
|
|
@@ -47933,7 +47949,7 @@ const NavProvider = ({
|
|
|
47933
47949
|
const name = "tinacms";
|
|
47934
47950
|
const type = "module";
|
|
47935
47951
|
const typings = "dist/index.d.ts";
|
|
47936
|
-
const version$1 = "3.7.
|
|
47952
|
+
const version$1 = "3.7.1";
|
|
47937
47953
|
const main = "dist/index.js";
|
|
47938
47954
|
const module = "./dist/index.js";
|
|
47939
47955
|
const exports = {
|
|
@@ -48043,6 +48059,8 @@ const dependencies = {
|
|
|
48043
48059
|
"react-colorful": "catalog:",
|
|
48044
48060
|
"react-datetime": "catalog:",
|
|
48045
48061
|
"react-day-picker": "^9.13.0",
|
|
48062
|
+
"react-dnd": "catalog:",
|
|
48063
|
+
"react-dnd-html5-backend": "catalog:",
|
|
48046
48064
|
"react-dropzone": "catalog:",
|
|
48047
48065
|
"react-final-form": "catalog:",
|
|
48048
48066
|
"react-icons": "^5.4.0",
|
|
@@ -48980,11 +48998,11 @@ const FormLists = (props) => {
|
|
|
48980
48998
|
"input",
|
|
48981
48999
|
{
|
|
48982
49000
|
type: "checkbox",
|
|
48983
|
-
checked:
|
|
48984
|
-
onChange: (e3) => setShowReferences(
|
|
49001
|
+
checked: showReferences,
|
|
49002
|
+
onChange: (e3) => setShowReferences(e3.target.checked),
|
|
48985
49003
|
className: "w-4 h-4 text-orange-500 border-gray-300 rounded focus:ring-orange-500"
|
|
48986
49004
|
}
|
|
48987
|
-
), /* @__PURE__ */ React.createElement("span", null, "
|
|
49005
|
+
), /* @__PURE__ */ React.createElement("span", null, "Show all references"))), /* @__PURE__ */ React.createElement("div", { className: "flex-1 overflow-x-auto overflow-y-auto min-h-0" }, cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}` }, /* @__PURE__ */ React.createElement(
|
|
48988
49006
|
FormList,
|
|
48989
49007
|
{
|
|
48990
49008
|
setActiveFormId: (id2) => {
|
|
@@ -66,3 +66,9 @@ export declare const CloudConfigNavComponentClickedEvent: string;
|
|
|
66
66
|
export type CloudConfigNavComponentClickedPayload = {
|
|
67
67
|
itemType: 'Project Config' | 'User Management' | 'Support';
|
|
68
68
|
};
|
|
69
|
+
export declare const SlashCommandOpenedEvent: string;
|
|
70
|
+
export type SlashInputElementOpenedPayload = Record<string, never>;
|
|
71
|
+
export declare const SlashCommandUsedEvent: string;
|
|
72
|
+
export type SlashCommandUsedPayload = {
|
|
73
|
+
command: string;
|
|
74
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "tinacms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
|
-
"version": "3.7.
|
|
5
|
+
"version": "3.7.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"exports": {
|
|
@@ -103,6 +103,8 @@
|
|
|
103
103
|
"react-colorful": "^5.6.1",
|
|
104
104
|
"react-datetime": "^3.3.1",
|
|
105
105
|
"react-day-picker": "^9.13.0",
|
|
106
|
+
"react-dnd": "^16.0.1",
|
|
107
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
106
108
|
"react-dropzone": "14.2.3",
|
|
107
109
|
"react-final-form": "^6.5.9",
|
|
108
110
|
"react-icons": "^5.4.0",
|
|
@@ -114,7 +116,7 @@
|
|
|
114
116
|
"zod": "^3.24.2",
|
|
115
117
|
"@tinacms/mdx": "2.1.0",
|
|
116
118
|
"@tinacms/schema-tools": "2.7.0",
|
|
117
|
-
"@tinacms/search": "1.2.
|
|
119
|
+
"@tinacms/search": "1.2.8"
|
|
118
120
|
},
|
|
119
121
|
"devDependencies": {
|
|
120
122
|
"@graphql-tools/utils": "^10.8.1",
|