mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-30 00:48:36 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
388693d5b4 | ||
|
|
dda6710fe9 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "share-to-notionnext",
|
||||
"name": "Share to NotionNext",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"minAppVersion": "0.0.1",
|
||||
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
|
||||
"author": "EasyChris, jxpeng98",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "share-to-notionnext",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
|
||||
"main": "main.js",
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
import {App, PluginSettingTab, Setting} from "obsidian";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {i18nConfig} from "../lang/I18n";
|
||||
import {ObsidianSettingTab} from "./settingTabs";
|
||||
|
||||
export class SettingGeneralTabs extends PluginSettingTab {
|
||||
plugin: ObsidianSyncNotionPlugin;
|
||||
private settingTab: ObsidianSettingTab;
|
||||
|
||||
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
this.settingTab = settingTab;
|
||||
}
|
||||
|
||||
display(): void {
|
||||
|
||||
// General Database Settings
|
||||
this.settingTab.containerEl.createEl('h2', { text: i18nConfig.NotionGeneralSettingHeader });
|
||||
|
||||
// new Setting(containerEl)
|
||||
// .setName(i18nConfig.NotYetFinish)
|
||||
new Setting(this.settingTab.containerEl)
|
||||
.setName(i18nConfig.NotionGeneralButton)
|
||||
.setDesc(i18nConfig.NotionGeneralButtonDesc)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.GeneralButton)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.GeneralButton = value;
|
||||
|
||||
this.settingTab.updateSettingEl(tagButtonEl, value)
|
||||
this.settingTab.updateSettingEl(CustomTitleEl, value)
|
||||
// name should follow the result of the title button
|
||||
if (value) {
|
||||
this.settingTab.updateSettingEl(CustomNameEl, this.plugin.settings.CustomTitleButton)
|
||||
this.settingTab.updateSettingEl(CustomValuesEl, this.plugin.settings.CustomTitleButton)
|
||||
} else {
|
||||
this.settingTab.updateSettingEl(CustomNameEl, value)
|
||||
this.settingTab.updateSettingEl(CustomValuesEl, value)
|
||||
}
|
||||
|
||||
this.settingTab.updateSettingEl(notionAPIGeneralEl, value)
|
||||
this.settingTab.updateSettingEl(databaseIDGeneralEl, value)
|
||||
|
||||
|
||||
await this.plugin.saveSettings();
|
||||
await this.plugin.commands.updateCommand();
|
||||
|
||||
})
|
||||
);
|
||||
|
||||
// add the tagButton to control whether to add tags to the general database
|
||||
const tagButtonEl = this.settingTab.createStyleDiv('tag-button', (this.plugin.settings.GeneralButton && this.plugin.settings.CustomTitleButton));
|
||||
this.settingTab.createSettingEl(tagButtonEl, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.plugin.settings.tagButton, 'tagButton')
|
||||
|
||||
// Custom Title Button
|
||||
const CustomTitleEl = this.settingTab.createStyleDiv('custom-title', this.plugin.settings.GeneralButton);
|
||||
new Setting(CustomTitleEl)
|
||||
.setName(i18nConfig.NotionCustomTitle)
|
||||
.setDesc(i18nConfig.NotionCustomTitleDesc)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.CustomTitleButton)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.CustomTitleButton = value;
|
||||
|
||||
this.settingTab.updateSettingEl(CustomNameEl, value)
|
||||
|
||||
this.settingTab.updateSettingEl(CustomValuesEl, value)
|
||||
|
||||
await this.plugin.saveSettings();
|
||||
await this.plugin.commands.updateCommand();
|
||||
})
|
||||
);
|
||||
|
||||
// Custom Title Name
|
||||
const CustomNameEl = this.settingTab.createStyleDiv('custom-name', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
|
||||
this.settingTab.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName, 'CustomTitleName')
|
||||
|
||||
// Custom database properties
|
||||
const CustomValuesEl = this.settingTab.createStyleDiv('custom-values', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
|
||||
new Setting(CustomValuesEl)
|
||||
.setName(i18nConfig.NotionCustomValues)
|
||||
.setDesc(i18nConfig.NotionCustomValuesDesc)
|
||||
.addTextArea((text) =>
|
||||
text
|
||||
.setPlaceholder(i18nConfig.NotionCustomValuesText)
|
||||
.setValue(this.plugin.settings.CustomValues)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.CustomValues = value;
|
||||
await this.plugin.saveSettings();
|
||||
await this.plugin.commands.updateCommand();
|
||||
})
|
||||
);
|
||||
// new Setting(containerEl)
|
||||
// .setName("Convert tags(optional)")
|
||||
// .setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'")
|
||||
// .addToggle((toggle) =>
|
||||
// toggle
|
||||
// .setValue(this.plugin.settings.allowTags)
|
||||
// .onChange(async (value) => {
|
||||
// this.plugin.settings.allowTags = value;
|
||||
// await this.plugin.saveSettings();
|
||||
// })
|
||||
// );
|
||||
|
||||
const notionAPIGeneralEl = this.settingTab.createStyleDiv('api-general', this.plugin.settings.GeneralButton);
|
||||
this.settingTab.createSettingEl(notionAPIGeneralEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPIGeneral, 'notionAPIGeneral')
|
||||
|
||||
|
||||
const databaseIDGeneralEl = this.settingTab.createStyleDiv('databaseID-general', this.plugin.settings.GeneralButton);
|
||||
this.settingTab.createSettingEl(databaseIDGeneralEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDGeneral, 'databaseIDGeneral')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,6 @@ import {
|
||||
import { i18nConfig } from "../lang/I18n";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {DatabaseDetails, ObsidianSettingTab} from "./settingTabs";
|
||||
import {SettingNextTabs} from "./settingNextTabs";
|
||||
import {SettingGeneralTabs} from "./settingGeneralTabs";
|
||||
|
||||
|
||||
export class SettingModal extends Modal {
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import {App, PluginSettingTab, Setting} from "obsidian";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {i18nConfig} from "../lang/I18n";
|
||||
import {ObsidianSettingTab} from "./settingTabs";
|
||||
import {SettingModal} from "./settingModal";
|
||||
|
||||
export class SettingNextTabs extends PluginSettingTab {
|
||||
plugin: ObsidianSyncNotionPlugin;
|
||||
settingModal: SettingModal;
|
||||
|
||||
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
display(): void {
|
||||
|
||||
// notion next database settings
|
||||
this.containerEl.createEl('h2', { text: i18nConfig.NotionNextSettingHeader });
|
||||
|
||||
const NextButtonEl = this.containerEl.createDiv();
|
||||
|
||||
new Setting(NextButtonEl)
|
||||
.setName(i18nConfig.NotionNextButton)
|
||||
.setDesc(i18nConfig.NotionNextButtonDesc)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.NextButton)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.NextButton = value;
|
||||
|
||||
this.settingModal.updateSettingEl(notionAPINextEl, value)
|
||||
|
||||
this.settingModal.updateSettingEl(databaseIDNextEl, value)
|
||||
|
||||
await this.plugin.saveSettings();
|
||||
await this.plugin.commands.updateCommand();
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
const notionAPINextEl = this.settingModal.createStyleDiv('api-next', this.plugin.settings.NextButton,NextButtonEl)
|
||||
this.settingModal.createSettingEl(notionAPINextEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPINext,'notionAPINext')
|
||||
|
||||
const databaseIDNextEl = this.settingModal.createStyleDiv('databaseID-next', this.plugin.settings.NextButton,NextButtonEl)
|
||||
this.settingModal.createSettingEl(databaseIDNextEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDNext,'databaseIDNext')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,6 @@ import {App, ButtonComponent, Modal, PluginSettingTab, Setting} from "obsidian";
|
||||
import {i18nConfig} from "../lang/I18n";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {SettingModal} from "./settingModal";
|
||||
import {SettingNextTabs} from "./settingNextTabs";
|
||||
import {SettingGeneralTabs} from "./settingGeneralTabs";
|
||||
import {set} from "yaml/dist/schema/yaml-1.1/set";
|
||||
import {PreviewModal} from "./PreviewModal";
|
||||
import {EditModal} from "./EditModal";
|
||||
|
||||
Reference in New Issue
Block a user