diff --git a/package-lock.json b/package-lock.json index b5c8ca69..ffae8d72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rwth-acis/syncmeta-widgets", - "version": "2.4.9", + "version": "2.4.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rwth-acis/syncmeta-widgets", - "version": "2.4.9", + "version": "2.4.10", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@jsplumb/browser-ui": "^6.0.5", @@ -1411,9 +1411,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" @@ -2648,9 +2648,9 @@ } }, "node_modules/postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -2659,10 +2659,14 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "nanoid": "^3.3.4", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -3204,9 +3208,15 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "node_modules/postcss/node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -3461,9 +3471,9 @@ "integrity": "sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w==" }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "bin": { "semver": "bin/semver.js" } diff --git a/package.json b/package.json index 3691d852..a563c07f 100644 --- a/package.json +++ b/package.json @@ -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": "acis@dbis.rwth-aachen.de" diff --git a/src/es6/attribute_widget/CodeEditorValue.js b/src/es6/attribute_widget/CodeEditorValue.js index bdfc59ac..572b2aa4 100644 --- a/src/es6/attribute_widget/CodeEditorValue.js +++ b/src/es6/attribute_widget/CodeEditorValue.js @@ -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 @@ -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); @@ -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 = $( @@ -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(); }); /** diff --git a/src/templates/attribute_widget/code_edtior_value.html b/src/templates/attribute_widget/code_edtior_value.html index d72c3d58..91511d0b 100755 --- a/src/templates/attribute_widget/code_edtior_value.html +++ b/src/templates/attribute_widget/code_edtior_value.html @@ -1,7 +1,3 @@ - diff --git a/src/templates/attribute_widget/editor_modal.html b/src/templates/attribute_widget/editor_modal.html index 2d15bc4a..b3907b9d 100644 --- a/src/templates/attribute_widget/editor_modal.html +++ b/src/templates/attribute_widget/editor_modal.html @@ -1,19 +1,14 @@