Fixes for Chrome
This commit is contained in:
parent
cd784e34c3
commit
cf123f40eb
2 changed files with 20 additions and 19 deletions
|
@ -46,25 +46,23 @@ function openEditor() {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
(async function () {
|
const body = queryArgsFromForm(form);
|
||||||
const body = queryArgsFromForm(form);
|
textarea.disabled = true;
|
||||||
textarea.disabled = true;
|
|
||||||
|
|
||||||
const response = await fetch(
|
|
||||||
form.getAttribute("action"),
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
|
||||||
},
|
|
||||||
body: body,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
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 + ")");
|
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
|
// Update url-bar, page title and footer
|
||||||
window.history.replaceState(null, result.title, result.slug == "" ? "." : result.slug);
|
window.history.replaceState(null, result.title, result.slug == "" ? "." : result.slug);
|
||||||
document.querySelector("title").textContent = result.title;
|
document.querySelector("title").textContent = result.title;
|
||||||
|
@ -84,12 +82,11 @@ function openEditor() {
|
||||||
container.classList.remove('edit');
|
container.classList.remove('edit');
|
||||||
|
|
||||||
textarea.disabled = false;
|
textarea.disabled = false;
|
||||||
}()
|
}).catch(err => {
|
||||||
.catch(err => {
|
|
||||||
textarea.disabled = false;
|
textarea.disabled = false;
|
||||||
console.error(err);
|
console.error(err);
|
||||||
alert(err);
|
alert(err);
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
cancel.addEventListener('click', function (ev) {
|
cancel.addEventListener('click', function (ev) {
|
||||||
|
|
|
@ -131,6 +131,10 @@ footer dd:last-child::after {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input:focus, textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
|
|
Loading…
Reference in a new issue