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

RichText: absorb internal list controls #10744

Merged
merged 8 commits into from Nov 14, 2018

Conversation

@iseulde
Member

iseulde commented Oct 18, 2018

Description

This change aims to absorb any RichText related logic from the list block into the RichText component. With this, none of our core blocks will use the unstableGetSettings or unstableOnSetup props, which I would like to remove entirely so that no TinyMCE APIs remain exposed.

Also fixes a bug where the the active button is not set for nested lists.

After #10799, the list buttons may be rewritten to manipulate the internal rich text value directly, removing the dependency on the TinyMCE lists plugin.

How has this been tested?

The list block should continue to work as before.

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@iseulde iseulde added this to the 4.2 - API freeze milestone Oct 18, 2018

@iseulde iseulde added this to In Progress in API freeze via automation Oct 18, 2018

@iseulde iseulde requested a review from WordPress/gutenberg-core Oct 18, 2018

@aduth

This comment has been minimized.

Member

aduth commented Oct 18, 2018

With this, none of our core blocks will use the unstableGetSettings or unstableOnSetup props, which I would like to remove entirely so that no TinyMCE APIs remain exposed.

Can we delete them here and now?

@iseulde

This comment has been minimized.

Member

iseulde commented Oct 18, 2018

Can we delete them here and now?

Sure thing! More than happy to!

@iseulde

This comment has been minimized.

Member

iseulde commented Oct 18, 2018

There you go!

@iseulde iseulde force-pushed the try/rich-text-absorb-internal-list-controls branch from d389235 to 2af3985 Oct 18, 2018

@iseulde iseulde self-assigned this Oct 18, 2018

@gziolo gziolo self-requested a review Oct 25, 2018

@youknowriad youknowriad modified the milestones: 4.2, WordPress 5.0 Oct 30, 2018

@gziolo gziolo modified the milestones: WordPress 5.0, 4.4 Nov 5, 2018

@iseulde iseulde modified the milestones: 4.4, 4.3 Nov 6, 2018

@iseulde iseulde force-pushed the try/rich-text-absorb-internal-list-controls branch 2 times, most recently from 5d15b6f to ad64fcc Nov 6, 2018

/>
<RichTextShortcut
type="primary"
character="["

This comment has been minimized.

@aduth

aduth Nov 8, 2018

Member

These were ported backwards. ] should be for the indent.

This comment has been minimized.

@aduth

aduth Nov 8, 2018

Member

These were ported backwards. ] should be for the indent.

Updated in 25997a2

@aduth aduth force-pushed the try/rich-text-absorb-internal-list-controls branch from 3d21666 to bacbbdf Nov 9, 2018

@aduth

This comment has been minimized.

Member

aduth commented Nov 9, 2018

There's something not working quite right with indentation on new list items. I'll plan to investigate.

@aduth

This comment has been minimized.

Member

aduth commented Nov 9, 2018

It's not immediately obvious to me what's going on with the list indentation. The callbacks for the key handlers are not being called. Doing anything after the new item (even moving mouse, leaving screen and returning, pressing Escape) is enough to cause the keybind to work again, which itself is concerning as these don't seem like they should be causing any change in state to the RichText element.

We also still didn't quite port the existing binds as they were before, because Cmd+M / Cmd+Shift+M were only bound previously if the keyboard didn't support the ].

Given this is more a refactoring, and while I'd like to see the unstable functions gone sooner than later, I'm inclined to punt this to 4.4.

@aduth aduth modified the milestones: 4.3, 4.4 Nov 9, 2018

@iseulde

This comment has been minimized.

Member

iseulde commented Nov 14, 2018

@aduth Could you provide some steps to reproduce the indentation issue? I don't find any issues.

@iseulde

This comment has been minimized.

Member

iseulde commented Nov 14, 2018

Tbh the shortcuts added for lists are not great. On a Mac, 3/4 of the shortcuts clash:

screen shot 2018-11-14 at 12 37 43

screen shot 2018-11-14 at 12 38 39

@iseulde

This comment has been minimized.

Member

iseulde commented Nov 14, 2018

@aduth Okay, I found the problem with the shortcuts. They unmount when the toolbar disappears. So when when you type, they no longer work, when you hover again so the toolbars show, they work again.

@iseulde iseulde force-pushed the try/rich-text-absorb-internal-list-controls branch from bacbbdf to 7d08d2e Nov 14, 2018

Feedback addressed.

@iseulde

This comment has been minimized.

Member

iseulde commented Nov 14, 2018

We also still didn't quite port the existing binds as they were before, because Cmd+M / Cmd+Shift+M were only bound previously if the keyboard didn't support the ].

It's a bit strange to me that we're only binding based on some random language detection. The [] shortcuts won't do anything if you don't have the keys on your keyboard so it doesn't hurt to bind them. I don't think we can accurately detect if a keyboard has these keys

I also think we should bind Cmd+M / Cmd+Shift+M for everyone. Why would we only make them work in certain cases?

@iseulde iseulde requested a review from WordPress/gutenberg-core Nov 14, 2018

@aduth

aduth approved these changes Nov 14, 2018

Looks good 👍

@iseulde

This comment has been minimized.

Member

iseulde commented Nov 14, 2018

Thanks!

@iseulde iseulde merged commit 5757ec7 into master Nov 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

API freeze automation moved this from In Progress to Done Nov 14, 2018

@iseulde iseulde deleted the try/rich-text-absorb-internal-list-controls branch Nov 14, 2018

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Nov 22, 2018

RichText: absorb internal list controls (WordPress#10744)
* RichText: absorb internal list controls

* require editor for list toolbar

* Correct isActive for internal list

* Remove unstableGetSettings and unstableOnSetup

* Restore shortcuts

* Editor: Fix RichText indent character mappings

* restore lists_indent_on_tab=false

* Move shortcuts out of BlockFormatControls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment