Permalink
Browse files

BUG Flush editors on form submission (os#8222)

Otherwise some non-textual changes such as moving images and resizing
them could be missed when saving.

This is because TinyMCE does not treat the image move/resize as an
undolevel and does not register this via regular "onChange" event.
  • Loading branch information...
1 parent 3457f43 commit 6c78bf9be9310ec022562c39a28d18e15c122e16 @mateusz mateusz committed Jan 29, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 javascript/HtmlEditorField.js
View
10 javascript/HtmlEditorField.js
@@ -290,6 +290,16 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this._super();
},
+ /**
+ * Make sure the editor has flushed all it's buffers before the form is submitted.
+ */
+ 'from .cms-edit-form': {
+ onbeforesubmitform: function(e) {
+ this.getEditor().save();
+ this._super();
+ }
+ },
+
oneditorinit: function() {
// Delayed show because TinyMCE calls hide() via setTimeout on removing an element,
// which is called in quick succession with adding a new editor after ajax loading new markup

0 comments on commit 6c78bf9

Please sign in to comment.