Previously, a transaction was used to set an undo grouping interval
for every editor command except `undo` and `redo`. The problem is
that currently, moving a marker inside of a transaction causes the
buffer's redo stack to be cleared. For now, just don't use
transactions for commands that don't modify the buffer's contents."
To allow testing of async editor rendering in packages. This is helpful
for overlay decorations which behave differently when rendering is
async.
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
The goal is to allow the editor’s styling to be overridden as follows:
atom-text-editor {
background: black;
color: white;
}
If we retain these classes, themes will continue to style the root
element of the editor and destroy the ability to style the editor in
this way. You would instead have to do the following:
atom-text-editor::shadow .editor {
background: black;
color: white;
}
This is way less intuitive and confusing for people.
Trying to style both modes of the text editor with the same style sheet
is proving to be more trouble than it’s worth. This prepares the shadow
DOM style sheet to diverge more radically to enable the background color
to be overridden from the outside more easily.
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>
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.
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.
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.