1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00

All: Added support for hierarchical/nested tags ()

The implementation uses / symbol as a nesting separator. I.e. tag/subtag is a nested tag, where tag is the parent tag and subtag is its child. Creating a tag named tag/subtag/subsubtag creates three tags, one for each level. The tags are associated using parent_id field.

In the app, viewing notes with a tag will also show all notes that are associated with any of the tag's descendant tags (same for the note count). Deleting a tag will also delete all its descendant tags.

In the desktop app the tags are shown nested just like the notebooks.
This commit is contained in:
Vaidotas Šimkus
2020-07-12 18:09:07 +01:00
committed by GitHub
parent 073bd80f89
commit e11e57f1d8
31 changed files with 991 additions and 191 deletions

@ -1,6 +1,7 @@
const BaseItem = require('lib/models/BaseItem.js');
const Folder = require('lib/models/Folder.js');
const Note = require('lib/models/Note.js');
const Tag = require('lib/models/Tag.js');
const Resource = require('lib/models/Resource.js');
const ItemChange = require('lib/models/ItemChange.js');
const Setting = require('lib/models/Setting.js');
@ -776,7 +777,15 @@ class Synchronizer {
}
const ItemClass = BaseItem.itemClass(local.type_);
await ItemClass.delete(local.id, { trackDeleted: false, changeSource: ItemChange.SOURCE_SYNC });
if (ItemClass === Tag) {
await Tag.delete(local.id, {
trackDeleted: false,
changeSource: ItemChange.SOURCE_SYNC,
deleteChildren: false,
deleteNotelessParents: false });
} else {
await ItemClass.delete(local.id, { trackDeleted: false, changeSource: ItemChange.SOURCE_SYNC });
}
}
}