Skip to content

Commit a345781

Browse files
authored
Fix edit error (#28)
1 parent 3596784 commit a345781

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.zenuml</groupId>
66
<artifactId>confluence-addon</artifactId>
7-
<version>1.0.8</version>
7+
<version>1.0.9</version>
88
<organization>
99
<name>P and D Vision</name>
1010
<url>https://www.zenuml.com/</url>

src/main/resources/atlassian-plugin.xml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,24 @@
1515
</web-panel>
1616
<!-- add our web resources -->
1717
<web-resource key="active-sequence-resources" name="sequence Web Resources">
18-
<dependency>com.atlassian.auiplugin:ajs</dependency>
19-
<dependency>com.atlassian.auiplugin:dialog2</dependency>
20-
<dependency>confluence.editor.actions:editor-macro-browser</dependency>
21-
<resource type="download" name="demo.html" location="/demo.html" value="enabled"/>
2218
<resource type="download" name="sequence.css" location="/css/sequence.css" value="enabled"/>
2319
<resource type="download" name="vue.js" location="/js/vue.js" value="enabled"/>
2420
<resource type="download" name="md5.min.js" location="/js/md5.min.js" value="enabled"/>
2521
<resource type="download" name="dom-to-image.min.js" location="/js/dom-to-image.min.js" value="enabled"/>
26-
<resource type="download" name="zen-sequence-vendor.js" location="/js/zen-sequence-vendor.js" value="enabled"/>
27-
<resource type="download" name="zen-sequence-app.js" location="/js/zen-sequence-app.js" value="enabled"/>
28-
<resource type="download" name="macro-customise.js" location="/js/macro-customise.js" value="enabled"/>
2922
<resource type="download" name="images/" location="/images" value="enabled"/>
3023
<resource type="download" name="analytics.js" location="/js/analytics.js" value="enabled"/>
3124
<resource type="download" name="diagram-as-code.js" location="/META-INF/resources/webjars/diagram-as-code.js/0.1.14/dist/diagram-as-code.min.js" value="enabled"/>
32-
<context>editor</context>
25+
</web-resource>
26+
27+
<web-resource key="active-sequence-resources-editor" name="sequence Web Resources for editor">
28+
<dependency>com.atlassian.auiplugin:ajs</dependency>
29+
<dependency>com.atlassian.auiplugin:dialog2</dependency>
30+
<dependency>confluence.editor.actions:editor-macro-browser</dependency>
31+
<resource type="download" name="sequence.css" location="/css/sequence.css" value="enabled"/>
32+
<resource type="download" name="vue.js" location="/js/vue.js" value="enabled"/>
33+
<resource type="download" name="macro-customise.js" location="/js/macro-customise.js" value="enabled"/>
34+
<resource type="download" name="diagram-as-code.js" location="/META-INF/resources/webjars/diagram-as-code.js/0.1.14/dist/diagram-as-code.min.js" value="enabled"/>
35+
<context>atl.general</context>
3336
</web-resource>
3437
<xhtml-macro name="active-sequence" class="com.zenuml.confluence.macro.SequenceMacro" icon="/download/resources/${atlassian.plugin.key}:active-sequence-resources/images/zenuml_logo.png" key="active-sequence-macro">
3538
<description key="sequence.macro.desc"/>

src/main/resources/js/macro-customise.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ AJS.$(document).ready(function () {
4747
// return a dom node list
4848
function getAllShadowElements() {
4949
var elements = [];
50-
AJS.$('sequence-diagram').each(function () {
51-
if (this.shadowRoot.querySelector(".sequence-diagram-container")) {
52-
elements.push(this.shadowRoot.querySelector(".sequence-diagram-container"))
50+
AJS.$('diagram-as-code').each(function () {
51+
if (this.shadowRoot.querySelector(".diagram-as-code.noEditor>.split>.sequence-diagram")) {
52+
elements.push(this.shadowRoot.querySelector(".sequence-diagram"))
5353
}
5454
});
5555
return elements;
@@ -62,17 +62,14 @@ AJS.$(document).ready(function () {
6262
if (doms.length > 0) {
6363
var dslList = [];
6464
doms.forEach(function (dom) {
65-
var dslEls = AJS.$(dom).find('.zenuml-dsl');
66-
if (dslEls.length > 0) {
67-
var dslText = dslEls.text();
68-
// remove duplicate when upload mutiple same uml at the same time
69-
if (dslList.indexOf(dslText) < 0) {
70-
objects.push({
71-
dsl: dslText,
72-
domtoimagePromise: domtoimage.toBlob(dom, { bgcolor: 'white' })
73-
});
74-
dslList.push(dslText);
75-
}
65+
var dslText = dom.__vue__.$store.state.code;
66+
// remove duplicate when upload mutiple same uml at the same time
67+
if (dslList.indexOf(dslText) < 0) {
68+
objects.push({
69+
dsl: dslText,
70+
domtoimagePromise: domtoimage.toBlob(dom, { bgcolor: 'white' })
71+
});
72+
dslList.push(dslText);
7673
}
7774
})
7875
}

0 commit comments

Comments
 (0)