ckeditor/_source/plugins/enterkey/plugin.js

(开头部分) 12KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

(function()
{
	CKEDITOR.plugins.add( 'enterkey',
	{
		requires : [ 'keystrokes', 'indent' ],

		init : function( editor )
		{
			editor.addCommand( 'enter', {
				modes : { wysiwyg:1 },
				editorFocus : false,
				exec : function( editor ){ enter( editor ); }
			});

			editor.addCommand( 'shiftEnter', {
				modes : { wysiwyg:1 },
				editorFocus : false,
				exec : function( editor ){ shiftEnter( editor ); }
			});

			var keystrokes = editor.keystrokeHandler.keystrokes;
			keystrokes[ 13 ] = 'enter';
			keystrokes[ CKEDITOR.SHIFT + 13 ] = 'shiftEnter';
		}
	});

	CKEDITOR.plugins.enterkey =
	{
		enterBlock : function( editor, mode, range, forceMode )
		{
			// Get the range for the current selection.
			range = range || getRange( editor );

			// We may not have valid ranges to work on, like when inside a
			// contenteditable=false element.
			if ( !range )
				return;

			var doc = range.document;

			var atBlockStart = range.checkStartOfBlock(),
				atBlockEnd = range.checkEndOfBlock(),
				path = new CKEDITOR.dom.elementPath( range.startContainer ),
				block = path.block;

			if ( atBlockStart && atBlockEnd )
			{
				// Exit the list when we're inside an empty list item block. (#5376)
				if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) )
				{
					editor.execCommand( 'outdent' );
					return;
				}

				if ( block && block.getParent().is( 'blockquote' ) )
后面还有 373 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。