Fix partial rendering

This commit is contained in:
benweet 2013-09-16 01:03:17 +01:00
parent 17bbe028bf
commit 7bcb24df0d
5 changed files with 55 additions and 56 deletions

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
#Date Sun Sep 15 2013 22:11:18 #Date Mon Sep 16 2013 01:02:30
CACHE: CACHE:
index.html index.html

View File

@ -12079,14 +12079,13 @@ define("config", function() {}), define("storage", [ "underscore", "utils" ], fu
return n >= t.length || e.text != t[n].text ? (i = n, !0) : void 0; return n >= t.length || e.text != t[n].text ? (i = n, !0) : void 0;
}); });
var o = -c.length; var o = -c.length;
if (e.some(c.slice().reverse(), function(e, n) { e.some(c.slice().reverse(), function(e, n) {
return n >= t.length || e.text != t[t.length - n - 1].text ? (o = -n, !0) : void 0; return n >= t.length || e.text != t[t.length - n - 1].text ? (o = -n, !0) : void 0;
}), 0 === i || 0 !== i + o) { }), i - o > c.length && (o = i - c.length);
var r = c.slice(0, i); var r = c.slice(0, i);
h = t.slice(i, t.length + o); h = t.slice(i, t.length + o);
var s = c.slice(c.length + o, c.length); var s = c.slice(c.length + o, c.length);
p = e.first(s), d = c.slice(i, c.length + o), c = r.concat(h).concat(s); p = e.first(s), d = c.slice(i, c.length + o), c = r.concat(h).concat(s);
}
} }
function r() { function r() {
e.each(d, function(e) { e.each(d, function(e) {
@ -19204,7 +19203,7 @@ if (hljs.LANGUAGES.glsl = function(e) {
element: ".navbar .action-create-file", element: ".navbar .action-create-file",
title: "New document", title: "New document",
content: "Click the <i class='icon-file'></i> <code>New document</code> button to create a new document.", content: "Click the <i class='icon-file'></i> <code>New document</code> button to create a new document.",
placement: "bottom", placement: "left",
reflex: !0 reflex: !0
}, { }, {
element: ".document-panel .collapse-button", element: ".document-panel .collapse-button",
@ -23120,7 +23119,7 @@ if (hljs.LANGUAGES.glsl = function(e) {
} }
function a() { function a() {
var e = O.val(); var e = O.val();
e = d.makeHtml(e), h.html(e), p.onPreviewRefresh(); e = h.makeHtml(e), p.html(e), f.onPreviewRefresh();
} }
void 0 !== z && s.onFileClosed(z), z = n, j = void 0; void 0 !== z && s.onFileClosed(z), z = n, j = void 0;
var l = z.content; var l = z.content;
@ -23130,46 +23129,47 @@ if (hljs.LANGUAGES.glsl = function(e) {
var c = e(".preview-container"); var c = e(".preview-container");
if (!lightMode) { if (!lightMode) {
var u = t.debounce(function() { var u = t.debounce(function() {
z.editorScrollTop = I.renderer.getScrollTop(); void 0 !== j && (z.editorScrollTop = I.renderer.getScrollTop());
}, 100); }, 100);
I.session.on("changeScrollTop", function() { I.session.on("changeScrollTop", u);
void 0 !== j && u(); var d = t.debounce(function() {
}), I.session.selection.on("changeCursor", function() { void 0 !== j && (z.editorSelectRange = I.getSelectionRange());
void 0 !== j && (console.log("changeCursor"), z.editorSelectRange = I.getSelectionRange()); }, 100);
}), c.scroll(function() { I.session.selection.on("changeSelection", d), I.session.selection.on("changeCursor", d),
c.scroll(function() {
void 0 !== j && (z.previewScrollTop = c.scrollTop()); void 0 !== j && (z.previewScrollTop = c.scrollTop());
}); });
} }
var d = new Markdown.Converter(); var h = new Markdown.Converter();
if (d.hooks.chain("preConversion", function(e) { if (h.hooks.chain("preConversion", function(e) {
s.previewStartTime = new Date(); s.previewStartTime = new Date();
var t = e + "\n\n", n = [], i = 0; var t = e + "\n\n", n = [], i = 0;
return t.replace(/^```.*\n[\s\S]*?\n```|(^.+[ \t]*\n=+[ \t]*\n+|^.+[ \t]*\n-+[ \t]*\n+|^\#{1,6}[ \t]*.+?[ \t]*\#*\n+)/gm, function(e, o, r) { return t.replace(/^```.*\n[\s\S]*?\n```|(^.+[ \t]*\n=+[ \t]*\n+|^.+[ \t]*\n-+[ \t]*\n+|^\#{1,6}[ \t]*.+?[ \t]*\#*\n+)/gm, function(e, o, r) {
return o && (n.push(t.substring(i, r)), i = r), ""; return o && (n.push(t.substring(i, r)), i = r), "";
}), n.push(t.substring(i, e.length)), s.onSectionsCreated(n), e; }), n.push(t.substring(i, e.length)), s.onSectionsCreated(n), e;
}), lightMode) { }), lightMode) {
var h = e("#wmd-preview"), p = new Markdown.HookCollection(); var p = e("#wmd-preview"), f = new Markdown.HookCollection();
p.addNoop("onPreviewRefresh"); f.addNoop("onPreviewRefresh");
var f = t.debounce(a, 1e3), g = function() { var g = t.debounce(a, 1e3), m = function() {
void 0 === j ? (a(), s.onFileOpen(z)) : f(), i(); void 0 === j ? (a(), s.onFileOpen(z)) : g(), i();
}; };
O.on("input propertychange", g), N = { O.on("input propertychange", m), N = {
hooks: p, hooks: f,
getConverter: function() { getConverter: function() {
return d; return h;
}, },
run: g, run: m,
refreshPreview: g refreshPreview: m
}; };
} else N = new Markdown.Editor(d), N.hooks.set("insertLinkDialog", function(t) { } else N = new Markdown.Editor(h), N.hooks.set("insertLinkDialog", function(t) {
return E.insertLinkCallback = t, o.resetModalInputs(), e(".modal-insert-link").modal(), return E.insertLinkCallback = t, o.resetModalInputs(), e(".modal-insert-link").modal(),
!0; !0;
}), N.hooks.set("insertImageDialog", function(t) { }), N.hooks.set("insertImageDialog", function(t) {
return E.insertLinkCallback = t, E.catchModal ? !0 : (o.resetModalInputs(), e(".modal-insert-image").modal(), return E.insertLinkCallback = t, E.catchModal ? !0 : (o.resetModalInputs(), e(".modal-insert-image").modal(),
!0); !0);
}); });
var g; var m;
g = r.lazyRendering === !0 ? function(e) { m = r.lazyRendering === !0 ? function(e) {
var n = t.debounce(e, 500); var n = t.debounce(e, 500);
return function() { return function() {
void 0 === j ? (e(), c.scrollTop(z.previewScrollTop), t.defer(function() { void 0 === j ? (e(), c.scrollTop(z.previewScrollTop), t.defer(function() {
@ -23183,19 +23183,19 @@ if (hljs.LANGUAGES.glsl = function(e) {
})), i(); })), i();
}; };
}, s.onPagedownConfigure(N), N.hooks.chain("onPreviewRefresh", s.onAsyncPreview), }, s.onPagedownConfigure(N), N.hooks.chain("onPreviewRefresh", s.onAsyncPreview),
N.run(I, g), I && I.selection.setSelectionRange(z.editorSelectRange), I && I.focus() || O.focus(), N.run(I, m), I && I.selection.setSelectionRange(z.editorSelectRange), I && I.focus() || O.focus(),
e(".wmd-button-row li").addClass("btn btn-success").css("left", 0).find("span").hide(); e(".wmd-button-row li").addClass("btn btn-success").css("left", 0).find("span").hide();
var m = e(".wmd-button-group1"); var v = e(".wmd-button-group1");
e("#wmd-bold-button").append(e('<i class="icon-bold">')).appendTo(m), e("#wmd-italic-button").append(e('<i class="icon-italic">')).appendTo(m); e("#wmd-bold-button").append(e('<i class="icon-bold">')).appendTo(v), e("#wmd-italic-button").append(e('<i class="icon-italic">')).appendTo(v);
var m = e(".wmd-button-group2"); var v = e(".wmd-button-group2");
e("#wmd-link-button").append(e('<i class="icon-globe">')).appendTo(m), e("#wmd-quote-button").append(e('<i class="icon-indent-right">')).appendTo(m), e("#wmd-link-button").append(e('<i class="icon-globe">')).appendTo(v), e("#wmd-quote-button").append(e('<i class="icon-indent-right">')).appendTo(v),
e("#wmd-code-button").append(e('<i class="icon-code">')).appendTo(m), e("#wmd-image-button").append(e('<i class="icon-picture">')).appendTo(m); e("#wmd-code-button").append(e('<i class="icon-code">')).appendTo(v), e("#wmd-image-button").append(e('<i class="icon-picture">')).appendTo(v);
var m = e(".wmd-button-group3"); var v = e(".wmd-button-group3");
e("#wmd-olist-button").append(e('<i class="icon-list-numbered">')).appendTo(m), e("#wmd-olist-button").append(e('<i class="icon-list-numbered">')).appendTo(v),
e("#wmd-ulist-button").append(e('<i class="icon-list-bullet">')).appendTo(m), e("#wmd-heading-button").append(e('<i class="icon-text-height">')).appendTo(m), e("#wmd-ulist-button").append(e('<i class="icon-list-bullet">')).appendTo(v), e("#wmd-heading-button").append(e('<i class="icon-text-height">')).appendTo(v),
e("#wmd-hr-button").append(e('<i class="icon-ellipsis">')).appendTo(m); e("#wmd-hr-button").append(e('<i class="icon-ellipsis">')).appendTo(v);
var m = e(".wmd-button-group4"); var v = e(".wmd-button-group4");
e("#wmd-undo-button").append(e('<i class="icon-reply">')).appendTo(m), e("#wmd-redo-button").append(e('<i class="icon-forward">')).appendTo(m); e("#wmd-undo-button").append(e('<i class="icon-reply">')).appendTo(v), e("#wmd-redo-button").append(e('<i class="icon-forward">')).appendTo(v);
}; };
var q = !1, W = !1; var q = !1, W = !1;
return E.onReady = function() { return E.onReady = function() {

View File

@ -411,21 +411,20 @@ define([
if(!lightMode) { if(!lightMode) {
// Store editor scrollTop on scroll event // Store editor scrollTop on scroll event
var debouncedUpdateScroll = _.debounce(function() { var saveScroll = _.debounce(function() {
fileDesc.editorScrollTop = aceEditor.renderer.getScrollTop();
}, 100);
aceEditor.session.on('changeScrollTop', function() {
if(documentContent !== undefined) { if(documentContent !== undefined) {
debouncedUpdateScroll(); fileDesc.editorScrollTop = aceEditor.renderer.getScrollTop();
} }
}); }, 100);
aceEditor.session.on('changeScrollTop', saveScroll);
// Store editor selection on change // Store editor selection on change
aceEditor.session.selection.on('changeCursor', function() { var saveSelection = _.debounce(function() {
if(documentContent !== undefined) { if(documentContent !== undefined) {
console.log('changeCursor');
fileDesc.editorSelectRange = aceEditor.getSelectionRange(); fileDesc.editorSelectRange = aceEditor.getSelectionRange();
} }
}); }, 100);
aceEditor.session.selection.on('changeSelection', saveSelection);
aceEditor.session.selection.on('changeCursor', saveSelection);
// Store preview scrollTop on scroll event // Store preview scrollTop on scroll event
$previewContainerElt.scroll(function() { $previewContainerElt.scroll(function() {
if(documentContent !== undefined) { if(documentContent !== undefined) {

View File

@ -49,9 +49,9 @@ define([
} }
}); });
if(leftIndex !== 0 && leftIndex + rightIndex === 0) { if(leftIndex - rightIndex > sectionList.length) {
// nothing changed // Prevent overlap
return; rightIndex = leftIndex - sectionList.length;
} }
// Create an array composed of left unmodified, modified, right // Create an array composed of left unmodified, modified, right

View File

@ -42,7 +42,7 @@ define([
element: ".navbar .action-create-file", element: ".navbar .action-create-file",
title: "New document", title: "New document",
content: "Click the <i class='icon-file'></i> <code>New document</code> button to create a new document.", content: "Click the <i class='icon-file'></i> <code>New document</code> button to create a new document.",
placement: "bottom", placement: "left",
reflex: true, reflex: true,
}, },
{ {