Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Conversation

@JakeStoeffler
Copy link
Contributor

The cause of the browser refresh in #1886 is that _onDocumentSaved() thinks the Document being saved is an HTML Document, so an HTML live reload is triggered. But in reality, the Document being saved is a CSS Document in an inline editor.

Previously the _onDocumentSaved() method assumed that the Document being saved was the one returned by _getCurrentDocument(). In the case when an inline editor's Document is saved, _getCurrentDocument() returns the Document of the primary editor instead of the inline editor.

The actual saved Document is passed along when the documentSaved event is triggered in Document.prototype.notifySaved():

$(exports).triggerHandler("documentSaved", this) 

We just needed to accept the event data into _onDocumentSaved() and utilize it to determine the saved Document.

Note: An alternative solution would be to change the behavior of _getCurrentDocument() so that it returns the inline editor's Document, but I'm assuming we always want that to return the primary Document.

@ghost ghost assigned RaymondLim Oct 20, 2012
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just use the document passed in the event since DocumentManager always passes it in?
You can simply replace "data" with "doc" and then remove the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can make that change. Just thought I would make this "backwards compatible", but if it's only triggered from one place then it won't matter.

@RaymondLim
Copy link
Contributor

Looks good! Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants