Skip to content

Commit

Permalink
Merge pull request #157 from rwth-acis:lakhoune/issue156
Browse files Browse the repository at this point in the history
init multivalue, Fixes #156
  • Loading branch information
lakhoune authored May 22, 2023
2 parents 58796ce + 1a18d59 commit 4df17d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/es6/canvas_widget/MultiValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "https://unpkg.com/[email protected]/dist/jquery.js";
import "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js";
import _ from "lodash-es";
import AbstractValue from "./AbstractValue";
import { Map as YMap, YMapEvent, YTextEvent } from "yjs";
import { Text as YText, Map as YMap, YMapEvent, YTextEvent } from "yjs";
import { EntityManagerInstance } from "./Manager";

/**
Expand Down Expand Up @@ -162,6 +162,13 @@ export class MultiValue extends AbstractValue {
}
EntityManagerInstance.storeDataYjs();
});
//initialize the map with the values
for (const [key, value] of Object.entries(this._value)) {
if (!this._ymap.has(key)) {
const ytext = new YText(value);
this._ymap.set(key, ytext);
}
}
}

toJSON() {
Expand Down

0 comments on commit 4df17d7

Please sign in to comment.