strapi-plugin-field-clearer 1.0.8 → 1.0.10

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.
@@ -220,7 +220,7 @@ const ClearFieldModalContent = ({
220
220
  designSystem.Flex,
221
221
  { gap: 2 },
222
222
  react.createElement(designSystem.TextInput, {
223
- placeholder: "e.g., coupons.freebies or coupons[1].freebies",
223
+ placeholder: "e.g., field, field.nested, blocks[0].items.subfield",
224
224
  value: inputValue,
225
225
  onChange: handleInputChange,
226
226
  onKeyDown: handleKeyDown,
@@ -352,7 +352,7 @@ const ClearFieldModalContent = ({
352
352
  react.createElement(designSystem.Button, { variant: "tertiary", size: "S", onClick: () => setBulkMode(true) }, "Bulk Mode")
353
353
  ),
354
354
  react.createElement(designSystem.TextInput, {
355
- placeholder: "e.g., coupons.freebies or coupons[1].freebies",
355
+ placeholder: "e.g., field, field.nested, blocks[0].items.subfield",
356
356
  value: inputValue,
357
357
  onChange: handleInputChange,
358
358
  onKeyDown: handleKeyDown,
@@ -518,8 +518,9 @@ const index = {
518
518
  },
519
519
  bootstrap(app) {
520
520
  const contentManagerApis = app.getPlugin("content-manager").apis;
521
- const ClearFieldAction = ({ model, documentId }) => {
522
- if (!documentId) {
521
+ const ClearFieldAction = ({ model, documentId, collectionType }) => {
522
+ const isSingleType = collectionType === "single-types";
523
+ if (!documentId && !isSingleType) {
523
524
  return null;
524
525
  }
525
526
  return {
@@ -530,7 +531,7 @@ const index = {
530
531
  dialog: {
531
532
  type: "modal",
532
533
  title: "Clear Field Data",
533
- content: react.createElement(ClearFieldModalContent, { contentType: model, documentId })
534
+ content: react.createElement(ClearFieldModalContent, { contentType: model, documentId: documentId || "" })
534
535
  }
535
536
  };
536
537
  };
@@ -219,7 +219,7 @@ const ClearFieldModalContent = ({
219
219
  Flex,
220
220
  { gap: 2 },
221
221
  createElement(TextInput, {
222
- placeholder: "e.g., coupons.freebies or coupons[1].freebies",
222
+ placeholder: "e.g., field, field.nested, blocks[0].items.subfield",
223
223
  value: inputValue,
224
224
  onChange: handleInputChange,
225
225
  onKeyDown: handleKeyDown,
@@ -351,7 +351,7 @@ const ClearFieldModalContent = ({
351
351
  createElement(Button, { variant: "tertiary", size: "S", onClick: () => setBulkMode(true) }, "Bulk Mode")
352
352
  ),
353
353
  createElement(TextInput, {
354
- placeholder: "e.g., coupons.freebies or coupons[1].freebies",
354
+ placeholder: "e.g., field, field.nested, blocks[0].items.subfield",
355
355
  value: inputValue,
356
356
  onChange: handleInputChange,
357
357
  onKeyDown: handleKeyDown,
@@ -517,8 +517,9 @@ const index = {
517
517
  },
518
518
  bootstrap(app) {
519
519
  const contentManagerApis = app.getPlugin("content-manager").apis;
520
- const ClearFieldAction = ({ model, documentId }) => {
521
- if (!documentId) {
520
+ const ClearFieldAction = ({ model, documentId, collectionType }) => {
521
+ const isSingleType = collectionType === "single-types";
522
+ if (!documentId && !isSingleType) {
522
523
  return null;
523
524
  }
524
525
  return {
@@ -529,7 +530,7 @@ const index = {
529
530
  dialog: {
530
531
  type: "modal",
531
532
  title: "Clear Field Data",
532
- content: createElement(ClearFieldModalContent, { contentType: model, documentId })
533
+ content: createElement(ClearFieldModalContent, { contentType: model, documentId: documentId || "" })
533
534
  }
534
535
  };
535
536
  };