mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
Updated windowResize, page unload, page error and minor some tweaks for performance
This commit is contained in:
parent
db956cc298
commit
c900703d75
1 changed files with 14 additions and 3 deletions
|
@ -400,7 +400,6 @@ $(document).ready(function () {
|
||||||
clearMap();
|
clearMap();
|
||||||
}
|
}
|
||||||
checkEditorStyle();
|
checkEditorStyle();
|
||||||
changeMode(currentMode);
|
|
||||||
/* we need this only on touch devices */
|
/* we need this only on touch devices */
|
||||||
if (isTouchDevice) {
|
if (isTouchDevice) {
|
||||||
/* cache dom references */
|
/* cache dom references */
|
||||||
|
@ -423,13 +422,18 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
//when page resize
|
//when page resize
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
|
checkLayout();
|
||||||
|
checkEditorStyle();
|
||||||
|
checkTocStyle();
|
||||||
|
checkCursorMenu();
|
||||||
|
windowResize();
|
||||||
});
|
});
|
||||||
//when page unload
|
//when page unload
|
||||||
$(window).unload(function () {
|
$(window).unload(function () {
|
||||||
writeHistory(ui.area.markdown);
|
updateHistoryInner();
|
||||||
});
|
});
|
||||||
$(window).error(function () {
|
$(window).error(function () {
|
||||||
setNeedRefresh();
|
//setNeedRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
//when page hash change
|
//when page hash change
|
||||||
|
@ -460,9 +464,11 @@ var windowResizeDebounce = 200;
|
||||||
var windowResize = _.debounce(windowResizeInner, windowResizeDebounce);
|
var windowResize = _.debounce(windowResizeInner, windowResizeDebounce);
|
||||||
|
|
||||||
function windowResizeInner() {
|
function windowResizeInner() {
|
||||||
|
checkLayout();
|
||||||
checkResponsive();
|
checkResponsive();
|
||||||
checkEditorStyle();
|
checkEditorStyle();
|
||||||
checkTocStyle();
|
checkTocStyle();
|
||||||
|
checkCursorMenu();
|
||||||
//refresh editor
|
//refresh editor
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
editor.setOption('viewportMargin', Infinity);
|
editor.setOption('viewportMargin', Infinity);
|
||||||
|
@ -480,6 +486,11 @@ function windowResizeInner() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkLayout() {
|
||||||
|
var navbarHieght = $('.navbar').outerHeight();
|
||||||
|
$('body').css('padding-top', navbarHieght + 'px');
|
||||||
|
}
|
||||||
|
|
||||||
function editorHasFocus() {
|
function editorHasFocus() {
|
||||||
return $(editor.getInputField()).is(":focus");
|
return $(editor.getInputField()).is(":focus");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue