/* DokuWiki MoaiEditor Bootstrap3.js file Version : 0.5 (May 5, 2026) Author : MoaiTools License : GPL 3 (http://www.gnu.org/licenses/gpl.html) */ /* This class extends 'MoaiEditor.Template' class and allows to override some methods to support a specific template, in this case 'Bootstrap3'. This is the list of methods you generally can override to support your template: detectTemplate addStartButton find_ElementsToHide find_Messages() find_Toolbar find_Pagetools find_EditSummary find_Form find_Textarea find_EditButtons See 'templates/default.js' to understand each of these methods. See 'README' to learn how to support a new template. */ MoaiEditor.Template_bootstrap3 = class extends MoaiEditor.Template { detectTemplate() { if (DOKU_TPL.endsWith ('tpl/bootstrap3/')) return true; return false; } addStartButton() { // Option 1: Add a proper button const button = moaiEditor.start.button; button.classList.add('btn'); button.classList.add('btn-default'); button.classList.add('mr-2'); this.elements.editButtons.appendChild(moaiEditor.start.button); // Option 2: Add a small image (to blend well in the size control buttons area of the DokuWiki native editor) //document.body.querySelector("#size__ctl").appendChild(moaiEditor.start.png); } find_ElementsToHide() { // Find the elements which contain the old editor in order to be hidden // This method can return a single element, or an array of elements return document.body.querySelector("body > .dokuwiki") } find_Messages() { // Find the displayed messages (info, error, success, notify) usually rendered by inc/html.php -> html_msgarea(). // Some templates like bootstrap3 implement their own message rendering function and don't use html_msgarea(). // In order to check how (and if) your template's messages are being displayed in this editor, you can simulate // fake messages by either: // a) Adding '&fakemsg' to the browser's URL while in edit mode. // b) Set the MOAIED_FAKE_MESSAGES constant to true in: lib/plugins/moaieditor/action.php var messages = document.body.querySelectorAll('#dw__msgarea div.alert'); return messages; } }; // End Class