从 Office 插件粘贴不去除字体颜色
Paste from Office plugin not stripping font color
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
];
因为我导入了整个字体库,它会自动将 FontColor 包含在其他嵌套插件中。我错误地认为我添加到工具栏的项目是包含的插件。
为了解决我的问题,我更改了我的导入:
import Font from '@ckeditor/ckeditor5-font/src/font';
至
import FontSize from '@ckeditor/ckeditor5-font/src/fontsize';
现在,当我从 Word 中粘贴彩色文本时,颜色会按预期去除。
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
];
因为我导入了整个字体库,它会自动将 FontColor 包含在其他嵌套插件中。我错误地认为我添加到工具栏的项目是包含的插件。
为了解决我的问题,我更改了我的导入:
import Font from '@ckeditor/ckeditor5-font/src/font';
至
import FontSize from '@ckeditor/ckeditor5-font/src/fontsize';
现在,当我从 Word 中粘贴彩色文本时,颜色会按预期去除。