Fix issues with reloading

This commit is contained in:
Kenox 2022-11-04 09:25:16 +01:00
commit 232d85379d
2 changed files with 12 additions and 12 deletions

View file

@ -248,18 +248,18 @@ haste.prototype.loadDocument = function(key) {
_this.doc = new haste_document(); _this.doc = new haste_document();
_this.doc.load(parts[0], function(ret) { _this.doc.load(parts[0], function(ret) {
if (ret) { if (ret) {
var lines = ret.value.split(/\r\n|\r|\n/); const lines = ret.value.split(/\r\n|\r|\n/);
for (var i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
let code = document.createElement('code'); let code = document.createElement('code');
code.innerHTML = lines[i]; code.innerHTML = lines[i];
let pre = document.getElementById("box"); let pre = document.getElementById("box");
pre.appendChild(code); pre.appendChild(code);
code.onclick = function() { code.onclick = function() {
var file = '/' + ret.key + "#" + (i + 1).toString(); var file = '/' + ret.key + "#" + (i + 1).toString();
window.history.pushState(null, _this.appName + '-' + ret.key, file); window.history.pushState(null, _this.appName + '-' + ret.key, file);
highlightNew(code); highlightNew(code);
} }
} }
_this.setTitle(ret.key); _this.setTitle(ret.key);

File diff suppressed because one or more lines are too long