Mailspring/static/components
Evan Morikawa c7a685630d refactor(toolbar): allow toolbar extensions in contenteditable
Summary:
This is a refactor of the toolbar in the contenteditable. Goals of this
are:

1. Allow developers to add new buttons to the toolbar
2. Allow developers to add other component types to the floating toolbar (like the LinkEditor)
3. Make the toolbar declaratively defined instead of imperatively set
4. Separate out logical units of the toolbar into individual sections
5. Clean up `innerState` of the Contenteditable

The Floating Toolbar used to be an imperative mess. Doing simple
functionality additions required re-understanding a very complex set of
logic to hide and show the toolbar and delecately manage focus states.
There also was no real capacity for any developer to extend the toolbar.

It also used to be completely outside of our `atomicEdit` system and was a
legacy of having raw access to contenteditable controls (since it all used
to be directly inside of the contenteditable)

Finally it was difficult to declaratively define things because the
`innerState` of the Contenteditable was inconsistently used and its
lifecycle not properly thought through. This fixed several lifecycle bugs
with that.

Along the way several of the DOMUtils methods were also subtly not
functional and fixed.

The Toolbar is now broken apart into separate logical units.

There are now `ContentedtiableExtension`s that declare what should be
displayed in the toolbar at any given moment.

They define a method called `toolbarComponentData`. This is a pure
function of the state of the `Contenteditable`. If selection and content
conditions look correct, then that method will return a component to
render. This is how we declaratively define whether a toolbar should be
visible or not instead of manually setting `hide` & `show` bits.

There is also a `toolbarButtons` method that declaratively defines buttons
that can go in the new `<ToolbarButtons>` component.

The `ToolbarButtonManager` takes care of extracting these and binding the
correct editorAPI context.

Now the `<LinkEditor>` is a separate component from the `<ToolbarButtons>`
instead of being smashed together.

The `LinkManager` takes care of declaring when the `LinkEditor` should be
displayed and has properly bound methods to update the `contenteditable`
through the standard `atomicEdit` interface.

If users have additional contenteditable popup plugins (like displaying
extra info on a name or some content in the composer), they can now
implement the `toolbarComponentData` api and declaratively define that
information based on the state of the contenteditable.

Test Plan: TODO

Reviewers: bengotow, juan

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2442
2016-01-20 14:35:20 -08:00
..
button-dropdown.less feat(windows): improve UI for Windows 2015-10-21 20:32:33 -07:00
contenteditable.less refactor(toolbar): allow toolbar extensions in contenteditable 2016-01-20 14:35:20 -08:00
disclosure-triangle.less feat(prefs): Allow tabs with an accounts submenu 2015-11-30 11:43:49 -08:00
editable-list.less feat(mail-rules): Per-account mail rules filter incoming, existing mail 2015-12-23 02:19:32 -05:00
extra.less feat(windows): improve UI for Windows 2015-10-21 20:32:33 -07:00
generated-form.less feat(salesforce): load current user 2015-05-07 15:28:44 -07:00
key-commands-region.less feat(keymap): add new <KeymapHandlers /> 2015-11-06 11:47:06 -08:00
list-tabular.less fix(thread-list): Focused / selected threads appear gray when window is blurred 2015-09-28 02:43:46 -07:00
menu.less fix(dropdowns): 3% darken on hover, not full blue 2015-11-13 16:58:55 -08:00
popover.less bump(️): Electron 0.29.2 > 0.34.3, Sqlite 3.0.11 > 3.1.1 2015-11-17 15:36:32 -08:00
scroll-region.less feat(sidebar): Hierarchical folders/labels in the sidebar, rendering perf 2015-10-22 10:53:57 -07:00
spinner.less fix(spinner): Improve loading indicator style / tweening 2015-12-09 15:47:51 -08:00
switch.less feat(post-auth): Initial prefs + packages screens, welcome copy changes 2015-09-29 23:58:30 -07:00
tokenizing-text-field.less fix(ui-dark): Small color adjustments, resolves #299, #148 2015-11-09 18:52:24 -08:00
unsafe.less fix(lint): fix linter errors with latest land 2015-04-30 18:27:39 -07:00