Wiki: Add ContentTools to all wiki pages.

Change-Id: I30e3c59458b2754439c9edfd5029d260816dd9de
diff --git a/src/main/resources/META-INF/resources/package.json b/src/main/resources/META-INF/resources/package.json
index b13c554..b2e1002 100644
--- a/src/main/resources/META-INF/resources/package.json
+++ b/src/main/resources/META-INF/resources/package.json
@@ -1,5 +1,6 @@
 {
   "dependencies": {
+    "ContentTools": "^1.6.10",
     "elix": "^9.0.3",
     "lit-html": "^1.1.2",
     "normalize.css": "^8.0.1",
@@ -14,6 +15,9 @@
   },
   "snowpack": {
     "webDependencies": [
+      "ContentTools",
+      "ContentTools/build/content-tools.min.css",
+      "ContentTools/build/images/*",
       "elix",
       "lit-html",
       "normalize.css/normalize.css",
diff --git a/src/main/resources/META-INF/resources/yarn.lock b/src/main/resources/META-INF/resources/yarn.lock
index 89a9b82..59f6c69 100644
--- a/src/main/resources/META-INF/resources/yarn.lock
+++ b/src/main/resources/META-INF/resources/yarn.lock
@@ -779,6 +779,11 @@
   dependencies:
     "@types/node" "*"
 
+ContentTools@^1.6.10:
+  version "1.6.10"
+  resolved "https://registry.yarnpkg.com/ContentTools/-/ContentTools-1.6.10.tgz#a9a416e2cf6c2263490bc0fee5df886592272af5"
+  integrity sha512-jlm41jP7oPC2+XCMSnyG5zX5BiA9st9NEacREGqbjdSoqCmcTiGDpLucEVNrWzCFUsdEvkClbiBVez3wd9ZPNQ==
+
 acorn@^7.1.0:
   version "7.1.0"
   resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
diff --git a/src/main/resources/templates/base.html b/src/main/resources/templates/base.html
index 8fefe31..408424d 100644
--- a/src/main/resources/templates/base.html
+++ b/src/main/resources/templates/base.html
@@ -7,6 +7,8 @@
 
   <link rel="stylesheet" type="text/css" href="/common.css" />
   <script type="module" src="/components.js"></script>
+
+  {#insert head}{/}
 </head>
 
 <body>
diff --git a/src/main/resources/templates/benki/wiki/wikiPage.html b/src/main/resources/templates/benki/wiki/wikiPage.html
index 7caf94d..8ca34e7 100644
--- a/src/main/resources/templates/benki/wiki/wikiPage.html
+++ b/src/main/resources/templates/benki/wiki/wikiPage.html
@@ -1,7 +1,20 @@
 {@eu.mulk.mulkcms2.benki.wiki.WikiPageRevision page}
 
 {#include base.html}
+
 {#title}{page.title} &#8212; Benki Wiki{/title}
+
+{#head}
+<link rel="stylesheet" type="text/css" href="/web_modules/ContentTools/build/content-tools.min.css" />
+<script type="module">
+  import {ContentTools} from "/web_modules/ContentTools.js";
+  window.addEventListener('DOMContentLoaded', function() {
+    let editor = ContentTools.EditorApp.get();
+    editor.init('*[data-editable]', 'data-name');
+  });
+</script>
+{/head}
+
 {#body}
 <article id="wiki-page">
   <header>
@@ -9,7 +22,9 @@
   </header>
 
   <main>
-    {#with page}{content.raw}{/}
+    <div data-editable data-name="main-content">
+      {#with page}{content.raw}{/}
+    </div>
   </main>
 
   <hr>
@@ -19,4 +34,5 @@
   </footer>
 </article>
 {/body}
+
 {/include}