ReadonlydocumentA reference to the module:engine/view/document~ViewDocument object.
ReadonlydomIf set to true DOM events will be listened on the capturing phase.
Default value is false.
If set to true, indicates that the function specified by listener will never call preventDefault().
Default value is false.
ReadonlyviewAn instance of the view controller.
The state of the observer. If it is disabled, no events will be fired.
Checks whether a given DOM event should be ignored (should not be turned into a synthetic view document event).
Currently, an event will be ignored only if its target or any of its ancestors has the data-cke-ignore-events attribute.
This attribute can be used inside the structures generated by
module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement ViewDowncastWriter#createUIElement() to ignore events
fired within a UI that should be excluded from CKEditor 5's realms.
The DOM event target to check (usually an element, sometimes a text node and potentially sometimes a document, too).
Whether this event should be ignored by the observer.
Delegates selected events to another module:utils/emittermixin~Emitter. For instance:
emitterA.delegate( 'eventX' ).to( emitterB );
emitterA.delegate( 'eventX', 'eventY' ).to( emitterC );
then eventX is delegated (fired by) emitterB and emitterC along with data:
emitterA.fire( 'eventX', data );
and eventY is delegated (fired by) emitterC along with data:
emitterA.fire( 'eventY', data );
Event names that will be delegated to another emitter.
Disables and destroys the observer, among others removes event listeners created by the observer.
Enables the observer. This method is called when the observer is registered to the module:engine/view/view~EditingView and after module:engine/view/view~EditingView#forceRender rendering (all observers are #disable disabled before rendering).
A typical use case for disabling observers is that mutation observers need to be disabled for the rendering. However, a child class may not need to be disabled, so it can implement an empty method.
Calls Document#fire() if observer #isEnabled is enabled.
The event type (name).
The DOM event.
OptionaladditionalData: objectThe additional data which should extend the module:engine/view/observer/domeventdata~ViewDocumentDomEventData event data object.
Finishes setting the document focus state.
Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node. It is backwards compatible with module:utils/emittermixin~Emitter#listenTo.
The object that fires the event.
The name of the event.
The function to be called on event.
Optionaloptions: CallbackOptions & { useCapture?: boolean; usePassive?: boolean }Additional options.
Optional ReadonlyuseCapture?: booleanIndicates that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree.
Optional ReadonlyusePassive?: booleanIndicates that the function specified by listener will never call preventDefault() and prevents blocking browser's main thread by this event handler.
Registers a callback function to be executed when an event is fired in a specific (emitter) object.
Events can be grouped in namespaces using :.
When namespaced event is fired, it additionally fires all callbacks for that namespace.
// myEmitter.on( ... ) is a shorthand for myEmitter.listenTo( myEmitter, ... ).
myEmitter.on( 'myGroup', genericCallback );
myEmitter.on( 'myGroup:myEvent', specificCallback );
// genericCallback is fired.
myEmitter.fire( 'myGroup' );
// both genericCallback and specificCallback are fired.
myEmitter.fire( 'myGroup:myEvent' );
// genericCallback is fired even though there are no callbacks for "foo".
myEmitter.fire( 'myGroup:foo' );
An event callback can module:utils/eventinfo~EventInfo#stop stop the event and set the module:utils/eventinfo~EventInfo#return return value of the #fire method.
The type describing the event. See module:utils/emittermixin~BaseEvent.
The object that fires the event.
The name of the event.
The function to be called on event.
Optionaloptions: CallbackOptionsAdditional options.
Starts observing given DOM element.
DOM element to observe.
Stops executing the callback on the given event.
Shorthand for #stopListening this.stopListening( this, event, callback ).
The name of the event.
The function to stop being called.
Registers a callback function to be executed when an event is fired.
Shorthand for #listenTo this.listenTo( this, event, callback, options ) (it makes the emitter
listen on itself).
The type descibing the event. See module:utils/emittermixin~BaseEvent.
The name of the event.
The function to be called on event.
Optionaloptions: GetCallbackOptions<TEvent>Additional options.
Registers a callback function to be executed on the next time the event is fired only. This is similar to calling #on followed by #off in the callback.
The type descibing the event. See module:utils/emittermixin~BaseEvent.
The name of the event.
The function to be called on event.
Optionaloptions: GetCallbackOptions<TEvent>Additional options.
Callback which should be called when the DOM event occurred. Note that the callback will not be called if observer #isEnabled is not enabled.
Stops delegating events. It can be used at different levels:
Optionalevent: stringThe name of the event to stop delegating. If omitted, stops it all delegations.
Optionalemitter: Emitter(requires event) The object to stop delegating a particular event to.
If omitted, stops delegation of event to all emitters.
Stops listening for events. It can be used at different levels: It is backwards compatible with module:utils/emittermixin~Emitter#listenTo.
Optionalemitter: Node | EventTarget | Emitter | WindowThe object to stop listening to. If omitted, stops it for all objects.
Optionalevent: string(Requires the emitter) The name of the event to stop listening to. If omitted, stops it
for all events from emitter.
Optionalcallback: Function(Requires the event) The function to be removed from the call list for the given
event.
module:engine/view/document~ViewDocument#event:focus Focus and module:engine/view/document~ViewDocument#event:blur blur events observer. Focus observer handle also module:engine/view/rooteditableelement~ViewRootEditableElement#isFocused isFocused property of the module:engine/view/rooteditableelement~ViewRootEditableElement root elements.
Note that this observer is attached by the module:engine/view/view~EditingView and is available by default.