v1.1.5
This commit is contained in:
@@ -153,12 +153,14 @@ var AttachmentCleanPasteModule = class extends BaseModule {
|
|||||||
textarea.inputEl.style.width = "100%";
|
textarea.inputEl.style.width = "100%";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async processAll(files, editor, settings) {
|
async processAll(files, editor, settings, evt) {
|
||||||
const matchingFiles = Array.from(files).filter(
|
const matchingFiles = Array.from(files).filter(
|
||||||
(f) => this.shouldProcess(f.name, settings)
|
(f) => this.shouldProcess(f.name, settings)
|
||||||
);
|
);
|
||||||
if (matchingFiles.length === 0)
|
if (matchingFiles.length === 0)
|
||||||
return;
|
return;
|
||||||
|
evt.preventDefault();
|
||||||
|
evt.stopPropagation();
|
||||||
const links = [];
|
const links = [];
|
||||||
for (const file of matchingFiles) {
|
for (const file of matchingFiles) {
|
||||||
const link = await this.processFile(file, settings);
|
const link = await this.processFile(file, settings);
|
||||||
@@ -175,9 +177,7 @@ var AttachmentCleanPasteModule = class extends BaseModule {
|
|||||||
const files = (_a = evt.clipboardData) == null ? void 0 : _a.files;
|
const files = (_a = evt.clipboardData) == null ? void 0 : _a.files;
|
||||||
if (!files || files.length === 0)
|
if (!files || files.length === 0)
|
||||||
return;
|
return;
|
||||||
evt.preventDefault();
|
await this.processAll(files, editor, settings, evt);
|
||||||
evt.stopPropagation();
|
|
||||||
await this.processAll(files, editor, settings);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
createDropHandler(settings) {
|
createDropHandler(settings) {
|
||||||
@@ -186,9 +186,7 @@ var AttachmentCleanPasteModule = class extends BaseModule {
|
|||||||
const files = (_a = evt.dataTransfer) == null ? void 0 : _a.files;
|
const files = (_a = evt.dataTransfer) == null ? void 0 : _a.files;
|
||||||
if (!files || files.length === 0)
|
if (!files || files.length === 0)
|
||||||
return;
|
return;
|
||||||
evt.preventDefault();
|
await this.processAll(files, editor, settings, evt);
|
||||||
evt.stopPropagation();
|
|
||||||
await this.processAll(files, editor, settings);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
shouldProcess(filename, settings) {
|
shouldProcess(filename, settings) {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "zeroq-qol-modules",
|
"id": "zeroq-qol-modules",
|
||||||
"name": "ZeroQ QoL Modules",
|
"name": "ZeroQ QoL Modules",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "QoL Modules",
|
"description": "QoL Modules",
|
||||||
"author": "oqyude",
|
"author": "oqyude",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "zeroq-qol-modules",
|
"name": "zeroq-qol-modules",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"description": "Modular Obsidian plugin with toggleable QoL modules",
|
"description": "Modular Obsidian plugin with toggleable QoL modules",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -75,12 +75,16 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
|||||||
files: FileList,
|
files: FileList,
|
||||||
editor: Editor,
|
editor: Editor,
|
||||||
settings: AttachmentCleanPasteSettings,
|
settings: AttachmentCleanPasteSettings,
|
||||||
|
evt: ClipboardEvent | DragEvent,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const matchingFiles = Array.from(files).filter((f) =>
|
const matchingFiles = Array.from(files).filter((f) =>
|
||||||
this.shouldProcess(f.name, settings),
|
this.shouldProcess(f.name, settings),
|
||||||
);
|
);
|
||||||
if (matchingFiles.length === 0) return;
|
if (matchingFiles.length === 0) return;
|
||||||
|
|
||||||
|
evt.preventDefault();
|
||||||
|
evt.stopPropagation();
|
||||||
|
|
||||||
const links: string[] = [];
|
const links: string[] = [];
|
||||||
for (const file of matchingFiles) {
|
for (const file of matchingFiles) {
|
||||||
const link = await this.processFile(file, settings);
|
const link = await this.processFile(file, settings);
|
||||||
@@ -100,10 +104,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
|||||||
const files = evt.clipboardData?.files;
|
const files = evt.clipboardData?.files;
|
||||||
if (!files || files.length === 0) return;
|
if (!files || files.length === 0) return;
|
||||||
|
|
||||||
evt.preventDefault();
|
await this.processAll(files, editor, settings, evt);
|
||||||
evt.stopPropagation();
|
|
||||||
|
|
||||||
await this.processAll(files, editor, settings);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,10 +117,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
|||||||
const files = evt.dataTransfer?.files;
|
const files = evt.dataTransfer?.files;
|
||||||
if (!files || files.length === 0) return;
|
if (!files || files.length === 0) return;
|
||||||
|
|
||||||
evt.preventDefault();
|
await this.processAll(files, editor, settings, evt);
|
||||||
evt.stopPropagation();
|
|
||||||
|
|
||||||
await this.processAll(files, editor, settings);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user