Skip to content
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

7336: ConversionAPI update #7652

Merged
merged 36 commits into from
Aug 5, 2020
Merged

7336: ConversionAPI update #7652

merged 36 commits into from
Aug 5, 2020

Conversation

jodator
Copy link
Contributor

@jodator jodator commented Jul 20, 2020

Suggested merge commit message (convention)

Feature (engine): Introduced new upcast ConversionApi helper methods - conversionApi.safeInsert() and conversionApi.updateConversionResult(). New methods are intended to simplify writing event based element-to-element converters. Closes #7336.

MAJOR BREAKING CHANGE (engine): The config.view parameter for upcast element-to-element conversion helpers configurations is again mandatory. You can retain previous "catch-all" behavior for upcast converter using config.view = /[\s\S]+/.


Additional information

In addition to changes described previously under the ticket (#7336 (comment)):

  • I've updated list converters a bit (dd9481f) by using some of the API - however, I had to add a conditional statement to not update the modelRange if it was defined already (we might skip that change).
  • tests are still to be written (as the previous point might change implementation). done
  • I've updated the API docs
  • the getSplitParts() and splitToAllowedParent() are not used anymore - might be dropped.

TODO:

  • the getSplitParts() and splitToAllowedParent() are not used anymore - might be dropped - let's keep it for a while.
  • decide if special handling of modelRange is to be preserved (I couldn't find another way for that).
  • check if the consuming part shouldn't be simplified - a follow-up but not in this PR.

@jodator jodator marked this pull request as ready for review July 21, 2020 11:36
@jodator jodator requested a review from Reinmar July 21, 2020 11:36
// Otherwise continue conversion after the last list item.
data.modelCursor = data.modelRange.end;
}
conversionApi.updateConversionResult( listItem, data );
Copy link
Contributor Author

@jodator jodator Jul 29, 2020

Choose a reason for hiding this comment

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

Check if modelCursor can be cached before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't make it work without full copy-pate of the updateConversionResult() so 🤷‍♂️ dunno we might live with that if() inside it.

@jodator jodator requested a review from niegowski July 31, 2020 05:29
@jodator
Copy link
Contributor Author

jodator commented Jul 31, 2020

@niegowski Please make a review for this PR. We've looked at this with @Reinmar and the whole idea and change looks OK.

A conversation on a solution starts here: #7336 (comment).

@jodator
Copy link
Contributor Author

jodator commented Jul 31, 2020

@Reinmar I've updated the conversion deep-dive guide if you wish to check it - if not please just mark this PR as ✔️  to not block @niegowski with eventual merge.

@jodator
Copy link
Contributor Author

jodator commented Aug 4, 2020

@Reinmar as @niegowski is off today:

  1. I've fixed found issues.
  2. I've added UpcastConversionData typedef: 2e7c739.

So IMO it is good to merge.

@Reinmar
Copy link
Member

Reinmar commented Aug 4, 2020

I scanned all the code and I now work on the guide. I want to extend it a bit with some more context. But I may be stuck for a while on how to incorporate it into the existing guides. If you'll see that it may cause problems with maintaining this branch if it takes me 1-2 days, I can merge it as it is.

@jodator
Copy link
Contributor Author

jodator commented Aug 5, 2020

I scanned all the code and I now work on the guide. I want to extend it a bit with some more context

I'd go with a follow-up as it is only a guide update.

@Reinmar
Copy link
Member

Reinmar commented Aug 5, 2020

I pushed guide improvements. Could you scan them, @jodator?

@Reinmar
Copy link
Member

Reinmar commented Aug 5, 2020

OK, that's all for my review. I pushed some more changes to the API docs.

Please take a look at them and if I didn't make some bigger mistakes, you can merge this PR.

Co-authored-by: Kuba Niegowski <1232187+niegowski@users.noreply.github.com>
@jodator jodator closed this Aug 5, 2020
@jodator jodator reopened this Aug 5, 2020
@jodator
Copy link
Contributor Author

jodator commented Aug 5, 2020

@Reinmar - nice update :) and @niegowski good catch with that typo. As from me the PR is OK now, so you can merge.

@niegowski niegowski merged commit 8d84af1 into master Aug 5, 2020
@niegowski niegowski deleted the i/7336 branch August 5, 2020 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writing an event-based elementToElement upcast converter should be simpler
3 participants