Skip to content

Commit

Permalink
feat: add index0 and index1 placeholders to array fields (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenle authored May 6, 2024
1 parent 7f17523 commit 6aa2fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-walls-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blinkk/root-cms': patch
---

feat: add index0 and index1 placeholders to array fields
2 changes: 2 additions & 0 deletions packages/root-cms/ui/components/DocEditor/DocEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6aa2fc4

Please sign in to comment.