feat: improved file drag-n-drop experience (#1848)

This commit is contained in:
Aman Harwara
2022-10-20 02:18:52 +05:30
committed by GitHub
parent 0282a7958a
commit e99c7b7c51
20 changed files with 534 additions and 1022 deletions

View File

@@ -282,25 +282,22 @@ export class LinkingController extends AbstractViewController {
}
}
linkItemToSelectedItem = async (itemToLink: LinkableItem) => {
await this.ensureActiveItemIsInserted()
const activeItem = this.activeItem
if (activeItem && itemToLink instanceof SNTag) {
await this.addTagToItem(itemToLink, activeItem)
}
if (activeItem instanceof SNNote) {
linkItems = async (item: LinkableItem, itemToLink: LinkableItem) => {
if (item instanceof SNNote) {
if (itemToLink instanceof FileItem) {
await this.application.items.associateFileWithNote(itemToLink, activeItem)
await this.application.items.associateFileWithNote(itemToLink, item)
} else if (itemToLink instanceof SNNote && this.isEntitledToNoteLinking) {
await this.application.items.linkNoteToNote(activeItem, itemToLink)
await this.application.items.linkNoteToNote(item, itemToLink)
} else if (itemToLink instanceof SNTag) {
await this.addTagToItem(itemToLink, item)
}
} else if (activeItem instanceof FileItem) {
} else if (item instanceof FileItem) {
if (itemToLink instanceof SNNote) {
await this.application.items.associateFileWithNote(activeItem, itemToLink)
await this.application.items.associateFileWithNote(item, itemToLink)
} else if (itemToLink instanceof FileItem) {
await this.application.items.linkFileToFile(activeItem, itemToLink)
await this.application.items.linkFileToFile(item, itemToLink)
} else if (itemToLink instanceof SNTag) {
await this.addTagToItem(itemToLink, item)
}
}
@@ -308,6 +305,17 @@ export class LinkingController extends AbstractViewController {
this.reloadAllLinks()
}
linkItemToSelectedItem = async (itemToLink: LinkableItem) => {
await this.ensureActiveItemIsInserted()
const activeItem = this.activeItem
if (!activeItem) {
return
}
await this.linkItems(activeItem, itemToLink)
}
createAndAddNewTag = async (title: string) => {
await this.ensureActiveItemIsInserted()
const activeItem = this.activeItem