Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
4 changes: 2 additions & 2 deletions packages/ckeditor5-code-block/src/codeblockediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
type UpcastElementEvent,
type UpcastTextEvent,
type ModelElement,
type SelectionChangeRangeEvent
type ModelSelectionChangeRangeEvent
} from 'ckeditor5/src/engine.js';
import { ClipboardPipeline, type ClipboardContentInsertionEvent } from 'ckeditor5/src/clipboard.js';

Expand Down Expand Up @@ -318,7 +318,7 @@ export class CodeBlockEditing extends Plugin {

let lastFocusedCodeBlock: ModelElement | null = null;

model.document.selection.on<SelectionChangeRangeEvent>( 'change:range', () => {
model.document.selection.on<ModelSelectionChangeRangeEvent>( 'change:range', () => {
const focusParent = model.document.selection.focus!.parent;

if ( !ui || lastFocusedCodeBlock === focusParent || !focusParent.is( 'element' ) ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-engine/src/controller/editingcontroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { type ModelTextProxy } from '../model/textproxy.js';
import type { ModelDocumentChangeEvent } from '../model/document.js';
import type { Marker } from '../model/markercollection.js';
import type { StylesProcessor } from '../view/stylesmap.js';
import type { ViewDocumentSelectionChangeEvent } from '../view/observer/selectionobserver.js';
import type { ViewDocumentObserverSelectionChangeEvent } from '../view/observer/selectionobserver.js';

// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );

Expand Down Expand Up @@ -116,7 +116,7 @@ export class EditingController extends /* #__PURE__ */ ObservableMixin() {
}, { priority: 'low' } );

// Convert selection from the view to the model when it changes in the view.
this.listenTo<ViewDocumentSelectionChangeEvent>( this.view.document, 'selectionChange',
this.listenTo<ViewDocumentObserverSelectionChangeEvent>( this.view.document, 'selectionChange',
convertSelectionChange( this.model, this.mapper )
);

Expand Down
13 changes: 8 additions & 5 deletions packages/ckeditor5-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export {
type DowncastAddHighlightCallback,
type DowncastHighlightDescriptorCreatorFunction,
type DowncastRemoveHighlightCallback,
type DowncastMarkerDataCreatorFunction
type DowncastMarkerDataCreatorFunction,
type DowncastAttributeCreatorFunction
} from './conversion/downcasthelpers.js';

export type {
Expand Down Expand Up @@ -213,7 +214,6 @@ export type {
ModelModifySelectionEvent,
ModelCanEditAtEvent
} from './model/model.js';
export type { ModelSelectionChangeRangeEvent as SelectionChangeRangeEvent } from './model/selection.js';

// View.
export { ViewDataTransfer, type ViewDropEffect, type ViewEffectAllowed } from './view/datatransfer.js';
Expand Down Expand Up @@ -247,7 +247,7 @@ export { ViewRawElement } from './view/rawelement.js';
export { ViewUIElement } from './view/uielement.js';
export { ViewDocumentFragment } from './view/documentfragment.js';
export type { ViewElementDefinition, ViewElementObjectDefinition } from './view/elementdefinition.js';
export { ViewDocumentSelection } from './view/documentselection.js';
export { ViewDocumentSelection, type ViewDocumentSelectionChangeEvent } from './view/documentselection.js';
export type { ViewItem } from './view/item.js';
export { ViewNode, type ViewNodeChangeEvent } from './view/node.js';
export {
Expand Down Expand Up @@ -298,7 +298,7 @@ export {

export {
SelectionObserver,
type ViewDocumentSelectionEventData
type ViewDocumentObserverSelectionEventData
} from './view/observer/selectionobserver.js';

export { CompositionObserver, type ViewDocumentCompositionEventData } from './view/observer/compositionobserver.js';
Expand Down Expand Up @@ -366,7 +366,10 @@ export type {
} from './view/observer/touchobserver.js';
export type { ViewDocumentTabEvent } from './view/observer/tabobserver.js';
export type { ViewDocumentClickEvent } from './view/observer/clickobserver.js';
export type { ViewDocumentSelectionChangeEvent, ViewDocumentSelectionChangeDoneEvent } from './view/observer/selectionobserver.js';
export type {
ViewDocumentObserverSelectionChangeEvent,
ViewDocumentObserverSelectionChangeDoneEvent
} from './view/observer/selectionobserver.js';

// View / Styles.
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import type { ViewDocumentArrowKeyEvent } from './arrowkeysobserver.js';
import { ViewSelection } from '../selection.js';
import { type EditingView } from '../view.js';
import type {
ViewDocumentSelectionChangeEvent,
ViewDocumentSelectionChangeDoneEvent,
ViewDocumentSelectionEventData
ViewDocumentObserverSelectionChangeEvent,
ViewDocumentObserverSelectionChangeDoneEvent,
ViewDocumentObserverSelectionEventData
} from './selectionobserver.js';
import { keyCodes } from '@ckeditor/ckeditor5-utils';
import { debounce, type DebouncedFunction } from 'es-toolkit/compat';
Expand All @@ -30,7 +30,7 @@ export class FakeSelectionObserver extends Observer {
/**
* Fires debounced event `selectionChangeDone`. It uses `es-toolkit#debounce` method to delay function call.
*/
private readonly _fireSelectionChangeDoneDebounced: DebouncedFunction<( data: ViewDocumentSelectionEventData ) => void>;
private readonly _fireSelectionChangeDoneDebounced: DebouncedFunction<( data: ViewDocumentObserverSelectionEventData ) => void>;

/**
* Creates new FakeSelectionObserver instance.
Expand All @@ -39,7 +39,7 @@ export class FakeSelectionObserver extends Observer {
super( view );

this._fireSelectionChangeDoneDebounced = debounce( data => {
this.document.fire<ViewDocumentSelectionChangeDoneEvent>( 'selectionChangeDone', data );
this.document.fire<ViewDocumentObserverSelectionChangeDoneEvent>( 'selectionChangeDone', data );
}, 200 );
}

Expand Down Expand Up @@ -110,7 +110,7 @@ export class FakeSelectionObserver extends Observer {
};

// Fire dummy selection change event.
this.document.fire<ViewDocumentSelectionChangeEvent>( 'selectionChange', data );
this.document.fire<ViewDocumentObserverSelectionChangeEvent>( 'selectionChange', data );

// Call` #_fireSelectionChangeDoneDebounced` every time when `selectionChange` event is fired.
// This function is debounced what means that `selectionChangeDone` event will be fired only when
Expand Down
20 changes: 10 additions & 10 deletions packages/ckeditor5-engine/src/view/observer/selectionobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class SelectionObserver extends Observer {
/**
* Fires debounced event `selectionChangeDone`. It uses `es-toolkit#debounce` method to delay function call.
*/
private readonly _fireSelectionChangeDoneDebounced: DebouncedFunction<( data: ViewDocumentSelectionEventData ) => void>;
private readonly _fireSelectionChangeDoneDebounced: DebouncedFunction<( data: ViewDocumentObserverSelectionEventData ) => void>;

/**
* When called, starts clearing the {@link #_loopbackCounter} counter in time intervals. When the number of selection
Expand Down Expand Up @@ -103,7 +103,7 @@ export class SelectionObserver extends Observer {
this.domConverter = view.domConverter;

this._fireSelectionChangeDoneDebounced = debounce( data => {
this.document.fire<ViewDocumentSelectionChangeDoneEvent>( 'selectionChangeDone', data );
this.document.fire<ViewDocumentObserverSelectionChangeDoneEvent>( 'selectionChangeDone', data );
}, 200 );

this._clearInfiniteLoopInterval = setInterval( () => this._clearInfiniteLoop(), 1000 );
Expand Down Expand Up @@ -339,7 +339,7 @@ export class SelectionObserver extends Observer {
// Just re-render it, no need to fire any events, etc.
this.view.forceRender();
} else {
const data: ViewDocumentSelectionEventData = {
const data: ViewDocumentObserverSelectionEventData = {
oldSelection: this.selection,
newSelection: newViewSelection,
domSelection
Expand All @@ -353,7 +353,7 @@ export class SelectionObserver extends Observer {
// @if CK_DEBUG_TYPING // }

// Prepare data for new selection and fire appropriate events.
this.document.fire<ViewDocumentSelectionChangeEvent>( 'selectionChange', data );
this.document.fire<ViewDocumentObserverSelectionChangeEvent>( 'selectionChange', data );

// Call `#_fireSelectionChangeDoneDebounced` every time when `selectionChange` event is fired.
// This function is debounced what means that `selectionChangeDone` event will be fired only when
Expand All @@ -372,9 +372,9 @@ export class SelectionObserver extends Observer {
}

/**
* The value of {@link ~ViewDocumentSelectionChangeEvent} and {@link ~ViewDocumentSelectionChangeDoneEvent} events.
* The value of {@link ~ViewDocumentObserverSelectionChangeEvent} and {@link ~ViewDocumentObserverSelectionChangeDoneEvent} events.
*/
export type ViewDocumentSelectionEventData = {
export type ViewDocumentObserverSelectionEventData = {

/**
* Old View selection which is {@link module:engine/view/document~ViewDocument#selection}.
Expand Down Expand Up @@ -404,9 +404,9 @@ export type ViewDocumentSelectionEventData = {
* @see module:engine/view/observer/selectionobserver~SelectionObserver
* @eventName module:engine/view/document~ViewDocument#selectionChange
*/
export type ViewDocumentSelectionChangeEvent = {
export type ViewDocumentObserverSelectionChangeEvent = {
name: 'selectionChange';
args: [ ViewDocumentSelectionEventData ];
args: [ ViewDocumentObserverSelectionEventData ];
};

/**
Expand All @@ -420,7 +420,7 @@ export type ViewDocumentSelectionChangeEvent = {
* @see module:engine/view/observer/selectionobserver~SelectionObserver
* @eventName module:engine/view/document~ViewDocument#selectionChangeDone
*/
export type ViewDocumentSelectionChangeDoneEvent = {
export type ViewDocumentObserverSelectionChangeDoneEvent = {
name: 'selectionChangeDone';
args: [ ViewDocumentSelectionEventData ];
args: [ ViewDocumentObserverSelectionEventData ];
};
5 changes: 3 additions & 2 deletions packages/ckeditor5-engine/src/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ import {
env,
ObservableMixin,
scrollViewportToShowTarget,
type ObservableChangeEvent
type ObservableChangeEvent,
type IfTrue
} from '@ckeditor/ckeditor5-utils';
import { injectUiElementHandling } from './uielement.js';
import { injectQuirksHandling } from './filler.js';

import { cloneDeep } from 'es-toolkit/compat';

type IfTrue<T> = T extends true ? true : never;
// type IfTrue<T> = T extends true ? true : never;
type DomRange = globalThis.Range;

/**
Expand Down
14 changes: 7 additions & 7 deletions packages/ckeditor5-fullscreen/src/fullscreencommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { Command, type Editor } from 'ckeditor5/src/core.js';
import type { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
import type { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled';

import { AbstractEditorHandler } from './handlers/abstracteditorhandler.js';
import { ClassicEditorHandler } from './handlers/classiceditorhandler.js';
import { DecoupledEditorHandler } from './handlers/decouplededitorhandler.js';
import { FullscreenAbstractEditorHandler } from './handlers/abstracteditorhandler.js';
import { FullscreenClassicEditorHandler } from './handlers/classiceditorhandler.js';
import { FullscreenDecoupledEditorHandler } from './handlers/decouplededitorhandler.js';

/**
* A command toggling the fullscreen mode.
Expand Down Expand Up @@ -43,7 +43,7 @@ export class FullscreenCommand extends Command {
* } );
* ```
*/
public fullscreenHandler: AbstractEditorHandler;
public fullscreenHandler: FullscreenAbstractEditorHandler;

/**
* @inheritDoc
Expand All @@ -59,11 +59,11 @@ export class FullscreenCommand extends Command {
// Currently only `ClassicEditor` and `DecoupledEditor` are supported. For other editor types, you should create a custom handler
// that extends `AbstractEditorHandler` and replace `fullscreenHandler` with it.
if ( isClassicEditor( editor ) ) {
this.fullscreenHandler = new ClassicEditorHandler( editor );
this.fullscreenHandler = new FullscreenClassicEditorHandler( editor );
} else if ( isDecoupledEditor( editor ) ) {
this.fullscreenHandler = new DecoupledEditorHandler( editor );
this.fullscreenHandler = new FullscreenDecoupledEditorHandler( editor );
} else {
this.fullscreenHandler = new AbstractEditorHandler( editor );
this.fullscreenHandler = new FullscreenAbstractEditorHandler( editor );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const DIALOG_OFFSET = 28;
*
* This class is exported to allow for custom extensions.
*/
export class AbstractEditorHandler {
export class FullscreenAbstractEditorHandler {
/**
* Maps placeholder names to placeholder elements and moved elements.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import { MenuBarView } from 'ckeditor5/src/ui.js';
import type { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';

import { AbstractEditorHandler } from './abstracteditorhandler.js';
import { FullscreenAbstractEditorHandler } from './abstracteditorhandler.js';

/**
* The classic editor fullscreen mode handler.
*/
export class ClassicEditorHandler extends AbstractEditorHandler {
export class FullscreenClassicEditorHandler extends FullscreenAbstractEditorHandler {
/**
* An editor instance.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

import type { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled';

import { AbstractEditorHandler } from './abstracteditorhandler.js';
import { FullscreenAbstractEditorHandler } from './abstracteditorhandler.js';

/**
* The decoupled editor fullscreen mode handler.
*/
export class DecoupledEditorHandler extends AbstractEditorHandler {
export class FullscreenDecoupledEditorHandler extends FullscreenAbstractEditorHandler {
/**
* An editor instance.
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-fullscreen/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export { FullscreenEditing } from './fullscreenediting.js';
export { FullscreenUI } from './fullscreenui.js';
export { FullscreenCommand } from './fullscreencommand.js';

export { AbstractEditorHandler as FullscreenAbstractEditorHandler } from './handlers/abstracteditorhandler.js';
export { ClassicEditorHandler as FullscreenClassicEditorHandler } from './handlers/classiceditorhandler.js';
export { DecoupledEditorHandler as FullscreenDecoupledEditorHandler } from './handlers/decouplededitorhandler.js';
export { FullscreenAbstractEditorHandler } from './handlers/abstracteditorhandler.js';
export { FullscreenClassicEditorHandler } from './handlers/classiceditorhandler.js';
export { FullscreenDecoupledEditorHandler } from './handlers/decouplededitorhandler.js';

export type { FullscreenConfig } from './fullscreenconfig.js';

Expand Down
16 changes: 8 additions & 8 deletions packages/ckeditor5-fullscreen/tests/fullscreencommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { MultiRootEditor } from '@ckeditor/ckeditor5-editor-multi-root';
import { removeEditorBodyOrphans } from '@ckeditor/ckeditor5-core/tests/_utils/cleanup.js';

import { FullscreenCommand } from '../src/fullscreencommand.js';
import { ClassicEditorHandler } from '../src/handlers/classiceditorhandler.js';
import { DecoupledEditorHandler } from '../src/handlers/decouplededitorhandler.js';
import { AbstractEditorHandler } from '../src/handlers/abstracteditorhandler.js';
import { FullscreenClassicEditorHandler } from '../src/handlers/classiceditorhandler.js';
import { FullscreenDecoupledEditorHandler } from '../src/handlers/decouplededitorhandler.js';
import { FullscreenAbstractEditorHandler } from '../src/handlers/abstracteditorhandler.js';

const basicConfig = {
plugins: [
Expand Down Expand Up @@ -68,23 +68,23 @@ describe( 'FullscreenCommand', () => {
} );

it( 'for Classic editor', async () => {
testEditorTypeHandler( tempElement, ClassicEditor, ClassicEditorHandler );
testEditorTypeHandler( tempElement, ClassicEditor, FullscreenClassicEditorHandler );
} );

it( 'for Decoupled editor', async () => {
testEditorTypeHandler( tempElement, DecoupledEditor, DecoupledEditorHandler );
testEditorTypeHandler( tempElement, DecoupledEditor, FullscreenDecoupledEditorHandler );
} );

it( 'for Inline editor', async () => {
testEditorTypeHandler( tempElement, InlineEditor, AbstractEditorHandler );
testEditorTypeHandler( tempElement, InlineEditor, FullscreenAbstractEditorHandler );
} );

it( 'for Balloon editor', async () => {
testEditorTypeHandler( tempElement, BalloonEditor, AbstractEditorHandler );
testEditorTypeHandler( tempElement, BalloonEditor, FullscreenAbstractEditorHandler );
} );

it( 'for Multiroot editor', async () => {
testEditorTypeHandler( tempElement, MultiRootEditor, AbstractEditorHandler );
testEditorTypeHandler( tempElement, MultiRootEditor, FullscreenAbstractEditorHandler );
} );

async function testEditorTypeHandler( element, editorConstructor, editorHandler ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SourceEditing } from '@ckeditor/ckeditor5-source-editing';
import { Plugin } from '@ckeditor/ckeditor5-core';

import { RevisionHistoryMock } from '../_utils/revisionhistorymock.js';
import { AbstractEditorHandler } from '../../src/handlers/abstracteditorhandler.js';
import { FullscreenAbstractEditorHandler } from '../../src/handlers/abstracteditorhandler.js';
import { Fullscreen } from '../../src/fullscreen.js';

describe( 'AbstractHandler', () => {
Expand All @@ -31,7 +31,7 @@ describe( 'AbstractHandler', () => {
]
} );

abstractHandler = new AbstractEditorHandler( editor );
abstractHandler = new FullscreenAbstractEditorHandler( editor );
} );

afterEach( () => {
Expand Down Expand Up @@ -272,7 +272,7 @@ describe( 'AbstractHandler', () => {
}
} );

const tempAbstractHandlerDynamicToolbar = new AbstractEditorHandler( tempEditorDynamicToolbar );
const tempAbstractHandlerDynamicToolbar = new FullscreenAbstractEditorHandler( tempEditorDynamicToolbar );

tempAbstractHandlerDynamicToolbar.enable();
tempAbstractHandlerDynamicToolbar.disable();
Expand Down Expand Up @@ -300,7 +300,7 @@ describe( 'AbstractHandler', () => {
}
} );

const tempAbstractHandlerStaticToolbar = new AbstractEditorHandler( tempEditorStaticToolbar );
const tempAbstractHandlerStaticToolbar = new FullscreenAbstractEditorHandler( tempEditorStaticToolbar );

tempAbstractHandlerStaticToolbar.enable();
tempAbstractHandlerStaticToolbar.disable();
Expand Down Expand Up @@ -381,7 +381,7 @@ describe( 'AbstractHandler', () => {
]
} );

abstractEditorHandler = new AbstractEditorHandler( editorWithRevisionHistory );
abstractEditorHandler = new FullscreenAbstractEditorHandler( editorWithRevisionHistory );
} );

afterEach( async () => {
Expand Down Expand Up @@ -447,7 +447,7 @@ describe( 'AbstractHandler', () => {
]
} );

abstractEditorHandler = new AbstractEditorHandler( editorWithSourceEditing );
abstractEditorHandler = new FullscreenAbstractEditorHandler( editorWithSourceEditing );
sinon.stub( abstractEditorHandler, '_generateDocumentOutlineContainer' );
} );

Expand Down
Loading