Преглед изворни кода

Outdent command should be disabled if offset is 0.

Maciej Gołaszewski пре 6 година
родитељ
комит
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;
 	}
 }