mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 17:38:20 +01:00
add MarkOn package
This commit is contained in:
parent
bd515642cd
commit
ad22c6e356
2
Makefile
2
Makefile
@ -20,7 +20,7 @@ coffees= src/core/core.coffee\
|
||||
|
||||
|
||||
|
||||
packages = CoreServices NotePad wTerm ActivityMonitor DummyApp Files
|
||||
packages = CoreServices NotePad wTerm ActivityMonitor DummyApp Files MarkOn
|
||||
|
||||
main: build_coffees build_tags build_themes schemes libs build_packages
|
||||
- cp src/index.html $(BUILDDIR)/
|
||||
|
11
src/packages/MarkOn/Makefile
Normal file
11
src/packages/MarkOn/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles = simplemde.min.js
|
||||
|
||||
cssfiles = simplemde.min.css main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=MarkOn
|
||||
include ../pkg.mk
|
51
src/packages/MarkOn/main.coffee
Normal file
51
src/packages/MarkOn/main.coffee
Normal file
@ -0,0 +1,51 @@
|
||||
class MarkOn extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "MarkOn", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
markarea = @find "markarea"
|
||||
@container = @find "mycontainer"
|
||||
@previewOn = false
|
||||
@editor = new SimpleMDE
|
||||
element: markarea
|
||||
autofocus: true
|
||||
tabSize: 4
|
||||
indentWithTabs: true
|
||||
toolbar: [
|
||||
"bold", "italic", "heading", "|", "quote", "code",
|
||||
"unordered-list", "ordered-list", "|", "link",
|
||||
"image", "table", "horizontal-rule", "|",
|
||||
{
|
||||
name: "preview",
|
||||
className: "fa fa-eye no-disable",
|
||||
action: (e) ->
|
||||
me.previewOn = !me.previewOn
|
||||
SimpleMDE.togglePreview e
|
||||
#if(self.previewOn) toggle the highlight
|
||||
#{
|
||||
# var container = self._scheme.find(self,"Text")
|
||||
# .$element.getElementsByClassName("editor-preview");
|
||||
# if(container.length == 0) return;
|
||||
# var codes = container[0].getElementsByTagName('pre');
|
||||
# codes.forEach(function(el){
|
||||
# hljs.highlightBlock(el);
|
||||
# });
|
||||
# //console.log(code);
|
||||
#}
|
||||
}
|
||||
]
|
||||
@editor.codemirror.on "change", () ->
|
||||
console.log "thing changed"
|
||||
@on "vboxchange", (e) -> me.resizeContent()
|
||||
@resizeContent()
|
||||
|
||||
resizeContent: () ->
|
||||
children = ($ @container).children()
|
||||
titlebar = (($ @scheme).find ".afx-window-top")[0]
|
||||
toolbar = children[1]
|
||||
statusbar = children[4]
|
||||
cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 40
|
||||
($ children[2]).css("height", cheight + "px")
|
||||
#($ children[2]).css("height", )
|
||||
this.OS.register "MarkOn", MarkOn
|
4
src/packages/MarkOn/main.css
Normal file
4
src/packages/MarkOn/main.css
Normal file
@ -0,0 +1,4 @@
|
||||
/*afx-app-window[data-id ='markon-win'] div.CodeMirror-scroll{
|
||||
height: calc(100%) - 50px;
|
||||
background-color: red;
|
||||
}*/
|
13
src/packages/MarkOn/package.json
Normal file
13
src/packages/MarkOn/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"app":"MarkOn",
|
||||
"name":"Mardown editor",
|
||||
"description":"Simple markdown editor",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.1a",
|
||||
"category":"Utils",
|
||||
"iconclass":"fa fa-leanpub",
|
||||
"mimes":["text/.*"]
|
||||
}
|
7
src/packages/MarkOn/scheme.html
Normal file
7
src/packages/MarkOn/scheme.html
Normal file
@ -0,0 +1,7 @@
|
||||
<afx-app-window data-id = "markon-win" apptitle="Markon" width="600" height="450">
|
||||
<afx-vbox >
|
||||
<div data-id = "mycontainer">
|
||||
<textarea data-id="markarea" ></textarea>
|
||||
</div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
7
src/packages/MarkOn/simplemde.min.css
vendored
Normal file
7
src/packages/MarkOn/simplemde.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
15
src/packages/MarkOn/simplemde.min.js
vendored
Normal file
15
src/packages/MarkOn/simplemde.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -69,4 +69,4 @@ class wTerm extends this.OS.GUI.BaseApplication
|
||||
#el.style.display = "block"
|
||||
cleanup: (e)->
|
||||
@socket.close() if @socket
|
||||
this.OS.register "wTerm",wTerm
|
||||
this.OS.register "wTerm", wTerm
|
Loading…
Reference in New Issue
Block a user