Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 0481242a82
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (44 sloc) 2.057 kb
Reviser
A wysiwig editor for editing any element inline. Inspired by wysihat http://github.com/josh/wysihat/tree.
Still very much a work in progress, but getting there.
Example:
$('.editable_elements').click(function(){
this.editor = new DS.Reviser({
elm:this,
editorType:'inline', // inline || modal, leave it out to use best guess based on size
overlay :true, // true || false, default: true
beforeSave:function(html){
console.log("Before Save"); // preprocess stuff here if needed.
return html;
},
afterSave:function(html){
console.log(html); // ajaxy stuff here
}
});
});
Custom Menu Example:
$(document).ready(function(){
$('.reviser').click(function(){
this.editor = new DS.Reviser({
elm:this,
menuHTML:$('<div class="reviser_menu" >\
<a href="#" class="reviser_btn" id="boldSelection" alt="Text Bold"><strong>B</strong></a>\
<a href="#" class="reviser_btn" id="italicSelection" alt="Text Italic"><em>I</em></a>\
<a href="#" class="reviser_btn" id="strikethroughSelection" alt="Text Strike"><strike>abc</strike></a>\
<a href="#" class="reviser_btn" id="underlineSelection" alt="Text Under"><u>U</u></a>\
<a href="#" class="reviser_btn" id="insertP" alt="Insert Paragraph">&lt;p&gt;</a>\
<a href="#" class="reviser_btn" id="insertImage" alt="Insert Image">&lt;img&gt;</a>\
<a href="#" class="reviser_btn" id="createLink" alt="Insert Link">&lt;href&gt;</a>\
<a href="#" class="reviser_btn" id="insertOrderedList" alt="Insert Ordered List">&lt;ol&gt;</a>\
<a href="#" class="reviser_btn" id="insertUnorderedList" alt="Insert Ordered List">&lt;ul&gt;</a>\
<a href="#" class="reviser_btn" id="sourceMode" alt="HTML">source</a>\
<a href="#" class="reviser_btn" id="save" alt="Save">save</a>\
<a href="#" class="reviser_btn" id="revert" alt="Cancel">cancel</a>\
</div>'),
afterSave:function(html){
console.log(html);
}
});
});
});
Check examples dir for a working example.
Jump to Line
Something went wrong with that request. Please try again.