mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Limit annotations to badge type
This commit is contained in:
parent
844bf29de1
commit
3255e11cfc
@ -61,7 +61,7 @@ RED.view.annotations = (function() {
|
|||||||
* @param {type} opts - annotations options
|
* @param {type} opts - annotations options
|
||||||
*
|
*
|
||||||
* opts: {
|
* opts: {
|
||||||
* type: "badge"|"annotation"
|
* type: "badge"
|
||||||
* class: "",
|
* class: "",
|
||||||
* element: function(node),
|
* element: function(node),
|
||||||
* show: string|function(node),
|
* show: string|function(node),
|
||||||
@ -69,6 +69,9 @@ RED.view.annotations = (function() {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function register(id, opts) {
|
function register(id, opts) {
|
||||||
|
if (opts.type !== 'badge') {
|
||||||
|
throw new Error("Unsupported annotation type: "+opts.type);
|
||||||
|
}
|
||||||
annotations[id] = opts
|
annotations[id] = opts
|
||||||
RED.hooks.add("viewAddNode.annotation-"+id, function(evt) {
|
RED.hooks.add("viewAddNode.annotation-"+id, function(evt) {
|
||||||
if (opts.filter && !opts.filter(evt.node)) {
|
if (opts.filter && !opts.filter(evt.node)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user