This commit is contained in:
lxsang 2018-07-25 14:20:13 +00:00
parent e54a33605a
commit d8d56ffef5
4 changed files with 6 additions and 8 deletions

View File

@ -10,7 +10,6 @@
var me; var me;
me = this; me = this;
this.editor = this.find("editor"); this.editor = this.find("editor");
this.stbar = this.find("statusbar");
this.bindKey("ALT-N", function() { this.bindKey("ALT-N", function() {
return me.newFile(); return me.newFile();
}); });
@ -20,7 +19,7 @@
this.bindKey("CTRL-S", function() { this.bindKey("CTRL-S", function() {
return me.saveFile(); return me.saveFile();
}); });
this.filehandler = null; this.filehandler = this.args && this.args.length > 0 ? this.args[0].asFileHandler() : null;
$(this.editor).on('input', function(e) { $(this.editor).on('input', function(e) {
if (me.filehandler.dirty === true) { if (me.filehandler.dirty === true) {
return; return;
@ -74,7 +73,7 @@
return this.read(); return this.read();
} }
openFile(fi) { openFile() {
var me; var me;
me = this; me = this;
return this.openDialog("FileDiaLog", function(dir, fname, d) { return this.openDialog("FileDiaLog", function(dir, fname, d) {

View File

@ -9,5 +9,5 @@
"version":"0.0.1-a", "version":"0.0.1-a",
"category":"Other", "category":"Other",
"iconclass":"fa fa-adn", "iconclass":"fa fa-adn",
"mimes":["none"] "mimes":["text/.*"]
} }

View File

@ -5,11 +5,10 @@ class TinyEditor extends this.OS.GUI.BaseApplication
main: () -> main: () ->
me = @ me = @
@editor = @find "editor" @editor = @find "editor"
@stbar = @find "statusbar"
@bindKey "ALT-N", () -> me.newFile() @bindKey "ALT-N", () -> me.newFile()
@bindKey "ALT-O", () -> me.openFile() @bindKey "ALT-O", () -> me.openFile()
@bindKey "CTRL-S", () -> me.saveFile() @bindKey "CTRL-S", () -> me.saveFile()
@filehandler = null @filehandler = if @args and @args.length > 0 then @args[0].asFileHandler() else null
$(@editor).on 'input', (e) -> $(@editor).on 'input', (e) ->
return if me.filehandler.dirty is true return if me.filehandler.dirty is true
me.filehandler.dirty = true me.filehandler.dirty = true
@ -39,7 +38,7 @@ class TinyEditor extends this.OS.GUI.BaseApplication
@filehandler = null @filehandler = null
@read() @read()
openFile: (fi) -> openFile: () ->
me = @ me = @
@openDialog "FileDiaLog", ( dir, fname, d ) -> @openDialog "FileDiaLog", ( dir, fname, d ) ->
me.filehandler = "#{dir}/#{fname}".asFileHandler() me.filehandler = "#{dir}/#{fname}".asFileHandler()

View File

@ -9,5 +9,5 @@
"version":"0.0.1-a", "version":"0.0.1-a",
"category":"Other", "category":"Other",
"iconclass":"fa fa-adn", "iconclass":"fa fa-adn",
"mimes":["none"] "mimes":["text/.*"]
} }