mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Compare commits
9 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
494d159107 | ||
|
|
0532186cb2 | ||
|
|
f6a28dab67 | ||
|
|
85cd981d8d | ||
|
|
f172b8508f | ||
|
|
4a71e3d795 | ||
|
|
101758a52b | ||
|
|
a493120095 | ||
|
|
8248de14d9 |
4 changed files with 24 additions and 16 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "folder-notes",
|
||||
"name": "Folder notes",
|
||||
"version": "1.8.23",
|
||||
"version": "1.8.26",
|
||||
"minAppVersion": "1.4.10",
|
||||
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
|
||||
"author": "Lost Paul",
|
||||
|
|
|
|||
|
|
@ -202,8 +202,12 @@ async function updateFolderNamesInPath(
|
|||
viewHeaderTitle.classList.remove('path-is-folder-note');
|
||||
}
|
||||
}
|
||||
if (!folderNote) return;
|
||||
if (folderNote) breadcrumb.classList.add('has-folder-note');
|
||||
if (!folderNote) {
|
||||
breadcrumb.classList.remove('has-folder-note');
|
||||
breadcrumb.removeAttribute('data-path');
|
||||
continue;
|
||||
}
|
||||
breadcrumb.classList.add('has-folder-note');
|
||||
breadcrumb?.setAttribute('data-path', path.slice(0, -TRAILING_SLASH_LENGTH));
|
||||
if (!breadcrumb.onclick) {
|
||||
breadcrumb.addEventListener('click', (e) => {
|
||||
|
|
|
|||
28
src/main.ts
28
src/main.ts
|
|
@ -221,9 +221,13 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
registerFileExplorerObserver(this);
|
||||
|
||||
const fileExplorer = getFileExplorer(this);
|
||||
if (fileExplorer) {
|
||||
// @ts-expect-error use internal API
|
||||
fileExplorer.view.tree.infinityScroll.rootMargin = 1.5;
|
||||
// @ts-expect-error use internal API
|
||||
const infinityScroll = fileExplorer?.view?.tree?.infinityScroll;
|
||||
|
||||
if (infinityScroll) {
|
||||
// increase infinity scroll buffer to show hidden folder notes
|
||||
// Issue: https://github.com/LostPaul/obsidian-folder-notes/issues/274
|
||||
infinityScroll.rootMargin = 1.5;
|
||||
}
|
||||
|
||||
this.registerView(FOLDER_OVERVIEW_VIEW, (leaf: WorkspaceLeaf) => {
|
||||
|
|
@ -302,13 +306,13 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
clipboardProto.handleDragOver as unknown as ClipboardManagerLike['handleDragOver'];
|
||||
const originalHandleDrop =
|
||||
clipboardProto.handleDrop as unknown as ClipboardManagerLike['handleDrop'];
|
||||
|
||||
clipboardProto.handleDragOver = (evt: DragEvent, ...args: unknown[]): void => {
|
||||
const { dragManager } = clipboardManager.app;
|
||||
const folderNotePlugin = this;
|
||||
clipboardProto.handleDragOver = function (evt: DragEvent, ...args: unknown[]): void {
|
||||
const { dragManager } = (this as ClipboardManagerLike).app;
|
||||
const draggable = dragManager?.draggable;
|
||||
|
||||
if (draggable?.file instanceof TFolder) {
|
||||
const folderNote = getFolderNote(this, draggable.file.path);
|
||||
const folderNote = getFolderNote(folderNotePlugin, draggable.file.path);
|
||||
if (folderNote) {
|
||||
dragManager.setAction(
|
||||
window.i18next.t('interface.drag-and-drop.insert-link-here'),
|
||||
|
|
@ -317,22 +321,22 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
originalHandleDragOver(evt, ...args);
|
||||
return originalHandleDragOver.call(this, evt, ...args);
|
||||
};
|
||||
|
||||
clipboardProto.handleDrop = (evt: DragEvent, ...args: unknown[]): void => {
|
||||
const { dragManager } = clipboardManager.app;
|
||||
clipboardProto.handleDrop = function (evt: DragEvent, ...args: unknown[]): void {
|
||||
const { dragManager } = (this as ClipboardManagerLike).app;
|
||||
const draggable = dragManager?.draggable;
|
||||
|
||||
if (draggable?.file instanceof TFolder) {
|
||||
const folderNote = getFolderNote(this, draggable.file.path);
|
||||
const folderNote = getFolderNote(folderNotePlugin, draggable.file.path);
|
||||
if (folderNote) {
|
||||
draggable.file = folderNote;
|
||||
draggable.type = 'file';
|
||||
}
|
||||
}
|
||||
|
||||
originalHandleDrop(evt, ...args);
|
||||
return originalHandleDrop.call(this, evt, ...args);
|
||||
};
|
||||
|
||||
if (this.settings.fvGlobalSettings.autoUpdateLinks) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2bc9795b1feede51554dafacfe56123af5e2f2a6
|
||||
Subproject commit f047859cc9a7f1c04ad35ecdc440a31a300bc6c2
|
||||
Loading…
Reference in a new issue