add extension to codepad

This commit is contained in:
Xuan Sang LE
2020-05-17 01:40:18 +02:00
parent e20ee262fc
commit 95cfddb389
17 changed files with 345 additions and 48 deletions

View File

@ -117,9 +117,9 @@ class BaseApplication extends this.OS.GUI.BaseModel
# implement by subclasses
# to add menu to application
[]
open:->
open: () ->
#implement by subclasses
data:->
data: ->
#implement by subclasses
# to return app data

View File

@ -31,7 +31,9 @@ class SubWindow extends this.OS.GUI.BaseModel
init: () ->
main: () ->
meta: () ->
@parent.meta()
return @parent.meta() if @parent and @parent.meta
{}
show: () ->
@trigger 'focus'
($ @scheme).css "z-index", window._zindex + 2

View File

@ -98,7 +98,16 @@ class BaseModel
mt = @meta()
icon = undefined
icon = "#{mt.path}/#{mt.icon}" if mt.icon
Ant.OS.announcer.trigger t, { id: @pid, name: @name, data: { m: m, icon: icon, iconclass: mt.iconclass }, error: e }
Ant.OS.announcer.trigger t, {
id: @pid,
name: @name,
data: {
m: m,
icon: icon,
iconclass: mt.iconclass,
e: e
}
}
notify: (m) ->
@publish "notification", m
@ -115,7 +124,7 @@ class BaseModel
throwe: () ->
@_api.throwe @name
update:->
update: () ->
@scheme.update() if @scheme
find: (id) -> ($ "[data-id='#{id}']", @scheme)[0] if @scheme

View File

@ -307,16 +307,17 @@ Ant.OS.API =
})
.appendTo 'head'
Ant.OS.API.shared[l] = true
console.log "loaded css:", l
console.log "Loaded :", l
Ant.OS.announcer.trigger "sharedlibraryloaded", l
resolve undefined
.catch (e) -> reject e
when "js"
Ant.OS.API.script libfp.getlink()
.then () ->
.then (data) ->
Ant.OS.API.shared[l] = true
console.log "loaded javascript:", l
console.log "Loaded :", l
Ant.OS.announcer.trigger "sharedlibraryloaded", l
resolve(l)
resolve(data)
.catch (e) ->
reject e
else

View File

@ -34,6 +34,9 @@ Ant.OS or=
register: (name, x) ->
if x.type is 3 then Ant.OS.GUI.subwindows[name] = x else Ant.OS.APP[name] = x
# import proprety from an App
PM:
pidalloc: 0
processes: {}

View File

@ -51,6 +51,10 @@ class BaseFileHandle
@basename = @genealogy[@genealogy.length - 1] unless @isRoot()
@ext = @basename.split( "." ).pop() unless @basename.lastIndexOf(".") is 0 or @basename.indexOf( "." ) is -1
setCache: (v) ->
@cache = v
@
asFileHandle: () -> @
isRoot: () -> (not @genealogy) or (@genealogy.size is 0)