Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 1 | {@eu.mulk.mulkcms2.benki.wiki.WikiPageRevision page} |
Matthias Andreas Benkard | d8f1644 | 2020-01-25 05:37:43 +0100 | [diff] [blame] | 2 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 3 | {#include base.html} |
Matthias Andreas Benkard | ffb428e | 2020-01-25 10:47:36 +0100 | [diff] [blame] | 4 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 5 | {#title}{page.title} — Benki Wiki{/title} |
Matthias Andreas Benkard | ffb428e | 2020-01-25 10:47:36 +0100 | [diff] [blame] | 6 | |
| 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 Benkard | d50bbb7 | 2020-01-27 05:53:07 +0100 | [diff] [blame] | 14 | 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 Benkard | 97130f9 | 2020-01-27 21:03:39 +0100 | [diff] [blame^] | 28 | let response = await fetch("/wiki/{page.title}", { |
Matthias Andreas Benkard | d50bbb7 | 2020-01-27 05:53:07 +0100 | [diff] [blame] | 29 | method: 'POST', |
| 30 | body: requestParams |
| 31 | }); |
Matthias Andreas Benkard | 97130f9 | 2020-01-27 21:03:39 +0100 | [diff] [blame^] | 32 | |
Matthias Andreas Benkard | d50bbb7 | 2020-01-27 05:53:07 +0100 | [diff] [blame] | 33 | this.busy(false); |
| 34 | }); |
Matthias Andreas Benkard | ffb428e | 2020-01-25 10:47:36 +0100 | [diff] [blame] | 35 | }); |
| 36 | </script> |
| 37 | {/head} |
| 38 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 39 | {#body} |
| 40 | <article id="wiki-page"> |
| 41 | <header> |
Matthias Andreas Benkard | d50bbb7 | 2020-01-27 05:53:07 +0100 | [diff] [blame] | 42 | <div data-editable data-name="wiki-title"> |
| 43 | <h1>{page.title}</h1> |
| 44 | </div> |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 45 | </header> |
Matthias Andreas Benkard | d8f1644 | 2020-01-25 05:37:43 +0100 | [diff] [blame] | 46 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 47 | <main> |
Matthias Andreas Benkard | d50bbb7 | 2020-01-27 05:53:07 +0100 | [diff] [blame] | 48 | <div data-editable data-name="wiki-content"> |
Matthias Andreas Benkard | 97130f9 | 2020-01-27 21:03:39 +0100 | [diff] [blame^] | 49 | {#with page}{enrichedContent.raw}{/} |
Matthias Andreas Benkard | ffb428e | 2020-01-25 10:47:36 +0100 | [diff] [blame] | 50 | </div> |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 51 | </main> |
Matthias Andreas Benkard | d8f1644 | 2020-01-25 05:37:43 +0100 | [diff] [blame] | 52 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 53 | <hr> |
Matthias Andreas Benkard | 9222efa | 2020-01-24 19:11:24 +0100 | [diff] [blame] | 54 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 55 | <footer> |
| 56 | <a href="/wiki/{page.title}/revisions">Page revisions</a> |
| 57 | </footer> |
| 58 | </article> |
| 59 | {/body} |
Matthias Andreas Benkard | ffb428e | 2020-01-25 10:47:36 +0100 | [diff] [blame] | 60 | |
Matthias Andreas Benkard | ae40234 | 2020-01-25 10:09:57 +0100 | [diff] [blame] | 61 | {/include} |