Fossil SCM
Minor CSS and layout tweaks to /pikchrshow layout. Preview mode toggle is now disabled/enabled, rather than hidden/revealed, to help reduce UI jumpiness.
Commit
2b556f1cc81aeaa269fab0a3e025aa9b78a19a1d8d0dfde362dedcb08de3d87c
Parent
a5c685fa0d681d4…
2 files changed
+6
-5
+7
-1
+6
-5
| --- src/fossil.page.pikchrshow.js | ||
| +++ src/fossil.page.pikchrshow.js | ||
| @@ -91,11 +91,11 @@ | ||
| 91 | 91 | D.addClass(preTgt, 'error'); |
| 92 | 92 | this.e.previewModeLabel.innerText = "Error"; |
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | D.removeClass(preTgt, 'error'); |
| 96 | - D.removeClass(this.e.btnTogglePreviewMode, 'hidden'); | |
| 96 | + D.enable(this.e.btnTogglePreviewMode); | |
| 97 | 97 | let label; |
| 98 | 98 | switch(this.previewMode){ |
| 99 | 99 | case 0: |
| 100 | 100 | label = "Rendered SVG"; |
| 101 | 101 | preTgt.innerHTML = this.response.raw; |
| @@ -131,13 +131,15 @@ | ||
| 131 | 131 | |
| 132 | 132 | /** Fetches the preview from the server and updates the preview to |
| 133 | 133 | the rendered SVG content or error report. */ |
| 134 | 134 | P.preview = function fp(){ |
| 135 | 135 | if(!fp.hasOwnProperty('toDisable')){ |
| 136 | - fp.toDisable = [ /* elements to disable during ajax operations */ | |
| 136 | + fp.toDisable = [ | |
| 137 | + /* input elements to disable during ajax operations */ | |
| 137 | 138 | this.e.btnSubmit, this.e.taContent, |
| 138 | - this.e.btnTogglePreviewMode, this.e.selectMarkupAlignment, | |
| 139 | + this.e.selectMarkupAlignment | |
| 140 | + /* this.e.btnTogglePreviewMode is handled separately */ | |
| 139 | 141 | ]; |
| 140 | 142 | fp.target = this.e.previewTarget; |
| 141 | 143 | fp.updateView = function(c,isError){ |
| 142 | 144 | P.previewMode = 0; |
| 143 | 145 | P.response.raw = c; |
| @@ -144,12 +146,11 @@ | ||
| 144 | 146 | P.response.isError = isError; |
| 145 | 147 | D.enable(fp.toDisable); |
| 146 | 148 | P.renderPreview(); |
| 147 | 149 | }; |
| 148 | 150 | } |
| 149 | - D.disable(fp.toDisable); | |
| 150 | - D.addClass(this.e.btnTogglePreviewMode, 'hidden'); | |
| 151 | + D.disable(fp.toDisable, this.e.btnTogglePreviewMode); | |
| 151 | 152 | const content = this.e.taContent.value.trim(); |
| 152 | 153 | this.response.raw = undefined; |
| 153 | 154 | this.response.inputText = content; |
| 154 | 155 | if(!content){ |
| 155 | 156 | fp.updateView("No pikchr content!",true); |
| 156 | 157 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -91,11 +91,11 @@ | |
| 91 | D.addClass(preTgt, 'error'); |
| 92 | this.e.previewModeLabel.innerText = "Error"; |
| 93 | return; |
| 94 | } |
| 95 | D.removeClass(preTgt, 'error'); |
| 96 | D.removeClass(this.e.btnTogglePreviewMode, 'hidden'); |
| 97 | let label; |
| 98 | switch(this.previewMode){ |
| 99 | case 0: |
| 100 | label = "Rendered SVG"; |
| 101 | preTgt.innerHTML = this.response.raw; |
| @@ -131,13 +131,15 @@ | |
| 131 | |
| 132 | /** Fetches the preview from the server and updates the preview to |
| 133 | the rendered SVG content or error report. */ |
| 134 | P.preview = function fp(){ |
| 135 | if(!fp.hasOwnProperty('toDisable')){ |
| 136 | fp.toDisable = [ /* elements to disable during ajax operations */ |
| 137 | this.e.btnSubmit, this.e.taContent, |
| 138 | this.e.btnTogglePreviewMode, this.e.selectMarkupAlignment, |
| 139 | ]; |
| 140 | fp.target = this.e.previewTarget; |
| 141 | fp.updateView = function(c,isError){ |
| 142 | P.previewMode = 0; |
| 143 | P.response.raw = c; |
| @@ -144,12 +146,11 @@ | |
| 144 | P.response.isError = isError; |
| 145 | D.enable(fp.toDisable); |
| 146 | P.renderPreview(); |
| 147 | }; |
| 148 | } |
| 149 | D.disable(fp.toDisable); |
| 150 | D.addClass(this.e.btnTogglePreviewMode, 'hidden'); |
| 151 | const content = this.e.taContent.value.trim(); |
| 152 | this.response.raw = undefined; |
| 153 | this.response.inputText = content; |
| 154 | if(!content){ |
| 155 | fp.updateView("No pikchr content!",true); |
| 156 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -91,11 +91,11 @@ | |
| 91 | D.addClass(preTgt, 'error'); |
| 92 | this.e.previewModeLabel.innerText = "Error"; |
| 93 | return; |
| 94 | } |
| 95 | D.removeClass(preTgt, 'error'); |
| 96 | D.enable(this.e.btnTogglePreviewMode); |
| 97 | let label; |
| 98 | switch(this.previewMode){ |
| 99 | case 0: |
| 100 | label = "Rendered SVG"; |
| 101 | preTgt.innerHTML = this.response.raw; |
| @@ -131,13 +131,15 @@ | |
| 131 | |
| 132 | /** Fetches the preview from the server and updates the preview to |
| 133 | the rendered SVG content or error report. */ |
| 134 | P.preview = function fp(){ |
| 135 | if(!fp.hasOwnProperty('toDisable')){ |
| 136 | fp.toDisable = [ |
| 137 | /* input elements to disable during ajax operations */ |
| 138 | this.e.btnSubmit, this.e.taContent, |
| 139 | this.e.selectMarkupAlignment |
| 140 | /* this.e.btnTogglePreviewMode is handled separately */ |
| 141 | ]; |
| 142 | fp.target = this.e.previewTarget; |
| 143 | fp.updateView = function(c,isError){ |
| 144 | P.previewMode = 0; |
| 145 | P.response.raw = c; |
| @@ -144,12 +146,11 @@ | |
| 146 | P.response.isError = isError; |
| 147 | D.enable(fp.toDisable); |
| 148 | P.renderPreview(); |
| 149 | }; |
| 150 | } |
| 151 | D.disable(fp.toDisable, this.e.btnTogglePreviewMode); |
| 152 | const content = this.e.taContent.value.trim(); |
| 153 | this.response.raw = undefined; |
| 154 | this.response.inputText = content; |
| 155 | if(!content){ |
| 156 | fp.updateView("No pikchr content!",true); |
| 157 |
+7
-1
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -72,20 +72,26 @@ | ||
| 72 | 72 | CX("#sbs-wrapper {" |
| 73 | 73 | "display: flex; flex-direction: row; flex-wrap: wrap;" |
| 74 | 74 | "}"); |
| 75 | 75 | CX("#sbs-wrapper > * {" |
| 76 | 76 | "margin: 0 0.25em 0.5em 0; flex: 1 10 auto;" |
| 77 | + "align-self: stretch;" | |
| 77 | 78 | "}"); |
| 78 | - CX("#sbs-wrapper textarea {max-width: initial}"); | |
| 79 | + CX("#sbs-wrapper textarea {" | |
| 80 | + "max-width: initial; flex: 1 1 auto;" | |
| 81 | + "}"); | |
| 79 | 82 | CX("#pikchrshow-output, #pikchrshow-form" |
| 80 | 83 | "{display: flex; flex-direction: column; align-items: stretch;}"); |
| 81 | 84 | CX("#pikchrshow-form > * {margin: 0.25em 0}"); |
| 82 | 85 | CX("#pikchrshow-output {flex: 5 1 auto; padding: 0}"); |
| 83 | 86 | CX("#pikchrshow-output > pre, " |
| 84 | 87 | "#pikchrshow-output > pre > div, " |
| 85 | 88 | "#pikchrshow-output > pre > div > pre " |
| 86 | 89 | "{margin: 0; padding: 0}"); |
| 90 | + CX("#pikchrshow-output > pre > div > pre " | |
| 91 | + /* Server-side error report */ | |
| 92 | + "{padding: 0.5em}"); | |
| 87 | 93 | CX("#pikchrshow-controls {" /* where the buttons live */ |
| 88 | 94 | "display: flex; flex-direction: row; " |
| 89 | 95 | "align-items: center; flex-wrap: wrap;" |
| 90 | 96 | "}"); |
| 91 | 97 | CX("#pikchrshow-controls > * {" |
| 92 | 98 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -72,20 +72,26 @@ | |
| 72 | CX("#sbs-wrapper {" |
| 73 | "display: flex; flex-direction: row; flex-wrap: wrap;" |
| 74 | "}"); |
| 75 | CX("#sbs-wrapper > * {" |
| 76 | "margin: 0 0.25em 0.5em 0; flex: 1 10 auto;" |
| 77 | "}"); |
| 78 | CX("#sbs-wrapper textarea {max-width: initial}"); |
| 79 | CX("#pikchrshow-output, #pikchrshow-form" |
| 80 | "{display: flex; flex-direction: column; align-items: stretch;}"); |
| 81 | CX("#pikchrshow-form > * {margin: 0.25em 0}"); |
| 82 | CX("#pikchrshow-output {flex: 5 1 auto; padding: 0}"); |
| 83 | CX("#pikchrshow-output > pre, " |
| 84 | "#pikchrshow-output > pre > div, " |
| 85 | "#pikchrshow-output > pre > div > pre " |
| 86 | "{margin: 0; padding: 0}"); |
| 87 | CX("#pikchrshow-controls {" /* where the buttons live */ |
| 88 | "display: flex; flex-direction: row; " |
| 89 | "align-items: center; flex-wrap: wrap;" |
| 90 | "}"); |
| 91 | CX("#pikchrshow-controls > * {" |
| 92 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -72,20 +72,26 @@ | |
| 72 | CX("#sbs-wrapper {" |
| 73 | "display: flex; flex-direction: row; flex-wrap: wrap;" |
| 74 | "}"); |
| 75 | CX("#sbs-wrapper > * {" |
| 76 | "margin: 0 0.25em 0.5em 0; flex: 1 10 auto;" |
| 77 | "align-self: stretch;" |
| 78 | "}"); |
| 79 | CX("#sbs-wrapper textarea {" |
| 80 | "max-width: initial; flex: 1 1 auto;" |
| 81 | "}"); |
| 82 | CX("#pikchrshow-output, #pikchrshow-form" |
| 83 | "{display: flex; flex-direction: column; align-items: stretch;}"); |
| 84 | CX("#pikchrshow-form > * {margin: 0.25em 0}"); |
| 85 | CX("#pikchrshow-output {flex: 5 1 auto; padding: 0}"); |
| 86 | CX("#pikchrshow-output > pre, " |
| 87 | "#pikchrshow-output > pre > div, " |
| 88 | "#pikchrshow-output > pre > div > pre " |
| 89 | "{margin: 0; padding: 0}"); |
| 90 | CX("#pikchrshow-output > pre > div > pre " |
| 91 | /* Server-side error report */ |
| 92 | "{padding: 0.5em}"); |
| 93 | CX("#pikchrshow-controls {" /* where the buttons live */ |
| 94 | "display: flex; flex-direction: row; " |
| 95 | "align-items: center; flex-wrap: wrap;" |
| 96 | "}"); |
| 97 | CX("#pikchrshow-controls > * {" |
| 98 |