mirror of
https://github.com/neocities/neocities.git
synced 2025-04-28 11:12:30 +02:00
read file directly in because of some weird cross domain issue
This commit is contained in:
parent
06597748ea
commit
0bf3cf409e
2 changed files with 7 additions and 11 deletions
2
app.rb
2
app.rb
|
@ -149,7 +149,7 @@ post '/site_files/delete' do
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/site_files/text_editor/:filename' do |filename|
|
get '/site_files/text_editor/:filename' do |filename|
|
||||||
@file_url = "http://#{current_site.username}.neocities.org/#{filename}"
|
@file_data = File.read File.join(site_base_path(current_site.username), filename)
|
||||||
slim :'site_files/text_editor'
|
slim :'site_files/text_editor'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ css:
|
||||||
.row
|
.row
|
||||||
.span12
|
.span12
|
||||||
div id="editor" style="width: 100%; height: 1000px; position: relative;"
|
div id="editor" style="width: 100%; height: 1000px; position: relative;"
|
||||||
p Loading, please wait..
|
#{@file_data}
|
||||||
|
|
||||||
.row.text-center style="margin-top: 10px"
|
.row.text-center style="margin-top: 10px"
|
||||||
.span4
|
.span4
|
||||||
|
@ -111,13 +111,9 @@ javascript:
|
||||||
var editor = {};
|
var editor = {};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.get("#{@file_url}", function (response) {
|
editor = ace.edit("editor");
|
||||||
$("#editor").text(response);
|
setTheme();
|
||||||
|
editor.getSession().setMode("ace/mode/html");
|
||||||
editor = ace.edit("editor");
|
editor.setFontSize(14);
|
||||||
setTheme();
|
editor.setShowPrintMargin(false);
|
||||||
editor.getSession().setMode("ace/mode/html");
|
|
||||||
editor.setFontSize(14);
|
|
||||||
editor.setShowPrintMargin(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue