mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
fix drag & drop for chrome and code editor
This commit is contained in:
parent
a79aec85b5
commit
d1992b061c
@ -28,9 +28,11 @@ const dragAndDropSetup = {
|
|||||||
const dataTransfer = data.dataTransfer;
|
const dataTransfer = data.dataTransfer;
|
||||||
|
|
||||||
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
||||||
|
const files = [...dataTransfer.files]; // chrome has issue that dataTransfer.files empties after async operation
|
||||||
|
|
||||||
const importDialog = await import('../dialogs/import.js');
|
const importDialog = await import('../dialogs/import.js');
|
||||||
|
|
||||||
importDialog.uploadFiles(node.data.noteId, dataTransfer.files, {
|
importDialog.uploadFiles(node.data.noteId, files, {
|
||||||
safeImport: true,
|
safeImport: true,
|
||||||
shrinkImages: true,
|
shrinkImages: true,
|
||||||
textImportedAsText: true,
|
textImportedAsText: true,
|
||||||
|
@ -389,8 +389,11 @@ $tabContentsContainer.on("drop", async e => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const files = [...e.originalEvent.dataTransfer.files]; // chrome has issue that dataTransfer.files empties after async operation
|
||||||
|
|
||||||
const importDialog = await import("../dialogs/import.js");
|
const importDialog = await import("../dialogs/import.js");
|
||||||
importDialog.uploadFiles(activeNote.noteId, e.originalEvent.dataTransfer.files, {
|
|
||||||
|
importDialog.uploadFiles(activeNote.noteId, files, {
|
||||||
safeImport: true,
|
safeImport: true,
|
||||||
shrinkImages: true,
|
shrinkImages: true,
|
||||||
textImportedAsText: true,
|
textImportedAsText: true,
|
||||||
@ -416,8 +419,6 @@ tabRow.addListener('activeTabChange', async ({ detail }) => {
|
|||||||
const tabId = detail.tabEl.getAttribute('data-tab-id');
|
const tabId = detail.tabEl.getAttribute('data-tab-id');
|
||||||
|
|
||||||
await showTab(tabId);
|
await showTab(tabId);
|
||||||
|
|
||||||
console.log(`Activated tab ${tabId}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tabRow.addListener('tabRemove', async ({ detail }) => {
|
tabRow.addListener('tabRemove', async ({ detail }) => {
|
||||||
|
@ -48,7 +48,8 @@ class NoteDetailCode {
|
|||||||
tabindex: 100,
|
tabindex: 100,
|
||||||
// we linewrap partly also because without it horizontal scrollbar displays only when you scroll
|
// we linewrap partly also because without it horizontal scrollbar displays only when you scroll
|
||||||
// all the way to the bottom of the note. With line wrap there's no horizontal scrollbar so no problem
|
// all the way to the bottom of the note. With line wrap there's no horizontal scrollbar so no problem
|
||||||
lineWrapping: true
|
lineWrapping: true,
|
||||||
|
dragDrop: false // with true the editor inlines dropped files which is not what we expect
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onNoteChange(() => this.ctx.noteChanged());
|
this.onNoteChange(() => this.ctx.noteChanged());
|
||||||
|
@ -101,8 +101,6 @@ class TabContext {
|
|||||||
|
|
||||||
this.$unprotectButton = this.$tabContent.find(".unprotect-button");
|
this.$unprotectButton = this.$tabContent.find(".unprotect-button");
|
||||||
this.$unprotectButton.click(protectedSessionService.unprotectNoteAndSendToServer);
|
this.$unprotectButton.click(protectedSessionService.unprotectNoteAndSendToServer);
|
||||||
|
|
||||||
console.debug(`Created note tab ${this.tabId}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setNote(note, notePath) {
|
async setNote(note, notePath) {
|
||||||
@ -139,8 +137,6 @@ class TabContext {
|
|||||||
if (this.sidebar) {
|
if (this.sidebar) {
|
||||||
this.sidebar.noteLoaded(); // load async
|
this.sidebar.noteLoaded(); // load async
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug(`Switched tab ${this.tabId} to ${this.noteId}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user