add MarkOn package

This commit is contained in:
Xuan Sang LE 2018-01-28 23:02:14 +01:00
parent bd515642cd
commit ad22c6e356
9 changed files with 110 additions and 2 deletions

View File

@ -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)/

View 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

View 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

View File

@ -0,0 +1,4 @@
/*afx-app-window[data-id ='markon-win'] div.CodeMirror-scroll{
height: calc(100%) - 50px;
background-color: red;
}*/

View 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/.*"]
}

View 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

File diff suppressed because one or more lines are too long

15
src/packages/MarkOn/simplemde.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -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