Editor Not saving updated text value


#1

Hi,

Editor not saving new values in Email object on saveEmailTemplate()
And I am getting this error. Any help?

Uncaught TypeError: Cannot read property ‘dispatchEvent’ of undefined
at B. (app.js:1616)
at t.i [as fire] (common.min.js:10)
at B.fire (common.min.js:10)
at m.i (common.min.js:12)
at e (common.min.js:3)
at HTMLTableCellElement.h (common.min.js:3)

Thank you,
Nouman


#2

Never mind, I solved this issue by writing few lines of code.
I know it is not optimized and their might be some extra things but for me it works just before

                    // when typing keyup event
                    editor.on('keyup change', function () {
                        // get new value
                        // Start of Custom code
                        $($('#' + $(this).attr('id')).get(0).parentNode.childNodes).each(function (i, o) {
                            if (o.nodeName == 'TEXTAREA')
                                textarea = $(o);
                        });
                        // End of Custom code
                        textarea.val(editor.getContent({ format: 'raw' }));
                        var customEvent = new Event('input', { bubbles: true }); // won't work in IE <11
                        textarea.get(0).dispatchEvent(customEvent);
                    });

#3

It’s a little weird, but I’m happy that works for you :wink: