How to force-redraw a ui.textarea?

ui

#1

Currently hiding and showing, but would be great if there’s a better way?


#2

could you show an example of what you are trying to do?


#3

@harutyun, sure! So I’m working on this editor plugin where I have a ui.textarea whose height and width are 100% of its parent.

When resizing the editor (e.g., by dragging the splitter between panes), the ui.textarea doesn’t resize, so I’m currently handling this by handling the resize event on the editor, and hiding then showing the ui.textarea to get it to resize.

plugin.on("resize", function() {
    if (textarea) {
        textarea.setAttribute("visible", false);
        textarea.setAttribute("visible", true);
    }
};

Let me know, if you need more details!


#4

link to the plugin code would be very helpful, or at least a larger snippet which i could use to reproduce the issue


#5

Thanks for looking into this, @harutyun You should be able to reproduce by commenting these lines out!


#6

have you considered using ace instead of textarea to display hex code?


#7

@harutyun, just wanted to keep things simple, you know, but would love to give it a try! Any particular example I should look at?


#8

@kzidane we could do something like http://jsbin.com/canihuteca/edit?html,output