ericabouaf / wireit

A javascript wiring library to create web wirable interfaces for dataflow applications, visual programming languages or graphical modeling.
http://neyric.github.io/wireit/docs/
Other
520 stars 90 forks source link

Do not hardwire the inputex.InPlaceEdit as wire label editor #56

Closed sprat closed 1 year ago

sprat commented 13 years ago

Actually, the inputex.InPlaceEdit is hardwired as the wire label editor, so it's not easy to customize its behavior except by monkey patching it, which is evil. It would be better to implement the Wire.renderLabel function like this, so it would just be a matter of overloading the Wire.createLabelEditor function to change it:

     renderLabel: function() {
        this.labelEl = WireIt.cn('div',{className:"WireIt-Wire-Label"}, this.labelStyle );

        if(this.labelEditor) {
            this.labelField = this.createLabelEditor(); 
            this.labelField.setValue(this.label);
        }
        else {
            this.labelEl.innerHTML = this.label;
        }

        this.element.parentNode.appendChild(this.labelEl);

    },
    createLabelEditor: function() {
        return new inputex.InPlaceEdit({parentEl: this.labelEl, editorField: this.labelEditor, animColors:{from:"#FFFF99" , to:"#DDDDFF"} });
    }