Skip to content

Commit 4f913e1

Browse files
devvaannshabose
authored andcommitted
feat: remove live preview editor preview sync setting
1 parent 5796c14 commit 4f913e1

8 files changed

Lines changed: 4 additions & 47 deletions

File tree

src/LiveDevelopment/LivePreviewConstants.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,4 @@ define(function main(require, exports, module) {
4141
exports.HIGHLIGHT_CLICK = "click";
4242

4343
exports.PREFERENCE_SHOW_RULER_LINES = "livePreviewShowMeasurements";
44-
45-
exports.PREFERENCE_LIVE_PREVIEW_SYNC = "livePreviewSyncSourceAndPreview";
4644
});

src/LiveDevelopment/MultiBrowserImpl/documents/LiveDocument.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ define(function (require, exports, module) {
192192
if (!this.editor) {
193193
return;
194194
}
195-
if(!_disableHighlightOnCursor &&
196-
PreferencesManager.get(CONSTANTS.PREFERENCE_LIVE_PREVIEW_SYNC) !== false){
195+
if(!_disableHighlightOnCursor){
197196
this.updateHighlight();
198197
}
199198
};

src/LiveDevelopment/MultiBrowserImpl/protocol/LiveDevProtocol.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@ define(function (require, exports, module) {
240240
// hilights are enabled only in edit and highlight mode
241241
return;
242242
}
243-
if(PreferencesManager.get(CONSTANTS.PREFERENCE_LIVE_PREVIEW_SYNC) === false){
244-
return;
245-
}
246243
const liveDoc = LiveDevMultiBrowser.getCurrentLiveDoc(),
247244
activeEditor = EditorManager.getActiveEditor(), // this can be an inline editor
248245
activeFullEditor = EditorManager.getCurrentFullEditor();

src/LiveDevelopment/main.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,6 @@ define(function main(require, exports, module) {
325325
MultiBrowserLiveDev.updateConfig(config);
326326
}
327327

328-
function updateSyncConfig() {
329-
const prefValue = PreferencesManager.get(CONSTANTS.PREFERENCE_LIVE_PREVIEW_SYNC);
330-
const config = MultiBrowserLiveDev.getConfig();
331-
config.syncSourceAndPreview = prefValue !== false;
332-
MultiBrowserLiveDev.updateConfig(config);
333-
}
334-
335328
EventDispatcher.makeEventDispatcher(exports);
336329

337330
// private api
@@ -355,7 +348,6 @@ define(function main(require, exports, module) {
355348
exports.setLivePreviewTransportBridge = setLivePreviewTransportBridge;
356349
exports.updateElementHighlightConfig = updateElementHighlightConfig;
357350
exports.updateRulerLinesConfig = updateRulerLinesConfig;
358-
exports.updateSyncConfig = updateSyncConfig;
359351
exports.getConnectionIds = MultiBrowserLiveDev.getConnectionIds;
360352
exports.getLivePreviewDetails = MultiBrowserLiveDev.getLivePreviewDetails;
361353
exports.hideHighlight = MultiBrowserLiveDev.hideHighlight;

src/extensionsIntegrated/Phoenix-live-preview/LivePreviewSettings.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ define(function (require, exports, module) {
6262
const SUPPORTED_FRAMEWORKS = {};
6363
SUPPORTED_FRAMEWORKS[FRAMEWORK_DOCUSAURUS] = {configFile: "docusaurus.config.js", hotReloadSupported: true};
6464

65-
const PREFERENCE_LINK_EDITOR_AND_PREVIEW = "livePreviewSyncSourceAndPreview",
66-
PREFERENCE_SHOW_LIVE_PREVIEW_PANEL = "livePreviewShowAtStartup",
65+
const PREFERENCE_SHOW_LIVE_PREVIEW_PANEL = "livePreviewShowAtStartup",
6766
PREFERENCE_PROJECT_SERVER_ENABLED = "livePreviewUseDevServer",
6867
PREFERENCE_PROJECT_SERVER_URL = "livePreviewServerURL",
6968
PREFERENCE_PROJECT_SERVER_PATH = "livePreviewServerProjectPath",
@@ -123,9 +122,7 @@ define(function (require, exports, module) {
123122
{"settings": currentSettings, "Strings": Strings}));
124123

125124
// Select the correct theme.
126-
const $linkEditorAndPreviewChk = $template.find("#linkEditorAndPreviewChk"),
127-
$linkEditorAndPreviewInfo = $template.find("#linkEditorAndPreviewInfo"),
128-
$livePreviewServerURL = $template.find("#livePreviewServerURL"),
125+
const $livePreviewServerURL = $template.find("#livePreviewServerURL"),
129126
$enableCustomServerChk = $template.find("#enableCustomServerChk"),
130127
$showLivePreviewAtStartup = $template.find("#showLivePreviewAtStartupChk"),
131128
$serveRoot = $template.find("#serveRoot"),
@@ -136,13 +133,6 @@ define(function (require, exports, module) {
136133
$frameworkSelect = $template.find("#frameworkSelect");
137134

138135
// Initialize form values from preferences
139-
$linkEditorAndPreviewChk.prop(
140-
'checked', PreferencesManager.get(PREFERENCE_LINK_EDITOR_AND_PREVIEW) !== false
141-
);
142-
$linkEditorAndPreviewInfo.on("click", function(e) {
143-
e.preventDefault();
144-
Phoenix.app.openURLInDefaultBrowser("https://docs.phcode.dev");
145-
});
146136
$enableCustomServerChk.prop('checked', PreferencesManager.get(PREFERENCE_PROJECT_SERVER_ENABLED));
147137
$showLivePreviewAtStartup.prop('checked', PreferencesManager.get(PREFERENCE_SHOW_LIVE_PREVIEW_PANEL));
148138
$hotReloadChk.prop('checked', !!PreferencesManager.get(PREFERENCE_PROJECT_SERVER_HOT_RELOAD_SUPPORTED));
@@ -184,7 +174,6 @@ define(function (require, exports, module) {
184174
Metrics.countEvent(Metrics.EVENT_TYPE.LIVE_PREVIEW, "settings", "dialog");
185175
Dialogs.showModalDialogUsingTemplate($template).done(function (id) {
186176
if (id === Dialogs.DIALOG_BTN_OK) {
187-
PreferencesManager.set(PREFERENCE_LINK_EDITOR_AND_PREVIEW, $linkEditorAndPreviewChk.is(":checked"));
188177
PreferencesManager.set(PREFERENCE_SHOW_LIVE_PREVIEW_PANEL, $showLivePreviewAtStartup.is(":checked"));
189178
_saveProjectPreferences($enableCustomServerChk.is(":checked"), $livePreviewServerURL.val(),
190179
$serveRoot.val(), $hotReloadChk.is(":checked"), $frameworkSelect.val());

src/extensionsIntegrated/Phoenix-live-preview/livePreviewSettings.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ <h1 class="dialog-title">{{Strings.LIVE_DEV_SETTINGS_TITLE}}</h1>
88
<input type="checkbox" class="form-check-input" id="showLivePreviewAtStartupChk" style="margin-top: -2px;">
99
<label class="form-check-label" for="showLivePreviewAtStartupChk" style="display: inline">{{Strings.LIVE_DEV_SETTINGS_STARTUP}}</label>
1010
</div>
11-
<div class="form-group form-check" style="margin-top: 9px;">
12-
<input type="checkbox" class="form-check-input" id="linkEditorAndPreviewChk" style="margin-top: -2px;">
13-
<label class="form-check-label" for="linkEditorAndPreviewChk" style="display: inline">{{Strings.LIVE_PREVIEW_LINK_EDITOR_AND_PREVIEW}}</label>
14-
<a href="#" id="linkEditorAndPreviewInfo" title="{{Strings.LIVE_DEV_SETTINGS_LINK_EDITOR_AND_PREVIEW_PREFERENCE}}" style="margin-left: 4px; color: var(--content-color-weaker); text-decoration: none;"><i class="fa-solid fa-info-circle"></i></a>
15-
</div>
1611
<div class="form-group" style="margin-top: 9px;">
1712
<input id="enableCustomServerChk" type="checkbox" class="form-check-input" style="margin-top: -1px;">
1813
<label id="enableCustomServerLabel" class="form-check-label" for="enableCustomServerChk" style="display: inline">{{Strings.LIVE_DEV_SETTINGS_USE_SERVER}}</label>

src/extensionsIntegrated/Phoenix-live-preview/main.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ define(function (require, exports, module) {
115115
description: Strings.LIVE_DEV_SETTINGS_SHOW_RULER_LINES_PREFERENCE
116116
});
117117

118-
// live preview link editor and preview preference
119-
const PREFERENCE_LIVE_PREVIEW_SYNC = CONSTANTS.PREFERENCE_LIVE_PREVIEW_SYNC;
120-
PreferencesManager.definePreference(PREFERENCE_LIVE_PREVIEW_SYNC, "boolean", true, {
121-
description: Strings.LIVE_DEV_SETTINGS_LINK_EDITOR_AND_PREVIEW_PREFERENCE
122-
});
123-
124118
const LIVE_PREVIEW_PANEL_ID = "live-preview-panel";
125119
const LIVE_PREVIEW_IFRAME_ID = "panel-live-preview-frame";
126120
const MDVIEWR_IFRAME_ID = "panel-md-preview-frame";
@@ -1474,14 +1468,9 @@ define(function (require, exports, module) {
14741468
PreferencesManager.on("change", PREFERENCE_SHOW_RULER_LINES, function() {
14751469
LiveDevelopment.updateRulerLinesConfig();
14761470
});
1477-
PreferencesManager.on("change", PREFERENCE_LIVE_PREVIEW_SYNC, function() {
1478-
LiveDevelopment.updateSyncConfig();
1479-
});
1480-
1481-
// Initialize element highlight, ruler lines, and sync config on startup
1471+
// Initialize element highlight and ruler lines config on startup
14821472
LiveDevelopment.updateElementHighlightConfig();
14831473
LiveDevelopment.updateRulerLinesConfig();
1484-
LiveDevelopment.updateSyncConfig();
14851474

14861475
LiveDevelopment.openLivePreview();
14871476
LiveDevelopment.on(LiveDevelopment.EVENT_OPEN_PREVIEW_URL, _openLivePreviewURL);

src/nls/root/strings.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,6 @@ define({
549549
"LIVE_PREVIEW_MODE_EDIT": "Edit Mode",
550550
"LIVE_PREVIEW_EDIT_HIGHLIGHT_ON": "Inspect Element on Hover",
551551
"LIVE_PREVIEW_SHOW_RULER_LINES": "Show Measurements",
552-
"LIVE_PREVIEW_LINK_EDITOR_AND_PREVIEW": "Link Editor and Preview",
553-
"LIVE_DEV_SETTINGS_LINK_EDITOR_AND_PREVIEW_PREFERENCE": "Link editor cursor with live preview element highlighting. When enabled, moving the cursor in the editor highlights the corresponding element in the live preview, and clicking an element in the live preview jumps the cursor to its source code. Defaults to 'true'",
554552
"LIVE_PREVIEW_MODE_PREFERENCE": "'{0}' shows only the webpage, '{1}' connects the webpage to your code - click on elements to jump to their code and vice versa, '{2}' provides highlighting along with advanced element manipulation",
555553
"LIVE_PREVIEW_CONFIGURE_MODES": "Configure Live Preview Modes",
556554

0 commit comments

Comments
 (0)