Project

General

Profile

Actions

Feature #40556

closed

Focus on the textarea after clicking the Edit Journal button

Added by Yasu Saku 7 months ago. Updated 7 months 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 7 months 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 7 months ago

  • Resolution set to Fixed
Actions #3

Updated by Marius BĂLTEANU 7 months ago

  • Status changed from Resolved to Closed
Actions #4

Updated by Yasu Saku 7 months ago

Thank you!

Actions

Also available in: Atom PDF