Project

General

Profile

Actions

Feature #40556

closed

Focus on the textarea after clicking the Edit Journal button

Added by Yasu Saku 17 days ago. Updated about 3 hours ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

I suggest adding the feature to focus on the textarea after clicking on the Edit Journal button.

Here is a simple patch as follows.

diff --git a/app/views/journals/edit.js.erb b/app/views/journals/edit.js.erb
index 96cf6b4f8..49fe4bec0 100644
--- a/app/views/journals/edit.js.erb
+++ b/app/views/journals/edit.js.erb
@@ -6,3 +6,13 @@ if ($("form#journal-<%= @journal.id %>-form").length > 0) {
 } else {
   $("#journal-<%= @journal.id %>-notes").after('<%= escape_javascript(render :partial => 'notes_form') %>');
 }
+
+// Focus on the textarea
+(() => {
+  const $textarea = $("#journal-<%= @journal.id %>-form .wiki-edit");
+  if ($textarea.length > 0) {
+    $textarea.focus();
+    const textareaLength = $textarea.val().length;
+    $textarea.get(0).setSelectionRange(textareaLength, textareaLength);
+  }
+})();

Actions #1

Updated by Marius BĂLTEANU 1 day ago

  • Status changed from New to Resolved
  • Assignee set to Marius BĂLTEANU
  • Target version set to 5.0.9

Patch committed, thanks!

Actions #2

Updated by Marius BĂLTEANU 1 day ago

  • Resolution set to Fixed
Actions #3

Updated by Marius BĂLTEANU about 3 hours ago

  • Status changed from Resolved to Closed
Actions #4

Updated by Yasu Saku about 3 hours ago

Thank you!

Actions

Also available in: Atom PDF