浏览代码

Simplified list callback code.

Maksymilian Barnaś 9 年之前
父节点
当前提交
d98e938ca9
共有 1 个文件被更改,包括 2 次插入22 次删除
  1. 2 22
      packages/ckeditor5-autoformat/src/autoformat.js

+ 2 - 22
packages/ckeditor5-autoformat/src/autoformat.js

@@ -30,17 +30,7 @@ export default class Autoformat extends Feature {
 
 		if ( editor.commands.has( 'bulletedList' ) ) {
 			new AutoformatEngine( editor, /^[\*\-]\s$/, ( context ) => {
-				const { range, batch, element } = context;
-				const ancestors = element.getAncestors();
-				const command = editor.commands.get( 'bulletedList' );
-
-				const isInList = command.value || ancestors.some( ( element ) => {
-					return element.name === 'listItem';
-				} );
-
-				if ( isInList ) {
-					return;
-				}
+				const { range, batch } = context;
 
 				batch.remove( range );
 				editor.execute( 'bulletedList', { batch } );
@@ -49,17 +39,7 @@ export default class Autoformat extends Feature {
 
 		if ( editor.commands.has( 'numberedList' ) ) {
 			new AutoformatEngine( editor, /^\d+[\.|)]?\s$/, ( context ) => {
-				const { range, batch, element } = context;
-				const ancestors = element.getAncestors();
-				const command = editor.commands.get( 'numberedList' );
-
-				const isInList = command.value || ancestors.some( ( element ) => {
-					return element.name === 'listItem';
-				} );
-
-				if ( isInList ) {
-					return;
-				}
+				const { range, batch } = context;
 
 				batch.remove( range );
 				editor.execute( 'numberedList', { batch } );