mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +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
|
||||
|
||||
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'
|
||||
end
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ css:
|
|||
.row
|
||||
.span12
|
||||
div id="editor" style="width: 100%; height: 1000px; position: relative;"
|
||||
p Loading, please wait..
|
||||
#{@file_data}
|
||||
|
||||
.row.text-center style="margin-top: 10px"
|
||||
.span4
|
||||
|
@ -111,13 +111,9 @@ javascript:
|
|||
var editor = {};
|
||||
|
||||
$(document).ready(function() {
|
||||
$.get("#{@file_url}", function (response) {
|
||||
$("#editor").text(response);
|
||||
|
||||
editor = ace.edit("editor");
|
||||
setTheme();
|
||||
editor.getSession().setMode("ace/mode/html");
|
||||
editor.setFontSize(14);
|
||||
editor.setShowPrintMargin(false);
|
||||
});
|
||||
editor = ace.edit("editor");
|
||||
setTheme();
|
||||
editor.getSession().setMode("ace/mode/html");
|
||||
editor.setFontSize(14);
|
||||
editor.setShowPrintMargin(false);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue