mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Cleanup + fix popover.getContent can be a function and apply #4450 changes
This commit is contained in:
		@@ -53,8 +53,8 @@
 | 
				
			|||||||
 * Returns the popover object with the following properties/functions:
 | 
					 * Returns the popover object with the following properties/functions:
 | 
				
			||||||
 *   properties:
 | 
					 *   properties:
 | 
				
			||||||
 *    - element : DOM element - the popover dom element
 | 
					 *    - element : DOM element - the popover dom element
 | 
				
			||||||
 *    - content : string|function - the popover content
 | 
					 | 
				
			||||||
 *   functions:
 | 
					 *   functions:
 | 
				
			||||||
 | 
					 *    - getContent() - get the popover content
 | 
				
			||||||
 *    - setContent(content) - change the popover content. This only works if the
 | 
					 *    - setContent(content) - change the popover content. This only works if the
 | 
				
			||||||
 *                            popover is not currently displayed. It does not
 | 
					 *                            popover is not currently displayed. It does not
 | 
				
			||||||
 *                            change the content of a visible popover.
 | 
					 *                            change the content of a visible popover.
 | 
				
			||||||
@@ -160,7 +160,7 @@ RED.popover = (function() {
 | 
				
			|||||||
        var size = options.size||"default";
 | 
					        var size = options.size||"default";
 | 
				
			||||||
        var popupOffset = options.offset || 0;
 | 
					        var popupOffset = options.offset || 0;
 | 
				
			||||||
        if (!deltaSizes[size]) {
 | 
					        if (!deltaSizes[size]) {
 | 
				
			||||||
            throw new Error("Invalid RED.popover size value:" + size);
 | 
					            throw new Error("Invalid RED.popover size value: " + size);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var timer = null;
 | 
					        var timer = null;
 | 
				
			||||||
@@ -420,7 +420,6 @@ RED.popover = (function() {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        var res = {
 | 
					        var res = {
 | 
				
			||||||
            get element() { return div },
 | 
					            get element() { return div },
 | 
				
			||||||
            get content() { return content },
 | 
					 | 
				
			||||||
            setContent: function(_content) {
 | 
					            setContent: function(_content) {
 | 
				
			||||||
                content = _content;
 | 
					                content = _content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -471,7 +470,7 @@ RED.popover = (function() {
 | 
				
			|||||||
                delay: { show: 750, hide: 50 }
 | 
					                delay: { show: 750, hide: 50 }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            popover.getContent = function () {
 | 
					            popover.getContent = function () {
 | 
				
			||||||
                return content;
 | 
					                return label();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            popover.setContent = function(newContent) {
 | 
					            popover.setContent = function(newContent) {
 | 
				
			||||||
                content = newContent;
 | 
					                content = newContent;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1560,6 +1560,7 @@
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if ((typeof valid === "string") || !valid) {
 | 
					            if ((typeof valid === "string") || !valid) {
 | 
				
			||||||
 | 
					                this.element.addClass("input-error");
 | 
				
			||||||
                this.uiSelect.addClass("input-error");
 | 
					                this.uiSelect.addClass("input-error");
 | 
				
			||||||
                if (typeof valid === "string") {
 | 
					                if (typeof valid === "string") {
 | 
				
			||||||
                    let tooltip = this.element.data("tooltip");
 | 
					                    let tooltip = this.element.data("tooltip");
 | 
				
			||||||
@@ -1571,6 +1572,7 @@
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
 | 
					                this.element.removeClass("input-error");
 | 
				
			||||||
                this.uiSelect.removeClass("input-error");
 | 
					                this.uiSelect.removeClass("input-error");
 | 
				
			||||||
                const tooltip = this.element.data("tooltip");
 | 
					                const tooltip = this.element.data("tooltip");
 | 
				
			||||||
                if (tooltip) {
 | 
					                if (tooltip) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user