BigW Consortium Gitlab

Commit 1f8226e1 by Regis

check if description changed prior to binding TaskLists and calling renderGFM

parent fee0c932
...@@ -30,8 +30,9 @@ export default { ...@@ -30,8 +30,9 @@ export default {
return { return {
poll, poll,
timeoutId: null, timeoutId: null,
title: null, title: '<span></span>',
description: null, description: '<span></span>',
descriptionChange: false,
}; };
}, },
methods: { methods: {
...@@ -40,6 +41,9 @@ export default { ...@@ -40,6 +41,9 @@ export default {
this.triggerAnimation(body); this.triggerAnimation(body);
}, },
triggerAnimation(body) { triggerAnimation(body) {
// always reset to false before checking the change
this.descriptionChange = false;
const { title, description } = body; const { title, description } = body;
this.descriptionText = body.description_text; this.descriptionText = body.description_text;
...@@ -57,7 +61,12 @@ export default { ...@@ -57,7 +61,12 @@ export default {
if (!noTitleChange) { if (!noTitleChange) {
elementsToVisualize.push(this.$el.querySelector('.title')); elementsToVisualize.push(this.$el.querySelector('.title'));
} else if (!noDescriptionChange) { }
if (!noDescriptionChange) {
// only change to true when we need to bind TaskLists the html of description
this.descriptionChange = true;
elementsToVisualize.push(this.$el.querySelector('.wiki')); elementsToVisualize.push(this.$el.querySelector('.wiki'));
} }
...@@ -100,6 +109,8 @@ export default { ...@@ -100,6 +109,8 @@ export default {
}); });
}, },
updated() { updated() {
// if new html is injected (description changed) - bind TaskList and call renderGFM
if (this.descriptionChange) {
const tl = new gl.TaskList({ const tl = new gl.TaskList({
dataType: 'issue', dataType: 'issue',
fieldName: 'description', fieldName: 'description',
...@@ -109,6 +120,8 @@ export default { ...@@ -109,6 +120,8 @@ export default {
$(this.$refs['issue-content-container-gfm-entry']).renderGFM(); $(this.$refs['issue-content-container-gfm-entry']).renderGFM();
return tl; return tl;
}
return null;
}, },
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment