How can WYMeditor and Jquery UI Dialog work together

383 Views Asked by At

In my modal dialog, when I'm done editing with WYMeditor, I want to click the OK button and have it update the Textarea. I don't see any example how to use this with a Jquery UI modal dialog, so I'm kind of stuck.

1

There are 1 best solutions below

0
On

As long as I know the instance of it, I can set it as such.

$('#editContent').wymeditor();

var wym = WYMeditor.INSTANCES[0];

$('#dialog').dialog({
    buttons: {
        Ok: function() {
            wym.update();
            var newContent = $('#editContent').val();

            $( this ).dialog( "close" );
        },
        Cancel: function() {
            $( this ).dialog( "close" );
        }
    },
    close: function() {
        //$( this ).dialog( "close" );
    }
});

Seems to work... finally.