End*_*ame 2 html javascript jquery tinymce angularjs
我在表单中使用angular tinyMCE指令.提交后我使用此命令清除textarea:
tinyMCE.activeEditor.setContent('');
Run Code Online (Sandbox Code Playgroud)
而且这个:$scope.tinymceModel ='';清除模型.我的表格是一个模态.当我再次打开模态时,textarea似乎很清楚,但TinyMCE中的"撤消"按钮是活动的,如果我点击它,我可以看到旧的内容.是否可以重置并清除TinyMCE撤消历史记录?这是html部分:
<textarea id="elm1" ui-tinymce="tinymceOptions" ng-model="tinymceModel" auto-focus id="elm1" rows="8" cols="100"></textarea>
Run Code Online (Sandbox Code Playgroud)
这是选项
$scope.tinymceModel = '';
$scope.tinymceOptions = {
height: 420,
language:'it',
theme: "modern",
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
"save table contextmenu directionality emoticons template paste textcolor"
],
content_css: "css/partials/content.css",
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage",
style_formats: [
{title: 'Bold text', inline: 'b'},
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
{title: 'Example 1', inline: 'span', classes: 'example1'},
{title: 'Example 2', inline: 'span', classes: 'example2'},
{title: 'Table styles'},
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
],
setup : function(ed){
ed.on('keyup', function(e) {
get_ed_content = tinymce.activeEditor.getContent();
if(get_ed_content != '' && get_ed_content != undefined && get_ed_content != null) {
$scope.tinyHasContent = true;
} else {
$scope.tinyHasContent = false;
}
});
ed.on('init', function()
{
this.getDoc().body.style.fontSize = '1.2em';
});
}
};
Run Code Online (Sandbox Code Playgroud)
谢谢
设置新内容后添加呼叫undoManager.clear().像这样的东西:
tinymce.activeEditor.setContent('');
tinymce.activeEditor.undoManager.clear()
Run Code Online (Sandbox Code Playgroud)
这将清除活动编辑器的撤消历史记录,因此您无法返回到先前的内容.
| 归档时间: |
|
| 查看次数: |
1056 次 |
| 最近记录: |