function init_snapeditor(_base_url){ // buttons SnapEditor.buttons.tempMorbus = { text: "Morbus", action: function (e) { e.api.insert("Morbus!"); } };
SnapEditor.buttons.tempDrug = { text: "Medikament", action: function (e) { e.api.insert("<h1>Medi!</h1>"); } };
SnapEditor.buttons.templates = { text: "Templates", items: ["tempMorbus", "tempDrug"] }
// init editor instance var editor = new SnapEditor.Form("text", { path: _base_url+"/snapeditor", buttons: [ "h1", "p", "bold", "italic", "subscript", "superscript", "|", "orderedList", "unorderedList", "indent", "outdent", "|", "table", "|", "templates" ], stylesheets: [_base_url+"css/area_editor.css"] });}body { font-family: Arial, Helvetica, sans-serif; font-size: 87%; /* roughly 14px */ color: #000000; line-height: 100%; padding: 0 5px;}
/*
other stuff
*/
/* icons */.snapeditor_toolbar_icon_templates { background-image: url("templates.png");}<!DOCTYPE html><html> <head> <style type="text/css"> .snapeditor_toolbar_icon_say_hi { background-image: url("say_hi.png"); } body { background-image: url("say_hi.png"); } </style> </head>
<body> <div id="editor"> <h1>This is editable.</h1> <p>Click me to start editing.</p> <p><i>Note: If you're not running this from a server and instead have just simply opened the HTML file, image uploads will not work.</i></p> </div>
<script type="text/javascript" src="snapeditor.js"></script> <script type="text/javascript"> SnapEditor.buttons.sayHi = { text: "Say Hi", action: function (e) { e.api.insert("<p>Hi</p>"); } }
var editor = new SnapEditor.InPlace("editor", { toolbar: { items: [ "h1", "p", "bold", "italic", "subscript", "superscript", "|", "orderedList", "unorderedList", "indent", "outdent", "|", "table", "|", "sayHi" ], }, width: 600, height: 400 }); </script> </body></html>/* Provide a stronger selector */
.snapeditor_toolbar .snapeditor_toolbar_icon_say_hi {
background-image: url("say_hi.png");
}
/* or */
/* Use !important */
.snapeditor_toolbar_icon_say_hi {
background-image: url("say_hi.png") !important;.snapeditor_toolbar .snapeditor_toolbar_icon_say_hi {
background-image: url("say_hi.png");
}