Button Reset

button-reset control

Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Button Reset",
  "description": "config for editor button-reset control",
  "type": "object",
  "required": [
    "option",
    "defaults",
  ],
  "properties": {
    "control": {
      "const": "button-reset",
    },
    "label": {
      "title": "Label",
      "description": "Button Reset label",
      "type": "string"
    },
    "icon": {
      "type": "string",
      "description": "Icon name"
    },
    "strings": {
      "type": "object",
      "description": "Strings to add to button-reset",
      "properties": {
        "label": { 
          "type": "string",
          "description": "string to show in the reset button",
             "example": [
              "Reset",
            ],
        },
        "dialogTitle": { 
          "type": "string",
          "description": "string title to show in the confirmation modal",
             "example": [
                "are you sure?"
            ],
        },
        "dialogText": { 
          "type": "string",
          "description": "string text to show in the confirmation modal",
             "example": [
                "you are about to reset the colors"
            ],
        },
        "dialogConfirm": { 
          "type": "string",
          "description": "string confirmation action to show in the confirmation modal",
             "example": [
                "Reset"
            ],
        },
        "dialogCancel": { 
          "type": "string",
          "description": "string cancel action to show in the confirmation modal",
             "example": [
                "Cancel"
            ],
        },
      }
    },
    "defaults": {
      "type": "array",
      "description": "array of values to reset",
      "items": {
        "type": "object",
        "properties": {
          "destination": {
            "type": "object",
            "properties": {
              "$pathRef": {
                "type": "string",
                "description": "ref path to reset",
                "example": [
                  "#/schema/valueToReset"
                ],
              }
            }
          },
          "defaultValue": {
            "description": "default value to apply to the destination",
          },
        }
      },
    },
  }
}

Example

button-reset control

{
	"control": "button-reset",
	"icon": "palette",
	"strings": {
		"label": "Reset Colors",
		"dialogConfirm": "Confirm",
		"dialogCancel": "Cancel",
		"dialogText": "Are you sure?",
		"dialogTitle": "Reset Colors"
	},
	"defaults": [
		{
			"destination": { "$pathRef": "#/schema/primaryColor" },
			"defaultValue": "#F8F8F8"
		},
		{
			"destination": { "$pathRef": "#/schema/secondaryColor" },
			"defaultValue": ""
		}
	]
}