mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
Bug Fix: Fixed extra white space on landscape to portrait orientation change
This breaks focus on focused element to keep layout. This is because the layout still breaks if an element is focused, and you cannot trigger the system keyboard through Javascript to refocus an element after.
This commit is contained in:
parent
718c285808
commit
0e3cefa770
@ -1,6 +1,6 @@
|
||||
// # Article Editor
|
||||
|
||||
/*global window, document, $, _, Backbone, Ghost, Showdown, CodeMirror, shortcut, Countable, JST */
|
||||
/*global window, document, setTimeout, navigator, $, _, Backbone, Ghost, Showdown, CodeMirror, shortcut, Countable, JST */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
@ -284,7 +284,8 @@
|
||||
|
||||
events: {
|
||||
'click .markdown-help': 'showHelp',
|
||||
'blur #entry-title': 'trimTitle'
|
||||
'blur #entry-title': 'trimTitle',
|
||||
'orientationchange': 'orientationChange'
|
||||
},
|
||||
|
||||
syncScroll: _.debounce(function (e) {
|
||||
@ -330,6 +331,18 @@
|
||||
}
|
||||
},
|
||||
|
||||
// This is a hack to remove iOS6 white space on orientation change bug
|
||||
// See: http://cl.ly/RGx9
|
||||
orientationChange: function () {
|
||||
if (/iPhone/.test(navigator.userAgent) && !/Opera Mini/.test(navigator.userAgent)) {
|
||||
var focusedElement = document.activeElement,
|
||||
s = document.documentElement.style;
|
||||
focusedElement.blur();
|
||||
s.display = 'none';
|
||||
setTimeout(function () { s.display = 'block'; focusedElement.focus(); }, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// This updates the editor preview panel.
|
||||
// Currently gets called on every key press.
|
||||
// Also trigger word count update
|
||||
|
Loading…
Reference in New Issue
Block a user