Commit Graph

28 Commits

Author SHA1 Message Date
Nathan Sobo
badf1725fa Handle focus on hidden input when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:29 -07:00
Nathan Sobo
100af7d27d Fix corner cases related to lifecycle state of EditorComponent on events
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo
9b70cf2044 Make blur event on text editor element work with shadow DOM disabled
When the shadow DOM is enabled, this happens organically because the
focus is abstracted across the shadow boundary. Without that abstraction
boundary, we need to pretend that a blur of the hidden input is actually
a blur of the entire editor.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo
7fe9c14772 💄 2014-11-04 16:37:28 -07:00
Nathan Sobo
9690e44ffe Correctly handle focus when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo
0e57ede712 Only create a shadow root if editor.useShadowDOM config setting is true
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo
dd7335c30b Simplify focus/blur handling
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo
160bb29034 Null-guard component in blur handler 2014-11-04 16:37:27 -07:00
Nathan Sobo
6f3c53a17a Only cancel focus events if the editor is or contains the related target 2014-11-04 16:37:26 -07:00
Nathan Sobo
cf3f1aa2eb Don’t handle text editor focus when it already has focus 2014-11-04 16:37:26 -07:00
Nathan Sobo
eb19989ecd Handle focus at the host element level
Detecting focus and blur at the level of the input is creating problems
when we blur and then immediately refocus. This is simpler.
2014-11-04 16:37:25 -07:00
Nathan Sobo
b2bc09c13d Apply stylesheets with atom-editor-context in text editor specs 2014-11-04 16:37:22 -07:00
Nathan Sobo
2ab5fa405c Apply mini and is-focused class to both editor host element and root
This preserves existing theming behavior
2014-11-04 16:37:22 -07:00
Nathan Sobo
5f4fb23057 Initialize atom-styles element in editor shadow dom before measuring 2014-11-04 16:37:22 -07:00
Nathan Sobo
582066915b Apply syntax theme stylesheets in text editor shadow DOM via atom.styles 2014-11-04 16:37:21 -07:00
Nathan Sobo
c2d0b6d4f5 Load editor stylesheet in shadow root with style manager context param 2014-11-04 16:37:21 -07:00
Nathan Sobo
963c92eb4e Hack: Add editor stylesheets to atom-text-editor shadow root 2014-11-04 16:37:20 -07:00
Nathan Sobo
22212be90d Give atom-text-editor elements a shadow root
Themes aren’t applying correctly and there are issues with mini editors
but this basically works. I’m leaving the .editor node in the shadow
DOM for theme compatibility and because React still wants to render
into a wrapper element.
2014-11-04 16:37:20 -07:00
Kevin Sawicki
2e0bb66a9a Remove unneeded add encoding attr call 2014-10-29 16:03:57 -07:00
Kevin Sawicki
d205c4d664 Add data attribute for encoding
Mirrors the grammar data attribute
2014-10-29 16:03:10 -07:00
Nathan Sobo
02d20e3155 Call legacy SpacePen remove hooks before unmounting TextEditorComponent 2014-10-27 15:29:59 -06:00
Nathan Sobo
2910e017bb Unmount TextEditorComponent when TextEditor is destroyed
We don’t want to do it when the element is detached because it might
be caused by moving the editor rather than destroying it. Unmounting
the component entirely and then remounting it causes the hidden input
to not be recycled, interfering with focus restoration. Watching for
destruction of the model is a good way to ensure we always tear down
the view at the right time without doing it prematurely.
2014-10-27 15:12:30 -06:00
Nathan Sobo
2965398062 Throw on non-release builds if translating positions on destroyed editor
It’s possible that bundled packages stray into this corner case, so I’d
like us to catch and fix misbehaving packages before exposing users to 
any exceptions. Once we go one release with this turned on, we can
enable the exception for all builds.
2014-10-27 07:38:18 -06:00
Nathan Sobo
1eb3d8bf99 Use ‘atom-text-editor’ custom tag name for TextEditorElement 2014-10-09 07:39:14 -07:00
Nathan Sobo
fab0ac814d Fix checkout-head-revision command 2014-10-08 12:13:13 -07:00
Nathan Sobo
eaa3a27328 Add text-editor-element-spec and fix handling of focus and attributes 2014-10-08 12:13:13 -07:00
Nathan Sobo
1e4f4e0882 Move editor commands to global command registry 2014-10-08 12:13:13 -07:00
Nathan Sobo
003b67ee19 Add TextEditorElement and make TextEditorView a wrapper around it
This is the next step on converting all internal views to custom
elements instead of using SpacePen. The TextEditorElement instances
are associated with ::__spacePenView fields that are used for supporting
legacy access paths via atom.workspaceView.
2014-10-08 12:13:13 -07:00