From 6b2ef2c4516e661631ea97d380998889a593b260 Mon Sep 17 00:00:00 2001 From: LukasDoesDev Date: Wed, 20 Jan 2021 23:10:25 +0200 Subject: [PATCH 1/4] Remove unnecessary logs, update logs to have more information, add resizing to file editor --- app/classes/shared/helpers.py | 3 - app/classes/web/ajax_handler.py | 75 +++++++++---------- .../templates/panel/server_files.html | 7 +- 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 6fa08888..f0da09b7 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -471,9 +471,7 @@ class Helpers: @staticmethod def generate_tree(folder, output=""): for raw_filename in os.listdir(folder): - print(raw_filename) filename = html.escape(raw_filename) - print(filename) rel = os.path.join(folder, raw_filename) if os.path.isdir(rel): output += \ @@ -485,7 +483,6 @@ class Helpers: output += helper.generate_tree(rel) output += '\n' else: - console.debug('os.path.isdir(rel): "{}", rel: "{}"'.format(os.path.isdir(rel), rel)) output += """
  • Editing file -
    file_contents
    +
    file_contents

    @@ -217,6 +217,11 @@ editor.setTheme('ace/theme/dracula'); editor.session.setUseSoftTabs(true); + // mouseup = css resize end + document.addEventListener("mouseup", function(e){ + editor.resize(); + }); + let extensionChanges = [ { regex: /^js$/, From bf200480cec5a88fb9a9460bc0280bafa0b8be5c Mon Sep 17 00:00:00 2001 From: LukasDoesDev Date: Sat, 23 Jan 2021 00:12:52 +0200 Subject: [PATCH 2/4] Add buttons for choosing the keyboard handler thing (Ace, Vim, Emacs, Sublime) --- .../templates/panel/server_files.html | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/frontend/templates/panel/server_files.html b/app/frontend/templates/panel/server_files.html index 571dc505..67999a94 100644 --- a/app/frontend/templates/panel/server_files.html +++ b/app/frontend/templates/panel/server_files.html @@ -183,6 +183,12 @@
    Editing file
    file_contents
    +
    + + + + +

    @@ -657,6 +663,21 @@ getTreeView(); setTreeViewContext(); + function setKeyboard(target) { + var handlerName = target.getAttribute('data-handler-name'); + if (handlerName == 'null') handlerName = null; + editor.setKeyboardHandler(handlerName); + + var nodes = target.parentNode.querySelectorAll("[data-handler-name]"); + for (var i = 0; i < nodes.length; i++) { + nodes[i].classList.remove('btn-primary'); + nodes[i].classList.add('btn-secondary'); + } + + target.classList.remove('btn-secondary'); + target.classList.add('btn-primary'); + } + {% end %} \ No newline at end of file From 521eac3a833f1c814112fdd2dea042f42865a204 Mon Sep 17 00:00:00 2001 From: LukasDoesDev Date: Sat, 23 Jan 2021 00:18:48 +0200 Subject: [PATCH 3/4] Change "Ace" button to "Default" --- app/frontend/templates/panel/server_files.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/templates/panel/server_files.html b/app/frontend/templates/panel/server_files.html index 67999a94..57da4ffe 100644 --- a/app/frontend/templates/panel/server_files.html +++ b/app/frontend/templates/panel/server_files.html @@ -184,7 +184,7 @@ Editing file
    file_contents
    - + From 1bf3b381ac72196f7685c83c289bce6fb3d0924d Mon Sep 17 00:00:00 2001 From: LukasDoesDev Date: Sat, 23 Jan 2021 00:46:33 +0200 Subject: [PATCH 4/4] Add icons to file tree --- app/classes/shared/helpers.py | 8 ++++-- .../templates/panel/server_files.html | 25 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index f0da09b7..6321a007 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -476,7 +476,11 @@ class Helpers: if os.path.isdir(rel): output += \ """
  • - \n
    {}
    + \n
    + + + {} +
    \n