Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Temporarily substitute wrap and unwrap operations with inserts and moves #1565

Merged
merged 7 commits into from
Oct 1, 2018

Conversation

scofalik
Copy link
Contributor

@scofalik scofalik commented Sep 28, 2018

Suggested merge commit message (convention)

Internal: Removed usage of WrapOperation and UnwrapOperation, using MoveOperation and InsertOperation instead. Changed SplitOperation#insertionPosition to a settable. Renamed SplitOperation#position to SplitOperation#splitPosition. Closes ckeditor/ckeditor5#4432.

@coveralls
Copy link

coveralls commented Sep 28, 2018

Coverage Status

Coverage decreased (-0.04%) to 99.959% when pulling 38b6f53 on t/1563 into 0821d90 on master.

@scofalik
Copy link
Contributor Author

@scofalik
Copy link
Contributor Author

Coverage decreased (-0.04%) to 99.96% when pulling b393177 on t/1563 into 0821d90 on master.

100% on my local machine 🤔

@scofalik
Copy link
Contributor Author

These errors are because of block-quote's post fixer is not available in that build.

@@ -238,9 +232,7 @@ export default class Differ {

// If the wrap took the element from the graveyard, mark that the element from the graveyard was removed.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment need to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmm... I don't understand why?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned belove, we should remove all the code related to wrap and unwrap operations which is not used anymore.

@@ -119,7 +119,12 @@ export default class MergeOperation extends Operation {
* @returns {module:engine/model/operation/splitoperation~SplitOperation}
*/
getReversed() {
return new SplitOperation( this.targetPosition, this.howMany, this.graveyardPosition, this.baseVersion + 1 );
const targetPosition = this.targetPosition._getTransformedByMergeOperation( this );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comment is needed.

* @param {Number} howMany Total offset size of elements that are in the split element after `position`.
* @param {module:engine/model/position~Position} insertionPosition Position at which the clone of split element
* (or element from graveyard) will be inserted.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some example?

@@ -653,7 +651,8 @@ export default class Writer {
do {
const version = splitElement.root.document ? splitElement.root.document.version : null;
const howMany = splitElement.maxOffset - position.offset;
const split = new SplitOperation( position, howMany, null, version );
const insertionPosition = SplitOperation.getInsertionPosition( position );
const split = new SplitOperation( position, howMany, insertionPosition, null, version );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you create this operation is too complicated. :/

@pjasiun
Copy link

pjasiun commented Oct 1, 2018

We should remove the code and tests related to wrap operations the model (position, differ, etc.). It can be done in a follow-up.

@pjasiun pjasiun merged commit ebae0c3 into master Oct 1, 2018
@pjasiun pjasiun deleted the t/1563 branch October 1, 2018 15:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants