From 0651c85324e9804862abb5e58ed32f8c62221654 Mon Sep 17 00:00:00 2001 From: Linc <762699299@qq.com> Date: Tue, 27 Aug 2024 21:19:49 +0800 Subject: [PATCH] add: (setting) alias_use_default config --- manifest.json | 2 +- src/ABConverter/ABAlias.ts | 8 ++++++-- src/config/ABSettingTab.ts | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index ebfa839..b6d5bf2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "any-block", "name": "AnyBlock", - "version": "3.1.0", + "version": "3.1.1", "minAppVersion": "0.15.0", "description": "You can flexibility to create a 'Block' by some means. It also provides some useful features, like `list to table`. ", "author": "LincZero", diff --git a/src/ABConverter/ABAlias.ts b/src/ABConverter/ABAlias.ts index 1861142..337b488 100644 --- a/src/ABConverter/ABAlias.ts +++ b/src/ABConverter/ABAlias.ts @@ -302,8 +302,7 @@ const ABAlias_json_general: ABAlias_json_item[] = [ {regex: "|加粗|", replacement: "|addClass(ab-custom-font-bold)|"}, ] -// 暂时只支持在开头处替换 -export let ABAlias_json: ABAlias_json_item[] = [ +export const ABAlias_json_default: ABAlias_json_item[] = [ ...ABAlias_json_mdit, ...ABAlias_json_title, ...ABAlias_json_list, @@ -313,6 +312,11 @@ export let ABAlias_json: ABAlias_json_item[] = [ ...ABAlias_json_general, // 这个放最后 ] +// 暂时只支持在开头处替换 +export let ABAlias_json: ABAlias_json_item[] = [ + ...ABAlias_json_default +] + const ABAlias_json_end: ABAlias_json_item[] = [ {regex: "|::: 140lne", replacement: ""}, {regex: "|title 140lne", replacement: ""}, diff --git a/src/config/ABSettingTab.ts b/src/config/ABSettingTab.ts index 6a4fc25..d6717e6 100644 --- a/src/config/ABSettingTab.ts +++ b/src/config/ABSettingTab.ts @@ -8,7 +8,7 @@ import {App, PluginSettingTab, Setting, Modal} from "obsidian" import type AnyBlockPlugin from "../main" import {ABConvertManager} from "src/ABConverter/ABConvertManager" import {ABConvert, type ABConvert_SpecUser} from "src/ABConverter/converter/ABConvert" -import { ABAlias_json } from "src/ABConverter/ABAlias" +import { ABAlias_json, ABAlias_json_default } from "src/ABConverter/ABAlias" // 加载所有选择器 import {} from "src/ab_manager/abm_cm/ABSelector_MdBase" @@ -94,6 +94,9 @@ export class ABSettingTab extends PluginSettingTab { this.plugin = plugin; // 别名模块加载自定义别名 + if (plugin.settings.alias_use_default) { + ABAlias_json.concat(ABAlias_json_default) + } // 新版 for (let item of plugin.settings.alias_user){ let newReg: string|RegExp;