tôi đã sử dụng "OnInit" tùy chọn trong textareas và làm việc:
oninit: function(editor) {
$currentTextArea.closest('form').bind('submit, invalid', function() {
editor.save();
});
}
Bạn có thể thử sử dụng onChange sự kiện, nhưng nó không hoạt động đúng trong Firefox.
mã hoàn chỉnh của tôi:
$('textarea.tinymce').each(function(){
var options = {
theme : "advanced",
skin : "cirkuit",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", theme_advanced_buttons1 :"formatselect,fontsizeselect,forecolor,|,bold,italic,strikethrough,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
},
$this = $(this);
// fix TinyMCE bug
if ($this.is('[required]')) {
options.oninit = function(editor) {
$this.closest('form').bind('submit, invalid', function() {
editor.save();
});
}
}
$this.tinymce(options);
});
Bạn đã tìm thấy giải pháp cho điều này chưa? Điều này: http://www.tinymce.com/develop/bugtracker_view.php?id=5671 là loại khó chịu. Dường như nó vẫn chưa được giải quyết cho đến bây giờ. – Leah
@Leah liên kết của bạn không hoạt động. Tôi được chuyển hướng đến GitHub và không có vấn đề # 5671. – naXa
@naXa Nevermind that. Đã một năm trôi qua kể từ khi tôi đăng nhận xét/liên kết đó. Nó có thể đã bị xóa rồi. Thanks anyway cho phản ứng của bạn. – Leah