fix drag & drop for chrome and code editor

This commit is contained in:
zadam 2019-09-02 21:58:03 +02:00
parent a79aec85b5
commit d1992b061c
4 changed files with 9 additions and 9 deletions

View file

@ -28,9 +28,11 @@ const dragAndDropSetup = {
const dataTransfer = data.dataTransfer;
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');
importDialog.uploadFiles(node.data.noteId, dataTransfer.files, {
importDialog.uploadFiles(node.data.noteId, files, {
safeImport: true,
shrinkImages: true,
textImportedAsText: true,

View file

@ -389,8 +389,11 @@ $tabContentsContainer.on("drop", async e => {
return;
}
const files = [...e.originalEvent.dataTransfer.files]; // chrome has issue that dataTransfer.files empties after async operation
const importDialog = await import("../dialogs/import.js");
importDialog.uploadFiles(activeNote.noteId, e.originalEvent.dataTransfer.files, {
importDialog.uploadFiles(activeNote.noteId, files, {
safeImport: true,
shrinkImages: true,
textImportedAsText: true,
@ -416,8 +419,6 @@ tabRow.addListener('activeTabChange', async ({ detail }) => {
const tabId = detail.tabEl.getAttribute('data-tab-id');
await showTab(tabId);
console.log(`Activated tab ${tabId}`);
});
tabRow.addListener('tabRemove', async ({ detail }) => {

View file

@ -48,7 +48,8 @@ class NoteDetailCode {
tabindex: 100,
// 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
lineWrapping: true
lineWrapping: true,
dragDrop: false // with true the editor inlines dropped files which is not what we expect
});
this.onNoteChange(() => this.ctx.noteChanged());

View file

@ -101,8 +101,6 @@ class TabContext {
this.$unprotectButton = this.$tabContent.find(".unprotect-button");
this.$unprotectButton.click(protectedSessionService.unprotectNoteAndSendToServer);
console.debug(`Created note tab ${this.tabId}`);
}
async setNote(note, notePath) {
@ -139,8 +137,6 @@ class TabContext {
if (this.sidebar) {
this.sidebar.noteLoaded(); // load async
}
console.debug(`Switched tab ${this.tabId} to ${this.noteId}`);
}
show() {