mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
switch to ajax call to disable mystery caching that's popped up for some reason
This commit is contained in:
parent
28ed2718ba
commit
5a77fcb519
1 changed files with 36 additions and 31 deletions
|
@ -163,42 +163,47 @@
|
|||
|
||||
var editor = {}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$.get("/site_files/download/<%= Addressable::URI.parse(@filename).normalized_path.to_s %>", function(resp) {
|
||||
editor = ace.edit("editor")
|
||||
setTheme()
|
||||
<% if @ace_mode %>
|
||||
editor.getSession().setMode("ace/mode/<%= @ace_mode %>")
|
||||
<% end %>
|
||||
editor.getSession().setTabSize(2)
|
||||
editor.getSession().setUseWrapMode(true)
|
||||
editor.setFontSize(14)
|
||||
editor.setShowPrintMargin(false)
|
||||
editor.setOptions({
|
||||
maxLines: Infinity,
|
||||
autoScrollEditorIntoView: true
|
||||
})
|
||||
$.ajax({
|
||||
url: "/site_files/download/<%= Addressable::URI.parse(@filename).normalized_path.to_s %>",
|
||||
cache: false,
|
||||
success: function(resp) {
|
||||
editor = ace.edit("editor")
|
||||
setTheme()
|
||||
<% if @ace_mode %>
|
||||
editor.getSession().setMode("ace/mode/<%= @ace_mode %>")
|
||||
<% end %>
|
||||
editor.getSession().setTabSize(2)
|
||||
editor.getSession().setUseWrapMode(true)
|
||||
editor.setFontSize(14)
|
||||
editor.setShowPrintMargin(false)
|
||||
editor.setOptions({
|
||||
maxLines: Infinity,
|
||||
autoScrollEditorIntoView: true
|
||||
})
|
||||
|
||||
// Disable autocomplete
|
||||
editor.setBehavioursEnabled(false)
|
||||
// Disable autocomplete
|
||||
editor.setBehavioursEnabled(false)
|
||||
|
||||
editor.setValue(resp, -1)
|
||||
editor.getSession().setUndoManager(new ace.UndoManager())
|
||||
editor.setValue(resp, -1)
|
||||
editor.getSession().setUndoManager(new ace.UndoManager())
|
||||
|
||||
editor.on('change', function(obj) {
|
||||
$('a#saveButton,a#saveAndExitButton').css('opacity', 1)
|
||||
unsavedChanges = true
|
||||
})
|
||||
editor.on('change', function(obj) {
|
||||
$('a#saveButton,a#saveAndExitButton').css('opacity', 1)
|
||||
unsavedChanges = true
|
||||
})
|
||||
|
||||
editor.commands.addCommand({
|
||||
name: 'saveCommand',
|
||||
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
|
||||
exec: function(editor) {
|
||||
saveTextFile(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
editor.commands.addCommand({
|
||||
name: 'saveCommand',
|
||||
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
|
||||
exec: function(editor) {
|
||||
saveTextFile(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
if(unsavedChanges == true)
|
||||
|
|
Loading…
Add table
Reference in a new issue