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