update at 2025-10-08 09:18:20
This commit is contained in:
@@ -1,23 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2025 Sun Booshi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
/**
|
||||
* 文件:setting-tab.ts
|
||||
* 作用:Obsidian 设置面板集成,提供界面化配置入口。
|
||||
*/
|
||||
|
||||
import { App, TextAreaComponent, PluginSettingTab, Setting, Notice, sanitizeHTMLToDom } from 'obsidian';
|
||||
@@ -333,6 +316,51 @@ export class NoteToMpSettingTab extends PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
})
|
||||
|
||||
// 切图配置区块
|
||||
containerEl.createEl('h2', {text: '切图配置'});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('切图保存路径')
|
||||
.setDesc('切图文件的保存目录,默认:/Users/gavin/note2mp/images/xhs')
|
||||
.addText(text => {
|
||||
text.setPlaceholder('例如 /Users/xxx/images/xhs')
|
||||
.setValue(this.settings.sliceImageSavePath || '')
|
||||
.onChange(async (value) => {
|
||||
this.settings.sliceImageSavePath = value.trim();
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
text.inputEl.setAttr('style', 'width: 360px;');
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('切图宽度')
|
||||
.setDesc('长图及切图的宽度(像素),默认:1080')
|
||||
.addText(text => {
|
||||
text.setPlaceholder('数字 >=100')
|
||||
.setValue(String(this.settings.sliceImageWidth || 1080))
|
||||
.onChange(async (value) => {
|
||||
const n = parseInt(value, 10);
|
||||
if (Number.isFinite(n) && n >= 100) {
|
||||
this.settings.sliceImageWidth = n;
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
});
|
||||
text.inputEl.setAttr('style', 'width: 120px;');
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('切图横竖比例')
|
||||
.setDesc('格式:宽:高,例如 3:4 表示竖图,16:9 表示横图')
|
||||
.addText(text => {
|
||||
text.setPlaceholder('例如 3:4')
|
||||
.setValue(this.settings.sliceImageAspectRatio || '3:4')
|
||||
.onChange(async (value) => {
|
||||
this.settings.sliceImageAspectRatio = value.trim();
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
text.inputEl.setAttr('style', 'width: 120px;');
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('渲染图片标题')
|
||||
|
||||
Reference in New Issue
Block a user