This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix for issue #1561 #1707
Merged
Merged
Fix for issue #1561 #1707
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f82a22a
fix for issue 1561
6759e87
Fix for Issue 1561 - added eventHandler function for statusChange
9539c42
Merge remote-tracking branch 'upstream/master' into issue1561
03bb814
Changes to add checkmark only for STATUS_ACTIVE
563117b
Unnecessary whitespace cleanup
2d4d641
Merge remote-tracking branch 'upstream/master' into issue1561
7306f52
Refined condition for adding checkmark
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,6 @@ define(function main(require, exports, module) { | |
function _handleGoLiveCommand() { | ||
if (LiveDevelopment.status >= LiveDevelopment.STATUS_CONNECTING) { | ||
LiveDevelopment.close(); | ||
// TODO Ty: when checkmark support lands, remove checkmark | ||
} else { | ||
if (!params.get("skipLiveDevelopmentInfo") && !prefs.getValue("afterFirstLaunch")) { | ||
prefs.setValue("afterFirstLaunch", "true"); | ||
|
@@ -132,7 +131,6 @@ define(function main(require, exports, module) { | |
} else { | ||
LiveDevelopment.open(); | ||
} | ||
// TODO Ty: when checkmark support lands, add checkmark | ||
} | ||
} | ||
|
||
|
@@ -155,6 +153,20 @@ define(function main(require, exports, module) { | |
// Initialize tooltip for 'not connected' state | ||
_setLabel(_$btnGoLive, null, _statusStyle[1], _statusTooltip[1]); | ||
} | ||
|
||
/** maintains state of the menu item */ | ||
function _setupGoLiveMenu() { | ||
$(LiveDevelopment).on("statusChange", function statusChange(event, status) { | ||
//update the checkmark next to 'Live Preview' menu item | ||
//add checkmark when status is STATUS_CONNECTING | ||
if (status === LiveDevelopment.STATUS_CONNECTING) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to only show the checkmark when we actually finish establishing the connection (STATUS_ACTIVE). |
||
CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(true); | ||
} else if (status < LiveDevelopment.STATUS_CONNECTING) { | ||
//remove checkmark if status is STATUS_INACTIVE or STATUS_ERROR | ||
CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we only show the checkmark when the status is STATUS_ACTIVE, then you could just remove it in all other cases. |
||
} | ||
}); | ||
} | ||
|
||
/** Create the menu item "Highlight" */ | ||
function _setupHighlightButton() { | ||
|
@@ -191,6 +203,8 @@ define(function main(require, exports, module) { | |
LiveDevelopment.init(config); | ||
_loadStyles(); | ||
_setupGoLiveButton(); | ||
_setupGoLiveMenu(); | ||
|
||
/* _setupHighlightButton(); FUTURE - Highlight button */ | ||
if (config.debug) { | ||
_setupDebugHelpers(); | ||
|
@@ -209,9 +223,9 @@ define(function main(require, exports, module) { | |
} | ||
}); | ||
} | ||
|
||
} | ||
window.setTimeout(init); | ||
|
||
CommandManager.register(Strings.CMD_LIVE_FILE_PREVIEW, Commands.FILE_LIVE_FILE_PREVIEW, _handleGoLiveCommand); | ||
|
||
// Export public functions | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: we generally put one space after
//
and capitalize comments.