The Universal Editor Connector Interface (UECI)

UECI allows web application view to interact with native Editors e.g. DeskPack or ArtPro+ to do editor specific actions. Including getting editor version, document info, page boxes, and showing highlights on the current document.

Jump to: Change History

Getting started

Following are the important concept to start with.

Initialization

UECI provides initializer to help web-component initialize the Editor, currently supported in Adobe CEP/DeskPack and ArtPro+.

To initialize the connection with editor, include following UECI_SDK.js in your html page, these .js files are available in the UECI source package. There used to be 3 separate .js files ('AdobeCEPInitializer.js, ArtProPlusInitializer.js, Initializer.js) in UECI SDK 1.0.x, now they're merge as single UECI_SDK.js for convenience of use.

	<script type="text/javascript" src="js/UECI_SDK.js"> </script>

Followed by Javascript call

	try {
		let editor= await InitEditor();
	} catch (err) {
	}

Once editor is initialized, an editor object will be returned from the async function InitEditor(). Then you will be able to use the UECI apis through accessing the editor object

Editor class

Once initialization is done, there a global editor instance will be created, and added to 'window'.

Editor is the main API entry for web-component to control & interact with the editor.

The Editor class is a pure abstraction, that each host application needs to provide their own implementation, and inject into the web view after the web view is loaded. It is the host editor's responsibility to create Editor object instance.

See API reference of Editor class

Asynchronicity

All UECI APIs are asynchronous, this is because the asynchronicity between C++ / JS interactions in modern applications.

This means APIs like Editor.getVersionString() is async which returns a Promise object instead of string. In web comonent, it is also required to handle the return value in asynchronous way.

// Sample code of showing version string in web-component
async function showVersionString()
{
	const verStr = await editor.getVersionString.getVersionString();
	var s = document.getElementById('elementID');
	s.value(verStr);
}

Error Handling

Error could happen during call of an async API function, on error happens, the API function will throw Error object, it is the caller's responsibility to catch and properly handle it. A typical example is when a document has been closed by the host application, then calling APIs on such document will cause an error.

async function showDocumentTitle(doc)
{
	let title = '';
	try {
		title = await doc.title();
		console.log('Document title is: ' + title);
	} catch (err) {
		console.warn('Unable to get document title: ' + err.message);
	}
}

An alternative (simpler) way of catching the error;

async function showDocumentTitle(doc)
{
	let title = await doc.title().catch( (err) => { console.error(err); } );
    // do stuff with the title. title will be default on catching the error
}

Multiple web-components

The host editor is supposed to support interacting with multiple web-components. Each web-component window will have its own ID, and the ID is registered during initialization of the Editor instance, therefore each web-component only sees/accesses its own annotation.

Host Editor Dynamics

There're many reason beware of the host editor capabilities and the version dynamics, these includes but not limited to:

  • Different editors might be limited and not respond to certain API
  • Different editors might have slight different behavior
  • API might evolve from release to release, new API could be simply not supported on old editors API could evolve from release to release, therefore the client code need to be aware of the capability of the host app

Change History

Changes till now

  • The UECI SDK has combined 3 *Initializer.js into one file "UECI_SDK.js". To simplify the usage of the UECI SDK in the web-UI development
  • Editor.postMessage() API added

Changes since Release 1.0.x

Initial version of UECI SDK, and support all Esko Editor (ArtPro+ DeskPack) <= 24.03