Mailspring/static
Evan Morikawa c2ceb6fd6c 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
..
components refactor(toolbar): allow toolbar extensions in contenteditable 2016-01-20 14:35:20 -08:00
fonts/FontAwesome Restoring SearchBar, adding FontAwesome for icons not designed yet 2015-03-03 09:49:15 -08:00
images fix(packages): Default icon for third-party packages 2016-01-12 13:52:01 -08:00
mixins refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
package-template refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
sounds feat(notifications): Initial pass at new mail notifications 2015-02-20 12:19:34 -08:00
variables feat(keybindings): Show all keybindings in prefs 2015-12-01 18:31:19 -08:00
babelrc.json fix(babel): Roll back to babel@5, see details 2015-11-07 14:27:18 -08:00
buttons.less fix(prefs): Move to a sheet rather than a window, use configSchema 2015-11-23 12:20:51 -08:00
dropdowns.less Setup styles for dropdown (select) control 2015-10-21 21:27:53 +03:00
email-frame.less fix(styles): Remove custom pre tag styling for email 2015-11-24 12:35:35 -08:00
font-awesome.min.css refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
index.html Revert "bump(electron): 0.35.4 => 0.36.2" 2016-01-08 10:06:16 -08:00
index.js Revert "bump(electron): 0.35.4 => 0.36.2" 2016-01-08 10:06:16 -08:00
index.less feat(components): Add EditableList component to component-kit 2015-12-07 08:15:40 -08:00
inputs.less feat(mail-rules): Per-account mail rules filter incoming, existing mail 2015-12-23 02:19:32 -05:00
jasmine.less Make test output selectable 2015-12-31 04:06:18 -08:00
linux.less fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
normalize.less refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
react-remote-child.html feat(preferences): WIP Preferences panel 2015-08-14 15:40:11 -07:00
resizable.less button and less changes 2015-03-03 18:09:57 -08:00
selection.less fix(lint): fix linting css errors 2015-03-26 14:49:03 -04:00
type.less feat(keybindings): Show all keybindings in prefs 2015-12-01 18:31:19 -08:00
utilities.less fix(less): Lint errors preventing successful build 2015-03-05 15:42:38 -08:00
workspace.less rm(intercom): Point feedback to support.nylas, shrink button 2016-01-20 11:26:14 -08:00