Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/LiveDevelopment/LivePreviewConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ define(function main(require, exports, module) {

exports.PREFERENCE_SHOW_STYLES_BAR = "livePreviewShowStylesBar";

exports.PREFERENCE_SHOW_STARTER_BAR = "livePreviewShowStarterBar";

exports.PREFERENCE_STYLES_BAR_POSITION = "livePreviewStylesBarPosition";
});
13 changes: 11 additions & 2 deletions src/LiveDevelopment/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ define(function main(require, exports, module) {
elemHighlights: CONSTANTS.HIGHLIGHT_HOVER, // default value, this will get updated when the extension loads
showRulerLines: false, // default value, this will get updated when the extension loads
showStylesBar: true, // default value, this will get updated when the extension loads
stylesBarPosition: "", // saved dock side ("top"/"bottom"); empty = default bottom
showStarterBar: true, // default value, this will get updated when the extension loads
stylesBarPosition: "bottom", // saved dock side ("top"/"bottom")
syncSourceAndPreview: true, // default value, this will get updated when the extension loads
imageGalleryAutoOpen: true, // auto-open gallery on first image click per session
isPaidUser: false, // will be updated when we fetch entitlements
Expand Down Expand Up @@ -345,10 +346,17 @@ define(function main(require, exports, module) {
MultiBrowserLiveDev.updateConfig(config);
}

function updateStarterBarConfig() {
const prefValue = PreferencesManager.get(CONSTANTS.PREFERENCE_SHOW_STARTER_BAR);
const config = MultiBrowserLiveDev.getConfig();
config.showStarterBar = prefValue !== false; // defaults to true (on)
MultiBrowserLiveDev.updateConfig(config);
}

function updateStylesBarPositionConfig() {
const prefValue = PreferencesManager.get(CONSTANTS.PREFERENCE_STYLES_BAR_POSITION);
const config = MultiBrowserLiveDev.getConfig();
config.stylesBarPosition = prefValue || "";
config.stylesBarPosition = prefValue || "bottom";
MultiBrowserLiveDev.updateConfig(config);
}

Expand Down Expand Up @@ -376,6 +384,7 @@ define(function main(require, exports, module) {
exports.updateElementHighlightConfig = updateElementHighlightConfig;
exports.updateRulerLinesConfig = updateRulerLinesConfig;
exports.updateStylesBarConfig = updateStylesBarConfig;
exports.updateStarterBarConfig = updateStarterBarConfig;
exports.updateStylesBarPositionConfig = updateStylesBarPositionConfig;
exports.getConnectionIds = MultiBrowserLiveDev.getConnectionIds;
exports.getLivePreviewDetails = MultiBrowserLiveDev.getLivePreviewDetails;
Expand Down
17 changes: 14 additions & 3 deletions src/extensionsIntegrated/Phoenix-live-preview/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,17 @@ define(function (require, exports, module) {
description: Strings.LIVE_DEV_SETTINGS_SHOW_STYLES_BAR_PREFERENCE
});

// live preview styles bar position preference; persists where the user last dragged the bar
// live preview starter bar preference (show/hide the starter bar on empty pages); on by default
const PREFERENCE_SHOW_STARTER_BAR = CONSTANTS.PREFERENCE_SHOW_STARTER_BAR;
PreferencesManager.definePreference(PREFERENCE_SHOW_STARTER_BAR, "boolean", true, {
description: Strings.LIVE_DEV_SETTINGS_SHOW_STARTER_BAR_PREFERENCE
});

// live preview styles bar dock side preference; persisted when the user flips the bar's dock button
const PREFERENCE_STYLES_BAR_POSITION = CONSTANTS.PREFERENCE_STYLES_BAR_POSITION;
PreferencesManager.definePreference(PREFERENCE_STYLES_BAR_POSITION, "string", "", {
description: Strings.LIVE_DEV_SETTINGS_STYLES_BAR_POSITION_PREFERENCE
PreferencesManager.definePreference(PREFERENCE_STYLES_BAR_POSITION, "string", "bottom", {
description: Strings.LIVE_DEV_SETTINGS_STYLES_BAR_POSITION_PREFERENCE,
values: ["top", "bottom"]
});

const LIVE_PREVIEW_PANEL_ID = "live-preview-panel";
Expand Down Expand Up @@ -1555,13 +1562,17 @@ define(function (require, exports, module) {
PreferencesManager.on("change", PREFERENCE_SHOW_STYLES_BAR, function() {
LiveDevelopment.updateStylesBarConfig();
});
PreferencesManager.on("change", PREFERENCE_SHOW_STARTER_BAR, function() {
LiveDevelopment.updateStarterBarConfig();
});
PreferencesManager.on("change", PREFERENCE_STYLES_BAR_POSITION, function() {
LiveDevelopment.updateStylesBarPositionConfig();
});
// Initialize element highlight, ruler lines and styles bar config on startup
LiveDevelopment.updateElementHighlightConfig();
LiveDevelopment.updateRulerLinesConfig();
LiveDevelopment.updateStylesBarConfig();
LiveDevelopment.updateStarterBarConfig();
LiveDevelopment.updateStylesBarPositionConfig();

LiveDevelopment.openLivePreview();
Expand Down
7 changes: 3 additions & 4 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ define({
"LIVE_DEV_SETTINGS_ELEMENT_HIGHLIGHT_PREFERENCE": "Inspect element in Live Preview on 'hover' or 'click'. Defaults to 'hover'",
"LIVE_DEV_SETTINGS_SHOW_RULER_LINES_PREFERENCE": "Show measurements when elements are selected in live preview. Defaults to 'false'",
"LIVE_DEV_SETTINGS_SHOW_STYLES_BAR_PREFERENCE": "Show the styles bar when elements are selected in live preview. Defaults to 'true'",
"LIVE_DEV_SETTINGS_STYLES_BAR_POSITION_PREFERENCE": "Saved position of the live preview styles bar, set automatically when the bar is dragged. Empty places the bar at its default spot",
"LIVE_DEV_SETTINGS_SHOW_STARTER_BAR_PREFERENCE": "Show the starter bar when the live preview page is empty. Defaults to 'true'",
"LIVE_DEV_SETTINGS_STYLES_BAR_POSITION_PREFERENCE": "Which edge the live preview styles bar docks to, 'top' or 'bottom'. Defaults to 'bottom'",
"LIVE_DEV_TOOLBOX_SELECT_PARENT": "Select Parent",
"LIVE_DEV_TOOLBOX_EDIT_TEXT": "Edit Text",
"LIVE_DEV_TOOLBOX_DOUBLE_CLICK_HINT": "Double-click",
Expand Down Expand Up @@ -437,9 +438,7 @@ define({
"LIVE_DEV_INSERT_SHOW_MORE": "Show more",
"LIVE_DEV_INSERT_SHOW_LESS": "Show less",
"LIVE_DEV_INSERT_CREATE": "Create",
"LIVE_DEV_EMPTY_CANVAS_LABEL": "Your page is empty — add an element",
"LIVE_DEV_EMPTY_CANVAS_ADD": "Add your first element",
"LIVE_DEV_EMPTY_CANVAS_COLLAPSE": "Collapse",
"LIVE_DEV_STARTER_BAR_LABEL": "Your page is empty — add an element",
"LIVE_DEV_IMAGE_GALLERY_USE_IMAGE": "Download image",
"LIVE_DEV_IMAGE_GALLERY_SELECT_DOWNLOAD_FOLDER": "Choose image download folder",
"LIVE_DEV_IMAGE_GALLERY_SEARCH_PLACEHOLDER": "Search images\u2026",
Expand Down
2 changes: 1 addition & 1 deletion tracking-repos.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"phoenixPro": {
"commitID": "844cfa15093ec806a3b3327bb36791ca41405a66"
"commitID": "f0774ecdb6a1ad14330dae7c4482a7c77c385f60"
}
}
Loading