diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-11-01 10:38:20 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-11-01 10:38:20 +0100 |
commit | 2137b35a465ae9f830519c5a8bd49cb388fd552d (patch) | |
tree | 6c546094da1797adb52dfe60fe2af08a3d384d24 /src/main/resources/templates/benki/wiki/wikiPage.html | |
parent | e59db840207551430ac9f12be6ee4aa2a594fe66 (diff) |
Wiki: Rebundle Content Tools.
Content Tools was previously wrapped into an ECMAScript module through
the use of Snowpack. This mechanism broke some time ago, making the
wiki uneditable.
Content Tools is now imported as is, which simplifies its packaging
and restores it to a working state.
Change-Id: I49d2d625bc955a260a63c47bcaceb23b61366123
Diffstat (limited to 'src/main/resources/templates/benki/wiki/wikiPage.html')
-rw-r--r-- | src/main/resources/templates/benki/wiki/wikiPage.html | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/main/resources/templates/benki/wiki/wikiPage.html b/src/main/resources/templates/benki/wiki/wikiPage.html index 63d9950..b456475 100644 --- a/src/main/resources/templates/benki/wiki/wikiPage.html +++ b/src/main/resources/templates/benki/wiki/wikiPage.html @@ -7,7 +7,6 @@ {#nav}{#navbar siteSection="Wiki" /} {#head} -<link rel="stylesheet" type="text/css" href="/web_modules/ContentTools/build/content-tools.min.css" /> <script type="module" src="/lib.js" defer></script> <style type="text/css"> @@ -16,62 +15,10 @@ font-style: italic; } </style> - -<script type="module" defer> - import ContentTools from "/web_modules/ContentTools.js"; - - window.addEventListener('DOMContentLoaded', function() { - let editor = ContentTools.EditorApp.get(); - editor.init('*[data-editable]', 'data-name'); - - editor.addEventListener('saved', async function (ev) { - document.getElementById("warning-panel").close(); - - let regions = ev.detail().regions; - if (Object.getOwnPropertyNames(regions).length === 0) { - // Nothing changed. - return; - } - - this.busy(true); - - let requestParams = new URLSearchParams(); - for (let name of Object.getOwnPropertyNames(regions)) { - requestParams.append(name, regions[name]); - } - - let response = await fetch("/wiki/{page.title}", { - method: 'POST', - body: requestParams - }); - - if (!response.ok) { - document.getElementById("warning-panel").open(); - document.getElementById("warning-text").innerText = "Failed to save page: " + response.statusText; - this.busy(false); - return; - } - - let status = await response.json(); - if (status.status !== "ok") { - document.getElementById("warning-panel").open(); - document.getElementById("warning-text").innerText = "Failed to save page: " + JSON.stringify(status); - this.busy(false); - return; - } - - if (status.hasOwnProperty("content")) { - document.getElementById("wiki-content").innerHTML = status.content; - } - - this.busy(false); - }); - }); -</script> {/head} {#body} -<article id="wiki-page"> +<article id="wiki-page" data-page-title="{page.title}"> <header> <div data-editable data-name="wiki-title"> <h1>{page.title}</h1> |