aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/wiki.tpl
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-11-13 12:18:48 +1100
committerGitHub <noreply@github.com>2016-11-13 12:18:48 +1100
commit61d2bed0191f93f71d7fdad8b17b4b6c6ece7a6d (patch)
treee80e3538e6dc90fff62bd776f16fad89ac119c96 /view/tpl/wiki.tpl
parent640d15dba548533fbda5d73d04db8f6896197026 (diff)
parent52cbbed6a07e11de6b30e150e650fd3bea1387ff (diff)
downloadvolse-hubzilla-61d2bed0191f93f71d7fdad8b17b4b6c6ece7a6d.tar.gz
volse-hubzilla-61d2bed0191f93f71d7fdad8b17b4b6c6ece7a6d.tar.bz2
volse-hubzilla-61d2bed0191f93f71d7fdad8b17b4b6c6ece7a6d.zip
Merge pull request #583 from anaqreon/wiki
Move focus to Ace editor when switching to editor tab
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) {