1/*  DokuWiki MoaiEditor Sprintdoc.js file
2    Version : 0.5a (May 6, 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 'Sprintdoc'.
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_sprintdoc = class extends MoaiEditor.Template {
29
30    detectTemplate() {
31        if (DOKU_TPL.endsWith ('tpl/sprintdoc/'))
32            return true;
33        return false;
34
35        /* Shown below is an alternative way to identify templates,
36           by using a DOM signature. This might have the advantage
37           of indentifying a template even if it lives in another
38           folder. Say you have 'sprintdoc' and a slighly customized
39           version called 'sprint_personal'. By detecting the template
40           by something other than the file path, you can target many
41           templates with just one file, and without knowing beforehand
42           where it will be located.
43
44           This example code works with sprintdoc:
45
46              var element = document.getElementById('dokuwiki__site');
47              if (element  &&  element.classList.contains('tpl_sprintdoc'))
48                  return true;
49              return false;
50        */
51    }
52    find_Messages() {
53        // Find the displayed messages (info, error, success, notify) usually rendered by inc/html.php -> html_msgarea().
54        // Some templates like bootstrap3 implement their own message rendering function and don't use html_msgarea().
55        // In order to check how (and if) your template's messages are being displayed in this editor, you can simulate
56        // fake messages by either:
57        //    a) Adding '&fakemsg' to the browser's URL while in edit mode.
58        //    b) Set the MOAIED_FAKE_MESSAGES constant to true in: lib/plugins/moaieditor/action.php
59        var query = "";
60        var container = "#dokuwiki__content div.msg-area ";
61        query += container + "div.error,   ";
62        query += container + "div.info,    ";
63        query += container + "div.success, ";
64        query += container + "div.notify   ";
65        var messages = document.body.querySelectorAll(query);
66        return messages;
67    }
68
69}; // End Class
70
71
72
73