From cf9d3a0d709a29da21332b5d10c87636ad33a7e0 Mon Sep 17 00:00:00 2001 From: zwim Date: Wed, 4 Jan 2023 16:35:38 +0100 Subject: [PATCH] Add quickEditFile method to texteditor --- plugins/texteditor.koplugin/main.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/texteditor.koplugin/main.lua b/plugins/texteditor.koplugin/main.lua index bee254a15..5f4eb65b0 100644 --- a/plugins/texteditor.koplugin/main.lua +++ b/plugins/texteditor.koplugin/main.lua @@ -661,4 +661,13 @@ function TextEditor:onOpenLastEditedFile() end end +-- quickly open and edit a file +-- calls the done_callback function on close +function TextEditor:quickEditFile(file_path, done_callback, possible_new_file) + if done_callback then + self.whenDoneFunc = done_callback + end + self:checkEditFile(file_path, possible_new_file or false) +end + return TextEditor