refactor: Rename 'nestNoteFolder' to 'nestInFolder' for consistency in settings
This commit is contained in:
@@ -109,13 +109,13 @@ export default class odoxPlugin extends Plugin {
|
|||||||
const fileNameWithoutExt = file.name.replace('.md', '');
|
const fileNameWithoutExt = file.name.replace('.md', '');
|
||||||
const filePathWithoutExt = file.path.replace('.md', '');
|
const filePathWithoutExt = file.path.replace('.md', '');
|
||||||
|
|
||||||
if (this.settings.preserveFolderStructure && this.settings.nestNoteFolder) {
|
if (this.settings.preserveFolderStructure && this.settings.nestInFolder) {
|
||||||
// 保留文件夹 + 嵌套: notes/some-note.md > docs/notes/some-note/index.md
|
// 保留文件夹 + 嵌套: notes/some-note.md > docs/notes/some-note/index.md
|
||||||
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}/index.md`;
|
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}/index.md`;
|
||||||
} else if (this.settings.preserveFolderStructure) {
|
} else if (this.settings.preserveFolderStructure) {
|
||||||
// 保留文件夹结构: notes/some-note.md > docs/notes/some-note.md
|
// 保留文件夹结构: notes/some-note.md > docs/notes/some-note.md
|
||||||
docsPath = `${this.settings.docsPath}/${file.path}`;
|
docsPath = `${this.settings.docsPath}/${file.path}`;
|
||||||
} else if (this.settings.nestNoteFolder) {
|
} else if (this.settings.nestInFolder) {
|
||||||
// 嵌套文件夹: notes/some-note.md > docs/some-note/index.md
|
// 嵌套文件夹: notes/some-note.md > docs/some-note/index.md
|
||||||
docsPath = `${this.settings.docsPath}/${fileNameWithoutExt}/index.md`;
|
docsPath = `${this.settings.docsPath}/${fileNameWithoutExt}/index.md`;
|
||||||
} else {
|
} else {
|
||||||
@@ -161,13 +161,13 @@ export default class odoxPlugin extends Plugin {
|
|||||||
const filePathWithoutExt = file.path.replace('.canvas', '');
|
const filePathWithoutExt = file.path.replace('.canvas', '');
|
||||||
|
|
||||||
let docsPath: string;
|
let docsPath: string;
|
||||||
if (this.settings.preserveFolderStructure && this.settings.nestNoteFolder) {
|
if (this.settings.preserveFolderStructure && this.settings.nestInFolder) {
|
||||||
// 保留文件夹 + 嵌套: notes/some-note.canvas > docs/notes/some-note.canvas/index.md
|
// 保留文件夹 + 嵌套: notes/some-note.canvas > docs/notes/some-note.canvas/index.md
|
||||||
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}.canvas/index.md`;
|
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}.canvas/index.md`;
|
||||||
} else if (this.settings.preserveFolderStructure) {
|
} else if (this.settings.preserveFolderStructure) {
|
||||||
// 保留文件夹结构: notes/some-note.canvas > docs/notes/some-note.canvas.md
|
// 保留文件夹结构: notes/some-note.canvas > docs/notes/some-note.canvas.md
|
||||||
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}.md`;
|
docsPath = `${this.settings.docsPath}/${filePathWithoutExt}.md`;
|
||||||
} else if (this.settings.nestNoteFolder) {
|
} else if (this.settings.nestInFolder) {
|
||||||
// 嵌套文件夹: notes/some-note.canvas > docs/some-note.canvas/index.md
|
// 嵌套文件夹: notes/some-note.canvas > docs/some-note.canvas/index.md
|
||||||
docsPath = `${this.settings.docsPath}/${fileNameWithoutExt}.canvas/index.md`;
|
docsPath = `${this.settings.docsPath}/${fileNameWithoutExt}.canvas/index.md`;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import odoxPlugin from "./main";
|
|||||||
export interface odoxSettings {
|
export interface odoxSettings {
|
||||||
docsPath: string;
|
docsPath: string;
|
||||||
assetsPath: string;
|
assetsPath: string;
|
||||||
nestNoteFolder: boolean;
|
nestInFolder: boolean;
|
||||||
preserveFolderStructure: boolean;
|
preserveFolderStructure: boolean;
|
||||||
transparentCanvas: boolean;
|
transparentCanvas: boolean;
|
||||||
canvasEmbedTemplate: string;
|
canvasEmbedTemplate: string;
|
||||||
@@ -13,8 +13,8 @@ export interface odoxSettings {
|
|||||||
export const DEFAULT_SETTINGS: odoxSettings = {
|
export const DEFAULT_SETTINGS: odoxSettings = {
|
||||||
docsPath: 'docs',
|
docsPath: 'docs',
|
||||||
assetsPath: 'docs/public',
|
assetsPath: 'docs/public',
|
||||||
nestNoteFolder: true,
|
nestInFolder: false,
|
||||||
preserveFolderStructure: true,
|
preserveFolderStructure: false,
|
||||||
transparentCanvas: true,
|
transparentCanvas: true,
|
||||||
canvasEmbedTemplate: ''
|
canvasEmbedTemplate: ''
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ export class odoxSettingTab extends PluginSettingTab {
|
|||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Wiki path')
|
.setName('Docs path')
|
||||||
.setDesc('Path to the docs directory (relative to vault root)')
|
.setDesc('Path to the docs directory (relative to vault root)')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@@ -61,9 +61,9 @@ export class odoxSettingTab extends PluginSettingTab {
|
|||||||
.setName('Nest note folder')
|
.setName('Nest note folder')
|
||||||
.setDesc('Create a folder for each note (e.g., notes/some-note.md > docs/some-note/index.md)')
|
.setDesc('Create a folder for each note (e.g., notes/some-note.md > docs/some-note/index.md)')
|
||||||
.addToggle(toggle => toggle
|
.addToggle(toggle => toggle
|
||||||
.setValue(this.plugin.settings.nestNoteFolder)
|
.setValue(this.plugin.settings.nestInFolder)
|
||||||
.onChange(async (value) => {
|
.onChange(async (value) => {
|
||||||
this.plugin.settings.nestNoteFolder = value;
|
this.plugin.settings.nestInFolder = value;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user