From c3a3966927ee02f2f525f6c683736a9bb597fd36 Mon Sep 17 00:00:00 2001 From: Pierre Dubouilh Date: Thu, 7 Feb 2019 20:13:26 +0100 Subject: [PATCH] fix display editor --- src/script.js | 14 ++++++++++---- src/style.css | 4 ++-- src/template.go | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/script.js b/src/script.js index 60e6f8a..2f99fdb 100755 --- a/src/script.js +++ b/src/script.js @@ -89,7 +89,7 @@ window.onClickLink = e => { let softStatePushed function pushSoftState (d) { if (softStatePushed) { return } - softStatepushed = true + softStatePushed = true history.pushState({}, '', encodeURI(d)) } @@ -289,7 +289,7 @@ function padOff () { saveText(() => { clearInterval(window.padTimer) window.onbeforeunload = null - editor.style.display = crossIcon.style.display = 'none' + resetView() softPrev() refresh() }, () => { @@ -325,6 +325,7 @@ async function displayPad (a) { console.log('editing file', fileEdited) editor.style.display = crossIcon.style.display = 'block' + table.style.display = 'none' editor.focus() window.onbeforeunload = warningMsg window.padTimer = setInterval(saveText, 5000) @@ -334,6 +335,11 @@ async function displayPad (a) { window.displayPad = displayPad // quit pictures or editor +function resetView () { + table.style.display = 'table' + editor.style.display = pics.style.display = crossIcon.style.display = 'none' +} + window.quitAll = () => picsOff() || padOff() // Mkdir icon @@ -447,6 +453,7 @@ function setImage () { function picsOn (href) { imgsIndex = allImgs.findIndex(el => el.includes(href)) setImage() + table.style.display = 'none' crossIcon.style.display = 'block' pics.style.display = 'flex' pushSoftState(href.split('/').pop()) @@ -455,9 +462,8 @@ function picsOn (href) { function picsOff () { if (!isPicMode()) { return } + resetView() softPrev() - pics.src = '' - pics.style.display = crossIcon.style.display = 'none' return true } diff --git a/src/style.css b/src/style.css index 22e60aa..3b9937b 100644 --- a/src/style.css +++ b/src/style.css @@ -207,7 +207,7 @@ h1 { } #text-editor { - font-family: mono; + font-family: monospace; background-color: #2d3436; position: fixed; left: 0px; @@ -218,10 +218,10 @@ h1 { overflow-y: auto; word-wrap: anywhere; padding: 20px; - margin-bottom: 20px; outline: none; width: -moz-available; width: -webkit-fill-available; + border-bottom: 20px #2d3436 solid; } diff --git a/src/template.go b/src/template.go index 1c9f376..5255c38 100644 --- a/src/template.go +++ b/src/template.go @@ -2,6 +2,10 @@ + + + + {{.Title}}