Further features

Reporting data via iFrame

Congree provides an iFrame message which can be accessed using this code:

window.addEventListener('message', function(e) {

    if(e.data.type === 'congreeWebInterfaceEvent') {

        handleEvent(e.data.detail);

    }

}, false);

The result contains the following information:

checkStatus

checked (successful Check Document operation)

notStarted (no check started)

inProgress (check executing)

partiallyChecked (real-time check executed but no Check Document operation)

rulesetName

Unique name of the document-specific rule set

timestamp

Date and time in this format: yyyy-mm-ddThh:mm:ssZ

releaseLevel

Value between 0 and 100

errorTypes

name

Abbreviation

Grammar

Spelling

Style

Terminology

Errors

Error count between 0 and n

ignoredErrors

Error count between 0 and n

Sample result

{"checkStatus":"checked","rulesetName":"Compathy_Office_DE","timestamp":"2019-03-13T08:43:40.984Z","releaseLevel":87.3,"errorTypes":[{"name":"Grammar","errors":2,"ignoredErrors":1}]}


Forward attributes

You can forward attributes to Congree so that Congree can return a fitting rule set.

var congree = window.Congree || {};

window.Congree = congree;



congree.loadSidebar = function (username, password) {

    // loader code custom to host app

    congree.sidebar = new Congree.Sidebar({

        serverAddress: "http://10.0.102.3",

        // bulkCheckServicePath: "CongreeBulkCheckServiceNoSSL/BulkCheckService.svc",

        authentication: {

            userName: username || "cwi",

            password: password || "",

            loginType: "usernamePassword"

        },

        initialRuleSetName: "Compathy_Office_DE",

        editors: [

            Congree.AdapterFor.TextInput('textarea'),

            Congree.AdapterFor.TextInput('input[type="text"]'),

            Congree.AdapterFor.TinyMce4('.tinymce4', 'tinymce'),

            Congree.AdapterFor.CKEditor4('.ckeditor4')

        ],

        culture: 'de-DE',

        thirdPartyAttributes: {

            param1: 1,

            param2: 'asd',

            param3: 42,

            param4: false

        }

    });

    congree.sidebar.show("congreeSidebar");

};

You can forwards a culture so Congree only returns rule sets matching that culture

Relevant parameters for culture currently are “de-DE” and “en-US”

In thirdPartyAttributes you can specify the parameters and their values.

The values and culture you provide must match a rule in Congree. Otherwise you will get the following exception:

TypeError: e.Rules[0].RuleOption is undefined

It is not possible to have a fallback rule set, since this would contradict the goal of always having control over the displayed rule set and some wrong rule set could be selected without the author knowing. If you need something close to a fallback, a simple rule can be created which is true in most cases.

Sample configuration

culture: 'en-US',

        thirdPartyAttributes: {

            space: 'Compathy',

            department: 'TecDoc',

This will lead to Congree preselecting Compathy_Office_EN.