From fe94aa331ac2cfbb1ef2e350f7d50fb061ecb7bc Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 25 Apr 2020 10:19:08 -0400 Subject: [PATCH] Replace CodeMirror resize code with CSS flex --- src/1p-filters.html | 2 +- src/advanced-settings.html | 2 +- src/css/1p-filters.css | 14 ++++++++++-- src/css/advanced-settings.css | 14 ++++++++++-- src/css/codemirror.css | 4 ++++ src/css/dashboard-common.css | 16 +++++++++----- src/css/dyna-rules.css | 20 ++++++++++++----- src/css/whitelist.css | 18 +++++++++++---- src/dyna-rules.html | 6 ++--- src/js/advanced-settings.js | 2 +- src/js/dashboard-common.js | 41 +---------------------------------- src/whitelist.html | 2 +- 12 files changed, 75 insertions(+), 66 deletions(-) diff --git a/src/1p-filters.html b/src/1p-filters.html index 6454df7e6..27a2c81d9 100644 --- a/src/1p-filters.html +++ b/src/1p-filters.html @@ -31,7 +31,7 @@

-
+
diff --git a/src/advanced-settings.html b/src/advanced-settings.html index b3b64096a..564ae99dc 100644 --- a/src/advanced-settings.html +++ b/src/advanced-settings.html @@ -22,7 +22,7 @@   -
+
diff --git a/src/css/1p-filters.css b/src/css/1p-filters.css index 5983465a0..81c247f7b 100644 --- a/src/css/1p-filters.css +++ b/src/css/1p-filters.css @@ -1,13 +1,23 @@ html { height: 100vh; overflow: hidden; + width: 100vw; } body { + display: flex; + flex-direction: column; + height: 100%; + justify-content: stretch; overflow: hidden; + width: 100%; + } +.body { + flex-shrink: 0; + } +.codeMirrorContainer { + flex-grow: 1; } #userFilters { - height: 75vh; text-align: left; - width: 100%; word-wrap: normal; } diff --git a/src/css/advanced-settings.css b/src/css/advanced-settings.css index 7c4a8723a..b112e66a4 100644 --- a/src/css/advanced-settings.css +++ b/src/css/advanced-settings.css @@ -1,15 +1,25 @@ html { height: 100vh; overflow: hidden; + width: 100vw; } body { + display: flex; + flex-direction: column; + height: 100%; + justify-content: stretch; overflow: hidden; + width: 100%; + } +.body { + flex-shrink: 0; + } +.codeMirrorContainer { + flex-grow: 1; } #advancedSettings { border-top: 1px solid #ddd; - height: 75vh; text-align: left; - width: 100%; } .CodeMirror-wrap pre { word-break: break-all; diff --git a/src/css/codemirror.css b/src/css/codemirror.css index deb8ac2a7..5d3eafdc7 100644 --- a/src/css/codemirror.css +++ b/src/css/codemirror.css @@ -96,3 +96,7 @@ background-image: none; font-weight: bold; } +/* This probably needs to be added to CodeMirror repo */ +.CodeMirror-merge-gap { + vertical-align: top; + } diff --git a/src/css/dashboard-common.css b/src/css/dashboard-common.css index b144dca3c..0c1ef842d 100644 --- a/src/css/dashboard-common.css +++ b/src/css/dashboard-common.css @@ -53,9 +53,15 @@ input[type="checkbox"][disabled] + * { display: none !important; } } -@media (max-height: 400px) { - html { - min-height: 400px !important; - overflow: auto !important; - } +/** + On mobile device, the on-screen keyboard may take up + so much space that it overlaps the content being edited. + The rule below makes it possible to scroll the edited + content within view. +*/ +:root.mobile { + overflow: auto; + } +:root.mobile body { + min-height: 600px; } diff --git a/src/css/dyna-rules.css b/src/css/dyna-rules.css index d67cb0597..ca0735562 100644 --- a/src/css/dyna-rules.css +++ b/src/css/dyna-rules.css @@ -1,18 +1,22 @@ html { height: 100vh; overflow: hidden; + width: 100vw; } body { display: flex; flex-direction: column; + height: 100%; + justify-content: stretch; overflow: hidden; + width: 100%; + } +.body { + flex-shrink: 0; } #diff { border: 0; border-top: 1px solid #eee; - flex-grow: 1; - margin: 0; - padding: 0; white-space: nowrap; } #diff .tools > * { @@ -28,8 +32,7 @@ body { width: 50%; white-space: nowrap; } -#diff .ruleActions h3 { - font-weight: normal; +#diff .ruleActions .fieldset-header { margin: 0.5em 0; } #ruleFilter { @@ -63,7 +66,7 @@ body:not(.editing) #diff.dirty #commitButton:hover { } .codeMirrorContainer { - height: 60vh; + flex-grow: 1; } .CodeMirror-merge, .CodeMirror-merge-pane, .CodeMirror-merge .CodeMirror { box-sizing: border-box; @@ -83,3 +86,8 @@ body[dir="rtl"] .CodeMirror-merge-pane-rightmost { right: unset; left: 0; } + +/* mobile devices */ +:root.mobile #diff .tools { + overflow: auto; + } diff --git a/src/css/whitelist.css b/src/css/whitelist.css index fe116381b..715c9640d 100644 --- a/src/css/whitelist.css +++ b/src/css/whitelist.css @@ -1,12 +1,22 @@ html { height: 100vh; overflow: hidden; + width: 100vw; } body { + display: flex; + flex-direction: column; + height: 100%; + justify-content: stretch; overflow: hidden; - } -#whitelist { - height: 75vh; - text-align: left; width: 100%; } +.body { + flex-shrink: 0; + } +.codeMirrorContainer { + flex-grow: 1; + } +#whitelist { + text-align: left; + } diff --git a/src/dyna-rules.html b/src/dyna-rules.html index 17b13e21f..40cbcc17b 100644 --- a/src/dyna-rules.html +++ b/src/dyna-rules.html @@ -24,12 +24,12 @@
-

+
-

+
@@ -38,7 +38,7 @@
-
+
-
+