Fixes for Chrome

This commit is contained in:
Magnus Hoff 2017-09-21 12:18:09 +02:00
parent cd784e34c3
commit cf123f40eb
2 changed files with 20 additions and 19 deletions

View file

@ -46,25 +46,23 @@ function openEditor() {
ev.preventDefault();
ev.stopPropagation();
(async function () {
const body = queryArgsFromForm(form);
textarea.disabled = true;
const response = await fetch(
form.getAttribute("action"),
{
method: 'PUT',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: body,
}
);
const body = queryArgsFromForm(form);
textarea.disabled = true;
fetch(
form.getAttribute("action"),
{
method: 'PUT',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: body,
}
).then(response => {
if (!response.ok) throw new Error("Unexpected status code (" + response.status + ")");
const result = await response.json();
return response.json();
}).then(result => {
// Update url-bar, page title and footer
window.history.replaceState(null, result.title, result.slug == "" ? "." : result.slug);
document.querySelector("title").textContent = result.title;
@ -84,12 +82,11 @@ function openEditor() {
container.classList.remove('edit');
textarea.disabled = false;
}()
.catch(err => {
}).catch(err => {
textarea.disabled = false;
console.error(err);
alert(err);
}));
});
});
cancel.addEventListener('click', function (ev) {

View file

@ -131,6 +131,10 @@ footer dd:last-child::after {
margin: 0;
}
input:focus, textarea:focus {
outline: none;
}
textarea {
border: none;
background: none;