You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.5 KiB
60 lines
1.5 KiB
function dispatchCut() {
|
|
console.log("dispatch cut")
|
|
easyMDE.codemirror.getTextArea().dispatchEvent(new Event("cut"))
|
|
}
|
|
function getValue() {
|
|
return encodeURIComponent(easyMDE.value())
|
|
}
|
|
function myPreview() {
|
|
easyMDE.togglePreview()
|
|
}
|
|
|
|
function displayName() {
|
|
if (typeof Android !== 'undefined') return Android.triggerDisplayName()
|
|
else return "NONdroid"
|
|
}
|
|
function shareText() {
|
|
Android.triggerShare(easyMDE.markdown(easyMDE.codemirror.doc.getValue()))
|
|
}
|
|
|
|
function getHtml() {
|
|
return encodeURIComponent(easyMDE.markdown(easyMDE.codemirror.doc.getValue()))
|
|
}
|
|
|
|
function appendText() {
|
|
if ((appendix = Android.getMdToAppend()) !== "") {
|
|
cursor = easyMDE.codemirror.doc.getCursor()
|
|
easyMDE.codemirror.doc.setValue(easyMDE.codemirror.doc.getValue() + appendix)
|
|
easyMDE.codemirror.doc.setCursor(cursor)
|
|
}
|
|
}
|
|
|
|
function pasteText() {
|
|
data = new DataTransfer()
|
|
data.setData("text/plain", Android.getMdToAppend())
|
|
event = new Event("paste")
|
|
event.clipboardData = data
|
|
easyMDE.codemirror.focus()
|
|
document.getElementsByClassName("CodeMirror-scroll")[0].dispatchEvent(event);
|
|
}
|
|
|
|
windowHeight = window.innerHeight
|
|
function toggleBar() {
|
|
Android.toggleBar()
|
|
easyMDE.codemirror.focus()
|
|
}
|
|
themes = [ "solarized", "3024-night"]
|
|
i=1
|
|
function toggleTheme() {
|
|
easyMDE.codemirror.setOption("theme",themes[i])
|
|
i++
|
|
if (i>themes.length-1) i=0
|
|
}
|
|
|
|
function saveStatus() {
|
|
if (typeof easyMDE === 'undefined') return ''
|
|
else if (easyMDE.codemirror.doc.isClean()) return '*'
|
|
return ''
|
|
}
|
|
|