Require TextEditorElement eagerly

With snapshots, all the forbidden modules are required lazily. In the
case of `TextEditorElement` this can be problematic because users might
create editors via `document.createElement('atom-text-editor')`.

With this commit we will eagerly require
`src/text-editor-element.coffee`, thus forcing `TextEditorElement` to
register the HTML custom element and fixing the issue.
This commit is contained in:
Antonio Scandurra
2017-04-13 11:03:35 +02:00
parent f4fceb0e20
commit fb6834d68b

View File

@@ -196,6 +196,11 @@ class AtomEnvironment extends Model
@applicationDelegate.didChangeHistoryManager() unless e.reloaded
initialize: (params={}) ->
# This will force TextEditorElement to register the custom element, so that
# using `document.createElement('atom-text-editor')` works if it's called
# before opening a buffer.
require './text-editor-element'
{@window, @document, @blobStore, @configDirPath, onlyLoadBaseStyleSheets} = params
{devMode, safeMode, resourcePath, clearWindowState} = @getLoadSettings()