blob: 901b300444260554511993732d2e504711cc9fd9 [file] [log] [blame]
Matthias Andreas Benkardae402342020-01-25 10:09:57 +01001{@eu.mulk.mulkcms2.benki.wiki.WikiPageRevision page}
Matthias Andreas Benkardd8f16442020-01-25 05:37:43 +01002
Matthias Andreas Benkardae402342020-01-25 10:09:57 +01003{#include base.html}
Matthias Andreas Benkardffb428e2020-01-25 10:47:36 +01004
Matthias Andreas Benkardae402342020-01-25 10:09:57 +01005{#title}{page.title} — Benki Wiki{/title}
Matthias Andreas Benkardffb428e2020-01-25 10:47:36 +01006
7{#head}
8<link rel="stylesheet" type="text/css" href="/web_modules/ContentTools/build/content-tools.min.css" />
9<script type="module">
10 import {ContentTools} from "/web_modules/ContentTools.js";
11 window.addEventListener('DOMContentLoaded', function() {
12 let editor = ContentTools.EditorApp.get();
13 editor.init('*[data-editable]', 'data-name');
Matthias Andreas Benkardd50bbb72020-01-27 05:53:07 +010014 editor.addEventListener('saved', async function (ev) {
15 let regions = ev.detail().regions;
16 if (Object.getOwnPropertyNames(regions).length === 0) {
17 // Nothing changed.
18 return;
19 }
20
21 this.busy(true);
22
23 let requestParams = new URLSearchParams();
24 for (let name of Object.getOwnPropertyNames(regions)) {
25 requestParams.append(name, regions[name]);
26 }
27
Matthias Andreas Benkard97130f92020-01-27 21:03:39 +010028 let response = await fetch("/wiki/{page.title}", {
Matthias Andreas Benkardd50bbb72020-01-27 05:53:07 +010029 method: 'POST',
30 body: requestParams
31 });
Matthias Andreas Benkard97130f92020-01-27 21:03:39 +010032
Matthias Andreas Benkardd50bbb72020-01-27 05:53:07 +010033 this.busy(false);
34 });
Matthias Andreas Benkardffb428e2020-01-25 10:47:36 +010035 });
36</script>
37{/head}
38
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010039{#body}
40<article id="wiki-page">
41 <header>
Matthias Andreas Benkardd50bbb72020-01-27 05:53:07 +010042 <div data-editable data-name="wiki-title">
43 <h1>{page.title}</h1>
44 </div>
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010045 </header>
Matthias Andreas Benkardd8f16442020-01-25 05:37:43 +010046
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010047 <main>
Matthias Andreas Benkardd50bbb72020-01-27 05:53:07 +010048 <div data-editable data-name="wiki-content">
Matthias Andreas Benkard97130f92020-01-27 21:03:39 +010049 {#with page}{enrichedContent.raw}{/}
Matthias Andreas Benkardffb428e2020-01-25 10:47:36 +010050 </div>
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010051 </main>
Matthias Andreas Benkardd8f16442020-01-25 05:37:43 +010052
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010053 <hr>
Matthias Andreas Benkard9222efa2020-01-24 19:11:24 +010054
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010055 <footer>
56 <a href="/wiki/{page.title}/revisions">Page revisions</a>
57 </footer>
58</article>
59{/body}
Matthias Andreas Benkardffb428e2020-01-25 10:47:36 +010060
Matthias Andreas Benkardae402342020-01-25 10:09:57 +010061{/include}