mirror of
https://github.com/seejohnrun/haste-server
synced 2025-08-21 04:13:10 -07:00
Escape html chars
This commit is contained in:
parent
4fb17af9ce
commit
f03de530ea
2 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ var haste_document = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Escapes HTML tag characters
|
// Escapes HTML tag characters
|
||||||
haste_document.prototype.htmlEscape = function(s) {
|
htmlEscape = function(s) {
|
||||||
return s
|
return s
|
||||||
.replace(/&/g, '&')
|
.replace(/&/g, '&')
|
||||||
.replace(/>/g, '>')
|
.replace(/>/g, '>')
|
||||||
|
@ -28,7 +28,7 @@ haste_document.prototype.load = function(key, callback, lang) {
|
||||||
_this.data = res.data;
|
_this.data = res.data;
|
||||||
|
|
||||||
callback({
|
callback({
|
||||||
value: _this.htmlEscape(_this.data),
|
value: htmlEscape(_this.data),
|
||||||
key: key,
|
key: key,
|
||||||
language: lang,
|
language: lang,
|
||||||
lineCount: _this.data.split('\n').length
|
lineCount: _this.data.split('\n').length
|
||||||
|
@ -264,7 +264,7 @@ haste.prototype.lockDocument = function() {
|
||||||
_this.showMessage(err.message, 'error');
|
_this.showMessage(err.message, 'error');
|
||||||
}
|
}
|
||||||
else if (ret) {
|
else if (ret) {
|
||||||
_this.$code.html(_this.htmlEscape(ret.value));
|
_this.$code.html(htmlEscape(ret.value));
|
||||||
_this.setTitle(ret.key);
|
_this.setTitle(ret.key);
|
||||||
var file = '/' + ret.key;
|
var file = '/' + ret.key;
|
||||||
window.history.pushState(null, _this.appName + '-' + ret.key, file);
|
window.history.pushState(null, _this.appName + '-' + ret.key, file);
|
||||||
|
|
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