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;
|
||||
notionUser: string;
|
||||
NotionLinkDisplay: boolean;
|
||||
autoCopyNotionLink: boolean;
|
||||
autoSync: boolean;
|
||||
autoSyncDelay: number;
|
||||
autoSyncFrontmatterKey: string;
|
||||
@@ -53,6 +54,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
|
||||
bannerUrl: "",
|
||||
notionUser: "",
|
||||
NotionLinkDisplay: true,
|
||||
autoCopyNotionLink: true,
|
||||
autoSync: false,
|
||||
autoSyncDelay: 5,
|
||||
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.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')
|
||||
|
||||
new Setting(containerEl)
|
||||
|
||||
@@ -43,10 +43,13 @@ export async function updateYamlInfo(
|
||||
);
|
||||
});
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(url)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
new Notice(`${i18nConfig.CopyErrorMessage}`);
|
||||
// copy url to clipboard only if autoCopyNotionLink is enabled
|
||||
if (plugin.settings.autoCopyNotionLink) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
new Notice(`${i18nConfig.CopyErrorMessage}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user