diff --git a/packages/ckeditor5-code-block/src/codeblockediting.ts b/packages/ckeditor5-code-block/src/codeblockediting.ts index 96812bccf9e..0fb40697fb5 100644 --- a/packages/ckeditor5-code-block/src/codeblockediting.ts +++ b/packages/ckeditor5-code-block/src/codeblockediting.ts @@ -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'; @@ -318,7 +318,7 @@ export class CodeBlockEditing extends Plugin { let lastFocusedCodeBlock: ModelElement | null = null; - model.document.selection.on( 'change:range', () => { + model.document.selection.on( 'change:range', () => { const focusParent = model.document.selection.focus!.parent; if ( !ui || lastFocusedCodeBlock === focusParent || !focusParent.is( 'element' ) ) { diff --git a/packages/ckeditor5-engine/src/controller/editingcontroller.ts b/packages/ckeditor5-engine/src/controller/editingcontroller.ts index 33d3d8e7344..2bae953f563 100644 --- a/packages/ckeditor5-engine/src/controller/editingcontroller.ts +++ b/packages/ckeditor5-engine/src/controller/editingcontroller.ts @@ -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' ); @@ -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( this.view.document, 'selectionChange', + this.listenTo( this.view.document, 'selectionChange', convertSelectionChange( this.model, this.mapper ) ); diff --git a/packages/ckeditor5-engine/src/index.ts b/packages/ckeditor5-engine/src/index.ts index 28d80766e4a..559903d7bd1 100644 --- a/packages/ckeditor5-engine/src/index.ts +++ b/packages/ckeditor5-engine/src/index.ts @@ -69,7 +69,8 @@ export { type DowncastAddHighlightCallback, type DowncastHighlightDescriptorCreatorFunction, type DowncastRemoveHighlightCallback, - type DowncastMarkerDataCreatorFunction + type DowncastMarkerDataCreatorFunction, + type DowncastAttributeCreatorFunction } from './conversion/downcasthelpers.js'; export type { @@ -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'; @@ -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 { @@ -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'; @@ -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 { diff --git a/packages/ckeditor5-engine/src/view/observer/fakeselectionobserver.ts b/packages/ckeditor5-engine/src/view/observer/fakeselectionobserver.ts index bfeb7aabeca..c74ac809c6c 100644 --- a/packages/ckeditor5-engine/src/view/observer/fakeselectionobserver.ts +++ b/packages/ckeditor5-engine/src/view/observer/fakeselectionobserver.ts @@ -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'; @@ -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. @@ -39,7 +39,7 @@ export class FakeSelectionObserver extends Observer { super( view ); this._fireSelectionChangeDoneDebounced = debounce( data => { - this.document.fire( 'selectionChangeDone', data ); + this.document.fire( 'selectionChangeDone', data ); }, 200 ); } @@ -110,7 +110,7 @@ export class FakeSelectionObserver extends Observer { }; // Fire dummy selection change event. - this.document.fire( 'selectionChange', data ); + this.document.fire( '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 diff --git a/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts b/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts index 2bea51f6c4e..55603b8838a 100644 --- a/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts +++ b/packages/ckeditor5-engine/src/view/observer/selectionobserver.ts @@ -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 @@ -103,7 +103,7 @@ export class SelectionObserver extends Observer { this.domConverter = view.domConverter; this._fireSelectionChangeDoneDebounced = debounce( data => { - this.document.fire( 'selectionChangeDone', data ); + this.document.fire( 'selectionChangeDone', data ); }, 200 ); this._clearInfiniteLoopInterval = setInterval( () => this._clearInfiniteLoop(), 1000 ); @@ -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 @@ -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( 'selectionChange', data ); + this.document.fire( '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 @@ -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}. @@ -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 ]; }; /** @@ -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 ]; }; diff --git a/packages/ckeditor5-engine/src/view/view.ts b/packages/ckeditor5-engine/src/view/view.ts index 43396a4dd5e..84df916fcb1 100644 --- a/packages/ckeditor5-engine/src/view/view.ts +++ b/packages/ckeditor5-engine/src/view/view.ts @@ -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 extends true ? true : never; +// type IfTrue = T extends true ? true : never; type DomRange = globalThis.Range; /** diff --git a/packages/ckeditor5-fullscreen/docs/features/fullscreen.md b/packages/ckeditor5-fullscreen/docs/features/fullscreen.md index c62c162a09d..c8b9826f8d5 100644 --- a/packages/ckeditor5-fullscreen/docs/features/fullscreen.md +++ b/packages/ckeditor5-fullscreen/docs/features/fullscreen.md @@ -168,15 +168,15 @@ Below you will find a customized demo: This section covers how to provide fullscreen mode integration for other {@link getting-started/setup/editor-types editor types} than classic and decoupled. Please note that only these two editor types are officially supported, so the code snippets below are exemplary and may not solve all technical challenges. -First, you need to create a custom class extending {@link module:fullscreen/handlers/abstracteditorhandler~AbstractEditorHandler `AbstractEditorHandler`}. Besides the optional typing improvements, the most important thing is to implement its custom {@link module:fullscreen/handlers/abstracteditorhandler~AbstractEditorHandler#defaultOnEnter `#defaultOnEnter()`} method. It should move the editor UI elements proper for your editor type to the fullscreen container, preferably using {@link module:fullscreen/handlers/abstracteditorhandler~AbstractEditorHandler#moveToFullscreen `#moveToFullscreen()`} helper - it will assure the elements are moved back in DOM when leaving fullscreen mode. +First, you need to create a custom class extending {@link module:fullscreen/handlers/abstracteditorhandler~FullscreenAbstractEditorHandler `FullscreenAbstractEditorHandler`}. Besides the optional typing improvements, the most important thing is to implement its custom {@link module:fullscreen/handlers/abstracteditorhandler~FullscreenAbstractEditorHandler#defaultOnEnter `#defaultOnEnter()`} method. It should move the editor UI elements proper for your editor type to the fullscreen container, preferably using {@link module:fullscreen/handlers/abstracteditorhandler~FullscreenAbstractEditorHandler#moveToFullscreen `#moveToFullscreen()`} helper - it will assure the elements are moved back in DOM when leaving fullscreen mode. Then, in the editor's `toggleFullscreen` command, you will need to substitute the {@link module:fullscreen/fullscreencommand~FullscreenCommand#fullscreenHandler `#fullscreenHandler`} property with an instance of your custom class. It can be done by adding a custom plugin that should be later added to the editor configuration (see the full example below). ```ts -import { AbstractEditorHandler, FullscreenEditing } from '@ckeditor/ckeditor5-fullscreen'; +import { FullscreenAbstractEditorHandler, FullscreenEditing } from '@ckeditor/ckeditor5-fullscreen'; import { Plugin } from 'ckeditor5/src/core'; -class CustomEditorHandler extends AbstractEditorHandler { +class CustomEditorHandler extends FullscreenAbstractEditorHandler { // It's not mandatory to override `#_editor` property, but that will help TypeScript to properly handle the class. // Skip if you are not using TS. protected override readonly _editor: CustomEditorClass; diff --git a/packages/ckeditor5-fullscreen/src/fullscreencommand.ts b/packages/ckeditor5-fullscreen/src/fullscreencommand.ts index 8ba630af291..5c31a446673 100644 --- a/packages/ckeditor5-fullscreen/src/fullscreencommand.ts +++ b/packages/ckeditor5-fullscreen/src/fullscreencommand.ts @@ -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. @@ -31,11 +31,12 @@ export class FullscreenCommand extends Command { * Specialized class handling the fullscreen mode toggling for a specific editor type. * * If you want to add support for a new editor type (for now, only Classic and Decoupled editors are handled), - * create a custom handler that extends `AbstractEditorHandler` and replace `fullscreenHandler` with it after editor initialization: + * create a custom handler that extends `FullscreenAbstractEditorHandler` and replace `fullscreenHandler` with it after + * editor initialization: * * ```ts - * // See the details of how to implement a custom handler in the `AbstractEditorHandler` class API docs. - * class CustomEditorHandler extends AbstractEditorHandler {} + * // See the details of how to implement a custom handler in the `FullscreenAbstractEditorHandler` class API docs. + * class CustomEditorHandler extends FullscreenAbstractEditorHandler {} * * CustomEditorClass.create( document.querySelector( '#editor' ), {} ) * .then( ( editor ) => { @@ -43,7 +44,7 @@ export class FullscreenCommand extends Command { * } ); * ``` */ - public fullscreenHandler: AbstractEditorHandler; + public fullscreenHandler: FullscreenAbstractEditorHandler; /** * @inheritDoc @@ -57,13 +58,13 @@ export class FullscreenCommand extends Command { // Choose the appropriate handler based on the editor type. // 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. + // that extends `FullscreenAbstractEditorHandler` 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 ); } } diff --git a/packages/ckeditor5-fullscreen/src/handlers/abstracteditorhandler.ts b/packages/ckeditor5-fullscreen/src/handlers/abstracteditorhandler.ts index 09df83489da..5aa5dab2fe4 100644 --- a/packages/ckeditor5-fullscreen/src/handlers/abstracteditorhandler.ts +++ b/packages/ckeditor5-fullscreen/src/handlers/abstracteditorhandler.ts @@ -24,8 +24,8 @@ const DIALOG_OFFSET = 28; * or if you wish to heavily customize the default behavior. * * The only method that is necessary to provide when extending this class is {@link #defaultOnEnter}. However, make sure to - * familiarize yourself with the below full list of actions taken by `AbstractEditorHandler` to understand what is covered by default, - * and what should be provided by you. + * familiarize yourself with the below full list of actions taken by `FullscreenAbstractEditorHandler` to understand + * what is covered by default, and what should be provided by you. * * When entering the fullscreen mode, the {@link #enable} method is called. It creates the properly styled container * and handles the editor features that need it, in the following order: @@ -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. */ diff --git a/packages/ckeditor5-fullscreen/src/handlers/classiceditorhandler.ts b/packages/ckeditor5-fullscreen/src/handlers/classiceditorhandler.ts index 5d90098b9d4..9ca9dc0a028 100644 --- a/packages/ckeditor5-fullscreen/src/handlers/classiceditorhandler.ts +++ b/packages/ckeditor5-fullscreen/src/handlers/classiceditorhandler.ts @@ -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. */ diff --git a/packages/ckeditor5-fullscreen/src/handlers/decouplededitorhandler.ts b/packages/ckeditor5-fullscreen/src/handlers/decouplededitorhandler.ts index d1095cb25fe..7bb5572a649 100644 --- a/packages/ckeditor5-fullscreen/src/handlers/decouplededitorhandler.ts +++ b/packages/ckeditor5-fullscreen/src/handlers/decouplededitorhandler.ts @@ -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. */ diff --git a/packages/ckeditor5-fullscreen/src/index.ts b/packages/ckeditor5-fullscreen/src/index.ts index d10d457daa7..18b311ce651 100644 --- a/packages/ckeditor5-fullscreen/src/index.ts +++ b/packages/ckeditor5-fullscreen/src/index.ts @@ -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'; diff --git a/packages/ckeditor5-fullscreen/tests/fullscreencommand.js b/packages/ckeditor5-fullscreen/tests/fullscreencommand.js index 3b8518d38b7..7bd231c9241 100644 --- a/packages/ckeditor5-fullscreen/tests/fullscreencommand.js +++ b/packages/ckeditor5-fullscreen/tests/fullscreencommand.js @@ -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: [ @@ -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 ) { diff --git a/packages/ckeditor5-fullscreen/tests/handlers/abstracteditorhandler.js b/packages/ckeditor5-fullscreen/tests/handlers/abstracteditorhandler.js index cfbb832532b..60a5bf54e82 100644 --- a/packages/ckeditor5-fullscreen/tests/handlers/abstracteditorhandler.js +++ b/packages/ckeditor5-fullscreen/tests/handlers/abstracteditorhandler.js @@ -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', () => { @@ -31,7 +31,7 @@ describe( 'AbstractHandler', () => { ] } ); - abstractHandler = new AbstractEditorHandler( editor ); + abstractHandler = new FullscreenAbstractEditorHandler( editor ); } ); afterEach( () => { @@ -272,7 +272,7 @@ describe( 'AbstractHandler', () => { } } ); - const tempAbstractHandlerDynamicToolbar = new AbstractEditorHandler( tempEditorDynamicToolbar ); + const tempAbstractHandlerDynamicToolbar = new FullscreenAbstractEditorHandler( tempEditorDynamicToolbar ); tempAbstractHandlerDynamicToolbar.enable(); tempAbstractHandlerDynamicToolbar.disable(); @@ -300,7 +300,7 @@ describe( 'AbstractHandler', () => { } } ); - const tempAbstractHandlerStaticToolbar = new AbstractEditorHandler( tempEditorStaticToolbar ); + const tempAbstractHandlerStaticToolbar = new FullscreenAbstractEditorHandler( tempEditorStaticToolbar ); tempAbstractHandlerStaticToolbar.enable(); tempAbstractHandlerStaticToolbar.disable(); @@ -381,7 +381,7 @@ describe( 'AbstractHandler', () => { ] } ); - abstractEditorHandler = new AbstractEditorHandler( editorWithRevisionHistory ); + abstractEditorHandler = new FullscreenAbstractEditorHandler( editorWithRevisionHistory ); } ); afterEach( async () => { @@ -447,7 +447,7 @@ describe( 'AbstractHandler', () => { ] } ); - abstractEditorHandler = new AbstractEditorHandler( editorWithSourceEditing ); + abstractEditorHandler = new FullscreenAbstractEditorHandler( editorWithSourceEditing ); sinon.stub( abstractEditorHandler, '_generateDocumentOutlineContainer' ); } ); diff --git a/packages/ckeditor5-fullscreen/tests/handlers/classiceditorhandler.js b/packages/ckeditor5-fullscreen/tests/handlers/classiceditorhandler.js index 0e1fc516932..6d2b205e42a 100644 --- a/packages/ckeditor5-fullscreen/tests/handlers/classiceditorhandler.js +++ b/packages/ckeditor5-fullscreen/tests/handlers/classiceditorhandler.js @@ -8,7 +8,7 @@ import { Paragraph } from '@ckeditor/ckeditor5-paragraph/src/paragraph.js'; import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic/src/classiceditor.js'; import { global } from '@ckeditor/ckeditor5-utils/src/dom/global.js'; -import { ClassicEditorHandler } from '../../src/handlers/classiceditorhandler.js'; +import { FullscreenClassicEditorHandler } from '../../src/handlers/classiceditorhandler.js'; import { FullscreenEditing } from '../../src/fullscreenediting.js'; describe( 'ClassicEditorHandler', () => { @@ -25,7 +25,7 @@ describe( 'ClassicEditorHandler', () => { ] } ); - classicEditorHandler = new ClassicEditorHandler( editor ); + classicEditorHandler = new FullscreenClassicEditorHandler( editor ); } ); afterEach( () => { @@ -82,7 +82,7 @@ describe( 'ClassicEditorHandler', () => { } } ); - const tempClassicEditorHandler = new ClassicEditorHandler( tempEditor ); + const tempClassicEditorHandler = new FullscreenClassicEditorHandler( tempEditor ); tempClassicEditorHandler.enable(); diff --git a/packages/ckeditor5-fullscreen/tests/handlers/decouplededitorhandler.js b/packages/ckeditor5-fullscreen/tests/handlers/decouplededitorhandler.js index d0dde85e208..02e0f95754a 100644 --- a/packages/ckeditor5-fullscreen/tests/handlers/decouplededitorhandler.js +++ b/packages/ckeditor5-fullscreen/tests/handlers/decouplededitorhandler.js @@ -8,7 +8,7 @@ import { Paragraph } from '@ckeditor/ckeditor5-paragraph/src/paragraph.js'; import { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled'; import { global } from '@ckeditor/ckeditor5-utils/src/dom/global.js'; -import { DecoupledEditorHandler } from '../../src/handlers/decouplededitorhandler.js'; +import { FullscreenDecoupledEditorHandler } from '../../src/handlers/decouplededitorhandler.js'; import { FullscreenEditing } from '../../src/fullscreenediting.js'; describe( 'DecoupledEditorHandler', () => { @@ -30,7 +30,7 @@ describe( 'DecoupledEditorHandler', () => { } } ); - decoupledEditorHandler = new DecoupledEditorHandler( editor ); + decoupledEditorHandler = new FullscreenDecoupledEditorHandler( editor ); } ); afterEach( () => { diff --git a/packages/ckeditor5-list/src/legacytodolist/legacytodolistediting.ts b/packages/ckeditor5-list/src/legacytodolist/legacytodolistediting.ts index 01b72333ee1..da4361b87f3 100644 --- a/packages/ckeditor5-list/src/legacytodolist/legacytodolistediting.ts +++ b/packages/ckeditor5-list/src/legacytodolist/legacytodolistediting.ts @@ -20,7 +20,7 @@ import type { ViewDocumentKeyDownEvent, AttributeOperation, RenameOperation, - SelectionChangeRangeEvent, + ModelSelectionChangeRangeEvent, ModelDocumentFragment } from 'ckeditor5/src/engine.js'; @@ -235,7 +235,7 @@ export class LegacyTodoListEditing extends Plugin { return; } - model.document.selection.on( 'change:range', () => { + model.document.selection.on( 'change:range', () => { const focusParent = model.document.selection.focus!.parent; const lastElementIsTodoList = isLegacyTodoListItemElement( lastFocusedCodeBlock ); const currentElementIsTodoList = isLegacyTodoListItemElement( focusParent ); diff --git a/packages/ckeditor5-list/src/todolist/todolistediting.ts b/packages/ckeditor5-list/src/todolist/todolistediting.ts index b7689d74999..80badd9099c 100644 --- a/packages/ckeditor5-list/src/todolist/todolistediting.ts +++ b/packages/ckeditor5-list/src/todolist/todolistediting.ts @@ -17,7 +17,7 @@ import { type ViewDocumentArrowKeyEvent, type MapperViewToModelPositionEvent, type ViewDocumentFragment, - type SelectionChangeRangeEvent, + type ModelSelectionChangeRangeEvent, type ModelDocumentFragment, type ModelElement } from 'ckeditor5/src/engine.js'; @@ -387,7 +387,7 @@ export class TodoListEditing extends Plugin { return; } - model.document.selection.on( 'change:range', () => { + model.document.selection.on( 'change:range', () => { const focusParent = model.document.selection.focus!.parent; const lastElementIsTodoList = isTodoListItemElement( lastFocusedCodeBlock ); const currentElementIsTodoList = isTodoListItemElement( focusParent ); diff --git a/packages/ckeditor5-typing/src/twostepcaretmovement.ts b/packages/ckeditor5-typing/src/twostepcaretmovement.ts index 1f16a5bb9e6..aaa392b8fbc 100644 --- a/packages/ckeditor5-typing/src/twostepcaretmovement.ts +++ b/packages/ckeditor5-typing/src/twostepcaretmovement.ts @@ -21,7 +21,7 @@ import { type ModelPosition, type ViewDocumentArrowKeyEvent, type ViewDocumentMouseDownEvent, - type ViewDocumentSelectionChangeEvent, + type ViewDocumentObserverSelectionChangeEvent, type ViewDocumentTouchStartEvent, type ModelInsertContentEvent, type ModelDeleteContentEvent @@ -520,7 +520,7 @@ export class TwoStepCaretMovement extends Plugin { } ); // When the selection has changed... - this.listenTo( document, 'selectionChange', () => { + this.listenTo( document, 'selectionChange', () => { const attributes = this.attributes; if ( !clicked && !touched ) { diff --git a/packages/ckeditor5-ui/src/index.ts b/packages/ckeditor5-ui/src/index.ts index a95757f74f6..bc9bdca2923 100644 --- a/packages/ckeditor5-ui/src/index.ts +++ b/packages/ckeditor5-ui/src/index.ts @@ -269,6 +269,7 @@ export { type MenuBarConfig, type MenuBarConfigObject, type NormalizedMenuBarConfigObject, + type MenuBarMenuEvent, type MenuBarMenuGroupDefinition, type MenuBarMenuDefinition, type MenuBarConfigAddedPosition, diff --git a/packages/ckeditor5-ui/src/menubar/menubarview.ts b/packages/ckeditor5-ui/src/menubar/menubarview.ts index 4881b099256..0cbb2f79933 100644 --- a/packages/ckeditor5-ui/src/menubar/menubarview.ts +++ b/packages/ckeditor5-ui/src/menubar/menubarview.ts @@ -430,7 +430,7 @@ export type MenuBarConfigAddedMenu = { * Any namespaced event fired by menu a {@link module:ui/menubar/menubarview~MenuBarView#menus menu view instance} of the * {@link module:ui/menubar/menubarview~MenuBarView menu bar}. */ -interface MenuBarMenuEvent extends BaseEvent { +export interface MenuBarMenuEvent extends BaseEvent { name: `menu:${ string }` | `menu:change:${ string }`; } diff --git a/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.ts b/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.ts index a9303712e89..3e931c63aa1 100644 --- a/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.ts +++ b/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.ts @@ -42,7 +42,7 @@ import type { ViewDowncastWriter, ModelElement, ModelSchema, - SelectionChangeRangeEvent, + ModelSelectionChangeRangeEvent, ViewDocumentArrowKeyEvent, ViewDocumentCompositionStartEvent, ViewDocumentKeyDownEvent, @@ -321,7 +321,7 @@ export class WidgetTypeAround extends Plugin { // selection as soon as the model range changes. This attribute only makes sense when a widget is selected // (and the "fake horizontal caret" is visible) so whenever the range changes (e.g. selection moved somewhere else), // let's get rid of the attribute so that the selection downcast dispatcher isn't even bothered. - this._listenToIfEnabled( modelSelection, 'change:range', ( evt, data ) => { + this._listenToIfEnabled( modelSelection, 'change:range', ( evt, data ) => { // Do not reset the selection attribute when the change was indirect. if ( !data.directChange ) { return;