Skip to content

Commit

Permalink
#304 DrawTool - fix empty tags, make tags more unique
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Jan 12, 2023
1 parent 20c0cdd commit 488bb47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/essence/Tools/Draw/DrawTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,20 +997,20 @@ var DrawTool = {
}
if (typeof file_description !== 'string') return []

const tags = file_description.match(/#\w*/g) || []
const tags = file_description.match(/~#\w+/g) || []
const uniqueTags = [...tags]
// remove '#'s
tagFolders.tags = uniqueTags.map((t) => t.substring(1)) || []
tagFolders.tags = uniqueTags.map((t) => t.substring(2)) || []

const folders = file_description.match(/@\w*/g) || []
const folders = file_description.match(/~@\w+/g) || []
const uniqueFolders = [...folders]
// remove '@'s
tagFolders.folders = uniqueFolders.map((t) => t.substring(1)) || []
tagFolders.folders = uniqueFolders.map((t) => t.substring(2)) || []

const efolders = file_description.match(/\^\w*/g) || []
const efolders = file_description.match(/~\^\w+/g) || []
const uniqueEFolders = [...efolders]
// remove '^'s
tagFolders.efolders = uniqueEFolders.map((t) => t.substring(1)) || []
tagFolders.efolders = uniqueEFolders.map((t) => t.substring(2)) || []

// At least one folder
if (noDefaults !== true) {
Expand Down Expand Up @@ -1053,9 +1053,9 @@ var DrawTool = {
stripTagsFromDescription(file_description) {
if (typeof file_description !== 'string') return ''
return file_description
.replaceAll(/#\w*/g, '')
.replaceAll(/@\w*/g, '')
.replaceAll(/\^\w*/g, '')
.replaceAll(/~#\w+/g, '')
.replaceAll(/~@\w+/g, '')
.replaceAll(/~\^\w+/g, '')
.trimStart()
.trimEnd()
},
Expand Down
6 changes: 3 additions & 3 deletions src/essence/Tools/Draw/DrawTool_Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,13 +1204,13 @@ var Files = {
file_description:
description +
existingTagFol['efolders']
.map((t) => ' ^' + t)
.map((t) => ' ~^' + t)
.join('') +
existingTagFol['folders']
.map((t) => ' @' + t)
.map((t) => ' ~@' + t)
.join('') +
existingTagFol['tags']
.map((t) => ' #' + t)
.map((t) => ' ~#' + t)
.join(''),
public:
elm
Expand Down

0 comments on commit 488bb47

Please sign in to comment.