fix: drop files on markdown row into same folder
This commit is contained in:
@@ -5073,6 +5073,16 @@ const SIDEBAR_TREE_JS: &str = r##"
|
||||
return '';
|
||||
}
|
||||
|
||||
function fileTreeRowLocalUploadTargetRelativePath(row) {
|
||||
if (!(row instanceof HTMLElement)) return '';
|
||||
var kind = fileTreeRowKind(row);
|
||||
var relativePath = fileTreeRowLocalRelativePath(row);
|
||||
if (!relativePath) return '';
|
||||
if (kind === 'folder' || kind === 'directory') return relativePath;
|
||||
var lastSlash = relativePath.lastIndexOf('/');
|
||||
return lastSlash >= 0 ? relativePath.slice(0, lastSlash) : '';
|
||||
}
|
||||
|
||||
function fileTreeRowKind(row) {
|
||||
if (!(row instanceof HTMLElement)) return '';
|
||||
return String(row.getAttribute('data-row-kind') || '').trim();
|
||||
@@ -10111,9 +10121,7 @@ const SIDEBAR_TREE_JS: &str = r##"
|
||||
targetRowKind: targetRow ? targetRow.getAttribute('data-row-kind') : 'root',
|
||||
documentId: targetRow ? targetRow.getAttribute('data-document-id') || targetRow.getAttribute('data-doc-id') : null,
|
||||
assetId: targetRow ? targetRow.getAttribute('data-asset-id') : null,
|
||||
targetRelativePath: targetRow && (targetRow.getAttribute('data-row-kind') === 'folder' || targetRow.getAttribute('data-row-kind') === 'directory')
|
||||
? fileTreeRowLocalRelativePath(targetRow)
|
||||
: null,
|
||||
targetRelativePath: targetRow ? fileTreeRowLocalUploadTargetRelativePath(targetRow) : '',
|
||||
uploadIntent: 'filetree.folder.drop'
|
||||
};
|
||||
if (activeFileTreeDropRow instanceof HTMLElement) activeFileTreeDropRow.setAttribute('data-drop-target', 'false');
|
||||
|
||||
Reference in New Issue
Block a user