diff options
author | Jonas Kohl | 2024-10-12 19:56:49 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-10-12 19:56:49 +0200 |
commit | 5420ba37c5d5037617d6daab03272a5146af263c (patch) | |
tree | c1665a7244d15d01944032577e374ad93418c63c /src/application/views/form_addpost.php | |
parent | 0c45ffac2d8648fec4fa5e935754f4d34952983b (diff) |
Add rich text editor to New topic pagev0.5.1
Diffstat (limited to 'src/application/views/form_addpost.php')
-rw-r--r-- | src/application/views/form_addpost.php | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/application/views/form_addpost.php b/src/application/views/form_addpost.php index 9e617d9..b2fb2f2 100644 --- a/src/application/views/form_addpost.php +++ b/src/application/views/form_addpost.php @@ -51,60 +51,3 @@ if (($_formError = RequestUtils::getAndClearFormError("addpost")) !== null) { </div> <button type="submit" class="btn btn-success"><?= __("Post reply") ?> <span class="fa fa-send" aria-hidden="true"></span></button> </form> - -<script type="text/javascript"> - $(function() { - function insertAroundSelection(textarea, before, after) { - var start = textarea.selectionStart; - var end = textarea.selectionEnd; - var text = textarea.value; - var pre = text.substring(0, start); - var inner = text.substring(start, end); - var post = text.substring(end); - start += before.length; - end += before.length; - text = pre + before + inner + after + post; - textarea.value = text; - textarea.focus(); - textarea.selectionStart = start; - textarea.selectionEnd = end; - } - - function getTextarea(btn) { - return $($(btn).attr("data-area"))[0]; - } - - var commands = { - bold: function(textarea) { - insertAroundSelection(textarea, "[b]", "[/b]"); - }, - italic: function(textarea) { - insertAroundSelection(textarea, "[i]", "[/i]"); - }, - underline: function(textarea) { - insertAroundSelection(textarea, "[u]", "[/u]"); - }, - strikethrough: function(textarea) { - insertAroundSelection(textarea, "[s]", "[/s]"); - }, - sup: function(textarea) { - insertAroundSelection(textarea, "[^]", "[/^]"); - }, - sub: function(textarea) { - insertAroundSelection(textarea, "[_]", "[/_]"); - }, - quote: function(textarea) { - insertAroundSelection(textarea, "> ", ""); - }, - spoiler: function(textarea) { - insertAroundSelection(textarea, "[spoiler]", "[/spoiler]"); - } - } - - $("button[data-editor-command]").attr("data-toggle", "tooltip").attr("data-placement", "bottom").click(function() { - var command = $(this).attr("data-editor-command"); - var textarea = getTextarea(this); - commands[command](textarea); - }).tooltip(); - }); -</script> |