InternalFires an module:engine/model/markercollection~MarkerCollection#event:update event for the given ~Marker marker but does not change the marker. Useful to force module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast conversion for the marker.
Marker or name of a marker to refresh.
InternalRemoves given ~Marker marker or a marker with given name from the MarkerCollection.
Marker or name of a marker to remove.
true if marker was found and removed, false otherwise.
InternalCreates and adds a ~Marker marker to the MarkerCollection with given name on given
module:engine/model/range~ModelRange range.
If MarkerCollection already had a marker with given name (or ~Marker marker was passed), the marker in
collection is updated and module:engine/model/markercollection~MarkerCollection#event:update event is fired
but only if there was a change (marker range or module:engine/model/markercollection~Marker#managedUsingOperations
flag has changed.
Name of marker to set or marker instance to update.
Marker range.
OptionalmanagedUsingOperations: booleanSpecifies whether the marker is managed using operations.
OptionalaffectsData: booleanSpecifies whether the marker affects the data produced by the data pipeline (is persisted in the editor's data).
Marker instance which was added or updated.
Iterable interface.
Iterates over all ~Marker markers added to the collection.
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.
Destroys marker collection and all markers inside it.
Fires an event, executing all callbacks registered for it.
The first parameter passed to callbacks is an module:utils/eventinfo~EventInfo object,
followed by the optional args provided in the fire() method call.
The type describing the event. See module:utils/emittermixin~BaseEvent.
The name of the event or EventInfo object if event is delegated.
Additional arguments to be passed to the callbacks.
By default the method returns undefined. However, the return value can be changed by listeners
through modification of the module:utils/eventinfo~EventInfo#return evt.return's property (the event info
is the first param of every callback).
Returns ~Marker marker with given markerName.
Name of marker to get.
Marker with given name or null if such marker was
not added to the collection.
Returns iterator that iterates over all markers, which ranges contain given module:engine/model/position~ModelPosition position.
Iterates over all markers that starts with given prefix.
const markerFooA = markersCollection._set( 'foo:a', rangeFooA );
const markerFooB = markersCollection._set( 'foo:b', rangeFooB );
const markerBarA = markersCollection._set( 'bar:a', rangeBarA );
const markerFooBarA = markersCollection._set( 'foobar:a', rangeFooBarA );
Array.from( markersCollection.getMarkersGroup( 'foo' ) ); // [ markerFooA, markerFooB ]
Array.from( markersCollection.getMarkersGroup( 'a' ) ); // []
Returns iterator that iterates over all markers, which intersects with given module:engine/model/range~ModelRange range.
Checks if given ~Marker marker or marker name is in the collection.
Name of marker or marker instance to check.
true if marker is in the collection, false otherwise.
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: GetCallbackOptions<TEvent>Additional options.
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.
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:
Optionalemitter: EmitterThe 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.
The collection of all module:engine/model/markercollection~Marker markers attached to the document. It lets you module:engine/model/markercollection~MarkerCollection#get get markers or track them using module:engine/model/markercollection~MarkerCollection#event:update event.
To create, change or remove makers use module:engine/model/writer~ModelWriter model writers' methods: module:engine/model/writer~ModelWriter#addMarker or module:engine/model/writer~ModelWriter#removeMarker. Since the writer is the only proper way to change the data model it is not possible to change markers directly using this collection. All markers created by the writer will be automatically added to this collection.
By default there is one marker collection available as module:engine/model/model~Model#markers model property.
See
module:engine/model/markercollection~Marker