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

Outdent command should be disabled if offset is 0.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
b30ab91c7b
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      packages/ckeditor5-indent/src/indentblockcommand.js

+ 15 - 0
packages/ckeditor5-indent/src/indentblockcommand.js

@@ -90,6 +90,21 @@ export default class IndentBlockCommand extends Command {
 			return false;
 		}
 
+		if ( this.useClasses ) {
+			// eslint-disable-next-line no-undef
+			console.log( 'use classes' );
+		} else {
+			const currentIndent = block.getAttribute( 'indent' );
+			const currentOffset = parseFloat( currentIndent || 0 );
+
+			// is forward
+			if ( this.direction > 0 ) {
+				return true;
+			} else {
+				return currentOffset > 0;
+			}
+		}
+
 		return true;
 	}
 }