Permalink
Browse files

Save TinyMCE under AJAX

  • Loading branch information...
1 parent 9c370ad commit c2965bc88ddfa031c0f0b08904cb5bfb20d1371c @vrana committed Jun 13, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 plugins/tinymce.php
View
@@ -67,7 +67,15 @@ function selectVal(&$val, $link, $field) {
function editInput($table, $field, $attrs, $value) {
if (ereg("text", $field["type"]) && ereg("_html", $field["field"])) {
- return "<textarea$attrs id='fields-" . h($field["field"]) . "' rows='12' cols='50'>" . h($value) . "</textarea><script type='text/javascript'>tinyMCE.execCommand('mceAddControl', true, 'fields-" . js_escape($field["field"]) . "');</script>";
+ return "<textarea$attrs id='fields-" . h($field["field"]) . "' rows='12' cols='50'>" . h($value) . "</textarea><script type='text/javascript'>
+tinyMCE.remove(tinyMCE.get('fields-" . js_escape($field["field"]) . "') || { });
+tinyMCE.execCommand('mceAddControl', true, 'fields-" . js_escape($field["field"]) . "');
+document.getElementById('form').onsubmit = function () {
+ tinyMCE.each(tinyMCE.editors, function (ed) {
+ ed.remove();
+ });
+};
+</script>";
}
}

0 comments on commit c2965bc

Please sign in to comment.