Skip to content

Yjs shared data

Philipp edited this page Jul 16, 2020 · 8 revisions

The Community Application Editor uses Yjs for the realization of the shared modeling editor.

The content shared via Yjs should be documented here. Note, that the documentation is not complete yet.

Overview

Variable Type Content Description
data Map Contains metamodel, model, wireframe and metadata information.
users Map Maps Yjs client id to sub of logged in user.
userList Map Maps users sub to object containing more information on the user, e.g. name and email.
join Map Used for join and leave events of users.
undo Array
redo Array
canvas Map
nodes Map
edges Map
select Map
views Map
text Text
widgetConfig Map Currently only used to enable/disable view only mode of the SyncMeta widgets.

Detailed description

data

The data map contains the keys "metamodel", "model", "wireframe", "metadataDocString" and "metadataDoc". The value stored with key "metadataDocString" has the following structure:

{
    "info": {
        "description": description,
        "version": version,
        "termsOfService": termsOfService
    },
    "definitions": schemasJson,
    "nodes": nodeMetadataJson
}

The value stored with key "metadataDoc" has the following structure

{
    "componentId": componentId,
    "docType": "json",
    "docString": "",
    "docInput": infoNode
}

and gets stored by the Swagger Widget.

users

When a user enters the modeling space, then the activity widget (or the Canvas) from SyncMeta adds an entry to the users map. This entry uses y.db.userId (which is the user id of the Yjs client) as the key. The value gets set to the sub of the user which got received from Learning Layers.

userList

The userList may be used to get more detailed information on users. When just having there sub, the userList allows to get more information such as the full name or email of a user.

join

The join-map is used to handle joining and leaving of users. If a user joins the modeling space, then a join message gets sent. This notifies the other users, that someone joined the modeling. Every user who receives this join message, also sends a join message back to all the other users. Since that, a new user will receive join events from every user too and can use these to find out which users are currently online.

undo

redo

canvas

nodes

edges

select

views

text

widgetConfig

Note: These settings are still WIP. This map currently contains the keys "view_only" and "view_only_property_browser". By setting "view_only" to true, the editing functionalities of the Canvas, e.g. the possibility to add or delete a node, are disabled.

When "view_only_property_browser" is set to true, the Property Browser disabled all the input fields. Then, the attributes that are displayed can only be viewed, but not edited.