Skip to content

Commit

Permalink
fix/feat(api/QEditor): Fix and improve definitions prop type (fix #14141
Browse files Browse the repository at this point in the history
) (#14227)
  • Loading branch information
yusufkandemir committed Aug 20, 2022
1 parent f3f1e70 commit 1e16e53
Showing 1 changed file with 76 additions and 67 deletions.
143 changes: 76 additions & 67 deletions ui/src/components/editor/QEditor.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,74 +76,83 @@
":definitions=\"{ save: { tip: 'Save your work', icon: 'save', label: 'Save', handler: saveWork }, upload: { tip: 'Upload to cloud', icon: 'cloud_upload', label: 'Upload', handler: uploadIt } }\""
],
"definition": {
"label": {
"type": "String",
"desc": "Label of the button",
"examples": [ "Addresses" ]
},
"tip": {
"type": "String",
"desc": "Text to be displayed as a tooltip on hover",
"examples": [ "Add a contact from the Address Book" ]
},
"htmlTip": {
"type": "String",
"desc": "HTML formatted text to be displayed within a tooltip on hover",
"examples": [ "Add a <span class=\"red\">user</span> from the address book" ]
},
"icon": {
"type": "String",
"desc": "Icon of the button",
"examples": [ "fas fa-address-book" ]
},
"key": {
"type": "Number",
"desc": "Keycode of a key to be used together with the <ctrl> key for use as a shortcut to trigger this element",
"examples": [ "12", "36" ]
},
"handler": {
"type": "Function",
"desc": "Either this or \"cmd\" is required. Function for when button gets clicked/tapped.",
"params": null,
"returns": null,
"examples": [ "() => this.uploadFile()" ]
},
"cmd": {
"type": "String",
"desc": "Either this or \"handler\" is required. This must be a valid execCommand method according to the designMode API.",
"examples": [ "insertHTML", "justifyFull" ]
},
"param": {
"type": "String",
"desc": "Only set a param if using a \"cmd\". This is commonly text or HTML to inject, but is highly dependent upon the specific cmd being called.",
"examples": [ "<img src=\"://uploads/001.jpg\" alt=\"nice pic\" />" ]
},
"disable": {
"type": [ "Boolean", "Function" ],
"desc": "Is button disabled?",
"returns": {
"type": "Boolean",
"desc": "If true, the button will be disabled"
"...commandName": {
"type": "Object",
"tsType": "QEditorCommand",
"autoDefineTsType": true,
"desc": "Command definition",
"definition": {
"label": {
"type": "String",
"desc": "Label of the button",
"examples": [ "Addresses" ]
},
"tip": {
"type": "String",
"desc": "Text to be displayed as a tooltip on hover",
"examples": [ "Add a contact from the Address Book" ]
},
"htmlTip": {
"type": "String",
"desc": "HTML formatted text to be displayed within a tooltip on hover",
"examples": [ "Add a <span class=\"red\">user</span> from the address book" ]
},
"icon": {
"type": "String",
"desc": "Icon of the button",
"examples": [ "fas fa-address-book" ]
},
"key": {
"type": "Number",
"desc": "Keycode of a key to be used together with the <ctrl> key for use as a shortcut to trigger this element",
"examples": [ "12", "36" ]
},
"handler": {
"type": "Function",
"desc": "Either this or \"cmd\" is required. Function for when button gets clicked/tapped.",
"params": null,
"returns": null,
"examples": [ "() => this.uploadFile()" ]
},
"cmd": {
"type": "String",
"desc": "Either this or \"handler\" is required. This must be a valid execCommand method according to the designMode API.",
"examples": [ "insertHTML", "justifyFull" ]
},
"param": {
"type": "String",
"desc": "Only set a param if using a \"cmd\". This is commonly text or HTML to inject, but is highly dependent upon the specific cmd being called.",
"examples": [ "<img src=\"://uploads/001.jpg\" alt=\"nice pic\" />" ]
},
"disable": {
"type": [ "Boolean", "Function" ],
"desc": "Is button disabled?",
"returns": {
"type": "Boolean",
"desc": "If true, the button will be disabled"
},
"examples": [ "!user.active", "() => !checkIfUserIsActive()" ]
},
"type": {
"type": "String",
"desc": "Pass the value \"no-state\" if the button should not have an \"active\" state",
"values": [ null, "no-state" ],
"examples": [ "no-state" ]
},
"fixedLabel": {
"type": "Boolean",
"desc": "Lock the button label, so it doesn't change based on the child option selected."
},
"fixedIcon": {
"type": "Boolean",
"desc": "Lock the button icon, so it doesn't change based on the child option selected."
},
"highlight": {
"type": "Boolean",
"desc": "Highlight the toolbar button, when a child option has been selected."
}
},
"examples": [ "!user.active", "() => !checkIfUserIsActive()" ]
},
"type": {
"type": "String",
"desc": "Pass the value \"no-state\" if the button should not have an \"active\" state",
"values": [ null, "no-state" ],
"examples": [ "no-state" ]
},
"fixedLabel": {
"type": "Boolean",
"desc": "Lock the button label, so it doesn't change based on the child option selected."
},
"fixedIcon": {
"type": "Boolean",
"desc": "Lock the button icon, so it doesn't change based on the child option selected."
},
"highlight": {
"type": "Boolean",
"desc": "Highlight the toolbar button, when a child option has been selected."
"__exemption": [ "examples" ]
}
},
"category": "toolbar"
Expand Down

0 comments on commit 1e16e53

Please sign in to comment.