corinthia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kelly <>
Subject Sample code for Editor API bindings
Date Tue, 17 Mar 2015 14:54:11 GMT
Due to the poorly documented/explained nature of the way in which the Editor API [1], I decided
to share the binding code from UX Write, to aid in implementing the same thing in C++ for
the Qt version of the app. The relevant files are:


A couple of things to note:

1. If you haven’t worked with Objective C before, you’ll find the syntax a bit weird.
This is normal. All parameters in Objective C have to be named, so you get things like:

- (void)setProperties:(NSString *)itemId width:(NSString *)width src:(NSString *)src

instead of

void setProperties(NSString *itemId, NSString *width, NSString *src)

2. For callback functions, the UIWebView class in iOS doesn’t actually provide a way to
do this directly (that is, it’s possible to call from Objective C to JavaScript, but not
the other way round). Thus, every call gets routed through the executeJavaScript method which,
after it has completed the main call, invokes jsCallCompleted to get a list of “messages”
indicating callbacks that must be performed. As such, *all* callbacks that the editing library
makes - via calls to Editor_someFunction() are asynchronous.

Hopefully this should help clarify things a little… let me know if you have any further

As I mentioned in my previous mail, I don’t think this is necessary or viable to to do for
the Python bindings at the moment, because it’s heavily dependent on which embedded browser
engine is being used in the app, which introduces additional complexities. But if a Python
GUI were to be developed at some point, then Python bindings would be useful in that context,
although might be better implemented in Python itself rather than C, depending on the technique
used for embedding a web view.


Dr Peter M. Kelly

PGP key: <>
(fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message