Hide editor toolbars by default when using a small screen

pull/1/head
yflory 7 years ago
parent f45023ed1f
commit 7a70d69d8e

@ -852,6 +852,7 @@ define([
var tbState = true; var tbState = true;
common.getAttribute(['general', 'markdown-help'], function (e, data) { common.getAttribute(['general', 'markdown-help'], function (e, data) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
if ($(window).height() < 800) { return; }
if (data === true && $toolbarButton.length && tbState) { if (data === true && $toolbarButton.length && tbState) {
$toolbarButton.click(); $toolbarButton.click();
} }
@ -868,6 +869,7 @@ define([
} }
common.getAttribute(['general', 'markdown-help'], function (e, data) { common.getAttribute(['general', 'markdown-help'], function (e, data) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
if ($(window).height() < 800) { return; }
if (data === true && $toolbarButton) { if (data === true && $toolbarButton) {
// Show the toolbar using the button to make sure the icon in the button is // Show the toolbar using the button to make sure the icon in the button is
// correct (caret-down / caret-up) // correct (caret-down / caret-up)
@ -923,6 +925,7 @@ define([
}); });
common.getAttribute(['hideHelp', type], function (err, val) { common.getAttribute(['hideHelp', type], function (err, val) {
if ($(window).height() < 800) { return void toggleHelp(true); }
if (val === true) { toggleHelp(true); } if (val === true) { toggleHelp(true); }
}); });

@ -116,7 +116,7 @@ define([
} else { } else {
var errText = "[cursor.fixSelection] At least one of the " + var errText = "[cursor.fixSelection] At least one of the " +
"cursor nodes did not exist, could not fix selection"; "cursor nodes did not exist, could not fix selection";
console.error(errText); //console.error(errText);
return errText; return errText;
} }
} catch (e) { console.error(e); } } catch (e) { console.error(e); }

@ -400,7 +400,7 @@ define([
}); });
show(); show();
Common.getAttribute(['toolbar', 'userlist-drawer'], function (err, val) { Common.getAttribute(['toolbar', 'userlist-drawer'], function (err, val) {
if (val === false) { return void hide(); } if (val === false || $(window).height() < 800) { return void hide(); }
show(); show();
}); });

@ -282,7 +282,7 @@ define([
framework._.sfCommon.setAttribute(['pad', 'showToolbar'], visible); framework._.sfCommon.setAttribute(['pad', 'showToolbar'], visible);
}; };
framework._.sfCommon.getAttribute(['pad', 'showToolbar'], function (err, data) { framework._.sfCommon.getAttribute(['pad', 'showToolbar'], function (err, data) {
if (typeof(data) === "undefined" || data) { $('.cke_toolbox_main').show(); } if ($(window).height() >= 800 && (typeof(data) === "undefined" || data)) { $('.cke_toolbox_main').show(); }
else { $('.cke_toolbox_main').hide(); } else { $('.cke_toolbox_main').hide(); }
var $collapse = framework._.sfCommon.createButton('toggle', true, cfg, onClick); var $collapse = framework._.sfCommon.createButton('toggle', true, cfg, onClick);
framework._.toolbar.$rightside.append($collapse); framework._.toolbar.$rightside.append($collapse);

Loading…
Cancel
Save