From 6aa2fc4c9d6666e56462e1174bd5943c281679d5 Mon Sep 17 00:00:00 2001 From: Steven Le Date: Mon, 6 May 2024 11:20:19 -0700 Subject: [PATCH] feat: add index0 and index1 placeholders to array fields (#315) --- .changeset/tiny-walls-hide.md | 5 +++++ packages/root-cms/ui/components/DocEditor/DocEditor.tsx | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/tiny-walls-hide.md diff --git a/.changeset/tiny-walls-hide.md b/.changeset/tiny-walls-hide.md new file mode 100644 index 00000000..6876f04f --- /dev/null +++ b/.changeset/tiny-walls-hide.md @@ -0,0 +1,5 @@ +--- +'@blinkk/root-cms': patch +--- + +feat: add index0 and index1 placeholders to array fields diff --git a/packages/root-cms/ui/components/DocEditor/DocEditor.tsx b/packages/root-cms/ui/components/DocEditor/DocEditor.tsx index 4f31ade2..fda05a26 100644 --- a/packages/root-cms/ui/components/DocEditor/DocEditor.tsx +++ b/packages/root-cms/ui/components/DocEditor/DocEditor.tsx @@ -760,6 +760,8 @@ function arrayPreview( : [field.preview]; const placeholders = flattenNestedKeys(data); placeholders._index = String(index); + placeholders._index0 = String(index); + placeholders._index1 = String(index + 1); placeholders['_index:02'] = placeholders._index.padStart(2, '0'); placeholders['_index:03'] = placeholders._index.padStart(3, '0'); while (templates.length > 0) {