1/*
2 * Gero Gothe <gero.gothe@medizindoku.de>
3 *
4 * License: GPL2
5 *
6 */
7
8/* Adds the chosen text module at the current cursor position */
9function textmodule_snippet(t){
10    cursorPos = document.getElementById('wiki__text').selectionStart;
11
12    let x = document.getElementById('wiki__text').value;
13    document.getElementById('wiki__text').value = x.slice(0,cursorPos) + t + x.slice(cursorPos);
14
15    // Set cursor back to initial position
16    document.getElementById('wiki__text').focus();
17
18    document.getElementById('wiki__text').selectionStart = cursorPos;
19    document.getElementById('wiki__text').selectionEnd = cursorPos;
20}
21
22
23/* Expand/collapse the group of textmodules by changing the css class */
24function textmodule_expand(id) {
25    if (document.getElementById(id).className == "plugin_textmodule_box_active") {
26        document.getElementById(id).className = "plugin_textmodule_box";
27    } else document.getElementById(id).className = "plugin_textmodule_box_active";
28
29}
30