Skip to content

Commit

Permalink
Added ability to append and prepend text to the editor with built-in …
Browse files Browse the repository at this point in the history
…functions.
  • Loading branch information
meltingice committed Sep 16, 2009
1 parent 9c35f1d commit 4b5efb1
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions osimo_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ $.fn.osimoeditor = function(customOptions,data){
if(customOptions == 'get'){
return $.fn.osimoeditor.get($(this).attr('id'));
}
if(customOptions == 'set'){
if(customOptions == 'set'){
$.fn.osimoeditor.set($(this).attr('id'),data);
}
}
if(customOptions == 'append'){
$.fn.osimoeditor.append($(this).attr('id'),data);
}
if(customOptions == 'prepend'){
$.fn.osimoeditor.prepend($(this).attr('id'),data);
}
}
var options = $.extend({},$.fn.osimoeditor.defaultOptions, customOptions);
var num = 0;
Expand All @@ -42,7 +48,7 @@ $.fn.osimoeditor.defaultOptions = {
* osimo_editor files. This path *must* have a trailing
* slash and is relative to the document root.
*/
editor_path : "os-includes/js/osimo_editor/",
editor_path : "js/",
/*
* You can change this value to any theme that you have
* in the themes folder for the Osimo Editor. This is
Expand Down Expand Up @@ -71,6 +77,14 @@ $.fn.osimoeditor.set = function(editorID,data){
$('#'+editorID+'_editbox').attr('value',data);
}

$.fn.osimoeditor.append = function(editorID,data){
$('#'+editorID+'_editbox').attr('value',this.get(editorID) + data);
}

$.fn.osimoeditor.prepend = function(editorID,data){
$('#'+editorID+'_editbox').attr('value',data + this.get(editorID));
}

function OsimoEditor(input,options,num){
this.input = input;
this.options = options;
Expand Down

0 comments on commit 4b5efb1

Please sign in to comment.