-
Notifications
You must be signed in to change notification settings - Fork 41
T/329 Split Selection to Selection and DocumentSelection #505
Conversation
The only important difference between |
Done |
@@ -162,7 +162,6 @@ export default class Document { | |||
this.version++; | |||
|
|||
if ( operation.delta ) { | |||
// Right now I can't imagine operations without deltas, but let's be safe. | |||
this.history.addDelta( operation.delta ); |
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.
Can you merge master?
Conflicts: src/model/document.js tests/model/selection.js
Done. |
* | ||
* @returns {engine.model.Selection} Selection instance which ranges and direction is equal to this selection. | ||
*/ | ||
getSnapshot() { |
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.
We have Position.createFromPosition
, Range.createFromRange
so why not Selection.createFromSelection
?
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.
In fact I do not like these method, I prefer .clone( isDynamic )
but it is more important to have a consistent API now, we can discuss it in the separate issue.
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.
In fact, why not Zoidberg?
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.
I created a follow-up: https://github.com/ckeditor/ckeditor5-engine/issues/507
…on. Docs: Selection#_ranges is now protected.
Done. |
This PR fixes ckeditor/ckeditor5#3644
Notable changes:
DocumentSelection
which has same features as "old"Selection
.Selection
is now static, meaning that it does not createLiveRange
s and does not update when document changes.Selection
has no attributes API.Selection
has no "default range".DocumentSelection
hasgetSnapshot
method that returnsSelection
instance with same ranges and direction as thatDocumentSelection
.New
Selection
class is meant to be used when you need to cached it or in methods that may/have to modify selection.