ckeditor/_source/plugins/pastefromword/plugin.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
function forceHtmlMode( evt ) { evt.data.mode = 'html'; }
CKEDITOR.plugins.add( 'pastefromword',
{
init : function( editor )
{
// Flag indicate this command is actually been asked instead of a generic
// pasting.
var forceFromWord = 0;
var resetFromWord = function( evt )
{
evt && evt.removeListener();
editor.removeListener( 'beforePaste', forceHtmlMode );
forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 );
};
// Features bring by this command beside the normal process:
// 1. No more bothering of user about the clean-up.
// 2. Perform the clean-up even if content is not from MS-Word.
// (e.g. from a MS-Word similar application.)
editor.addCommand( 'pastefromword',
{
canUndo : false,
exec : function()
{
// Ensure the received data format is HTML and apply content filtering. (#6718)
forceFromWord = 1;
editor.on( 'beforePaste', forceHtmlMode );
if ( editor.execCommand( 'paste', 'html' ) === false )
{
editor.on( 'dialogShow', function ( evt )
{
evt.removeListener();
evt.data.on( 'cancel', resetFromWord );
});
editor.on( 'dialogHide', function( evt )
{
evt.data.removeListener( 'cancel', resetFromWord );
} );
}
editor.on( 'afterPaste', resetFromWord );
}
});
// Register the toolbar button.
editor.ui.addButton( 'PasteFromWord',
{
label : editor.lang.pastefromword.toolbar,
command : 'pastefromword'
});
后面还有 81 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。