From 493fe8183b1bb899c20bcf1afa827d6ad8f20f45 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 7 Aug 2014 09:32:10 -0400 Subject: [PATCH] Activate specific tab that is tapped/clicked. --- core/client/components/gh-codemirror.js | 11 ++++++++--- core/client/templates/editor/edit.hbs | 4 ++-- core/client/utils/codemirror-mobile.js | 12 +++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/client/components/gh-codemirror.js b/core/client/components/gh-codemirror.js index b9637e614a..502ff690e5 100644 --- a/core/client/components/gh-codemirror.js +++ b/core/client/components/gh-codemirror.js @@ -45,9 +45,14 @@ var Codemirror = Ember.TextArea.extend(MarkerManager, { var initMarkers = _.bind(this.initMarkers, this); // Allow tabbing behaviour when viewing on small screen (not mobile) - $('.floatingheader').on('click', function () { - $('.entry-markdown').toggleClass('active'); - $('.entry-preview').toggleClass('active'); + $('#entry-markdown-header').on('click', function () { + $('.entry-markdown').addClass('active'); + $('.entry-preview').removeClass('active'); + }); + + $('#entry-preview-header').on('click', function () { + $('.entry-markdown').removeClass('active'); + $('.entry-preview').addClass('active'); }); // replaces CodeMirror with TouchEditor only if we're on mobile diff --git a/core/client/templates/editor/edit.hbs b/core/client/templates/editor/edit.hbs index c9f2cd9abf..5340200025 100644 --- a/core/client/templates/editor/edit.hbs +++ b/core/client/templates/editor/edit.hbs @@ -5,7 +5,7 @@
-
+
Markdown
@@ -15,7 +15,7 @@
-
+
Preview {{gh-count-words scratch}}
diff --git a/core/client/utils/codemirror-mobile.js b/core/client/utils/codemirror-mobile.js index 565729bd50..1a8242142e 100644 --- a/core/client/utils/codemirror-mobile.js +++ b/core/client/utils/codemirror-mobile.js @@ -29,11 +29,17 @@ init = function init() { $('body').addClass('touch-editor'); // make editor tabs touch-to-toggle in portrait mode - $('.floatingheader').on('tap', function () { - $('.entry-markdown').toggleClass('active'); - $('.entry-preview').toggleClass('active'); + $('#entry-markdown-header').on('tap', function () { + $('.entry-markdown').addClass('active'); + $('.entry-preview').removeClass('active'); }); + $('#entry-preview-header').on('tap', function () { + $('.entry-markdown').removeClass('active'); + $('.entry-preview').addClass('active'); + }); + + Ember.touchEditor = true; //initialize FastClick to remove touch delays Ember.run.scheduleOnce('afterRender', null, function () {