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

Framework: split block logic out of RichText (part 2) #16309

Merged
merged 10 commits into from Jul 10, 2019

Conversation

@ellatrix
Copy link
Member

commented Jun 26, 2019

Description

This PR splits block related logic out of RichText into the RichText wrapper for blocks.

The RichText wrapper (to be used in blocks) now implements:

  • onEnter
  • onDelete (triggered at edges)
  • onPaste
  • inputRule ( for * to list etc.)

Also moves format relate logic to the format library:

  • Backtick ` rule to transform to <code>.
  • A paste rule for to link works on pasting a URL.
    • Also fixes the link pop up not showing after pasting the link.

How has this been tested?

E2e tests. Everything should work as before.

Screenshots

Types of changes

Refactoring.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ellatrix ellatrix force-pushed the try/rich-text-split-2 branch from 26f1136 to f8d5774 Jun 26, 2019

ellatrix added some commits Jun 26, 2019

@ellatrix ellatrix force-pushed the try/rich-text-split-2 branch from a289478 to f2342e5 Jun 27, 2019

@ellatrix ellatrix changed the title RichText: split block logic (part 2) Framework: split block logic out of RichText (part 2) Jun 27, 2019

@ellatrix ellatrix added the Framework label Jun 27, 2019

@ellatrix ellatrix added this to the Gutenberg 6.1 milestone Jun 27, 2019

ellatrix added some commits Jun 27, 2019

@ellatrix ellatrix force-pushed the try/rich-text-split-2 branch from beeeaf8 to 92532b2 Jun 27, 2019

@jorgefilipecosta
Copy link
Member

left a comment

Awesome work here @ellatrix, I did not find any regressions, and these changes seem to put the API in a better direction.
I left some comments but I don't think there are blockers.

let adjustedOnChange = originalOnChange;

// Handle deprecated format.
if ( Array.isArray( originalValue ) ) {

This comment has been minimized.

Copy link
@jorgefilipecosta

jorgefilipecosta Jul 9, 2019

Member

Should we add a deprecated call, to warn developers that a deprecated format is being used?

This comment has been minimized.

Copy link
@ellatrix

ellatrix Jul 9, 2019

Author Member

Good point. I believe a warning is logged from the blocks api package when this type of source is used, but I will test again to confirm.

This comment has been minimized.

Copy link
@ellatrix

ellatrix Jul 10, 2019

Author Member

As far as I can see, the deprecation were removed and never reintroduced. In other words, what @youknowriad suggested has never been done: #10439 (comment). Let's do this in a separate PR.

@ellatrix ellatrix merged commit 03121c5 into master Jul 10, 2019

1 of 2 checks passed

Filter merged Filter merged
Details
Travis CI - Pull Request Build Passed
Details

@ellatrix ellatrix deleted the try/rich-text-split-2 branch Jul 10, 2019

@ellatrix

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

Thanks for the review @jorgefilipecosta! :)

@ellatrix

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

The base RichText is again under a 1000 loc! 🎉

jg314 added a commit to jg314/gutenberg that referenced this pull request Jul 19, 2019

Framework: split block logic out of RichText (part 2) (WordPress#16309)
* wip

* Move enter, delete, paste

* Clean up isEmpty

* Clean up inputRule

* Update package.json

* Forgot bind

* Fix mistakes

* Simplify

* href => url

* Fix package.json

sbardian added a commit to sbardian/gutenberg that referenced this pull request Jul 29, 2019

Framework: split block logic out of RichText (part 2) (WordPress#16309)
* wip

* Move enter, delete, paste

* Clean up isEmpty

* Clean up inputRule

* Update package.json

* Forgot bind

* Fix mistakes

* Simplify

* href => url

* Fix package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.