Open Ruslan-Aleev opened 10 months ago
This can be solved this way:
In \manager\assets\modext\widgets\system\modx.tree.directory.js
change the copyRelativePath
function to:
,copyRelativePath: function(item,e) {
var node = this.cm.activeNode;
var path = (node.attributes.type == 'file') ? node.attributes.urlAbsolute : ('/' + node.attributes.pathRelative + '/');
var dummyRelativePathInput = document.createElement("input");
document.body.appendChild(dummyRelativePathInput);
dummyRelativePathInput.setAttribute('value', path);
dummyRelativePathInput.select();
document.execCommand("copy");
document.body.removeChild(dummyRelativePathInput);
}
p.s. The same function is present in the file \manager\assets\modext\widgets\media\modx.browser.js
, but I'm not sure if this function is used somewhere in the code.
Feature request
Summary
If you copy the path through "Copy Directory Path / Copy File Path" in the tree of your file source, then the copied path will be relative to the "basePath" setting of the source.
But the file browser will show the full path, which is confusing.
It's probably worth copying the path with "basePath", which will be more convenient and consistent.
In my example, the copied file path would be
catalog/grid.jpg
and the source's "basePath" setting would beassets/images/path/
accordingly.It’s also worth adding copying the path in the file browser by clicking on the file path with the icon.
Related issue(s)/PR(s)
N\A