Remove leading slash from data-path attributes

This commit is contained in:
Olivia Godone-Maresca 2023-02-16 23:29:32 -05:00
parent df93fee034
commit 09c1dfd92b

View File

@ -494,10 +494,6 @@ class ModelDropdown
// Return its width and height // Return its width and height
return { width, height } return { width, height }
} }
getFolder(model) {
return model.substring(0, model.lastIndexOf('/') + 1)
}
/** /**
* @param {Array<string>} models * @param {Array<string>} models
@ -607,7 +603,8 @@ class ModelDropdown
if (isRootFolder) { if (isRootFolder) {
classes.push('in-root-folder') classes.push('in-root-folder')
} }
const fullPath = `${folderName || ''}/${model}` // Remove the leading slash from the model path
const fullPath = folderName ? `${folderName.substring(1)}/${model}` : model
modelsMap.set( modelsMap.set(
model, model,
this.createElement('li', { 'data-path': fullPath }, classes, model), this.createElement('li', { 'data-path': fullPath }, classes, model),