-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
model.writer#setMarker should not change marker's options when they are not set #4276
Comments
Writing this comment I realised that it would be inconsistent: This is why I think we should split this method and have separate
Set marker should not accept "marker" as the first parameter. It could create a new marker instance and should return marker instance. It removes old maker if the marker with such name existed. Update marker should not create new marker instance but only update the existing instance. It should return nothing. It should change only options you define. |
To make it safer we should make |
@pjasiun does |
No. The whole point of |
@pjasiun just wanted to be sure. Anyway second question: writer.setMarker( [ name ], range, options );
writer.updateMarker( markerOrName, range, [ options ] ) I have problem with the first parameter ( Optional parameters should go as last but it looks weir a bit now. writer.setMarker( range, { using: true } );
writer.setMarker( range, { using: true }, 'myMarker' );
writer.updateMarker( 'myMarker', range );
writer.updateMarker( 'myMarker', range, { using: true } ); Or maybe: writer.setMarker( range, 'myMarker', { using: false } );
writer.setMarker( range, { using: true } );
writer.updateMarker( range, 'myMarker' );
writer.updateMarker( range, myMarker, { using: true } ); I can see at least two sensible options:
|
After talks with @pjasiun and that we cannot come to a cleaner solution will make
|
Yep. Also, we agreed to move |
Feature: Introduce `writer#updateMarker()` method. Closes #1299. BREAKING CHANGE: The `writer#setMarker()` method is used only to create a new marker and it does not accept a `marker` instance as a parameter. To update existing marker use `writer#updateMarker()` method. BREAKING CHANGE: The `options.usingOperation` option in `writer#setMarker()` is now a required one. BREAKING CHANGE: The `range` parameter was removed. Use `options.range` instead.
When creating a marker you can set whether the marker is managed through operations:
However, at the moment, the method works in a way, that you need to pass that object every time because when not set, the option will be overwritten:
Instead, when options object is not set,
setMarker
call should not change any options. Only this should change an option:The text was updated successfully, but these errors were encountered: