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

Fix for #1886 #1897

Merged
merged 2 commits into from
Oct 20, 2012
Merged

Fix for #1886 #1897

merged 2 commits into from
Oct 20, 2012

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
@@ -500,8 +500,8 @@ define(function LiveDevelopment(require, exports, module) {
}

/** Triggered by a document saved from the DocumentManager */
function _onDocumentSaved() {
var doc = _getCurrentDocument();
function _onDocumentSaved(event, data) {
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.

None yet

2 participants