-
Notifications
You must be signed in to change notification settings - Fork 40
Feature: Introduced Writer#refreshMarker
method.
#1694
Conversation
We agreed to use |
…ugh `Writer#updateMarker()` method.
src/model/markercollection.js
Outdated
const marker = this._markers.get( markerName ); | ||
|
||
if ( !marker ) { | ||
throw new CKEditorError( 'markers-refresh-marker-not-exists: Marker with provided name does not exists.' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new CKEditorError( 'markers-refresh-marker-not-exists: Marker with provided name does not exists.' ); | |
throw new CKEditorError( 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
throw new CKEditorError( 'markers-refresh-marker-not-exists: Marker with provided name does not exists.' ); | ||
} | ||
|
||
const range = marker.getRange(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const range = marker.getRange(); | |
const range = marker.getRange(); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/model/writer.js
Outdated
@@ -939,13 +939,38 @@ export default class Writer { | |||
} | |||
|
|||
/** | |||
* Adds or updates a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks | |||
* Adds updates or refreshes a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Adds updates or refreshes a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks | |
* Adds, updates or refreshes a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/model/writer.js
Outdated
* changes in the document and updates its range automatically, when model tree changes. Still, it is possible to change the | ||
* marker's range directly using this method. | ||
* | ||
* As the first parameter you can set marker name or instance. If none of them is provided, new marker, with a unique | ||
* name is created and returned. | ||
* | ||
* As the second parameter you can set the new marker data or leave this parameter as empty what will only refresh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* As the second parameter you can set the new marker data or leave this parameter as empty what will only refresh | |
* As the second parameter you can set the new marker data or leave this parameter as empty which will just refresh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
tests/model/markercollection.js
Outdated
it( 'should throw if marker does not exist', () => { | ||
expect( () => { | ||
markers._refresh( 'name' ); | ||
} ).to.throw( CKEditorError, 'markers-refresh-marker-not-exists: Marker with provided name does not exists.' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} ).to.throw( CKEditorError, 'markers-refresh-marker-not-exists: Marker with provided name does not exists.' ); | |
} ).to.throw( CKEditorError, 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.' ); |
Suggested merge commit message (convention)
Feature: Added possibility to refresh the marker with no changes through
Writer#updateMarker()
method. Closes ckeditor/ckeditor5#4471.Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.