Created
February 14, 2012 21:10
-
-
Save jfgomez86/1830471 to your computer and use it in GitHub Desktop.
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
| $(function() { | |
| WysiHat.Commands.promptLinkSelection = (function() { | |
| if (this.linkSelected()) { | |
| if (confirm("Remove link?")) | |
| this.unlinkSelection(); | |
| } else { | |
| var value = prompt("Enter a URL", "http://www.google.com/"); | |
| if (value) | |
| this.linkSelection(value); | |
| } | |
| }); | |
| WysiHat.Toolbar.ButtonSets.Snap = WysiHat.Toolbar.ButtonSets.Standard.concat({ | |
| label: "Link", | |
| cssClass: "toolbar_button", | |
| handler: function(e) { return e.promptLinkSelection(); } | |
| }); | |
| var snap_editor = (function (textarea) { | |
| var textarea = $(textarea).wysihat({buttons: WysiHat.Toolbar.ButtonSets.Snap}), | |
| editor = $("#" + textarea.attr('id') + '_editor'); | |
| editor.on("blur keyup paste", function (evt) { | |
| textarea.val($(this).html()); | |
| }); | |
| return editor; | |
| }); | |
| $(document).ready(function () { | |
| window.editor = snap_editor($("#content")); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment