CIB webRec technical documentation

Example 1: Button to insert RTF provided by a custom dialog

Assuming custom dialog exists with ID #picker and can trigger event named rtf_selected.

1.     Initialize please as shown before

2.     Provide necessary functions for editor in your JS

window.rec = { 
  init: function () {
    please.call('webRec.setIntegrationPanelState', [{
      key: 'custom-insert-rtf',
      title: 'Insert RTF here',
      shortcut: 'Ctrl+Shift+I',
      callback: 'rec.showRTFDialog',
      icon: 'plus-square',
      disabled: false,
      display: true
    }])
  },
  showRTFDialog: function () {
    please.call('webRec.blockUI', true).then(function () {
      $('#picker').show()
    })
  }
}

 

3.     Handle selection in your JS code:

$('#picker').on('rtf_selected', function (event) {
  var rtfString = event.data
  if (rtfString) {
    $('#picker').hide()
    please.call('webRec.insertRTF', rtfString).then(function () {
     please.call('webRec.blockUI', false)
    })
  }
})

 

4.     Embed webRec with parameters:

<iframe
src='editor.html?onEditorOpen="rec.init"&amp;onDocumentLoad="onDocumentLoaded"&amp;
enableHeader=false&amp;enableFileButtons=false&amp;reducePageSpace=true&mpinitialFont="Arial"
&amp;initialFontSize=11'>

See, “CIB webRec GET parameters” section for list of available GET parameters.