Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving module augmentation for essentials and more #13602

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7dcfc8a
Updated module augmentation.
niegowski Mar 2, 2023
3c06881
Updated module augmentation for alignment package.
niegowski Mar 2, 2023
0832992
Updated module augmentation for autoformat package.
niegowski Mar 2, 2023
9c76ad6
Updated module augmentation for autosave package.
niegowski Mar 2, 2023
14a4594
Updated module augmentation for basic-styles package.
niegowski Mar 2, 2023
f07934e
Updated module augmentation for block-quote package.
niegowski Mar 3, 2023
b71729f
Updated module augmentation for clipboard package.
niegowski Mar 3, 2023
e858ee1
Updated module augmentation for enter package.
niegowski Mar 3, 2023
8b8af82
Updated module augmentation for essentials package.
niegowski Mar 3, 2023
fba19b4
Updated module augmentation for paragraph package.
niegowski Mar 3, 2023
7cde3d6
Updated module augmentation for select-all package.
niegowski Mar 3, 2023
3773e90
Updated module augmentation for typing package.
niegowski Mar 3, 2023
ef24f6e
Updated module augmentation for ui package.
niegowski Mar 3, 2023
1defafe
Updated module augmentation for undo package.
niegowski Mar 3, 2023
ef867bb
Updated module augmentation for widget package.
niegowski Mar 3, 2023
7f3ad59
Updated imports.
niegowski Mar 3, 2023
5bf54bd
Updated module augmentation for core package.
niegowski Mar 3, 2023
f9549cc
Updated module augmentation for upload package.
niegowski Mar 3, 2023
c495996
Merge branch 'master' into ck/13565-improving-module-augmentation-for…
niegowski Mar 3, 2023
58b5fa6
Merge remote-tracking branch 'origin/master' into ck/13565-improving-…
filipsobol Mar 3, 2023
ad466d1
Added missing import.
niegowski Mar 3, 2023
f9f5c47
Merge branch 'ck/13565-improving-module-augmentation-for-essentials-a…
filipsobol Mar 6, 2023
f8d39a7
Merge remote-tracking branch 'origin/master' into ck/13565-improving-…
filipsobol Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/ckeditor5-adapter-ckfinder/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type { UploadAdapter } from './index';

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ UploadAdapter.pluginName ]: UploadAdapter;
}
}
2 changes: 2 additions & 0 deletions packages/ckeditor5-adapter-ckfinder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
*/

export { default as UploadAdapter } from './uploadadapter';

import './augmentation';
6 changes: 0 additions & 6 deletions packages/ckeditor5-alignment/src/alignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ export default class Alignment extends Plugin {
return 'Alignment';
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Alignment.pluginName ]: Alignment;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-alignment/src/alignmentcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,3 @@ function setAlignmentOnSelection( blocks: Array<Element>, writer: Writer, alignm
writer.setAttribute( ALIGNMENT, alignment, block );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface CommandsMap {
alignment: AlignmentCommand;
}
}
12 changes: 0 additions & 12 deletions packages/ckeditor5-alignment/src/alignmentconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,3 @@ export type AlignmentFormat = {
};

export type SupportedOption = 'left' | 'right' | 'center' | 'justify';

declare module '@ckeditor/ckeditor5-core' {
interface EditorConfig {

/**
* The configuration of the {@link module:alignment/alignment~Alignment alignment feature}.
*
* Read more in {@link module:alignment/alignmentconfig~AlignmentConfig}.
*/
alignment?: AlignmentConfig;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-alignment/src/alignmentediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,3 @@ function buildClassDefinition( options: Array<AlignmentFormat> ) {

return definition;
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ AlignmentEditing.pluginName ]: AlignmentEditing;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-alignment/src/alignmentui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,3 @@ export default class AlignmentUI extends Plugin {
} );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ AlignmentUI.pluginName ]: AlignmentUI;
}
}
34 changes: 34 additions & 0 deletions packages/ckeditor5-alignment/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type {
Alignment,
AlignmentEditing,
AlignmentUI,
AlignmentCommand,
AlignmentConfig
} from './index';

declare module '@ckeditor/ckeditor5-core' {
interface EditorConfig {

/**
* The configuration of the {@link module:alignment/alignment~Alignment alignment feature}.
*
* Read more in {@link module:alignment/alignmentconfig~AlignmentConfig}.
*/
alignment?: AlignmentConfig;
}

interface PluginsMap {
[ Alignment.pluginName ]: Alignment;
[ AlignmentUI.pluginName ]: AlignmentUI;
[ AlignmentEditing.pluginName ]: AlignmentEditing;
}

interface CommandsMap {
alignment: AlignmentCommand;
}
}
4 changes: 4 additions & 0 deletions packages/ckeditor5-alignment/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
export { default as Alignment } from './alignment';
export { default as AlignmentEditing } from './alignmentediting';
export { default as AlignmentUI } from './alignmentui';
export type { default as AlignmentCommand } from './alignmentcommand';
export type { AlignmentConfig } from './alignmentconfig';

import './augmentation';
12 changes: 12 additions & 0 deletions packages/ckeditor5-autoformat/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type { Autoformat } from './index';

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Autoformat.pluginName ]: Autoformat;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-autoformat/src/autoformat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,3 @@ function getCallbackFunctionForInlineAutoformat( editor: Editor, attributeKey: s
writer.removeSelectionAttribute( attributeKey );
};
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Autoformat.pluginName ]: Autoformat;
}
}
2 changes: 2 additions & 0 deletions packages/ckeditor5-autoformat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
*/

export { default as Autoformat } from './autoformat';

import './augmentation';
22 changes: 22 additions & 0 deletions packages/ckeditor5-autosave/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type { Autosave, AutosaveConfig } from './index';

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Autosave.pluginName ]: Autosave;
}

interface EditorConfig {

/**
* The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
*
* Read more in {@link module:autosave/autosave~AutosaveConfig}.
*/
autosave?: AutosaveConfig;
}
}
16 changes: 0 additions & 16 deletions packages/ckeditor5-autosave/src/autosave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,19 +423,3 @@ export interface AutosaveConfig {
*/
waitingTime?: number;
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Autosave.pluginName ]: Autosave;
}

interface EditorConfig {

/**
* The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
*
* Read more in {@link module:autosave/autosave~AutosaveConfig}.
*/
autosave?: AutosaveConfig;
}
}
2 changes: 1 addition & 1 deletion packages/ckeditor5-autosave/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @module autosave
*/

export { default as Autosave } from './autosave';
export { default as Autosave, type AutosaveConfig } from './autosave';
12 changes: 0 additions & 12 deletions packages/ckeditor5-basic-styles/src/attributecommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,3 @@ export default class AttributeCommand extends Command {
return false;
}
}

declare module '@ckeditor/ckeditor5-core' {
interface CommandsMap {
bold: AttributeCommand;
code: AttributeCommand;
italic: AttributeCommand;
strikethrough: AttributeCommand;
subscript: AttributeCommand;
superscript: AttributeCommand;
underline: AttributeCommand;
}
}
65 changes: 65 additions & 0 deletions packages/ckeditor5-basic-styles/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type {
Superscript,
Subscript,
Bold,
Code,
AttributeCommand,
BoldUI,
CodeEditing,
CodeUI,
Italic,
ItalicEditing,
ItalicUI,
Strikethrough,
StrikethroughEditing,
StrikethroughUI,
SubscriptEditing,
SubscriptUI,
SuperscriptEditing,
SuperscriptUI,
Underline,
UnderlineEditing,
UnderlineUI
} from './index';

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Superscript.pluginName ]: Superscript;
[ Subscript.pluginName ]: Subscript;
[ Bold.pluginName ]: Bold;
[ Code.pluginName ]: Code;
[ Code.pluginName ]: Code;
[ Code.pluginName ]: Code;
[ BoldUI.pluginName ]: BoldUI;
[ CodeEditing.pluginName ]: CodeEditing;
[ CodeUI.pluginName ]: CodeUI;
[ Italic.pluginName ]: Italic;
[ ItalicEditing.pluginName ]: ItalicEditing;
[ ItalicUI.pluginName ]: ItalicUI;
[ Strikethrough.pluginName ]: Strikethrough;
[ StrikethroughEditing.pluginName ]: StrikethroughEditing;
[ StrikethroughUI.pluginName ]: StrikethroughUI;
[ SubscriptEditing.pluginName ]: SubscriptEditing;
[ SubscriptUI.pluginName ]: SubscriptUI;
[ SuperscriptEditing.pluginName ]: SuperscriptEditing;
[ SuperscriptUI.pluginName ]: SuperscriptUI;
[ Underline.pluginName ]: Underline;
[ UnderlineEditing.pluginName ]: UnderlineEditing;
[ UnderlineUI.pluginName ]: UnderlineUI;
}

interface CommandsMap {
bold: AttributeCommand;
code: AttributeCommand;
italic: AttributeCommand;
strikethrough: AttributeCommand;
subscript: AttributeCommand;
superscript: AttributeCommand;
underline: AttributeCommand;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/bold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@ export default class Bold extends Plugin {
return 'Bold';
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Bold.pluginName ]: Bold;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/bold/boldediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,3 @@ export default class BoldEditing extends Plugin {
editor.keystrokes.set( 'CTRL+B', BOLD );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ BoldEditing.pluginName ]: BoldEditing;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/bold/boldui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,3 @@ export default class BoldUI extends Plugin {
} );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ BoldUI.pluginName ]: BoldUI;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,3 @@ export default class Code extends Plugin {
return 'Code';
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Code.pluginName ]: Code;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/code/codeediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,3 @@ export default class CodeEditing extends Plugin {
inlineHighlight( editor, CODE, 'code', HIGHLIGHT_CLASS );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ CodeEditing.pluginName ]: CodeEditing;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/code/codeui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,3 @@ export default class CodeUI extends Plugin {
} );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ CodeUI.pluginName ]: CodeUI;
}
}
3 changes: 3 additions & 0 deletions packages/ckeditor5-basic-styles/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ export { default as SuperscriptUI } from './superscript/superscriptui';
export { default as Underline } from './underline';
export { default as UnderlineEditing } from './underline/underlineediting';
export { default as UnderlineUI } from './underline/underlineui';
export type { default as AttributeCommand } from './attributecommand';

import './augmentation';
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/italic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@ export default class Italic extends Plugin {
return 'Italic';
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Italic.pluginName ]: Italic;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/italic/italicediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,3 @@ export default class ItalicEditing extends Plugin {
editor.keystrokes.set( 'CTRL+I', ITALIC );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ ItalicEditing.pluginName ]: ItalicEditing;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/italic/italicui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,3 @@ export default class ItalicUI extends Plugin {
} );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ ItalicUI.pluginName ]: ItalicUI;
}
}
6 changes: 0 additions & 6 deletions packages/ckeditor5-basic-styles/src/strikethrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@ export default class Strikethrough extends Plugin {
return 'Strikethrough';
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ Strikethrough.pluginName ]: Strikethrough;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,3 @@ export default class StrikethroughEditing extends Plugin {
editor.keystrokes.set( 'CTRL+SHIFT+X', 'strikethrough' );
}
}

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[ StrikethroughEditing.pluginName ]: StrikethroughEditing;
}
}
Loading