Skip to content

Commit

Permalink
Merge pull request #173 from rwth-acis/lakhoune/issue172
Browse files Browse the repository at this point in the history
Hot fix custom Shapes
  • Loading branch information
lakhoune authored Nov 22, 2023
2 parents 9acf4ea + 04c674f commit ea687f0
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
40 changes: 25 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rwth-acis/syncmeta-widgets",
"description": "SyncMeta is a near real-time collaborative modeling framework. This package only contains the used widgets. If you want to use the SyncMeta app in a docker container, see https://github.com/rwth-acis/syncmeta.",
"version": "2.4.9",
"version": "2.4.10",
"author": {
"name": "ACIS Group, RWTH Aachen",
"email": "[email protected]"
Expand Down
24 changes: 19 additions & 5 deletions src/es6/attribute_widget/CodeEditorValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CodeEditorValue extends AbstractValue {

var editor = null;

var init = false
var init = false;

/**
* jQuery object of DOM node representing the node
Expand All @@ -57,9 +57,9 @@ class CodeEditorValue extends AbstractValue {

var bindQuillEditor = function (ytext) {
if (init) {
return
return;
}
init = true
init = true;
_ytext = ytext;
new QuillBinding(_ytext, editor);

Expand All @@ -74,10 +74,12 @@ class CodeEditorValue extends AbstractValue {
bindQuillEditor(ytext);
}
};

const tagname = getWidgetTagName(CONFIG.WIDGET.NAME.ATTRIBUTE);
const editorId = "editor-" + rootSubjectEntity.getEntityId();

if (editor) {
$(editor.container).parent().show();
this.modal.show();
// $("#wrapper").hide();
} else {
var tpl = $(
Expand All @@ -86,24 +88,36 @@ class CodeEditorValue extends AbstractValue {
title: name,
})
);
this.modal = new bootstrap.Modal(tpl.get(0));

$(tagname).find(".main-wrapper").append(tpl);
// $("#wrapper").hide();

const domElem = tpl.get(0).querySelector("#" + editorId);
if (!domElem) {
console.error("domElem not found", domElem);
}
// editor language is html
editor = new Quill(domElem, {
theme: "snow",
modules: {
toolbar: false, // Snow includes toolbar by default
},
placeholder: "Paste your SVG code here",

syntax: true,
});
// editor.getSession().setMode("ace/mode/svg");
}

_$node.click(function () {
// listen to close button
tpl.find(".btn-close").click(() => {
this.modal.hide();
});

_$node.click(() => {
createYText();
this.modal.show();
});

/**
Expand Down
6 changes: 1 addition & 5 deletions src/templates/attribute_widget/code_edtior_value.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<button
class="btn btn-outline-secondary"
data-bs-toggle="modal"
data-bs-target="#editor-modal"
>
<button class="btn btn-outline-secondary" data-bs-toggle="modal">
Open Code Editor
</button>
9 changes: 2 additions & 7 deletions src/templates/attribute_widget/editor_modal.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<div
class="modal"
tabindex="-1"
id="editor-modal"
style="z-index: 3000000000 !important"
id="<%= id %>"
>
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%= title %></h5>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
<button type="button" class="btn-close" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="<%= id %>"></div>
Expand Down

0 comments on commit ea687f0

Please sign in to comment.