如何解决ckeditor 正在删除表格边框样式
我们正在将内容从一个 ckeditor 粘贴到另一个,然后表格的边框样式将被删除。
这在旧的 CKeditor 4.2 版中从未发生过,但在 4.15 版中发生。
如果您将以下 HTML 内容粘贴到新的 ckeditor 中,它将删除表格的边框样式
内容之前:
https://paste.laravel.io/ec016f9c-1abe-4bb3-ab2b-ee7ccaac1d2c
粘贴内容后
https://paste.laravel.io/9d0ab427-f34c-45c3-8f1e-03949efd95cf
以下是我的配置文件:
CKEDITOR.editorConfig = function( config ) {
config.filebrowserbrowseUrl = 'browser.PHP';
config.filebrowserFilebrowseUrl = 'browser.PHP';
config.filebrowserImagebrowseUrl = 'browser.PHP';
config.filebrowserVideobrowseUrl = 'browser.PHP'
config.filebrowserFlashbrowseUrl = 'browser.PHP';
config.uploadUrl = 'browser.PHP';
config.extraPlugins = 'stylesheetparser,uploadimage,pastetools';
config.filebrowserUploadUrl = 'browser.PHP';
config.imageUploadUrl = 'browser.PHP';
config.allowedContent = true;
config.extraAllowedContent = 'table(*)';
config.pasteFromWordRemoveStyles = false;
config.extraAllowedContent = 'table{background*,border*,style*,style,border}';
config.filebrowserUploadMethod = 'form';
config.disableNativeSpellChecker = false;
config.toolbar_Full = [
{ name: 'document',groups: ['mode','document','doctools'] },{ name: 'clipboard',groups: ['clipboard','undo'],items: ['Cut','copy','Paste','PasteText','PasteFromWord','Undo','Redo'] },// On the basic preset,clipboard and undo is handled by keyboard.
// Uncomment the following line to enable them on the toolbar as well.
{ name: 'insert',items: ['CreatePlaceholder','Image','Table','HorizontalRule','Smiley','SpecialChar'] },{ name: 'links',items: ['Link','Unlink','Anchor'] },{ name: 'paragraph',groups: ['list','indent','blocks','align'],items: ['NumberedList','BulletedList','Outdent','Indent','Blockquote','CreateDiv','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','BidiLtr','BidiRtl'] },{ name: 'basicstyles',groups: ['basicstyles','cleanup'],items: ['Bold','Italic','Underline','Subscript','Superscript','RemoveFormat'] },{ name: 'styles',items: ['Styles','Format','Font','FontSize'] },{ name: 'colors',items: ['TextColor','BGColor'] },{ name: 'tools',items: ['UIColor','Maximize','PageBreak'] },];
config.removePlugins = 'easyimage,cloudservices,exportpdf';
config.skin = 'moono';
config.toolbar = "Full";
//it will remove additional font style
CKEDITOR.addCss(".cke_editable span[lang] {font-style: inherit;}");
};
//!forcefully show copy/pase dialog Box if brower not support due to security concern.
CKEDITOR.on("instanceReady",function(event) {
event.editor.on("beforeCommandExec",function(event) {
// Show the paste dialog for the paste buttons and right-click paste
if (event.data.name == "paste") {
event.editor._.forcePasteDialog = true;
}
// Don't show the paste dialog for Ctrl+Shift+V
if (event.data.name == "pastetext" && event.data.commandData.from == "keystrokeHandler") {
event.cancel();
}
})
});
基本上我想关闭 CKeditor 在复制粘贴时删除表格的样式属性的行为。
我尝试了所有可能的解决方案并进行了大量谷歌搜索,但我找不到任何解决方案。
我发现的一个解决方案是:config.pasteFilter = null;
我认为这会禁用所有过滤,但我只想允许 CKeditor 的边框。如果有人找到最佳解决方案,请告诉我
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。