From abc017545c6fce1c4b754a560f19d3ccaaf82eca Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 20 Dec 2020 22:16:38 -0500 Subject: [PATCH] Update the popup preview to always be visible on the settings v2 page (#1151) --- ext/bg/css/settings2.css | 6 +----- ext/bg/data/options-schema.json | 5 ----- ext/bg/js/options.js | 2 ++ ext/bg/js/settings/popup-preview-controller.js | 17 ----------------- ext/bg/settings2.html | 6 ------ test/test-options-util.js | 1 - 6 files changed, 3 insertions(+), 34 deletions(-) diff --git a/ext/bg/css/settings2.css b/ext/bg/css/settings2.css index aba72968..10634dc0 100644 --- a/ext/bg/css/settings2.css +++ b/ext/bg/css/settings2.css @@ -561,11 +561,7 @@ h3 { .preview-frame-container { position: relative; align-self: stretch; - flex: 0 1 auto; - visibility: hidden; -} -.preview-frame-container.preview-frame-container-visible { - flex-grow: 1; + flex: 1 1 auto; visibility: visible; } .preview-frame { diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index 7fed4909..e4eb4a4e 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -821,7 +821,6 @@ "type": "object", "required": [ "database", - "showPopupPreview", "useSettingsV2" ], "properties": { @@ -837,10 +836,6 @@ } } }, - "showPopupPreview": { - "type": "boolean", - "default": false - }, "useSettingsV2": { "type": "boolean", "default": false diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index e946c461..6adfdd5e 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -665,6 +665,8 @@ class OptionsUtil { // Added general.popupCurrentIndicatorMode. // Added general.popupActionBarVisibility. // Added general.popupActionBarLocation. + // Removed global option showPopupPreview. + delete options.global.showPopupPreview; for (const profile of options.profiles) { profile.options.general.maximumClipboardSearchLength = 1000; profile.options.general.popupCurrentIndicatorMode = 'bar-left'; diff --git a/ext/bg/js/settings/popup-preview-controller.js b/ext/bg/js/settings/popup-preview-controller.js index 9dc29524..b5e347d0 100644 --- a/ext/bg/js/settings/popup-preview-controller.js +++ b/ext/bg/js/settings/popup-preview-controller.js @@ -29,7 +29,6 @@ class PopupPreviewController { this._customCss = null; this._customOuterCss = null; this._previewFrameContainer = null; - this._showPopupPreviewCheckbox = null; } async prepare() { @@ -41,19 +40,13 @@ class PopupPreviewController { this._customCss = document.querySelector('#custom-popup-css'); this._customOuterCss = document.querySelector('#custom-popup-outer-css'); this._previewFrameContainer = document.querySelector('.preview-frame-container'); - this._showPopupPreviewCheckbox = document.querySelector('#show-preview-checkbox'); this._customCss.addEventListener('input', this._onCustomCssChange.bind(this), false); this._customCss.addEventListener('settingChanged', this._onCustomCssChange.bind(this), false); this._customOuterCss.addEventListener('input', this._onCustomOuterCssChange.bind(this), false); this._customOuterCss.addEventListener('settingChanged', this._onCustomOuterCssChange.bind(this), false); this._frame.addEventListener('load', this._onFrameLoad2.bind(this), false); - this._showPopupPreviewCheckbox.addEventListener('change', this._onShowPreviewCheckboxChange.bind(this), false); this._settingsController.on('optionsContextChanged', this._onOptionsContextChange.bind(this)); - - const {global: {showPopupPreview}} = await this._settingsController.getOptionsFull(); - this._showPopupPreviewCheckbox.checked = showPopupPreview; - this._updatePopupPreviewVisibility(); } } @@ -65,10 +58,6 @@ class PopupPreviewController { this._previewVisible = true; } - _onShowPreviewCheckboxChange() { - this._updatePopupPreviewVisibility(); - } - _showAppearancePreview() { const container = document.querySelector('#settings-popup-preview-container'); const buttonContainer = document.querySelector('#settings-popup-preview-button-container'); @@ -137,10 +126,4 @@ class PopupPreviewController { if (this._frame === null || this._frame.contentWindow === null) { return; } this._frame.contentWindow.postMessage({action, params}, this._targetOrigin); } - - _updatePopupPreviewVisibility() { - const value = this._showPopupPreviewCheckbox.checked; - this._previewFrameContainer.classList.toggle('preview-frame-container-visible', value); - this._settingsController.setGlobalSetting('global.showPopupPreview', value); - } } diff --git a/ext/bg/settings2.html b/ext/bg/settings2.html index 72d863cc..e1cc3169 100644 --- a/ext/bg/settings2.html +++ b/ext/bg/settings2.html @@ -1458,12 +1458,6 @@
-
- -
diff --git a/test/test-options-util.js b/test/test-options-util.js index a00e9e72..7ef5e0a1 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -507,7 +507,6 @@ function createOptionsUpdatedTestData1() { database: { prefixWildcardsSupported: false }, - showPopupPreview: false, useSettingsV2: false } };