Custom handlers

For integration with WysiBB site provides the ability to attach its functions to handle key press. To do this, create a handler function and attach it to BB code.

<script>
var myfunc = function(command,value,queryState) {
  // command - BBcode name
  // value - value
  // queryState - is currently BBcode active

  //this.wbbInsertCallback(command,value) // Insert values ​​into the editor, value - to insert the parameters
  //this.wbbRemoveCallback(command); // delete the current BB code preserving content
  //this.wbbRemoveCallback(command,true) - BB code deletes the current contents with
  //this.showModal.call(this,command,opt.modal,queryState); //Show a modal window through WysiBB
  //opt.modal.call(this,command,opt.modal,queryState); //Display custom modal window
  
  //In our example, we insert a quote
  this.wbbInsertCallback(command,{AUTHOR:"WysiBB",SELTEXT:"Quote text"})
  //If you do not specify a value seltext - will be taken the currently selected text
  
}

$(document).ready(function() {
 var wbbOpt = {
  buttons: "myimg",
  allButtons: {
    quote: {
      title: "Insert quote",
      buttonText: 'myquote',
      buttonHTML: false,
      hotkey: 'ctrl+e',
      cmd: myfunc, //Custom handler
      transform: {
        '<div class="quote"><cite>{AUTHOR} wrote:</cite>{SELTEXT}</div>':'[quote={AUTHOR}]{SELTEXT}[/quote]'
      }
    }
  }
}
 $("#editor").wysibb(wbbOpt);
});
</script>
.....
<textarea id="editor"></textaera>

The result of this configuration: