]> git.joonet.de Git - adminer.git/commitdiff
Save TinyMCE under AJAX
authorJakub Vrana <jakub@vrana.cz>
Mon, 13 Jun 2011 16:02:16 +0000 (18:02 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 13 Jun 2011 16:02:16 +0000 (18:02 +0200)
plugins/tinymce.php

index d5caa377b007d393ac164012c791f8a5491dabb7..30553545e67c57482909296f96171fda42c66b3d 100644 (file)
@@ -67,7 +67,15 @@ tinyMCE.init({
        
        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>";
                }
        }