Mailspring/spec
Juan Tejada 96da7ccb2d feat(editor-region): Add support to register components as editors
Summary:
- The main purpose of this is to be able to properly register the editor for the markdown plugin (and any other plugins to come)

- Refactors ComposerView and Contenteditable ->
  - Replaces Contenteditable with an InjectedComponent for a new region role:
    "Composer:Editor"
  - Creates a new component called ComposerEditor, which is the one that is
    being registered by default as "Composer:Editor"
  - I used this class to try to standardize the props that should be
    passed to any would be editor Component:
    - Renamed a bunch of the props which (I think) had a bit of
      confusing names
    - Added a bunch of docs for these in the source file, although
      I feel like those docs should live elsewhere, like in the
      ComponentRegion docs.
  - In the process, I ended up pulling some stuff out of ComposerView and
    some stuff out of the Contenteditable, namely:
    - The scrolling logic to ensure that the composer is visible while
      typing was moved outside of the Contenteditable -- this feels more
      like the ComposerEditor's responsibility, especially since the
      Contenteditable is meant to be used in other contexts as well.
    - The ComposerExtensions state; it feels less awkward for me if this
      is inside the ComposerEditor because 1) ComposerView does less
      things, 2) these are actually just being passed to the
      Contenteditable, 3) I feel like other plugins shouldn't need to
      mess around with ComposerExtensions, so we shouldn't pass them to the
      editor. If you register an editor different from our default one,
      any other ComposerExtension callbacks will be disabled, which
      I feel is expected behavior.
  - I think there is still some more refactoring to be done, and I left some TODOS
    here and there, but I think this diff is already big enough and its a minimal
    set of changes to get the markdown editor working in a not so duck
    tapish way.
- New props for InjectedComponent:
  - `requiredMethods`: allows you to define a collection of methods that
    should be implemented by any Component that registers for your
    desired region.
    - It will throw an error if these are not implemented
    - It will automatically pass calls made on the InjectedComponent to these methods
      down to the instance of the actual registered component
    - Would love some comments on this approach and impl
  - `fallback`: allows you to define a default component to use if none were
    registered through the ComponentRegistry
- Misc:
  - Added a new test case for the QuotedHTMLTransformer
- Tests:
  - They were minimally updated so that they don't break, but a big TODO
    is to properly refactor them. I plan to do that in an upcoming
    diff.

Test Plan: - Unit tests

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2372
2015-12-18 11:06:44 -08:00
..
components fix(editable-list): Prevent empty selection on esc pressed + other fixes 2015-12-14 14:29:45 -08:00
fixtures feat(paste): Paste accepts more HTML, paste and match style now available 2015-12-07 15:34:03 -08:00
models feat(observables): Implementation of observables to replace some stores 2015-12-07 16:52:46 -08:00
services feat(paste): Paste accepts more HTML, paste and match style now available 2015-12-07 15:34:03 -08:00
stores feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
tasks feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
action-bridge-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
auto-update-manager-spec.coffee bump(electron): 0.34.3 => 0.35.1 2015-11-23 22:09:17 -08:00
buffered-process-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
clipboard-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
component-registry-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
database-object-registry-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
database-view-spec.coffee feat(trash): Trash for Gmail, and architectural changes for common tasks 2015-10-21 10:38:00 -07:00
dom-utils-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
extension-registry-spec.coffee update(extensions): Rename DraftStoreExtension and MessageStoreExtension 2015-11-30 16:08:05 -08:00
jasmine-helper.coffee refactor(spec): remove spectron from main app 2015-12-02 13:42:09 -08:00
jasmine-jquery.js refactor(dir): move exports to src/global and consolidate tests 2015-10-02 09:19:37 -07:00
jasmine.js refactor(dir): move exports to src/global and consolidate tests 2015-10-02 09:19:37 -07:00
launch-services-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
menu-manager-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
model-view-selection-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
model-view-spec.coffee feat(selection): add selection of read, unread, starred, etc 2015-11-09 10:03:55 -05:00
module-cache-spec.coffee fix(specs): Update specs following 0.29.2 > 0.34.3 move 2015-11-17 17:40:06 -08:00
n1-spec-reporter.coffee fix(*): Fix for "apply is not a function" lost in revert of e275f35 2015-12-10 14:12:16 -08:00
nylas-api-spec.coffee feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
nylas-env-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
nylas-protocol-handler-spec.coffee fix(specs): Update specs following 0.29.2 > 0.34.3 move 2015-11-17 17:40:06 -08:00
nylas-test-utils.coffee feat(tests): add integration tests 2015-12-02 13:41:14 -08:00
package-manager-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
package-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
quoted-html-transformer-spec.coffee feat(editor-region): Add support to register components as editors 2015-12-18 11:06:44 -08:00
quoted-plain-text-transformer-spec.coffee feat(paste): Paste accepts more HTML, paste and match style now available 2015-12-07 15:34:03 -08:00
spec-bootstrap.coffee feat(spec): add config dir to integration specs 2015-12-10 10:52:20 -05:00
spec-helper-platform.coffee fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
spec-helper.coffee feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
spec-suite.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
spellchecker-spec.coffee fix(spellcheck): let win < 8 fallback to hunspell 2015-12-11 16:41:41 -05:00
style-manager-spec.coffee refactor(spec) move spec-nylas to spec 2015-10-01 21:39:44 -07:00
styles-element-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
theme-manager-spec.coffee refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
time-override.coffee feat(tests): add integration tests 2015-12-02 13:41:14 -08:00
time-reporter.coffee refactor(utils): switch to regular underscore 2015-05-19 16:06:59 -07:00
undo-manager-spec.coffee fix(composer): support Chinese & others - handle composition events 2015-10-30 20:03:33 -04:00
utils-spec.coffee fix(serialization): Inflate / deflate JSON from database with registered object system 2015-12-08 15:14:43 -08:00