mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 08:08:34 +08:00
feat: auto copy after upload
This commit is contained in:
@@ -14,6 +14,7 @@ export interface PluginSettings {
|
|||||||
bannerUrl: string;
|
bannerUrl: string;
|
||||||
notionUser: string;
|
notionUser: string;
|
||||||
NotionLinkDisplay: boolean;
|
NotionLinkDisplay: boolean;
|
||||||
|
autoCopyNotionLink: boolean;
|
||||||
autoSync: boolean;
|
autoSync: boolean;
|
||||||
autoSyncDelay: number;
|
autoSyncDelay: number;
|
||||||
autoSyncFrontmatterKey: string;
|
autoSyncFrontmatterKey: string;
|
||||||
@@ -53,6 +54,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
|
|||||||
bannerUrl: "",
|
bannerUrl: "",
|
||||||
notionUser: "",
|
notionUser: "",
|
||||||
NotionLinkDisplay: true,
|
NotionLinkDisplay: true,
|
||||||
|
autoCopyNotionLink: true,
|
||||||
autoSync: false,
|
autoSync: false,
|
||||||
autoSyncDelay: 5,
|
autoSyncDelay: 5,
|
||||||
autoSyncFrontmatterKey: DEFAULT_AUTO_SYNC_DATABASE_KEY,
|
autoSyncFrontmatterKey: DEFAULT_AUTO_SYNC_DATABASE_KEY,
|
||||||
@@ -95,6 +97,8 @@ export class ObsidianSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay')
|
this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay')
|
||||||
|
|
||||||
|
this.createSettingEl(containerEl, i18nConfig.AutoCopyNotionLink, i18nConfig.AutoCopyNotionLinkDesc, 'toggle', i18nConfig.AutoCopyNotionLink, this.plugin.settings.autoCopyNotionLink, 'autoCopyNotionLink')
|
||||||
|
|
||||||
this.createSettingEl(containerEl, i18nConfig.AutoSync, i18nConfig.AutoSyncDesc, 'toggle', i18nConfig.AutoSync, this.plugin.settings.autoSync, 'autoSync')
|
this.createSettingEl(containerEl, i18nConfig.AutoSync, i18nConfig.AutoSyncDesc, 'toggle', i18nConfig.AutoSync, this.plugin.settings.autoSync, 'autoSync')
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
|
|||||||
@@ -43,10 +43,13 @@ export async function updateYamlInfo(
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// copy url to clipboard only if autoCopyNotionLink is enabled
|
||||||
|
if (plugin.settings.autoCopyNotionLink) {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(url)
|
await navigator.clipboard.writeText(url);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
new Notice(`${i18nConfig.CopyErrorMessage}`);
|
new Notice(`${i18nConfig.CopyErrorMessage}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user