Created
July 28, 2016 17:43
-
-
Save anonymous/7cce8fde7eba7d43b56d94df0271d64d to your computer and use it in GitHub Desktop.
This file contains 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($) { | |
// Define the hello button | |
$.cleditor.buttons.strong = { | |
name: "strong", | |
image: "hello.gif", | |
title: "Hello World", | |
command: "inserthtml", | |
/* | |
popupName: "hello", | |
popupClass: "cleditorPrompt", | |
popupContent: "Enter your name:<br><input type=text size=10><br><input type=button value=Submit>", | |
*/ | |
buttonClick: strongClick | |
}; | |
// Add the button to the default controls before the bold button | |
/* | |
$.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls | |
.replace("bold", "strong bold"); | |
*/ | |
// Handle the hello button click event | |
function strongClick(e, data) { | |
var editor = data.editor; | |
var selectedText = editor.selectedText(editor.$area); | |
//console.log(selectedText); | |
//console.log(data.button); | |
var html = "<strong>" + $.trim(selectedText) + "</strong>"; | |
// editor, command, value, useCSS, button | |
editor.execCommand(data.command, html, null, data.button); | |
editor.focus(); | |
/* | |
// Wire up the submit button click event | |
$(data.popup).children(":button") | |
.unbind("click") | |
.bind("click", function(e) { | |
// Get the editor | |
var editor = data.editor; | |
// Get the entered name | |
var name = $(data.popup).find(":text").val(); | |
// Insert some html into the document | |
var html = "<strong>" + name + "</strong>"; | |
editor.execCommand(data.command, html, null, data.button); | |
// Hide the popup and set focus back to the editor | |
editor.hidePopups(); | |
editor.focus(); | |
}); | |
*/ | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment