MDL-54633 tinymce: Automatically sync editor with its textarea
authorDavid Mudrák <david@moodle.com>
Wed, 18 May 2016 22:01:36 +0000 (00:01 +0200)
committerDavid Mudrák <david@moodle.com>
Wed, 18 May 2016 22:50:08 +0000 (00:50 +0200)
commit34321d491beec252cd4bb1da8d43a44b5866e5df
treec17ffff52f55d819175f1c9212e5b22d1700b2fc
parent33892edf189f5e2c9041c67119e1fd5fbe540635
MDL-54633 tinymce: Automatically sync editor with its textarea

Probably as a result of recent changes in the way how forms client side
validators are trigerred (MDL-52826), the field validator has been
triggered before the underlying textarea's values property is updated by
TinyMCE. This led to marking such a field as "required" even if the
value is provided.

Inspired by http://stackoverflow.com/questions/2122085/
this patch adds a new onchange callback that automatically keeps the
underlying textarea synced with the editor iframe. Relevant API docs:
http://archive.tinymce.com/wiki.php/Configuration3x:onchange_callback

I was also trying to call the save() method via the editor's onSubmit
method but that one seems to be also triggered only after the validator.
lib/editor/tinymce/module.js