mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 11:19:47 +02:00
add draggable treeview
This commit is contained in:
@ -77,7 +77,6 @@ class CodePad.BaseExtension
|
||||
dest.asFileHandle()
|
||||
.setCache('data:application/zip;base64,' + data)
|
||||
.write("base64").then (r) =>
|
||||
return reject r.error if r.error
|
||||
@notify __("Package is generated in release folder")
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
|
@ -112,7 +112,6 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
@ -125,7 +124,6 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache txt
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
|
@ -107,7 +107,6 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () ->
|
||||
@ -117,7 +116,6 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.setCache meta.meta
|
||||
.write("object")
|
||||
.then (data) ->
|
||||
return e data.error if data.error
|
||||
r data
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
|
@ -109,11 +109,19 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
@bindKey "CTRL-S", () => @menuAction "save"
|
||||
@bindKey "ALT-W", () => @menuAction "saveas"
|
||||
|
||||
@fileview.set "ondragndrop", (e) =>
|
||||
src = e.data.from.get("data").path.asFileHandle()
|
||||
des = e.data.to.get("data").path
|
||||
src.move "#{des}/#{src.basename}"
|
||||
.then (d) ->
|
||||
e.data.to.update des
|
||||
e.data.from.get("parent").update src.parent().path
|
||||
.catch (e) => @error __("Unable to move file/folder"), e
|
||||
|
||||
@loadExtensionMetaData()
|
||||
@initCommandPalete()
|
||||
@initSideBar()
|
||||
@openFile @currfile
|
||||
|
||||
|
||||
openFile: (file) ->
|
||||
#find tab
|
||||
@ -303,10 +311,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
fp = "#{dir.path}/#{d}".asFileHandle()
|
||||
fp.write("text/plain")
|
||||
.then (r) =>
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack), e
|
||||
|
||||
when "newdir"
|
||||
return unless dir
|
||||
@ -317,10 +324,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
dir.mk(d)
|
||||
.then (r) =>
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", dir.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", dir.path), e
|
||||
|
||||
when "rename"
|
||||
return unless file
|
||||
@ -335,10 +341,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
dir = file.parent()
|
||||
file.move "#{dir.path}/#{d}"
|
||||
.then (r) =>
|
||||
return @error __("Fail to rename to {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
|
||||
when "delete"
|
||||
return unless file
|
||||
@ -353,10 +358,9 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
dir = file.parent()
|
||||
file.remove()
|
||||
.then (r) =>
|
||||
return @error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
|
||||
else
|
||||
|
||||
@ -364,7 +368,6 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
save: (file) ->
|
||||
file.write("text/plain")
|
||||
.then (d) =>
|
||||
return @error __("Error saving file {0}: {1}", file.basename, d.error) if d.error
|
||||
file.dirty = false
|
||||
file.text = file.basename
|
||||
@tabbar.update()
|
||||
|
@ -155,6 +155,7 @@ class PushNotification extends this.OS.GUI.BaseService
|
||||
error: o.data.e,
|
||||
time: logtime
|
||||
}
|
||||
@dialog.loglist.set "data", @dialog.data.logs if @dialog
|
||||
|
||||
pushout: (s, o) ->
|
||||
d = {
|
||||
|
@ -81,6 +81,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
@currdir = dir
|
||||
($ @navinput).val dir.path
|
||||
resolve d.result
|
||||
.catch (e) -> reject e
|
||||
|
||||
@setting.sidebar = true if @setting.sidebar is undefined
|
||||
@setting.nav = true if @setting.nav is undefined
|
||||
@ -214,8 +215,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
return if d is file.filename
|
||||
file.path.asFileHandle().move "#{@currdir.path}/#{d}"
|
||||
.then (r) =>
|
||||
@error __("Fail to rename to {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
|
||||
@ -229,8 +228,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
return unless d
|
||||
file.path.asFileHandle().remove()
|
||||
.then (r) =>
|
||||
@error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
|
||||
@ -254,7 +251,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
@clipboard.file.move "#{@currdir.path}/#{@clipboard.file.basename}"
|
||||
.then (r) =>
|
||||
@clipboard = undefined
|
||||
@error __("Fail to paste: {0}", r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to paste: {0}", @clipboard.file.path), e
|
||||
else
|
||||
@ -266,7 +262,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
fp.write(@clipboard.file.info.mime)
|
||||
.then (r) =>
|
||||
@clipboard = undefined
|
||||
@error __("Fail to paste: {0}", r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to paste: {0}", @clipboard.file.path), e
|
||||
.catch (e) =>
|
||||
@ -284,8 +279,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
})
|
||||
.then (d) =>
|
||||
@currdir.mk(d)
|
||||
.then (r) =>
|
||||
@error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", d), e
|
||||
|
||||
@ -297,8 +290,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
.then (d) =>
|
||||
fp = "#{@currdir.path}/#{d}".asFileHandle()
|
||||
fp.write("text/plain")
|
||||
.then (r) =>
|
||||
@error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", fp.path)
|
||||
|
||||
@ -308,8 +299,6 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
|
||||
when "#{@name}-upload"
|
||||
@currdir.upload()
|
||||
.then (r) =>
|
||||
@error __("Fail to upload to {0}: {1}", @currdir.path, r.error) if r.error
|
||||
.catch (e) =>
|
||||
@error __("Fail to upload: {0}", e.toString()), e
|
||||
|
||||
@ -317,8 +306,7 @@ class Files extends this.OS.GUI.BaseApplication
|
||||
return unless file and file.type is "file"
|
||||
file.path.asFileHandle().publish()
|
||||
.then (r) =>
|
||||
return @error __("Cannot share file: {0}", r.error) if r.error
|
||||
return @notify __("Shared url: {0}", r.result)
|
||||
@notify __("Shared url: {0}", r.result)
|
||||
.catch (e) =>
|
||||
@error __("Fail to publish: {0}", file.path), e
|
||||
|
||||
|
Reference in New Issue
Block a user