Skip to content

Commit

Permalink
Feature (heading): Simplify TypeScript types of the Heading plugin …
Browse files Browse the repository at this point in the history
…configuration.
  • Loading branch information
filipsobol committed Jul 2, 2024
1 parent 1cc6695 commit ccc93c9
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions packages/ckeditor5-heading/src/headingconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,47 +73,14 @@ export interface HeadingConfig {
/**
* Heading option descriptor.
*/
export type HeadingOption = HeadingElementOption | HeadingParagraphOption | HeadingCustomElementOption;
export type HeadingOption = HeadingElementOption | HeadingParagraphOption;

export interface HeadingElementOption {

/**
* Name of the model element to convert.
*/
model: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';

/**
* Definition of a view element to convert from/to.
*/
view: ViewElementDefinition;

/**
* The user-readable title of the option.
*/
title: string;

/**
* The class which will be added to the dropdown item representing this option.
*/
class: string;

/**
* Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
*/
icon?: string;

/**
* An array with all matched elements that the view-to-model conversion should also accept.
*/
upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
}

export interface HeadingCustomElementOption {

/**
* Name of the model element to convert.
*/
model: `heading${ string }`;
model: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | `heading${ string }` & Record<never, never>;

/**
* Definition of a view element to convert from/to.
Expand Down

0 comments on commit ccc93c9

Please sign in to comment.