diff --git a/CHANGELOG.md b/CHANGELOG.md index a98e614c4..412183989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Journal instance pop up remain after launching a PDF or an external app #1619 - Welcome message not displayed in Write activity #1617 - PDF generated by Story doesn't contain image on iOS/Android #969 +- Bug in Calligra Activity when letters deleted #1466 ## [1.8.0] - 2024-04-10 ### Added diff --git a/activities/Calligra.activity/js/activity.js b/activities/Calligra.activity/js/activity.js index 83d394ce7..3dd1c58ce 100644 --- a/activities/Calligra.activity/js/activity.js +++ b/activities/Calligra.activity/js/activity.js @@ -167,15 +167,35 @@ var app = new Vue({ if (vm.currentView === TemplateViewer) { // Remove item if (editMode) { + const images = vm.currentTemplate.images.map(item=>{ + return { + ...item, + visible: item.visible !== undefined ? item.visible : true, + delete: item.delete !== undefined ? item.delete : false + } + }); + + if(vm.currentTemplate.name === 'template-word'){ var index = -1; for (var i = 0 ; i < vm.currentTemplate.images.length ; i++) { if (vm.currentTemplate.images[i] == item) { index = i; - break; + break; } } vm.currentTemplate.images.splice(index, 1); return; + } + var index = -1; + for (var i = 0 ; i < vm.currentTemplate.images.length ; i++) { + if (images[i].image == item.image) { + index = i; + break; + } + } + images[index].delete = true; + vm.currentTemplate.images = images; + return; } // Display item diff --git a/activities/Calligra.activity/js/template.js b/activities/Calligra.activity/js/template.js index 322755958..b24337838 100644 --- a/activities/Calligra.activity/js/template.js +++ b/activities/Calligra.activity/js/template.js @@ -67,9 +67,20 @@ var TemplateViewer = { }, computed: { visibleImages: function() { - return this.template.images.filter(function(item) { - return item.visible!=false; - }); + if(this.template.name !== 'template-word'){ + return this.template.images.map(item => { + return { + ...item, + visible: item.visible !== undefined ? item.visible : true, + delete: item.delete !== undefined ? item.delete : false + }; + }).filter(item => item.visible && !item.delete); + } + else{ + return this.template.images.filter(function(item) { + return item.visible!=false; + }); + } } }, methods: {