mirror of
https://github.com/seejohnrun/haste-server
synced 2025-08-21 04:13:10 -07:00
Fix issues with reloading
This commit is contained in:
parent
862499434c
commit
232d85379d
2 changed files with 12 additions and 12 deletions
|
@ -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);
|
||||||
|
|
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue