Skip to content

Commit

Permalink
wrapWidgetSync
Browse files Browse the repository at this point in the history
SQUASHED: AUTO-COMMIT-src-components-widgets-lively-code-mirror.js,
  • Loading branch information
JensLincke committed Jan 12, 2024
1 parent 69815b0 commit 8df6c31
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/components/widgets/lively-code-mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,30 @@ export default class LivelyCodeMirror extends HTMLElement {

return promise;
}

wrapWidgetSync(name, from, to, options) {
var widget = document.createElement("span");
widget.classList.add("lively-widget");
widget.style.whiteSpace = "normal";
var comp = document.createElement(name);
widget.appendChild(comp)

Object.assign(comp.style, {
display: "inline",
// backgroundColor: "rgb(250,250,250)",
display: "inline-block",
minWidth: "20px",
minHeight: "20px"
});

// #TODO, we assume that it will keep the first widget, and further replacements do not work.... and get therefore thrown away
var marker = this.editor.doc.markText(from, to, Object.assign({
replacedWith: widget
}, options));
comp.marker = marker;

return comp;
}

async printResult(result, obj, isPromise) {
var editor = this.editor;
Expand Down

0 comments on commit 8df6c31

Please sign in to comment.