Kudo Editor iframe → Partner Web Application
If you use an “On Premise / Cloud Installation”, our SDK is available to you. See section Server to Client Communication for further details on this topic.
The iframe sends some message events to its parent’s window object. To receive such events, you need to listen to JS ‘message’ events. Please note that this is not a Kudo specific mechanism but the native JavaScript message event is used so potentially you receive message events from other origin than Kudo iframe.
You can listen for dispatched messages by executing the following JavaScript:
window.addEventListener("message", (event) => {
if (event.origin !== "http://example.org:8080")
return;
// ...
}, false);
The properties of the dispatched message are:
origin - The origin of the window that sent the message. If you are using ARES Kudo SaaS, the origin is “https://app.kudo.graebert.com”.
data - The object passed from the iframe
Kudo sends data as a JSON object with a messageName string and a message string that usually contains a JSON object with some message dependent strings.
{
messageName: "nameOfTheMessage",
message: "{}"
}
Message Events
To avoid flooding parent with unnecessary messages, we have some type of message events you need to register for (Events you need to register for).
See Event register/Event deregister how to register or deregister for such message events.
Sent events
drawingLoaded
Sent when drawing is entirely loaded on clientside.
event.data
{
"messageName" : "drawingLoaded"
}
connectionLost
Sent when the connection to the server is lost due to e.g. network issues or server-side session terminated unexpectedly.
event.data
showChooseDialog
Sent by some commands (e.g. xref, insert, linetype) to open file chooser dialog.
event.data
attachmentType - type to be passed to response message event (possible values: drawing/image/richLine/cfg/linetype/dgn)
commandType - messageName to be passed to response message event (possible values: xref/attach/-attach/import)
filter - array of extension to filter files for (e.g. [“dwg”,”dxf”] for drawings or ["jpg","jpeg","svg","png","bmp","gif"] for images)
wtObjectId - optional object id of the dialog that sent the message; if it is there → elemId to be passed to response message event
Kudo expects a response message event with data JSON object that contains the info about the selected file:
id - file id of the selected file that is used to download the file (/files/:fileId/diffs)
folderId - id of the folder the selected file is in
name - file name (e.g. “test.dwg”)
path - file path absolute to root (e.g. “~/folderX/fileY.png”)
size - file size as a string (e.g. "11.9 kB")
creationDate - file creation date
updateDate - date of the last file update
google-analytics-data
When in the server configuration "send-ganalytics-to-parent" is true then we send google-analytics data to parent iframe instead of google-analytic server
We send data to parent Iframe like this
Where hitType is pageView and component is ‘/editor’
OR
Where hitType is an event and for other parameters, please check this
Events you need to register for
Command Events
Event name for registration: commandEvent
These events are fired when a command executes:
Message Name | Descriptions |
---|---|
commandWillStart | whenever the execution of a command will start. |
commandEnded | whenevever the execution of a command has ended |
commandCancelled | whenevever the execution of a command has been canceled. |
commandFailed | whenevever the execution of a command has failed. |
modelessOperationWillStart | whenever a modeless operation is about to start. |
modelessOperationEnded | whenever a modeless operation has ended. |
Structure of the Messages
commandWillStart
commandEnded
commandCancelled
commandFailed
modelessOperationWillStart
modelessOperationEnded
Lisp Events
Event name for registration: lispEvent
These events are fired when a lisp action is performed:
Message Name | Descriptions |
---|---|
lispEnded | whenevever the execution of a lisp has ended |
lispCancelled | whenevever the execution of a lisp has cancelled |
Structure of the Messages
lispEnded
lispCancelled
System Variables Events
Event name for registration: sysVarEvent
These events are fired when a system variable change action is performed:
Message Name | Descriptions |
---|---|
sysvarChanged | Occurs when a change is made to the value of a system variable. |
Structure of the Messages
sysvarChanged
Drawing Events
Event name for registration: drawingEvent
These events are fired when an action is performed on drawing:
Message Name | Descriptions |
---|---|
drawingSaved | when a drawing is saved. |
UploadBegin | when a drawing upload is going to start |
UploadComplete | when a drawing upload was done |
drawingDescription* | (*not implemented yet) |
Structure of the Messages
drawingSaved
UploadBegin
UploadComplete
View Events
Event name for registration: viewChangedEvent
These events are fired when a view change action is performed:
Message Name | Descriptions |
---|---|
viewChanged | whenever the World to Eye transformation matrix has been changed. |
Structure of the Messages
viewChanged
Selection Events
Event name for registration: selectionEvent
These events are fired when a selection action is performed:
Message Name | Descriptions |
---|---|
selectionChanged | when a change takes place to the current selection set. |
selectionCancelled | when a current selection is cancelled. |
Structure of the Messages
selectionChanged
selectionCancelled
Drawing Modified Events
Event name for registration: drawingModifiedEvent
These events are fired when a drawing edit action is performed:
Message Name | Descriptions |
---|---|
drawingModified | whenever any command or modeless operation is performed which could cause database modification. |
Structure of the Messages
drawingModified