从Office插件粘贴不会剥离字体颜色

时间:2020-07-23 19:50:06

标签: ckeditor ckeditor5

CK提供的PasteFromOffice插件规定如下:

With CKEditor 5 you do not need to worry about pasting messy content from Microsoft Word (or any other possible sources). 
Thanks to the CKEditor 5 {@link framework/guides/overview custom data model}, only content which is specifically handled by 
the loaded rich-text editor features will be preserved.

This means that if you did not enable, for instance, font font family and font size features, 
this sort of formatting will be automatically stripped off when you paste content from
Microsoft Word and other sources (e.g. other websites).

https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-from-word.html

我的工具栏上当前没有启用FontColor,但是不会自动删除它们。其他字体元素(如突出显示)将按预期方式删除,但不会删除颜色。

有人对此有见识吗?

这些是我内置的插件(这是一个自定义版本):

ClassicEditor.builtinPlugins = [
    Alignment,
    Essentials,
    UploadAdapter,
    Autoformat,
    Bold,
    Italic,
    BlockQuote,
    CKFinder,
    EasyImage,
    Font,
    Heading,
    HorizontalLine, 
    Image,
    ImageCaption,
    ImageLinkable, // Homemade
    ImageLinkTarget,
    ImageShareable, // Homemade
    ImageStyle,
    ImageToolbar,
    ImageUpload,
    Indent,
    IndentBlock,
    Link,
    List,
    MediaEmbed,
    MediaBrowser, // Homemade
    Mention,
    Paragraph,
    PasteFromOffice,
    RemoveFormat,
    SimpleBox, // Homemade
    TweetQuote // Homemade
];

1 个答案:

答案 0 :(得分:0)

因此,因为我正在导入整个字体库,所以它会自动在其他嵌套插件中包括FontColor。我错误地认为我添加到工具栏的项目是包含的插件。

为解决我的问题,我从以下位置更改了导入:

way

scanner.nextLine()

现在,当我从Word中粘贴彩色文本时,颜色将按预期剥离。

相关问题