保存多个TinyMCE实例是指在一个网页中创建和管理多个TinyMCE富文本编辑器实例。TinyMCE是一个流行的JavaScript库,用于创建具有丰富文本编辑功能的Web应用程序。以下是如何在一个网页中保存多个TinyMCE实例的方法:
<link rel="stylesheet" href="https://cdn.tiny.cloud/1/your-api-key/tinymce/5/tinymce.min.css">
textarea
元素,这些元素将成为TinyMCE实例的容器。
tinymce.init({
selector: 'textarea',
plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak',
toolbar_mode: 'floating',
tinyMCEPreInit: {
base: 'https://cdn.tiny.cloud/1/your-api-key/tinymce/5',
suffix: '.min'
},
setup: function (editor) {
editor.on('init', function () {
editor.setContent('这是一个TinyMCE实例');
});
}
});
tinymce.init({
selector: '#editor1',
plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak',
toolbar_mode: 'floating',
tinyMCEPreInit: {
base: 'https://cdn.tiny.cloud/1/your-api-key/tinymce/5',
suffix: '.min'
},
setup: function (editor) {
editor.on('init', function () {
editor.setContent('这是第一个TinyMCE实例');
});
}
});
tinymce.init({
selector: '#editor2',
plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak',
toolbar_mode: 'floating',
tinyMCEPreInit: {
base: 'https://cdn.tiny.cloud/1/your-api-key/tinymce/5',
suffix: '.min'
},
setup: function (editor) {
editor.on('init', function () {
editor.setContent('这是第二个TinyMCE实例');
});
}
});
tinymce.init({
selector: '#editor3',
plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak',
toolbar_mode: 'floating',
tinyMCEPreInit: {
base: 'https://cdn.tiny.cloud/1/your-api-key/tinymce/5',
suffix: '.min'
},
setup: function (editor) {
editor.on('init', function () {
editor.setContent('这是第三个TinyMCE实例');
});
}
});
通过以上步骤,您可以在一个网页中创建和管理多个TinyMCE富文本编辑器实例。
领取专属 10元无门槛券
手把手带您无忧上云