设置功能在 TinyMCE 中不起作用
Setup Function not working in TinyMCE
当我尝试在我的 TinyMCE 中添加 Setup: 函数时 javascript 它将我的 richtextbox 转换为一个简单的文本区域。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script type="text/javascript" >
tinyMCE.init({
selector: 'textArea', // change this value according to your HTML
menu: {
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
insert: { title: 'Insert', items: 'link media | template hr' },
format: { title: 'Format', items: 'bold italic superscript subscript' },
tools: { title: 'Tools', items: 'spellchecker code' }
},
resize: 'both',
plugins: "wordcount",
encoding: "xml",
setup: function (ed) {
ed.onSaveContent.add(function (ed, o) {
o.content = o.content.replace(/'/g, "&apos");
});
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="content1" rows="2" cols="20" runat="server" ></textarea>
<textarea id="content2" rows="2" cols="20" runat="server" ></textarea>
<textarea id="content3" rows="2" cols="20" runat="server" ></textarea>
<asp:Button ID="btnSave" Text="Save" runat="server" OnClick="btnSave_Click"></asp:Button>
</div>
</form>
我不知道是什么问题,因为没有设置:功能,它工作得非常好。
setup: function (editor) {
editor.on('SaveContent', function (e) {
e.content = e.content.replace(/'/g, "&apos");
});
}
当我尝试在我的 TinyMCE 中添加 Setup: 函数时 javascript 它将我的 richtextbox 转换为一个简单的文本区域。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script type="text/javascript" >
tinyMCE.init({
selector: 'textArea', // change this value according to your HTML
menu: {
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
insert: { title: 'Insert', items: 'link media | template hr' },
format: { title: 'Format', items: 'bold italic superscript subscript' },
tools: { title: 'Tools', items: 'spellchecker code' }
},
resize: 'both',
plugins: "wordcount",
encoding: "xml",
setup: function (ed) {
ed.onSaveContent.add(function (ed, o) {
o.content = o.content.replace(/'/g, "&apos");
});
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="content1" rows="2" cols="20" runat="server" ></textarea>
<textarea id="content2" rows="2" cols="20" runat="server" ></textarea>
<textarea id="content3" rows="2" cols="20" runat="server" ></textarea>
<asp:Button ID="btnSave" Text="Save" runat="server" OnClick="btnSave_Click"></asp:Button>
</div>
</form>
我不知道是什么问题,因为没有设置:功能,它工作得非常好。
setup: function (editor) {
editor.on('SaveContent', function (e) {
e.content = e.content.replace(/'/g, "&apos");
});
}