CIB webRec technical documentation

API

Methods

Document API
Toolbars API
Context menu API
Controls on webRec dialogs API
Shortcuts API
Cursor API
Document displaying API

Document API

webRec.newDoc()

Reset webRec editor to new (empty) document

Arguments:

1.      [title=''] (string): Title to be set in title bar

 Returns:

Nothing

 

webRec.getRTF()

Returns RTF representation of current document

Returns:

the promise object resolving to RTF content

 

webRec.setRTF(content, [title=”], [options={}])

Replaces current document with one represented by RTF

Arguments:

2.     content (string): RTF document (snippet or file content)

3.     [title=''] (string): Title to be set in title bar

4.     [options={}] (object): Additional parsing options to be sent to server

  • [options.filterCIBFields] (boolean): controls if CIB fields will be removed by server when the document is opened (default is taken from GET parameters)
  • [options.toggleFieldCode] (boolean): controls if fields will be displayed in code mode (default is taken from GET parameters)

Returns:

Nothing

 

webRec.insertRTF(content, [options={}])

Pastes provided RTF content into current caret position.

Arguments:

1.     content (string): RTF document (snippet or file content)

2.     [options={}] (object): Additional parsing options to be sent to server.

3.     [options.filterCIBFields] (boolean): controls if CIB fields will be removed by server when the document is opened (default is taken from GET parameters)

4.     [options.toggleFieldCode] (boolean): controls if fields will be displayed in code mode (default is taken from GET parameters)

Returns:

Nothing

 

webRec.blockUI(state)

Causes editor frame to display spinner and block all interactions with user if state is true. If state is false, cancels previous block. Does not cancel internal blocks that editor does e.g. when opening files.

You could specify to open initially webRec with blocked UI using initialBlockUI=true GET parameter.

Arguments:

1.     state (boolean): The state of block to be set in the frame

Returns:

Nothing

 

webRec.onlyPresetFontOptions(state)

Disables editing possibility for font and font size combo boxes on webRec toolbar and insde Font properties dialog.

Arguments:

1.     state (boolean): true - disables editing possibility, false - enables editing possibility

Returns:

Nothing


Toolbars API

webRec.setIntegrationPanelState(state)

Changes the configuration of panel with custom buttons. See Integration panel for the details.

Arguments:

1.     state (array): Array of button configurations

Returns:

Nothing


webRec.setIDS(ids, title)

Loads existing internal document structure into editor

Arguments:

1.     ids: the document structure to load

2.     title: title to display in UI

Returns:

Nothing


webRec.loadFromStorage(storageJson, cfg)

Loads document from remote document storage through webRec back-end

Arguments:

1.     storageJson: json object with an information about storage to be used, plus document id of the document to be loaded

Sample:

'{ "class": "de.cib.webrec.backend.service.document.MockStorageConnector", "documentId": 121001}'

2.     cfg: additional options to send into server

Returns:

the promise object



webRec.saveToStorage(storageJson)

Saves document to remote document storage through webRec back-end

Arguments:

1.     storageJson: json object with an information about storage to be used, plus document id of the document being saved

Sample:

'{ "class": "de.cib.webrec.backend.service.document.MockStorageConnector",
"documentId": 121001}'

Returns:

the promise object


webRec.setUiLanguage(lang)

Sets language for webrec UI

Arguments:

1.     lang: de_DE, en_US & ru_RU

Returns:

Nothing

 

webRec.focusDocumentInput()

Sets input focus into the document editing area

Arguments:

Nothing

Returns:

Nothing

 

webRec.createToolbar(id, position, isEmpty)

Creates toolbar at the specified place

Arguments:

1.     id: Id which will be assigned to the toolbar

2.     isEmpty: Indicates if toolbar should be empty (without controls)

3.     position: left, right, top, bottom. Top by default

Returns:

Nothing

 

webRec.removeToolbar(id)

Removes toolbar by provided id

Arguments:

1.     Id

Returns:

Nothing


webRec.removeToolbarControls(toolbarId)

Removes all controls from the toolbar

Arguments:

1.     toolbarId

Returns:

Nothing

 

webRec.restoreToolbarControls(toolbarId)

Restores the default toolbar configuration

Arguments:

1.     toolbarId

Returns:

Nothing

 

webRec.addStandardElements(ids, toolbarId, index)

Adds standard elements on the toolbar in the specified order. Both groups and controls can be added. List of the standard id's for each group/control can be found in Toolbar.tsx

Arguments:

1.     ids: List of standard names. Elements with these names will be added on the toolbar in the given order. For example: ['fileOptions', 'bold', 'italic']

2.     toolbarId

3.     index: Place where to add the elements. By default they will be added to the end.

Returns:

Nothing

 

webRec.addCustomElement(id, descriptor, toolbarId, index)

Adds custom element on the toolbar in the specified place. Either group or control can be added (depends on the second parameter)

Arguments:

1.     id: id of the element to add

2.     descriptor: declarative description of custom element

3.     toolbarId: id of the toolbar to add

4.     index: place where to add

Returns:

Nothing

Example

Adding 4 new custom buttons:

var integrationPanelState = [
    {
        id: 'prev',        
        title: 'Previous snippet',        
        shortcut: 'Ctrl+1',        
        callback: 'webRecCallbacks.prevBtn',        
        icon: 'icon-chevron_double_left',        
        disabled: true,        
        hidden: false    
    },
    {
        id: 'next',        
        title: 'Next snippet',        
        shortcut: 'Ctrl+2',        
        callback: 'webRecCallbacks.nextBtn',        
        icon: 'icon-chevron_double_right',        
        disabled: false,        
        hidden: false    
    },      
    {
        id: 'commit',        
        title: 'Save changes',        
        shortcut: 'Ctrl+3',        
        callback: 'webRecCallbacks.commitBtn',        
        icon: 'icon-check',        
        className: 'commit',        
        disabled: false,        
        hidden: false    
    },  
    {
        id: 'close',        
        title: 'Close editor',        
        shortcut: 'Ctrl+4',        
        callback: 'webRecCallbacks.closeBtn',        
        icon: 'icon-close',        
        className: 'close',        
        disabled: false,        
        hidden: false    
    }
];
 
please(frame.contentWindow).call(
'webRec.addCustomElement',
'integrationPanel',     // name of the new toobar group
integrationPanelState,  // list of buttons for the new group 'top',
0);

 

webRec.removeElements(ids)

Removes elements by theirs unique identifiers

Arguments:

1.     ids: Names of the elements to remove

Returns:

Nothing

 

webRec.updateControl(id, descriptor)

Updates control according to the given configuration

Arguments:

1.     descriptor, see example in addCustomElement() method description.

Returns:

Nothing

 

webRec.updateGroup(id, descriptor)

Updates group according to the given configuration

Arguments:

1.     id: Group id

2.     descriptor: New configuration, e.g. {layout: 'vertical'}

Returns:

Nothing

 

webRec.listStandardGroupNames()

list standard group's names (see Toolbar.tsx)

Returns:

array of names of standard groups


webRec.listStandardControlNames()

list standard control's names (see Toolbar.tsx)

Returns:

array of names of standard controls

 

webRec.insertStandardControlIntoGroup(groupId, controlId, index)

Returns:

Nothing

 

webRec.insertCustomControlIntoGroup(groupId, json, index)

Returns:

Nothing

 

webRec.placeToolbar(id, direction)

Returns:

Nothing


Context menu API

webRec.removeControlsInContextMenu(ids)

Removes menu entries from context menu

Arguments:

1.     ids array of names of controls to remove. The complete list of available by default entries could be retrieved using listControlsInContextMenu() call.

Returns:

Nothing

 

webRec.addControlsInContextMenu(ids)

Returns previously removed entries in context menu

Arguments:

1.     ids array of names of controls to be added. The complete list of available by default entries could be retrieved using listControlsInContextMenu() call.

Returns:

Nothing

 

webRec.disableControlsInContextMenu(ids)

Makes context menu entries gray and inaccessible

Arguments:

1.     ids array of names of controls to disable. The complete list of available by default entries could be retrieved using listControlsInContextMenu() call.

Returns:

Nothing

 

webRec.enableControlsInContextMenu(ids)

Enables previously disabled menu entries

Arguments:

1.     ids array of names of controls to enable. The complete list of available by default entries could be retrieved using listControlsInContextMenu() call.

Returns:

Nothing

 

webRec.listControlsInContextMenu()

Lists entries available by default inside context menu.

Returns:

In webRec 1.6 this method returns:

['open', 'save', 'undo', 'redo', 'increaseIndent', 'decreaseIndent', 'restartNumbering', 'continueNumbering', 'font', 'paragraph', 'page', 'insertRowAbove', 'insertRowBelow', 'insertColumnLeft', 'insertColumnRight', 'deleteRows', 'deleteColumns', 'tableProperties', 'license']

 

webRec.listRemovedControlsInContextMenu()

Returns:

Array of ids for removed controls from context menu.

 

webRec.listDisabledControlsInContextMenu()

Returns:

Array of ids for disabled controls inside context menu.


Controls on webRec dialogs API

webRec.removeControlsInDialogs(ids)

Removes specific controls from dialogs

Arguments:

1.     ids array of names of controls to remove. The complete list of available entries could be retrieved using listControlsInDialogs() call.

Returns:

Nothing

 

webRec.addControlsInDialogs(ids)

Returns previously removed controls in dialogs

Arguments:

1.     ids ids array of names of controls to be returned. The complete list of available controls could be retrieved using listControlsInDialogs() call.

Returns:

Nothing

 

webRec.disableControlsInDialogs(ids)

Disables specific controls on dialogs

Arguments:

1.     ids array of names of controls to disable. The complete list of available entries could be retrieved using listControlsInDialogs() call.

Returns:

Nothing

 

webRec.enableControlsInDialogs(ids)

Returns previously disabled controls in dialogs

Arguments:

1.     ids array of names of controls to be enabled. The complete list of available controls could be retrieved using listControlsInDialogs() call. To get a list of already disabled controls use listDisabledControlsInDialogs() call.

Returns:

Nothing

 

webRec.listControlsInDialogs(ids)

Returns list of available controls on dialogs

Arguments:

Nothing.

Returns:

Returns list of available controls on dialogs

In CIB webRec 1.6.2 this method returns:

["row.height", "row.break", "row.header", "row.leftPadding",
"row.rightPadding", "row.topPadding", "row.bottomPadding", "cell.vertAlignment",
"cell.leftPadding", "cell.rightPadding", "cell.topPadding", "cell.bottomPadding",
"page.size", "page.orientation", "page.margins", "font.fontName", "font.fontSize", "font.fontStyle",
"font.underline", "font.superscript", "font.allCaps", "font.hidden",
"font.strikethrough", "font.subscript", "font.smallCaps", "paragraph.alignment",
"paragraph.language", "paragraph.doNotHyphenate", "paragraph.leftIndent", "paragraph.rightIndent",
"paragraph.specialIndent", "paragraph.spaceBefore", "paragraph.spaceAfter", "paragraph.lineSpacing",
"paragraph.noSpaceSameStyle", "paragraph.pageBreakBefore", "paragraph.widowControl", "paragraph.keepWithNext",
"paragraph.keepLinesTogether", "paragraph.borders"].

 

webRec.listRemovedControlsInDialogs(ids)

Returns list of ids of removed controls from dialogs

Arguments:

Nothing

Returns:

Returns list of ids of removed controls from dialogs

 

webRec.listDisabledControlsInDialogs(ids)

Returns list of ids of disabled controls from dialogs

Arguments:

Nothing

Returns:

Returns list of ids of disabled controls from dialogs

Shortcuts API

webRec.listShortcuts()

Returns all available shortcuts

Arguments: none

Returns:

Array of available shortcuts

 

webRec.blockShortcut(key)

Disables shortcut

Arguments:

1.     key    Shortcut to disable. For example, 'Ctrl+Shift+F'

Returns:

Nothing

 

webRec.blockShortcuts(keys)

Disables several shortcuts

Arguments:

1.     keys    Array of shortcuts to disable. For example, ['Ctrl+Shift+F', ‘Enter’]

Returns:

Nothing

 

webRec.unblockShortcut(key)

Enables shortcut

Arguments:

1.     Key

Returns:

Nothing

 

webRec.listBlockedShortcuts()

Returns:

Array of blocked shortcuts. For example, ['Ctrl+Shift+F', ‘Enter’].

 

webRec.setShortcu(id, key)

Adds/removes a new shortcut for some specific toolbar button

Arguments:

1.     id     - id of the toolbar button, for example 'insertTable'. A list of available ids you could take using listStandardControlNames() method

2.     key    shortcut to add. For example, 'Ctrl+Shift+F'. If the key is null or empty string, the existing shortcut for this control will be removed.

Returns:

Nothing


Cursor API

webRec.showCursor(visibility)

Shows or hides cursor. Could used together with enableReadOnlyMode() / disableReadOnlyMode() call. Selected content will be highlighted in all cases regardless this option.

Arguments:

1.     visibility    true: show cursor or false – hide cursor.

Returns: Nothing

 

webRec.enableCursorBlinking()

Enables cursor blinking at caret position. By default cursor blinking is enabled.

Arguments: none

Returns: Nothing

 

webRec.disableCursorBlinking()

Disables cursor blinking at caret position. By default cursor blinking is enabled.

Arguments: none

Returns: Nothing

 

webRec.hideCursorOnLostFocus()

Activates or disables cursor visibility on lost/gain input focus in the webRec frame.

Arguments: hide – true if activate this fuctionality

Returns: Nothing

 

webRec.disableReadOnlyMode()

Enables all editing functions for opened document and resets page background color override (see, webRec.overridePageColor). Could be used together with blockUI(false) call.

Arguments: none

Returns: Nothing


Document displaying API

webRec.overridePageColor(pageColor = ‘’)

Sets background color of the page for displaying purpose only. Method is used together with read-only mode: enableReadOnlyMode(), disableReadOnlyMode().

Arguments:

1.     pageColor    color to be used, for example “#c1c1c1”, '' - to use color specified inside the document.

Returns: Nothing

 

webRec.enableSnippetMode(options | null)

Sets snippet mode for displaying of the document.

Arguments: none or options objects:

{
              enablePageBorderLines: boolean - enable page border lines
              resizeCanvasOnZoom: boolean - resize canvas on zoom
              resizeCanvasOnWindowResize: boolean - resize canvas on window resize
              offsets: {
                  leftOffset: number - left offset (grey area) in pixels
                  rightOffset: number - right offset in pixels
                  topOffset: number - top offset in pixels
                  pageOffset: number - page offset in pixels
              }
              pageMargins: {
                  top: number - top page margin (white area) in inches
                  bottom: number - bottom page margin in inches
                  left: number - left page margin in inches
                  right: number - right page margin in inches
              }
}

  • enablePageBorderLines  Enables page border line in disaplying of the document. When omitted this parameter by default is set to false.
  • resizeCanvasOnZoom    When set to true, the page will be resized to fit actual size of the webRec frame, on any zoom in/out operations. When omitted this parameter by default is set to true.
  • resizeCanvasOnWindowResize  When set to true, the page will be resized to fit actual size of the webRec frame. When omitted this parameter by default is set to true.

 

You could also open snippet mode using GET parameters:

Returns: Nothing

 

webRec.disableSnippetMode()

Returns back displaying of the document in page layout mode. The document will be saved with page definition specified inside Page dialog.

Note: When you have switched on snippet mode, then have resized the document, and switched back page layout mode, page definition inside the document will be set to webRec default values (A4, portrait).

Arguments: none

Returns: Nothing