【发布时间】:2017-05-22 16:50:52
【问题描述】:
您好,我正在尝试创建一个 TinyMCE 编辑器,在此我希望用户能够从任何他想要的地方粘贴。
我要设置的唯一限制是,当用户从其来源粘贴时,我的 TinyMCE 框应删除除上标和下标之外的所有富文本属性(例如颜色、字体样式、标题、表格)。
我只想保留上标和下标。
这是我的 TinyMCE 代码。目前我正在使用 paste_as_text:true ,因此它正在删除所有富文本样式,包括上标和下标。
http://fiddle.tinymce.com/KAfaab/4
<script type="text/javascript">
tinyMCE.init({
selector: 'textArea', // change this value according to your HTML
menubar: false,
width: "840",
toolbar: 'undo redo | superscript subscript | link image',
height: "225",
resize: 'both',
encoding: "xml",
elementpath: true,
paste_word_valid_elements: "superscript,subscript,sub,sup",
plugins: "paste",
paste_retain_style_properties: "superscript,subscript,sub,sup",
paste_as_text:true
});
<form method="post" action="dump.php">
<textarea name="content"></textarea>
</form>
【问题讨论】:
标签: javascript tinymce