mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
Fix ace view
This commit is contained in:
@@ -4,8 +4,7 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#file-view').html('<pre id="docu-view" class="vh">' + data['content'] + '</pre>');
|
$('#file-view').html('<div id="docu-view" class="vh">' + '</div>');
|
||||||
$('#docu-view').css({'position': 'relative', 'width': $('#docu-view').width(), 'height': $('#docu-view').height()}).html($('#docu-view').html());
|
|
||||||
var editor = ace.edit("docu-view");
|
var editor = ace.edit("docu-view");
|
||||||
$('#docu-view').removeClass('vh');
|
$('#docu-view').removeClass('vh');
|
||||||
editor.setReadOnly(true);
|
editor.setReadOnly(true);
|
||||||
@@ -51,6 +50,10 @@
|
|||||||
{% if fileext = 'xml' %}
|
{% if fileext = 'xml' %}
|
||||||
editor.session.setMode('ace/mode/xml');
|
editor.session.setMode('ace/mode/xml');
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
editor.session.getDocument().setValue(data['content']);
|
||||||
|
$('#docu-view').css({'position': 'relative', 'width': '100%', 'height': editor.session.getScreenLength() * 20 });
|
||||||
|
editor.resize(); // this line is needed to work in ie
|
||||||
},
|
},
|
||||||
error: function(xhr, ajaxOptions, thrownError) {
|
error: function(xhr, ajaxOptions, thrownError) {
|
||||||
var jsonVal = jQuery.parseJSON(xhr.responseText);
|
var jsonVal = jQuery.parseJSON(xhr.responseText);
|
||||||
|
2
views.py
2
views.py
@@ -896,7 +896,7 @@ def repo_file_get(request, repo_id):
|
|||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
# d['content'] = escape(u_content)
|
# d['content'] = escape(u_content)
|
||||||
# l.append(d)
|
# l.append(d)
|
||||||
data = json.dumps({'content': escape(u_content)})
|
data = json.dumps({'content': u_content})
|
||||||
return HttpResponse(data, status=200, content_type=content_type)
|
return HttpResponse(data, status=200, content_type=content_type)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user