Skip to content

Commit 98f5e2a

Browse files
committed
refactor: remove remote styles config passing as it can be passed directly in code
1 parent a27b650 commit 98f5e2a

File tree

3 files changed

+25
-44
lines changed

3 files changed

+25
-44
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,24 @@ function RemoteFunctions(config = {}) {
106106
*/
107107
var _editHandler;
108108

109+
let remoteHighlight = {
110+
animateStartValue: {
111+
"background-color": "rgba(0, 162, 255, 0.5)",
112+
"opacity": 0
113+
},
114+
animateEndValue: {
115+
"background-color": "rgba(0, 162, 255, 0)",
116+
"opacity": 0.6
117+
},
118+
paddingStyling: {
119+
"background-color": "rgba(200, 249, 197, 0.7)"
120+
},
121+
marginStyling: {
122+
"background-color": "rgba(249, 204, 157, 0.7)"
123+
},
124+
borderColor: "rgba(200, 249, 197, 0.85)",
125+
showPaddingMargin: true
126+
};
109127
let strings = {}, icons = {}, cssStyles = {}; // these will be injected below
110128
// the below code comment is replaced by added scripts for extensibility
111129
// DONT_STRIP_MINIFY:REPLACE_WITH_ADDED_REMOTE_CONSTANT_SCRIPTS
@@ -3816,7 +3834,7 @@ function RemoteFunctions(config = {}) {
38163834

38173835
var setVisibility = function (el) {
38183836
if (
3819-
!config.remoteHighlight.showPaddingMargin ||
3837+
!remoteHighlight.showPaddingMargin ||
38203838
parseInt(el.height, 10) <= 0 ||
38213839
parseInt(el.width, 10) <= 0
38223840
) {
@@ -3826,8 +3844,6 @@ function RemoteFunctions(config = {}) {
38263844
}
38273845
};
38283846

3829-
var mainBoxStyles = config.remoteHighlight.stylesToSet;
3830-
38313847
var paddingVisualisations = [
38323848
drawPaddingRect('top'),
38333849
drawPaddingRect('right'),
@@ -3864,11 +3880,11 @@ function RemoteFunctions(config = {}) {
38643880

38653881
setupVisualisations(
38663882
marginVisualisations,
3867-
config.remoteHighlight.marginStyling
3883+
remoteHighlight.marginStyling
38683884
);
38693885
setupVisualisations(
38703886
paddingVisualisations,
3871-
config.remoteHighlight.paddingStyling
3887+
remoteHighlight.paddingStyling
38723888
);
38733889

38743890
highlight.className = GLOBALS.HIGHLIGHT_CLASSNAME;
@@ -3898,14 +3914,14 @@ function RemoteFunctions(config = {}) {
38983914
"border-left": elementStyling.getPropertyValue('border-left'),
38993915
"border-top": elementStyling.getPropertyValue('border-top'),
39003916
"border-bottom": elementStyling.getPropertyValue('border-bottom'),
3901-
"border-color": config.remoteHighlight.borderColor
3917+
"border-color": remoteHighlight.borderColor
39023918
};
39033919

3904-
var mergedStyles = Object.assign({}, stylesToSet, config.remoteHighlight.stylesToSet);
3920+
var mergedStyles = Object.assign({}, stylesToSet, remoteHighlight.stylesToSet);
39053921

3906-
var animateStartValues = config.remoteHighlight.animateStartValue;
3922+
var animateStartValues = remoteHighlight.animateStartValue;
39073923

3908-
var animateEndValues = config.remoteHighlight.animateEndValue;
3924+
var animateEndValues = remoteHighlight.animateEndValue;
39093925

39103926
var transitionValues = {
39113927
"transition-property": "opacity, background-color, transform",

src/LiveDevelopment/main.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -100,31 +100,6 @@ define(function main(require, exports, module) {
100100

101101
var _$btnGoLive; // reference to the GoLive button
102102

103-
var prefs = PreferencesManager.getExtensionPrefs("livedev");
104-
105-
// "livedev.remoteHighlight" preference
106-
var PREF_REMOTEHIGHLIGHT = "remoteHighlight"; // todo remove this and put it inside remotefn itself
107-
var remoteHighlightPref = prefs.definePreference(PREF_REMOTEHIGHLIGHT, "object", {
108-
animateStartValue: {
109-
"background-color": "rgba(0, 162, 255, 0.5)",
110-
"opacity": 0
111-
},
112-
animateEndValue: {
113-
"background-color": "rgba(0, 162, 255, 0)",
114-
"opacity": 0.6
115-
},
116-
"paddingStyling": {
117-
"background-color": "rgba(200, 249, 197, 0.7)"
118-
},
119-
"marginStyling": {
120-
"background-color": "rgba(249, 204, 157, 0.7)"
121-
},
122-
"borderColor": "rgba(200, 249, 197, 0.85)",
123-
"showPaddingMargin": true
124-
}, {
125-
description: Strings.DESCRIPTION_LIVE_DEV_HIGHLIGHT_SETTINGS
126-
});
127-
128103
/** Load Live Development LESS Style */
129104
function _loadStyles() {
130105
var lessText = require("text!LiveDevelopment/main.less");
@@ -331,7 +306,6 @@ define(function main(require, exports, module) {
331306
/** Initialize LiveDevelopment */
332307
AppInit.appReady(function () {
333308
params.parse();
334-
config.remoteHighlight = prefs.get(PREF_REMOTEHIGHLIGHT);
335309
config.mode = getCurrentMode(); // update config.mode with current preference value
336310

337311
// init experimental multi-browser implementation
@@ -366,14 +340,6 @@ define(function main(require, exports, module) {
366340
_setupGoLiveButton();
367341
_setupGoLiveMenu();
368342

369-
remoteHighlightPref
370-
.on("change", function () {
371-
config.remoteHighlight = prefs.get(PREF_REMOTEHIGHLIGHT);
372-
if (MultiBrowserLiveDev && MultiBrowserLiveDev.status >= MultiBrowserLiveDev.STATUS_ACTIVE) {
373-
MultiBrowserLiveDev.updateConfig(JSON.stringify(config));
374-
}
375-
});
376-
377343
MultiBrowserLiveDev.on(MultiBrowserLiveDev.EVENT_OPEN_PREVIEW_URL, function (event, previewDetails) {
378344
exports.trigger(exports.EVENT_OPEN_PREVIEW_URL, previewDetails);
379345
});

src/nls/root/strings.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,6 @@ define({
11411141
"DESCRIPTION_INDENT_LINE_COMMENT": "true to enable indenting of line comments",
11421142
"DESCRIPTION_RECENT_FILES_NAV": "Enable/disable navigation in recent files",
11431143
"DESCRIPTION_LIVEDEV_WEBSOCKET_PORT": "Port on which WebSocket Server runs for Live Preview",
1144-
"DESCRIPTION_LIVE_DEV_HIGHLIGHT_SETTINGS": "Live Preview Highlight settings",
11451144
"DESCRIPTION_LIVEDEV_ENABLE_REVERSE_INSPECT": "false to disable live preview reverse inspect",
11461145
"DESCRIPTION_LIVEDEV_NO_PREVIEW": "Nothing to preview!",
11471146
"DESCRIPTION_LIVEDEV_EXCLUDED": "Custom Server Cannot Serve This file",

0 commit comments

Comments
 (0)