fix display editor

This commit is contained in:
Pierre Dubouilh 2019-02-07 20:13:26 +01:00
parent 8e2f79067e
commit c3a3966927
No known key found for this signature in database
GPG key ID: 8FE8BEDA9D4DB0D7
3 changed files with 16 additions and 6 deletions

View file

@ -89,7 +89,7 @@ window.onClickLink = e => {
let softStatePushed let softStatePushed
function pushSoftState (d) { function pushSoftState (d) {
if (softStatePushed) { return } if (softStatePushed) { return }
softStatepushed = true softStatePushed = true
history.pushState({}, '', encodeURI(d)) history.pushState({}, '', encodeURI(d))
} }
@ -289,7 +289,7 @@ function padOff () {
saveText(() => { saveText(() => {
clearInterval(window.padTimer) clearInterval(window.padTimer)
window.onbeforeunload = null window.onbeforeunload = null
editor.style.display = crossIcon.style.display = 'none' resetView()
softPrev() softPrev()
refresh() refresh()
}, () => { }, () => {
@ -325,6 +325,7 @@ async function displayPad (a) {
console.log('editing file', fileEdited) console.log('editing file', fileEdited)
editor.style.display = crossIcon.style.display = 'block' editor.style.display = crossIcon.style.display = 'block'
table.style.display = 'none'
editor.focus() editor.focus()
window.onbeforeunload = warningMsg window.onbeforeunload = warningMsg
window.padTimer = setInterval(saveText, 5000) window.padTimer = setInterval(saveText, 5000)
@ -334,6 +335,11 @@ async function displayPad (a) {
window.displayPad = displayPad window.displayPad = displayPad
// quit pictures or editor // quit pictures or editor
function resetView () {
table.style.display = 'table'
editor.style.display = pics.style.display = crossIcon.style.display = 'none'
}
window.quitAll = () => picsOff() || padOff() window.quitAll = () => picsOff() || padOff()
// Mkdir icon // Mkdir icon
@ -447,6 +453,7 @@ function setImage () {
function picsOn (href) { function picsOn (href) {
imgsIndex = allImgs.findIndex(el => el.includes(href)) imgsIndex = allImgs.findIndex(el => el.includes(href))
setImage() setImage()
table.style.display = 'none'
crossIcon.style.display = 'block' crossIcon.style.display = 'block'
pics.style.display = 'flex' pics.style.display = 'flex'
pushSoftState(href.split('/').pop()) pushSoftState(href.split('/').pop())
@ -455,9 +462,8 @@ function picsOn (href) {
function picsOff () { function picsOff () {
if (!isPicMode()) { return } if (!isPicMode()) { return }
resetView()
softPrev() softPrev()
pics.src = ''
pics.style.display = crossIcon.style.display = 'none'
return true return true
} }

View file

@ -207,7 +207,7 @@ h1 {
} }
#text-editor { #text-editor {
font-family: mono; font-family: monospace;
background-color: #2d3436; background-color: #2d3436;
position: fixed; position: fixed;
left: 0px; left: 0px;
@ -218,10 +218,10 @@ h1 {
overflow-y: auto; overflow-y: auto;
word-wrap: anywhere; word-wrap: anywhere;
padding: 20px; padding: 20px;
margin-bottom: 20px;
outline: none; outline: none;
width: -moz-available; width: -moz-available;
width: -webkit-fill-available; width: -webkit-fill-available;
border-bottom: 20px #2d3436 solid;
} }

View file

@ -2,6 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="theme-color" content="#070909">
<meta name="msapplication-navbutton-color" content="#070909">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<title>{{.Title}}</title> <title>{{.Title}}</title>
<link href="data:image/png;base64,favicon_will_be_here" rel="icon" type="image/png" /> <link href="data:image/png;base64,favicon_will_be_here" rel="icon" type="image/png" />