8
0
Просмотр исходного кода

Revert block quote command to previous state after fixes in selection.getSelectedBlocks().

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
96d0758085
1 измененных файлов с 3 добавлено и 15 удалено
  1. 3 15
      packages/ckeditor5-block-quote/src/blockquotecommand.js

+ 3 - 15
packages/ckeditor5-block-quote/src/blockquotecommand.js

@@ -45,15 +45,7 @@ export default class BlockQuoteCommand extends Command {
 		const schema = model.schema;
 		const schema = model.schema;
 		const selection = model.document.selection;
 		const selection = model.document.selection;
 
 
-		const selElem = selection.getSelectedElement();
-
-		let blocks;
-
-		if ( selElem ) {
-			blocks = [ selElem ];
-		} else {
-			blocks = Array.from( selection.getTopMostBlocks() );
-		}
+		const blocks = Array.from( selection.getTopMostBlocks() );
 
 
 		model.change( writer => {
 		model.change( writer => {
 			if ( this.value ) {
 			if ( this.value ) {
@@ -79,14 +71,10 @@ export default class BlockQuoteCommand extends Command {
 	_getValue() {
 	_getValue() {
 		const selection = this.editor.model.document.selection;
 		const selection = this.editor.model.document.selection;
 
 
-		let selectedBlock = selection.getSelectedElement();
-
-		if ( !selectedBlock ) {
-			selectedBlock = first( selection.getTopMostBlocks() );
-		}
+		const firstBlock = first( selection.getTopMostBlocks() );
 
 
 		// In the current implementation, the block quote must be an immediate parent of a block element.
 		// In the current implementation, the block quote must be an immediate parent of a block element.
-		return !!( selectedBlock && findQuote( selectedBlock ) );
+		return !!( firstBlock && findQuote( firstBlock ) );
 	}
 	}
 
 
 	/**
 	/**