diff --git a/lib/guest-portal-binding.js b/lib/guest-portal-binding.js index 7a008ee7..3fa00968 100644 --- a/lib/guest-portal-binding.js +++ b/lib/guest-portal-binding.js @@ -155,6 +155,8 @@ class GuestPortalBinding { this.newActivePaneItem = newActivePaneItem if (this.activePaneItem) { + this.ensurePaneItemStylesAreUpToDate(newActivePaneItem) + const pane = this.workspace.paneForItem(this.activePaneItem) const index = pane.getItems().indexOf(this.activePaneItem) pane.addItem(newActivePaneItem, {index, moved: this.addedPaneItems.has(newActivePaneItem)}) @@ -170,6 +172,18 @@ class GuestPortalBinding { this.newActivePaneItem = null } + ensurePaneItemStylesAreUpToDate (paneItem) { + // When editor styles change, Atom notifies only editor components that + // are attached to the DOM at the moment of the change. Thus, if the + // element we are about to add had already been rendered, we will + // preemptively clear all its styling information to ensure it will render + // correctly even if some styles changed while it was not attached to the + // DOM. + if (this.addedPaneItems.has(paneItem) && paneItem instanceof TextEditor) { + paneItem.component.didUpdateStyles() + } + } + getActivePaneItem () { return this.newActivePaneItem ? this.newActivePaneItem : this.activePaneItem }