Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mauryaratan committed Oct 2, 2020
1 parent f44a68f commit ce3cbe2
Show file tree
Hide file tree
Showing 9 changed files with 3,388 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
composer.lock
vendor
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# markdown-on-save
# Markdown On Save


### Credits

This plugin is a fork of [Markdown on Save](https://wordpress.org/plugins/markdown-on-save/) by Mark Jaquith.
Binary file added assets/img/32x20-solid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/32x20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions assets/js/markdown-on-save.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
do ($ = jQuery) ->
app = window.markdownOnSaveApp =
on: ->
$('body').addClass 'cws-markdown'
@html.click()
@checkbox.attr 'checked', yes
@buttonOn.show()
a.hide() for a in [ @buttonOff, @html, @visual, @htmlButtons ]
off: ->
$('body').removeClass 'cws-markdown'
@checkbox.attr 'checked', no
@buttonOn.hide()
a.show() for a in [ @buttonOff, @html, @visual, @htmlButtons ]
delay: (ms, f) -> setTimeout f, ms
start: ->
context = $ '#cws-markdown'
context.detach().insertBefore('#submitdiv h3 span').show()
@buttonOn = $ 'img.markdown-on', context
@buttonOff = $ 'img.markdown-off', context
@checkbox = $ '#cws_using_markdown'
@html = $ '#content-html'
@visual = $ '#content-tmce'
@htmlButtonsString = ('#qt_content_' + a for a in [
'strong'
'em'
'link'
'block'
'del'
'ins'
'img'
'ul'
'ol'
'li'
'code'
'close'
]).join ', '
@htmlButtons = $ @htmlButtonsString
@events()
@setFromCheckbox()
setFromCheckbox: ->
if app.checkbox.is ':checked' then app.on() else app.off()
events: ->
$([@buttonOn, @buttonOff]).each -> $(@).click (e) ->
e.stopPropagation() # Keep metabox from toggling
app.checkbox.click()
@checkbox.change @setFromCheckbox
# Kind of hacky, but this allows for Quicktags to be added to the DOM first
$ -> app.delay 0, -> app.start()
2 changes: 2 additions & 0 deletions assets/js/markdown-on-save.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "deliciousbrains/markdown-on-save",
"description": "Allows you to compose content in Markdown on a per-item basis.",
"license": "GPL-3.0+",
"authors": [
{
"name": "Delicious Brains",
"email": "[email protected]",
"homepage": "https://deliciousbrains.com/"
}
],
"type": "wordpress-plugin",
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit ce3cbe2

Please sign in to comment.