1/*  DokuWiki MoaiEditor Adhominem.js file
2    Version : 0.5 (May 5, 2026)
3    Author  : MoaiTools <info@moaitools.org>
4    License : GPL 3 (http://www.gnu.org/licenses/gpl.html) */
5/*
6    This class extends 'MoaiEditor.Template' class and allows to override
7    some methods to support a specific template, in this case 'Ad-hominem'.
8
9    This is the list of methods you generally can override to support your
10    template:
11
12        detectTemplate
13        addStartButton
14
15        find_ElementsToHide
16        find_Messages()
17        find_Toolbar
18        find_Pagetools
19        find_EditSummary
20        find_Form
21        find_Textarea
22        find_EditButtons
23
24    See 'templates/default.js' to understand each of these methods.
25
26    See 'README' to learn how to support a new template.
27*/
28MoaiEditor.Template_adhominem = class extends MoaiEditor.Template {
29
30    detectTemplate() {
31        if (DOKU_TPL.endsWith ('tpl/ad-hominem/'))
32            return true;
33        return false;
34    }
35    // ────────────────────────────────────
36    find_ElementsToHide() {
37        // Find the elements which contain the old editor in order to be hidden.
38        // This method can return a single element or an array of elements.
39        return [
40            document.body.querySelector("#skip-link"),
41            document.body.querySelector("#header-layout"),
42            document.body.querySelector("#main-layout"),
43            document.body.querySelector("#footer-layout"),
44            document.body.querySelector("#header-layout"),
45            document.body.querySelector("#header-layout"),
46        ]
47    }
48    find_Messages() {
49        // Find the displayed messages (info, error, success, notify) usually rendered by inc/html.php -> html_msgarea().
50        // Some templates like bootstrap3 implement their own message rendering function and don't use html_msgarea().
51        // In order to check how (and if) your template's messages are being displayed in this editor, you can simulate
52        // fake messages by either:
53        //    a) Adding '&fakemsg' to the browser's URL while in edit mode.
54        //    b) Set the MOAIED_FAKE_MESSAGES constant to true in: lib/plugins/moaieditor/action.php
55        var messages = document.body.querySelectorAll('#doku__msgarea div');
56        return messages;
57    }
58
59}; // End Class
60
61
62
63