1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

All: Added support for hierarchical/nested tags (#2572)

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

View File

@@ -264,6 +264,11 @@ function substrWithEllipsis(s, start, length) {
return `${s.substr(start, length - 3)}...`;
}
function substrStartWithEllipsis(s, start, length) {
if (s.length <= length) return s;
return `...${s.substr(start + 3, length)}`;
}
function nextWhitespaceIndex(s, begin) {
// returns index of the next whitespace character
const i = s.slice(begin).search(/\s/);
@@ -285,4 +290,4 @@ function scriptType(s) {
return 'en';
}
module.exports = Object.assign({ removeDiacritics, substrWithEllipsis, nextWhitespaceIndex, escapeFilename, wrap, splitCommandString, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType, commandArgumentsToString }, stringUtilsCommon);
module.exports = Object.assign({ removeDiacritics, substrWithEllipsis, substrStartWithEllipsis, nextWhitespaceIndex, escapeFilename, wrap, splitCommandString, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType, commandArgumentsToString }, stringUtilsCommon);