aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/wiki.tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-11-12 19:34:42 -0500
committerAndrew Manning <tamanning@zoho.com>2016-11-12 19:34:42 -0500
commit4b624ab5da99a2937bb56aa3e123223f9917d439 (patch)
treeaafe71b11c3f6aba0303d5ef3f851a7486d6ee71 /view/tpl/wiki.tpl
parentda5b9d5c743cfb51dfbea7a79feba463b4331aa5 (diff)
downloadvolse-hubzilla-4b624ab5da99a2937bb56aa3e123223f9917d439.tar.gz
volse-hubzilla-4b624ab5da99a2937bb56aa3e123223f9917d439.tar.bz2
volse-hubzilla-4b624ab5da99a2937bb56aa3e123223f9917d439.zip
Bring Ace editor into focus when Edit tab is clicked to allow immediate text entry.
Diffstat (limited to 'view/tpl/wiki.tpl')
-rw-r--r--view/tpl/wiki.tpl8
1 files changed, 6 insertions, 2 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 7e18b0fc4..c26ffd64a 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -111,7 +111,7 @@
<div id="wiki-content-container" class="section-content-wrapper" {{if $hideEditor}}style="display: none;"{{/if}}>
<ul class="nav nav-tabs" id="wiki-nav-tabs">
- <li><a data-toggle="tab" href="#edit-pane">Edit</a></li>
+ <li id="edit-pane-tab"><a data-toggle="tab" href="#edit-pane">Edit</a></li>
<li class="active"><a data-toggle="tab" href="#preview-pane" id="wiki-get-preview">Preview</a></li>
<li {{if $hidePageHistory}}style="display: none;"{{/if}}><a data-toggle="tab" href="#page-history-pane" id="wiki-get-history">History</a></li>
@@ -229,7 +229,11 @@
editor.setTheme("ace/theme/github");
editor.getSession().setMode("ace/mode/markdown");
editor.getSession().setValue(window.wiki_page_content);
-
+ window.editor = editor; // Store the editor in the window object so the anonymous function can use it.
+ $('#edit-pane-tab').click(function (ev) {
+ setTimeout(function() {window.editor.focus();}, 500); // Return the focus to the editor allowing immediate text entry
+ });
+
$('#wiki-get-preview').click(function (ev) {
$.post("wiki/{{$channel}}/preview", {content: editor.getValue(), resource_id: window.wiki_resource_id}, function (data) {
if (data.success) {