Last active
December 14, 2015 20:59
-
-
Save sbp/5147948 to your computer and use it in GitHub Desktop.
Octavo colour-box command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ -> | |
octavo.shortcuts["Ctrl+'"] = (position) -> | |
octavo.input (value) -> | |
return if not position.balanced | |
span = $("<span/>").text("").css | |
width: "9px" | |
height: "9px" | |
border: "1px solid #000" | |
background: value | |
display: "inline-block" | |
octavo.silently -> | |
position.range.deleteContents() | |
position.range.insertNode span[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To compile this script to embeddable JavaScript: