UI layout refresh when title change

This commit is contained in:
benweet 2013-04-27 13:25:02 +01:00
parent 7800cfe93b
commit 0ffc8ee2e3
4 changed files with 19 additions and 8 deletions

View File

@ -1 +1 @@
CACHE MANIFEST # v13 CACHE: index.html css/main-min.css js/main-min.js js/require.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: *
CACHE MANIFEST # v14 CACHE: index.html css/main-min.css js/main-min.js js/require.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: *

View File

@ -355,13 +355,13 @@ define(
*/
// apply Scroll Link
lastEditorScrollTop = -99;
lastPreviewScrollTop = -99;
lastEditorScrollTop = -9;
lastPreviewScrollTop = -9;
scrollLink();
}, 800);
var lastEditorScrollTop = -99;
var lastPreviewScrollTop = -99;
var lastEditorScrollTop = -9;
var lastPreviewScrollTop = -9;
var scrollLink = _.debounce(function() {
if(mdSectionList.length === 0 || mdSectionList.length !== htmlSectionList.length) {
return;
@ -396,11 +396,11 @@ define(
else if(Math.abs(previewScrollTop - lastPreviewScrollTop) > 5) {
editorScrollTop = animate(previewScrollTop, htmlSectionList, editorElt, mdSectionList);
}
}, 1000);
}, 1200);
// Create the layout
core.createLayout = function() {
var layout = undefined;
core.createLayout = function() {
var layoutGlobalConfig = {
closable : true,
resizable : false,
@ -452,6 +452,12 @@ define(
$("#wmd-input, #wmd-preview").scroll(scrollLink);
}
};
core.layoutRefresh = function() {
if(layout !== undefined) {
// Use defer to make sure UI has been updated
_.defer(layout.resizeAll);
}
};
// Create the PageDown editor
var insertLinkCallback = undefined;
@ -477,6 +483,8 @@ define(
var editor = new Markdown.Editor(converter);
if(core.settings.scrollLink === true) {
editor.hooks.chain("onPreviewRefresh", function() {
// Modify scroll position of the preview not the editor
lastEditorScrollTop = -9;
buildSections();
});
}

View File

@ -166,6 +166,8 @@ define(["jquery", "core", "synchronizer", "publisher", "underscore"],
}
$("#file-selector").append(li);
});
core.layoutRefresh();
};
// Remove a syncIndex (synchronized location)
@ -242,6 +244,7 @@ define(["jquery", "core", "synchronizer", "publisher", "underscore"],
}
input.hide().val(localStorage[fileIndexTitle]);
$("#file-title").show();
core.layoutRefresh();
}
$("#file-title-input").blur(function() {
applyTitle($(this));

2
js/main-min.js vendored

File diff suppressed because one or more lines are too long