Skip to content

Commit

Permalink
Merge branch 'pr/1642' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Jun 27, 2024
2 parents 9e98396 + 0ec747f commit 58551c1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 21 additions & 1 deletion activities/Calligra.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions activities/Calligra.activity/js/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 58551c1

Please sign in to comment.