Skip to content

Commit

Permalink
Add small fixes based on previous PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
martnpaneq committed Jan 13, 2023
1 parent 977c2db commit ea4b87c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ packages/ckeditor5-enter/src/**/*.js
packages/ckeditor5-essentials/src/**/*.js
packages/ckeditor5-heading/src/**/*.js
packages/ckeditor5-horizontal-line/src/**/*.js
packages/ckeditor5-indent/src/**/*.js
packages/ckeditor5-language/src/**/*.js
packages/ckeditor5-list/src/**/*.js
packages/ckeditor5-markdown-gfm/src/**/*.js
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-heading/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { default as HeadingEditing } from './headingediting';
export { default as HeadingUI } from './headingui';
export { default as HeadingButtonsUI } from './headingbuttonsui';
export { default as Title } from './title';
export type { HeadingOption } from './heading';
53 changes: 27 additions & 26 deletions packages/ckeditor5-indent/src/indentblock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { addMarginRules, type AttributeDescriptor, type ViewElement } from 'cked
import IndentBlockCommand from './indentblockcommand';
import IndentUsingOffset from './indentcommandbehavior/indentusingoffset';
import IndentUsingClasses from './indentcommandbehavior/indentusingclasses';
import type { HeadingOption } from '@ckeditor/ckeditor5-heading';

const DEFAULT_ELEMENTS = [ 'paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6' ];

Expand Down Expand Up @@ -80,11 +81,11 @@ export default class IndentBlock extends Plugin {
const outdentCommand = editor.commands.get( 'outdent' ) as MultiCommand;

// Enable block indentation to heading configuration options. If it is not defined enable in paragraph and default headings.
const options = editor.config.get( 'heading.options' ) as any; // TODO fix when heading merged
const configuredElements = options && options.map( ( option: any ) => option.model ); // TODO remove any
const options: Array<HeadingOption> = editor.config.get( 'heading.options' )!;
const configuredElements = options && options.map( option => option.model );
const knownElements = configuredElements || DEFAULT_ELEMENTS;

knownElements.forEach( ( elementName: any ) => { // TODO remove any
knownElements.forEach( elementName => {
if ( schema.isRegistered( elementName ) ) {
schema.extend( elementName, { allowAttributes: 'blockIndent' } );
}
Expand Down Expand Up @@ -170,35 +171,35 @@ export default class IndentBlock extends Plugin {
* create indentation steps.
*
* ```ts
* ClassicEditor
* .create( editorElement, {
* indentBlock: {
* offset: 2,
* unit: 'em'
* }
* } )
* .then( ... )
* .catch( ... );
* ClassicEditor
* .create( editorElement, {
* indentBlock: {
* offset: 2,
* unit: 'em'
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*
* Alternatively, the block indentation feature may set one of defined {@link module:indent/indentblock~IndentBlockConfig#classes} as
* indentation steps:
*
* ```ts
* ClassicEditor
* .create( editorElement, {
* indentBlock: {
* classes: [
* 'indent-a', // The first step - smallest indentation.
* 'indent-b',
* 'indent-c',
* 'indent-d',
* 'indent-e' // The last step - biggest indentation.
* ]
* }
* } )
* .then( ... )
* .catch( ... );
* ClassicEditor
* .create( editorElement, {
* indentBlock: {
* classes: [
* 'indent-a', // The first step - smallest indentation.
* 'indent-b',
* 'indent-c',
* 'indent-d',
* 'indent-e' // The last step - biggest indentation.
* ]
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*
* In the example above only 5 indentation steps will be available.
Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-indent/src/indentblockcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import { first } from 'ckeditor5/src/utils';
* To increase block indentation at the current selection, execute the command:
*
* ```ts
* editor.execute( 'indentBlock' );
* editor.execute( 'indentBlock' );
* ```
*
* To decrease block indentation at the current selection, execute the command:
*
* ```ts
* editor.execute( 'outdentBlock' );
* editor.execute( 'outdentBlock' );
* ```
*/
export default class IndentBlockCommand extends Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default class IndentUsingClasses {
/**
* The direction of indentation.
*/
declare public isForward: boolean;
public isForward: boolean;

/**
* A list of classes used for indentation.
*/
declare public classes: Array<string>;
public classes: Array<string>;

/**
* Creates an instance of the indentation behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ export default class IndentUsingOffset {
/**
* The direction of indentation.
*/
declare public isForward: boolean;
public isForward: boolean;

/**
* The offset of the next indentation step.
*/
declare public offset: number;
public offset: number;

/**
* Indentation unit.
*/
declare public unit: string;
public unit: string;

/**
* Creates an instance of the indentation behavior.
Expand Down

0 comments on commit ea4b87c

Please sign in to comment.