Skip to content
Snippets Groups Projects
Commit 1f8226e1 authored by Regis's avatar Regis
Browse files

check if description changed prior to binding TaskLists and calling renderGFM

parent fee0c932
No related branches found
No related tags found
1 merge request!10865Render Description Realtime :tada:
Pipeline #
Loading
Loading
@@ -30,8 +30,9 @@ export default {
return {
poll,
timeoutId: null,
title: null,
description: null,
title: '<span></span>',
description: '<span></span>',
descriptionChange: false,
};
},
methods: {
Loading
Loading
@@ -40,6 +41,9 @@ export default {
this.triggerAnimation(body);
},
triggerAnimation(body) {
// always reset to false before checking the change
this.descriptionChange = false;
const { title, description } = body;
 
this.descriptionText = body.description_text;
Loading
Loading
@@ -57,7 +61,12 @@ export default {
 
if (!noTitleChange) {
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'));
}
 
Loading
Loading
@@ -100,15 +109,19 @@ export default {
});
},
updated() {
const tl = new gl.TaskList({
dataType: 'issue',
fieldName: 'description',
selector: '.detail-page-description',
});
// if new html is injected (description changed) - bind TaskList and call renderGFM
if (this.descriptionChange) {
const tl = new gl.TaskList({
dataType: 'issue',
fieldName: 'description',
selector: '.detail-page-description',
});
 
$(this.$refs['issue-content-container-gfm-entry']).renderGFM();
$(this.$refs['issue-content-container-gfm-entry']).renderGFM();
 
return tl;
return tl;
}
return null;
},
};
</script>
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment