Skip to content

Commit

Permalink
#304 Fix DrawTool file list bug (#305)
Browse files Browse the repository at this point in the history
* #304 DrawTool - fix empty tags, make tags more unique

* #304 Add quotes to jquery attr selectors
  • Loading branch information
tariqksoliman authored Jan 12, 2023
1 parent 20c0cdd commit 33763f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 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
10 changes: 5 additions & 5 deletions src/essence/Tools/Draw/DrawTool_Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,11 @@ var Files = {
}
if (
$(
`.drawToolDrawFilesGroupElem[group_name=${g}] .drawToolDrawFilesGroupListElem > .drawToolDrawFilesListElem[file_id=${file.id}]`
`.drawToolDrawFilesGroupElem[group_name="${g}"] .drawToolDrawFilesGroupListElem > .drawToolDrawFilesListElem[file_id="${file.id}"]`
).length === 0
) {
d3.select(
`.drawToolDrawFilesGroupElem[group_name=${g}] .drawToolDrawFilesGroupListElem`
`.drawToolDrawFilesGroupElem[group_name="${g}"] .drawToolDrawFilesGroupListElem`
)
.append('li')
.attr(
Expand Down 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 33763f5

Please sign in to comment.