1/* DokuWiki MoaiEditor Start.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/* Handles the button that starts the editor. 7 8 It creates two button options, so you can use the one you prefer in your template: 9 a) A small PNG image (intended to be put in the '#size__ctl' element of the native 10 Dokuwiki editor, next to the other small buttons). 11 b) A proper button with an SVG icon (which by default goes next to the submit buttons 12 save, cancel and preview), but you can of course place it anywhere else. 13*/ 14MoaiEditor.StartButton = class { 15 16 constructor() { 17 this.png = this.createPNG(); 18 this.button = this.createButton(); 19 } 20 // ──────────────────────────────────── 21 createPNG () { 22 const png = moaiEditor.createHTML('<img id="moaied-start-png" src="lib/plugins/moaieditor/icons/start.png"></button>'); 23 png.addEventListener("click", this.onClick.bind(this)); 24 return png; 25 } 26 // ──────────────────────────────────── 27 createButton () { 28 const html = ` 29 <svg xmlns = "http://www.w3.org/2000/svg" 30 viewBox = "0 0 24 22" width="24" height="22" 31 style = "fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:butt;"> 32 <path d=" M 2 5 v 13 a 2 2 0 0 0 2 2 h 16 a 2 2 0 0 0 2 -2 v -13"/> 33 <path fill="currentColor" d=" M 2 5 v -0.5 a 2 2 0 0 1 2 -2 h 16 a 2 2 0 0 1 2 2 v 0.5"/> 34 <path stroke-width="1" d=" M 12 5 v 15"/> 35 </svg>`; 36 const button = moaiEditor.createHTML('<button id="moaied-start-button" type="submit"> '+html+' </button>'); 37 button.addEventListener("click", this.onClick.bind(this)); 38 return button; 39 } 40 // ──────────────────────────────────── 41 onClick () { 42 event.preventDefault(); // Prevent click from submitting the form 43 moaiEditor.startEditor(); // Start the editor now 44 } 45}; // End Class 46 47 48 49 50 51 52