mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 08:08:34 +08:00
feat: add notion link display
This commit is contained in:
27
CHANGELOG.md
27
CHANGELOG.md
@@ -1,25 +1,12 @@
|
||||
## Fix
|
||||
- fixed the issue that you cannot have empty values in the front matter of the customised database.
|
||||
- 修复了自定义数据库的前置数据中不能有空值的问题。
|
||||
For example, you have the property `tag` in your customised database, and you do not want to sync `tag` to Notion. You can remove the `tag` from the front matter.
|
||||
- 例如,自定义数据库中有属性`tag`,但是你不想将`tag`同步到Notion。现在,你可以直接在frontmatter中删除`tag`。
|
||||
## Feature
|
||||
|
||||
- add a notion link display button to control whether to display the synced notion link in the front matter of the markdown file.
|
||||
- 增加 notion 链接显示按钮,控制是否在 markdown 文件的 front matter 中显示已经生成的 notion 文章链接。
|
||||
|
||||
## Improvement
|
||||
**⚠️⚠️⚠️: The exist customised database should be recreated if you want to update to version 2.3.0. The new version has a new database structure, and the old database structure is not compatible with the new version to build the index properly.**
|
||||
Setting tabs:
|
||||
|
||||
### 自定义数据库用户
|
||||
**⚠️⚠️⚠️: 如果你想要更新到2.3.0版本,你需要重新创建自定义数据库。新版本有一个新的数据库结构,旧的数据库结构无法构建索引。**
|
||||

|
||||
|
||||
- redesigned the way to create new customised database. The modal has been removed with a more straightforward layout.
|
||||
- 重新设计了自定义数据库的创建方式。已删除模态框,采用更直观的布局。
|
||||

|
||||
Front matter after sync:
|
||||
|
||||
|
||||
- improved the edit modal for customised database. The layout has been simplified and the form has been reorganized.
|
||||
- 改进了自定义数据库的编辑模态框。简化了布局,重新组织了表单。
|
||||

|
||||
|
||||
- improved the preview modal for customised database.
|
||||
- 改进了自定义数据库的预览模态框。
|
||||

|
||||

|
||||
|
||||
@@ -12,6 +12,7 @@ export interface PluginSettings {
|
||||
databaseIDNext: string;
|
||||
bannerUrl: string;
|
||||
notionUser: string;
|
||||
NotionLinkDisplay: boolean;
|
||||
proxy: string;
|
||||
GeneralButton: boolean;
|
||||
tagButton: boolean;
|
||||
@@ -47,6 +48,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
|
||||
databaseIDNext: "",
|
||||
bannerUrl: "",
|
||||
notionUser: "",
|
||||
NotionLinkDisplay: true,
|
||||
proxy: "",
|
||||
GeneralButton: true,
|
||||
tagButton: true,
|
||||
@@ -83,6 +85,9 @@ export class ObsidianSettingTab extends PluginSettingTab {
|
||||
|
||||
this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser')
|
||||
|
||||
this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay')
|
||||
|
||||
|
||||
// add new button
|
||||
new Setting(containerEl)
|
||||
.setName("Add New Database")
|
||||
|
||||
@@ -12,7 +12,7 @@ export async function updateYamlInfo(
|
||||
) {
|
||||
let { url, id } = res.json
|
||||
// replace www to notionID
|
||||
const { notionUser } = plugin.settings;
|
||||
const { notionUser, NotionLinkDisplay } = plugin.settings;
|
||||
const { abName } = dbDetails
|
||||
const notionIDKey = `NotionID-${abName}`;
|
||||
const linkKey = `link-${abName}`;
|
||||
@@ -31,7 +31,7 @@ export async function updateYamlInfo(
|
||||
}
|
||||
// add new notionID and link
|
||||
yamlContent[notionIDKey] = id;
|
||||
yamlContent[linkKey] = url;
|
||||
(NotionLinkDisplay) ? yamlContent[linkKey] = url : null;
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -39,17 +39,4 @@ export async function updateYamlInfo(
|
||||
} catch (error) {
|
||||
new Notice(`复制链接失败,请手动复制${error}`)
|
||||
}
|
||||
// const __content = yamlContent.__content;
|
||||
// delete yamlContent.__content
|
||||
// const yamlhead = yaml.stringify(yamlContent)
|
||||
// // if yamlhead hava last \n remove it
|
||||
// const yamlhead_remove_n = yamlhead.replace(/\n$/, '')
|
||||
// // if __content have start \n remove it
|
||||
// const __content_remove_n = __content.replace(/^\n/, '')
|
||||
// const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_n;
|
||||
// try {
|
||||
// await nowFile.vault.modify(nowFile, content)
|
||||
// } catch (error) {
|
||||
// new Notice(`write file error ${error}`)
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user