Custom modal window
Many sites already used the library to display modal windows. In WysiBB the possibility of connecting their modal windows. To do this, create a function display a modal window. Consider this as an example.
<script>
var mymodal = function(cmd,opt,queryState) {
var url = prompt("Enter the image URL");
if (queryState) {
//Delete the current BB code, if it is active.
//This is necessary if you want to replace the current element
this.wbbRemoveCallback(cmd,true);
}
//Call syntax wbbInsertCallback (command, params), where params - Perrin values to be inserted
this.wbbInsertCallback(cmd,{src:url});
//this.wbbRemoveCallback(cmd); /delete the current function BB code
}
$(document).ready(function() {
var wbbOpt = {
buttons: "myimg",
allButtons: {
myimg: {
title: "Insert Picture",
buttonText: "myimg",
modal: mymodal, //function of custom modal window
transform: {
'<img src="{SRC}" />':'[img]{SRC}[/img]'
}
}
}
}
$("#editor").wysibb(wbbOpt);
});
</script>
.....
<textarea id="editor"></textaera>
This configuration will result.