diff --git a/plugin.json b/plugin.json
index e211c75..b74b70a 100644
--- a/plugin.json
+++ b/plugin.json
@@ -2,7 +2,7 @@
"name": "syplugin-misuzu-custom",
"author": "Misuzu2027",
"url": "https://github.com/Misuzu2027/syplugin-misuzu-custom",
- "version": "0.0.3",
+ "version": "0.0.4",
"minAppVersion": "3.0.14",
"backends": [
"all"
diff --git a/public/i18n/en_US.json b/public/i18n/en_US.json
index 8721caa..81eb71c 100644
--- a/public/i18n/en_US.json
+++ b/public/i18n/en_US.json
@@ -1,83 +1,18 @@
{
- "openDocumentSearchTab": "Open Document-based Search Tab",
- "table": "Table",
- "mathBlock": "Formula block",
- "quoteBlock": "Blockquote",
- "superBlock": "Super block",
- "paragraph": "Paragraph",
- "doc": "Doc",
- "headings": "Headings",
- "list": "List",
- "listItem": "List item",
- "codeBlock": "Code block",
- "htmlBlock": "HTML block",
- "embedBlock": "Embed block",
- "database": "Database",
- "video": "Video",
- "audio": "Audio",
- "IFrame": "IFrame",
- "widget": "Widget",
- "name": "Name",
- "alias": "Alias",
- "memo": "Memo",
- "allAttrs": "All attribute names and attribute values",
- "sortByRankASC": "Relevance ASC",
- "sortByRankDESC": "Relevance DESC",
- "modifiedASC": "Modified Time ASC",
- "modifiedDESC": "Modified Time DESC",
- "createdASC": "Created Time ASC",
- "createdDESC": "Created Time DESC",
- "type": "Type",
- "sortByContent": "Original content order",
- "sortByTypeAndContent": "Type And Original content order",
- "show": "Show",
- "hide": "Hide",
- "refCountASC": "Ref Count ASC",
- "refCountDESC": "Ref Count DESC",
- "fileNameASC": "Name Alphabet ASC",
- "fileNameDESC": "Name Alphabet DESC",
- "fileNameNatASC": "Name Natural ASC",
- "fileNameNatDESC": "Name Natural DESC",
- "notebook": "Notebook",
- "path": "Path",
- "sort": "Sort",
- "clear": "Clear",
- "refresh": "Refresh",
- "reference": "Ref",
- "documentBasedSearch": "Document-based Search",
- "flatDocumentTree": "Flat Document Tree",
- "documentBasedSearchDock": "Document-based Search Dock",
- "flatDocumentTreeDock": "Flat Document Tree Dock",
- "previousLabel": "Previous",
- "nextLabel": "Next",
- "findInBacklink": "Found ${x} backlink blocks",
- "notebookFilter": "Notebook Filter",
- "attr": "Attribute",
- "other": "Other",
- "expand": "Expand",
- "collapse": "Collapse",
- "noContentBelow": "No content matching the criteria exists below",
- "dockModifyTips": "Note: Modifying Dock will refresh the interface.",
- "settingDock": "🌈 Dock Settings",
- "settingNotebookFilter": "🌈 Notebook Filter",
- "settingType": "🌈 Type",
- "settingAttr": "🌈 Attribute",
- "settingOther": "🌈 Other",
- "docSortMethod": "Document Sorting Method",
- "contentBlockSortMethod": "Content Block Sorting Method",
- "documentsPerPage": "Documents Per Page",
- "blockCountBehaviorTips": "If the number of blocks in the query result is less than the current value, all documents will be expanded by default; otherwise, all documents will be collapsed by default.",
- "defaultExpansionCount": "Default Expansion Count",
- "alwaysExpandSingleDoc": "Always Expand Single Document",
- "displayDocBlock": "Display Document Blocks",
- "doubleClickTimeThreshold": "Double Click Time Threshold (Milliseconds)",
- "previewRefreshHighlightDelayTips": "For code blocks, databases, and other blocks that require time to render, too short a delay may fail. Set to 0 if not needed.",
- "previewRefreshHighlightDelay": "Preview Refresh Highlight Delay (Milliseconds)",
- "settingHub": "Settings Hub",
- "switchCurrentDocumentSearchFailureMessage": "Document Search Plugin: Failed to retrieve the opened document. You can switch tabs or reopen the document.",
- "swapDocumentItemClickLogic": "Swap Document Item Click Logic",
- "swapDocumentItemClickLogicTips": "When disabled, click to expand search results and double-click to open the document; when enabled, click to open the document and double-click to expand search results.",
- "allNotebooks": "All Notebooks",
- "specifyNotebook": "Specify Notebook",
- "searchInTheCurrentDocument": "Search in the current document"
+ "PluginSettings": "Misuzu Plugin Settings",
+ "Style": "Style",
+ "ModifyReferencedTextStyle": "Modify Referenced Text Style ",
+ "CodeBlock": "Code Block",
+ "CodeBlockNaming": "Code Block Naming",
+ "CommonCodeBlockLanguages": "Common Code Block Languages",
+ "CommonCodeBlockLanguagesTips": "Selected languages will be pinned at the top, separated by commas.",
+ "MaximumCodeBlockHeight": "Maximum Code Block Height",
+ "AdjustCodeBlockHeight": "Adjust Code Block Height",
+ "AdjustCodeBlockHeightTips": "If the maximum height is set, the drag range will not exceed it.",
+ "DisplayCollapseExpandCodeBlockButton": "Display Collapse/Expand Button for Code Block",
+ "CollapsedCodeBlockHeight": "Collapsed Code Block Height",
+ "FileTree":"Doc Tree",
+ "KeywordFilterNotebooks": "Keyword Filter for Notebooks",
+ "KeywordFilterNotebooksMatchSubdocuments": "Keyword Filter for Notebooks - Match Subdocuments"
+
}
\ No newline at end of file
diff --git a/public/i18n/zh_CN.json b/public/i18n/zh_CN.json
index 5d3d910..f4e8f61 100644
--- a/public/i18n/zh_CN.json
+++ b/public/i18n/zh_CN.json
@@ -1,84 +1,18 @@
{
- "openDocumentSearchTab": "打开搜索页签",
- "table": "表格",
- "mathBlock": "公式块",
- "quoteBlock": "引述块",
- "superBlock": "超级块",
- "paragraph": "段落",
- "doc": "文档",
- "headings": "标题",
- "list": "列表",
- "listItem": "列表项",
- "codeBlock": "代码块",
- "htmlBlock": "HTML 块",
- "embedBlock": "嵌入块",
- "database": "数据库",
- "video": "视频",
- "audio": "音频",
- "IFrame": "IFrame",
- "widget": "挂件",
- "name": "name",
- "alias": "别名",
- "memo": "备注",
- "allAttrs": "所有属性名和属性值",
- "sortByRankASC": "按相关度升序",
- "sortByRankDESC": "按相关度降序",
- "modifiedASC": "修改时间升序",
- "modifiedDESC": "修改时间降序",
- "createdASC": "创建时间升序",
- "createdDESC": "创建时间降序",
- "type": "类型",
- "sortByContent": "按原文内容顺序",
- "sortByTypeAndContent": "类型和原文内容顺序",
- "show": "显示",
- "hide": "隐藏",
- "refCountASC": "引用数升序",
- "refCountDESC": "引用数降序",
- "fileNameASC": "名称字母升序",
- "fileNameDESC": "名称字母降序",
- "fileNameNatASC": "名称自然升序",
- "fileNameNatDESC": "名称自然降序",
- "notebook": "笔记本",
- "path": "路径",
- "sort": "排序",
- "clear": "清空",
- "refresh": "刷新",
- "reference": "引用",
- "documentBasedSearch": "基于文档搜索",
- "flatDocumentTree": "扁平化文档树",
- "documentBasedSearchDock": "基于文档搜索 Dock",
- "flatDocumentTreeDock": "扁平化文档树 Dock",
- "previousLabel": "上一页",
- "nextLabel": "下一页",
- "findInBacklink": "共 ${x} 个反链块",
- "notebookFilter": "笔记本过滤",
- "attr": "属性",
- "other": "其他",
- "expand": "展开",
- "collapse": "折叠",
- "noContentBelow": "下不存在符合条件的内容",
- "dockModifyTips": "注:修改 Dock 会刷新界面。",
- "settingDock": "🌈 Dock 设置",
- "settingNotebookFilter": "🌈 笔记本过滤",
- "settingType": "🌈 类型",
- "settingAttr": "🌈 属性",
- "settingOther": "🌈 其他",
- "docSortMethod": "文档排序方式",
- "contentBlockSortMethod": "内容块排序方式",
- "documentsPerPage": "每页文档数量",
- "blockCountBehaviorTips": "如果查询结果的块数量小于当前值,默认展开全部文档;反之会默认折叠全部文档。",
- "defaultExpansionCount": "默认展开数",
- "alwaysExpandSingleDoc": "单篇文档始终展开",
- "displayDocBlock": "显示文档块",
- "doubleClickTimeThreshold": "双击时间阈值(毫秒)",
- "previewRefreshHighlightDelayTips": "用于代码块、数据库这种需要时间渲染的块高亮,太短可能会失败,不需要可以设置为0",
- "previewRefreshHighlightDelay": "刷新预览区高亮延迟(毫秒)",
- "settingHub": "设置中心",
- "switchCurrentDocumentSearchFailureMessage": "文档搜索插件: 没有获取到打开的文档,可切换页签或重新打开文档。",
- "swapDocumentItemClickLogic": "交换文档项点击逻辑",
- "swapDocumentItemClickLogicTips": "禁用时,单击展开搜索结果,双击打开文档;启用时,单击打开文档,双击展开搜索结果。",
- "allNotebooks": "所有笔记本",
- "specifyNotebook": "指定笔记本",
- "searchInTheCurrentDocument": "在当前文档查询"
+ "PluginSettings": "Misuzu插件设置",
+ "Style": "样式",
+ "ModifyReferencedTextStyle": "修改引用文本样式 ",
+ "CodeBlock": "代码块",
+ "CodeBlockNaming": "代码块命名",
+ "CommonCodeBlockLanguages": "代码块常用语言",
+ "CommonCodeBlockLanguagesTips": "选择语言时,会把这些语言置顶显示,英文逗号隔开多个语言 ",
+ "MaximumCodeBlockHeight": "代码块最大高度",
+ "AdjustCodeBlockHeight": "代码块调整高度",
+ "AdjustCodeBlockHeightTips": "如果设置了最大高度,拖拽范围也不会超过最大高度",
+ "DisplayCollapseExpandCodeBlockButton": "代码块显示折叠展开按钮",
+ "CollapsedCodeBlockHeight": "代码块折叠后高度",
+ "FileTree":"文档树",
+ "KeywordFilterNotebooks": "关键字过滤笔记本",
+ "KeywordFilterNotebooksMatchSubdocuments": "关键字过滤笔记本-匹配子文档"
}
\ No newline at end of file
diff --git a/src/components/filetree/FileTreeService.ts b/src/components/filetree/FileTreeService.ts
index fd0c7c5..d0678d6 100644
--- a/src/components/filetree/FileTreeService.ts
+++ b/src/components/filetree/FileTreeService.ts
@@ -1,10 +1,10 @@
import { SettingService } from "@/service/SettingService";
import { DocumentQueryCriteria, generateDocumentListSql } from "@/service/SqlService";
import { sql } from "@/utils/api";
-import { isArrayNotEmpty } from "@/utils/array-util";
-import { clearCssHighlights, highlightContent, highlightElementTextByCss } from "@/utils/html-util";
+import { isArrayEmpty, isArrayNotEmpty } from "@/utils/array-util";
+import { clearCssHighlights, highlightContent, highlightElementTextByCss, stringToElement } from "@/utils/html-util";
import Instance from "@/utils/Instance";
-import { containsAllKeywords, splitKeywordStringToArray } from "@/utils/string-util";
+import { containsAllKeywords, isStrBlank, isValidStr, splitKeywordStringToArray } from "@/utils/string-util";
export class FileTreeService {
private intervalId;
@@ -36,9 +36,17 @@ export class FileTreeService {
if (inputElement) {
inputElement.remove();
}
+ if (fileTreeObserve) {
+ fileTreeObserve.disconnect();
+ }
+ clearCssHighlights();
+ removeNotebookOrDocHide();
}
}
+let searchKeywordArray: string[] = [];
+let hideNotebookIdArray: string[] = [];
+let matchDocBlockArray: Block[] = [];
function initFileTreeSearchInput() {
let fileTreeDocElement = document.querySelector("#layouts div.layout-tab-container div.file-tree.sy__file");
@@ -53,6 +61,7 @@ function initFileTreeSearchInput() {
if (!anchorElement) {
return;
}
+ let fileTreeUlParentDivElement = fileTreeDocElement.querySelector(":scope > div.fn__flex-1") as HTMLElement;
let searchDivElement = document.createElement("div");
searchDivElement.style.margin = "1px 8px";
searchDivElement.classList.add("misuzu2027__search-div", "misuzu2027__copy", "misuzu2027__protyle-custom");
@@ -64,7 +73,13 @@ function initFileTreeSearchInput() {
// searchClearElement.setAttribute("style", `right: 8px; height: 42px;`);
// searchClearElement.innerHTML = ``
+ let clearElement = stringToElement(`
+
+`)
+
searchDivElement.append(searchInputElement);
+ searchDivElement.append(clearElement);
// searchDivElement.append(searchClearElement);
anchorElement.insertAdjacentElement('afterend', searchDivElement);
@@ -75,50 +90,136 @@ function initFileTreeSearchInput() {
return;
}
let searchKeyword = searchInputElement.value;
- let keywordArray = splitKeywordStringToArray(searchKeyword.toLowerCase());
+ searchKeywordArray = splitKeywordStringToArray(searchKeyword.toLowerCase());
let matchedSubDocs = SettingService.ins.SettingConfig.fileTreeKeywordFilterWithMatchedSubDocs;
let docFullTextSearch = false;
let includeConcatFields = ["content", "tag", "name", "alias", "memo"];
- let validSubdocsNotebookId = []
+ hideNotebookIdArray = [];
+ matchDocBlockArray = [];
- if (matchedSubDocs && isArrayNotEmpty(keywordArray)) {
+ if (matchedSubDocs && isArrayNotEmpty(searchKeywordArray)) {
let queryCriteria: DocumentQueryCriteria = new DocumentQueryCriteria(
- keywordArray, docFullTextSearch, null, null, null, null, includeConcatFields, null, null);
+ searchKeywordArray, docFullTextSearch, null, null, null, null, includeConcatFields, null, null);
let queryDocListSql = generateDocumentListSql(queryCriteria)
- let docBlockList: Block[] = await sql(queryDocListSql);
- for (const docBlock of docBlockList) {
- validSubdocsNotebookId.push(docBlock.box);
- }
+ matchDocBlockArray = await sql(queryDocListSql);
}
clearCssHighlights();
-
-
let boxUlElementArray = fileTreeDocElement.querySelectorAll("ul[data-url].b3-list.b3-list--background");
for (const ulElement of boxUlElementArray) {
-
let boxNameElement = ulElement.querySelector("li.b3-list-item > span.b3-list-item__text")
let boxName = boxNameElement.textContent.toLowerCase();
let boxId = ulElement.getAttribute("data-url");
- if (containsAllKeywords(boxName, keywordArray) || validSubdocsNotebookId.includes(boxId)) {
- highlightElementTextByCss(ulElement as HTMLElement, keywordArray)
-
- ulElement.classList.remove("fn__none");
- } else {
- ulElement.classList.add("fn__none");
+ if (!containsAllKeywords(boxName, searchKeywordArray)) {
+ hideNotebookIdArray.push(boxId)
}
}
+ for (const docBlock of matchDocBlockArray) {
+ hideNotebookIdArray = hideNotebookIdArray.filter(value => value !== docBlock.box);
+ }
+ refreshNotebookOrDoc(fileTreeDocElement as HTMLElement);
+
+ })
+ clearElement.addEventListener("click", (event) => {
+ searchInputElement.value = '';
+ searchInputElement.dispatchEvent(new Event('input'));
+ clearCssHighlights();
+ removeNotebookOrDocHide();
})
+ observeFileTreeChildChanges(fileTreeUlParentDivElement);
+}
+let fileTreeObserve: MutationObserver;
+
+function observeFileTreeChildChanges(targetElement: HTMLElement) {
+ // 创建一个 MutationObserver 实例
+ fileTreeObserve = new MutationObserver((mutationsList, observer) => {
+ // 检查是否有子元素发生变化
+ mutationsList.forEach(mutation => {
+ // if (isArrayEmpty(validDocBlockList)) {
+ // return;
+ // }
+ // 如果不是子元素发生变化时
+ if (mutation.type !== 'childList') {
+ return;
+ }
+ // 获取添加的节点
+ const addedNodes = Array.from(mutation.addedNodes);
+ for (const addNode of addedNodes) {
+ if (!(addNode instanceof HTMLElement)) {
+ continue
+ }
+ refreshNotebookOrDoc(addNode);
+ }
+
+ });
+ });
+
+ // 配置 MutationObserver 来监听子元素的变化
+ const config = { childList: true, subtree: true }; // subtree: true 用于监听所有后代节点的变化
+
+ // 开始观察
+ fileTreeObserve.observe(targetElement, config);
+
+}
+
+function refreshNotebookOrDoc(parentElement: HTMLElement) {
+
+ console.log("hideNotebookIdArray ", hideNotebookIdArray, "matchDocBlockArray ", matchDocBlockArray, " keywords ", searchKeywordArray)
+ // 查询笔记本节点,然后隐藏
+ let boxUlElementArray = parentElement.querySelectorAll("ul[data-url].b3-list.b3-list--background");
+ for (const ulElement of boxUlElementArray) {
+ let boxId = ulElement.getAttribute("data-url");
+ if (hideNotebookIdArray.includes(boxId)) {
+ ulElement.classList.add("fn__none");
+ } else {
+ ulElement.classList.remove("fn__none");
+ }
+ }
+ // 查询文档节点,然后隐藏
+ let liNodeList = parentElement.querySelectorAll(`li[data-type="navigation-file"]`);
+ for (const liNode of liNodeList) {
+ let rootId = liNode.getAttribute("data-node-id");
+ let hide = false;
+ for (const docBlock of matchDocBlockArray) {
+ if (docBlock.path.includes(rootId)) {
+ hide = false;
+ break;
+ } else {
+ hide = true;
+ }
+ }
+ if (hide) {
+ liNode.classList.add("fn__none");
+ } else {
+ liNode.classList.remove("fn__none");
+ }
+ }
+
+ highlightElementTextByCss(parentElement as HTMLElement, searchKeywordArray)
}
+function removeNotebookOrDocHide() {
+ let fileTreeDocElement = document.querySelector("#layouts div.layout-tab-container div.file-tree.sy__file");
+ if (!fileTreeDocElement) {
+ return;
+ }
+ let boxUlElementArray = fileTreeDocElement.querySelectorAll("ul[data-url].b3-list.b3-list--background.fn__none");
+ for (const ulElement of boxUlElementArray) {
+ ulElement.classList.remove("fn__none");
+ }
+ let liNodeList = fileTreeDocElement.querySelectorAll(`li[data-type="navigation-file"].fn__none`);
+ for (const liNode of liNodeList) {
+ liNode.classList.remove("fn__none");
+ }
+}
// let lastNoteBookMap;
// function initFileTreeElement() {
diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json
deleted file mode 100644
index 42ab238..0000000
--- a/src/i18n/en_US.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "openDocumentSearchTab": "Open Document-based Search Tab",
- "table": "Table",
- "mathBlock": "Formula block",
- "quoteBlock": "Blockquote",
- "superBlock": "Super block",
- "paragraph": "Paragraph",
- "doc": "Doc",
- "headings": "Headings",
- "list": "List",
- "listItem": "List item",
- "codeBlock": "Code block",
- "htmlBlock": "HTML block",
- "embedBlock": "Embed block",
- "database": "Database",
- "video": "Video",
- "audio": "Audio",
- "IFrame": "IFrame",
- "widget": "Widget",
- "name": "Name",
- "alias": "Alias",
- "memo": "Memo",
- "allAttrs": "All attribute names and attribute values",
- "sortByRankASC": "Relevance ASC",
- "sortByRankDESC": "Relevance DESC",
- "modifiedASC": "Modified Time ASC",
- "modifiedDESC": "Modified Time DESC",
- "createdASC": "Created Time ASC",
- "createdDESC": "Created Time DESC",
- "type": "Type",
- "sortByContent": "Original content order",
- "sortByTypeAndContent": "Type And Original content order",
- "show": "Show",
- "hide": "Hide",
- "refCountASC": "Ref Count ASC",
- "refCountDESC": "Ref Count DESC",
- "fileNameASC": "Name Alphabet ASC",
- "fileNameDESC": "Name Alphabet DESC",
- "fileNameNatASC": "Name Natural ASC",
- "fileNameNatDESC": "Name Natural DESC",
- "notebook": "Notebook",
- "path": "Path",
- "sort": "Sort",
- "clear": "Clear",
- "refresh": "Refresh",
- "reference": "Ref",
- "documentBasedSearch": "Document-based Search",
- "flatDocumentTree": "Flat Document Tree",
- "documentBasedSearchDock": "Document-based Search Dock",
- "flatDocumentTreeDock": "Flat Document Tree Dock",
- "previousLabel": "Previous",
- "nextLabel": "Next",
- "findInDoc": "Found ${x} documents",
- "notebookFilter": "Notebook Filter",
- "attr": "Attribute",
- "other": "Other",
- "expand": "Expand",
- "collapse": "Collapse",
- "noContentBelow": "No content matching the criteria exists below",
- "dockModifyTips": "Note: Modifying Dock will refresh the interface.",
- "settingDock": "🌈 Dock Settings",
- "settingNotebookFilter": "🌈 Notebook Filter",
- "settingType": "🌈 Type",
- "settingAttr": "🌈 Attribute",
- "settingOther": "🌈 Other",
- "docSortMethod": "Document Sorting Method",
- "contentBlockSortMethod": "Content Block Sorting Method",
- "documentsPerPage": "Documents Per Page",
- "blockCountBehaviorTips": "If the number of blocks in the query result is less than the current value, all documents will be expanded by default; otherwise, all documents will be collapsed by default.",
- "defaultExpansionCount": "Default Expansion Count",
- "alwaysExpandSingleDoc": "Always Expand Single Document",
- "displayDocBlock": "Display Document Blocks",
- "doubleClickTimeThreshold": "Double Click Time Threshold (Milliseconds)",
- "previewRefreshHighlightDelayTips": "For code blocks, databases, and other blocks that require time to render, too short a delay may fail. Set to 0 if not needed.",
- "previewRefreshHighlightDelay": "Preview Refresh Highlight Delay (Milliseconds)",
- "settingHub": "Settings Hub",
- "switchCurrentDocumentSearchFailureMessage": "Document Search Plugin: Failed to retrieve the opened document. You can switch tabs or reopen the document.",
- "swapDocumentItemClickLogic": "Swap Document Item Click Logic",
- "swapDocumentItemClickLogicTips": "When disabled, click to expand search results and double-click to open the document; when enabled, click to open the document and double-click to expand search results.",
- "allNotebooks": "All Notebooks",
- "specifyNotebook": "Specify Notebook",
- "searchInTheCurrentDocument": "Search in the current document"
-}
\ No newline at end of file
diff --git a/src/i18n/zh_CN.json b/src/i18n/zh_CN.json
deleted file mode 100644
index 4816714..0000000
--- a/src/i18n/zh_CN.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "openDocumentSearchTab": "打开搜索页签",
- "table": "表格",
- "mathBlock": "公式块",
- "quoteBlock": "引述块",
- "superBlock": "超级块",
- "paragraph": "段落",
- "doc": "文档",
- "headings": "标题",
- "list": "列表",
- "listItem": "列表项",
- "codeBlock": "代码块",
- "htmlBlock": "HTML 块",
- "embedBlock": "嵌入块",
- "database": "数据库",
- "video": "视频",
- "audio": "音频",
- "IFrame": "IFrame",
- "widget": "挂件",
- "name": "name",
- "alias": "别名",
- "memo": "备注",
- "allAttrs": "所有属性名和属性值",
- "sortByRankASC": "按相关度升序",
- "sortByRankDESC": "按相关度降序",
- "modifiedASC": "修改时间升序",
- "modifiedDESC": "修改时间降序",
- "createdASC": "创建时间升序",
- "createdDESC": "创建时间降序",
- "type": "类型",
- "sortByContent": "按原文内容顺序",
- "sortByTypeAndContent": "类型和原文内容顺序",
- "show": "显示",
- "hide": "隐藏",
- "refCountASC": "引用数升序",
- "refCountDESC": "引用数降序",
- "fileNameASC": "名称字母升序",
- "fileNameDESC": "名称字母降序",
- "fileNameNatASC": "名称自然升序",
- "fileNameNatDESC": "名称自然降序",
- "notebook": "笔记本",
- "path": "路径",
- "sort": "排序",
- "clear": "清空",
- "refresh": "刷新",
- "reference": "引用",
- "documentBasedSearch": "基于文档搜索",
- "flatDocumentTree": "扁平化文档树",
- "documentBasedSearchDock": "基于文档搜索 Dock",
- "flatDocumentTreeDock": "扁平化文档树 Dock",
- "previousLabel": "上一页",
- "nextLabel": "下一页",
- "findInDoc": "匹配到 ${x} 个文档",
- "notebookFilter": "笔记本过滤",
- "attr": "属性",
- "other": "其他",
- "expand": "展开",
- "collapse": "折叠",
- "noContentBelow": "下不存在符合条件的内容",
- "dockModifyTips": "注:修改 Dock 会刷新界面。",
- "settingDock": "🌈 Dock 设置",
- "settingNotebookFilter": "🌈 笔记本过滤",
- "settingType": "🌈 类型",
- "settingAttr": "🌈 属性",
- "settingOther": "🌈 其他",
- "docSortMethod": "文档排序方式",
- "contentBlockSortMethod": "内容块排序方式",
- "documentsPerPage": "每页文档数量",
- "blockCountBehaviorTips": "如果查询结果的块数量小于当前值,默认展开全部文档;反之会默认折叠全部文档。",
- "defaultExpansionCount": "默认展开数",
- "alwaysExpandSingleDoc": "单篇文档始终展开",
- "displayDocBlock": "显示文档块",
- "doubleClickTimeThreshold": "双击时间阈值(毫秒)",
- "previewRefreshHighlightDelayTips": "用于代码块、数据库这种需要时间渲染的块高亮,太短可能会失败,不需要可以设置为0",
- "previewRefreshHighlightDelay": "刷新预览区高亮延迟(毫秒)",
- "settingHub": "设置中心",
- "switchCurrentDocumentSearchFailureMessage": "文档搜索插件: 没有获取到打开的文档,可切换页签或重新打开文档。",
- "swapDocumentItemClickLogic": "交换文档项点击逻辑",
- "swapDocumentItemClickLogicTips": "禁用时,单击展开搜索结果,双击打开文档;启用时,单击打开文档,双击展开搜索结果。",
- "allNotebooks": "所有笔记本",
- "specifyNotebook": "指定笔记本",
- "searchInTheCurrentDocument": "在当前文档查询"
-
-}
\ No newline at end of file
diff --git a/src/index.scss b/src/index.scss
index 6394848..f9d09e8 100644
--- a/src/index.scss
+++ b/src/index.scss
@@ -94,4 +94,12 @@ body.misuzu2027.code-block__drag-height .protyle-wysiwyg .code-block .drag-bar {
// display: inline-block;
// }
-/* ---------------------------end 代码块样式 end------------------------------*/
\ No newline at end of file
+/* ---------------------------end 代码块样式 end------------------------------*/
+
+/* ---------------------------start 文件树样式 start------------------------------*/
+// 清空按钮
+.misuzu2027__search-div .b3-form__icon-clear {
+ color: var(--b3-theme-on-surface);
+}
+
+/* ---------------------------end 文件树样式 end------------------------------*/
\ No newline at end of file
diff --git a/src/models/setting-constant.ts b/src/models/setting-constant.ts
index ee16dbc..f75d71f 100644
--- a/src/models/setting-constant.ts
+++ b/src/models/setting-constant.ts
@@ -1,3 +1,4 @@
+import { EnvConfig } from "@/config/EnvConfig";
import { BACKLINK_BLOCK_SORT_METHOD_ELEMENT, CUR_DOC_DEF_BLOCK_SORT_METHOD_ELEMENT, RELATED_DEF_BLOCK_SORT_METHOD_ELEMENT, RELATED_DOCMUMENT_SORT_METHOD_ELEMENT } from "./backlink-constant";
import { ItemProperty, IOption, TabProperty, SettingConfig } from "./setting-model";
@@ -25,22 +26,23 @@ export function getSettingTabArray(): TabProperty[] {
];
+ let i18n = EnvConfig.ins.i18n;
tabProperties.push(
new TabProperty({
- key: "style-setting", name: "样式", iconKey: "iconFilter", props: [
- new ItemProperty({ key: "useRefTextStyle", type: "switch", name: "修改引用文本样式", description: "", tips: "" }),
+ key: "style-setting", name: i18n.Style, iconKey: "iconFilter", props: [
+ new ItemProperty({ key: "useRefTextStyle", type: "switch", name: i18n.ModifyReferencedTextStyle, description: "", tips: "" }),
]
}),
new TabProperty({
- key: "code-block-setting", name: "代码块", iconKey: "iconLink", props: [
+ key: "code-block-setting", name: i18n.CodeBlock, iconKey: "iconLink", props: [
- new ItemProperty({ key: "codeBlockNaming", type: "switch", name: "代码块命名", description: "", tips: "" }),
- new ItemProperty({ key: "codeBlockTopLanguages", type: "text", name: "代码块常用语言", description: "选择语言时,会把这些语言置顶显示,英文逗号或中文逗号隔开多个语言", tips: "" }),
- new ItemProperty({ key: "codeBlockMaxHeight", type: "number", name: "代码块最大高度", description: "", tips: "", min: 150 }),
- new ItemProperty({ key: "codeBlockAdjustHeight", type: "switch", name: "代码块调整高度", description: "如果设置了最大高度,拖拽范围也不会超过最大高度", tips: "" }),
- new ItemProperty({ key: "codeBlockToggle", type: "switch", name: "代码块显示折叠展开按钮", description: "", tips: "" }),
- new ItemProperty({ key: "codeBlockFoldHeight", type: "number", name: "代码块折叠后高度", description: "", tips: "", min: 150 }),
+ new ItemProperty({ key: "codeBlockNaming", type: "switch", name: i18n.CodeBlockNaming, description: "", tips: "" }),
+ new ItemProperty({ key: "codeBlockTopLanguages", type: "text", name: i18n.CommonCodeBlockLanguages, description: i18n.CommonCodeBlockLanguagesTips, tips: "" }),
+ new ItemProperty({ key: "codeBlockMaxHeight", type: "number", name: i18n.MaximumCodeBlockHeight, description: "", tips: "", min: 150 }),
+ new ItemProperty({ key: "codeBlockAdjustHeight", type: "switch", name: i18n.AdjustCodeBlockHeight, description: i18n.AdjustCodeBlockHeightTips, tips: "" }),
+ new ItemProperty({ key: "codeBlockToggle", type: "switch", name: i18n.DisplayCollapseExpandCodeBlockButton, description: "", tips: "" }),
+ new ItemProperty({ key: "codeBlockFoldHeight", type: "number", name: i18n.CollapsedCodeBlockHeight, description: "", tips: "", min: 150 }),
// new ItemProperty({ key: "queryAllContentUnderHeadline", type: "switch", name: "反链区域关键字查询标题下的所有内容", description: "必须开启 查询标题下关联定义块 才可生效。", tips: "" }),
@@ -48,9 +50,9 @@ export function getSettingTabArray(): TabProperty[] {
}),
new TabProperty({
- key: "file-tree-setting", name: "文档树", iconKey: "iconPlugin", props: [
- new ItemProperty({ key: "fileTreeKeywordFilter", type: "switch", name: "关键字过滤笔记本", description: "", tips: "" }),
- new ItemProperty({ key: "fileTreeKeywordFilterWithMatchedSubDocs", type: "switch", name: "关键字过滤笔记本-匹配子文档", description: "", tips: "" }),
+ key: "file-tree-setting", name: i18n.FileTree, iconKey: "iconPlugin", props: [
+ new ItemProperty({ key: "fileTreeKeywordFilter", type: "switch", name: i18n.KeywordFilterNotebooks, description: "", tips: "" }),
+ new ItemProperty({ key: "fileTreeKeywordFilterWithMatchedSubDocs", type: "switch", name: i18n.KeywordFilterNotebooksMatchSubdocuments, description: "", tips: "" }),
// new ItemProperty({ key: "documentBottomDisplay", type: "switch", name: "文档底部显示反链面板", description: "", tips: "" }),
// new ItemProperty({ key: "topBarDisplay", type: "switch", name: "桌面端顶栏创建反链页签 Icon", description: "", tips: "" }),
// new ItemProperty({ key: "cacheAfterResponseMs", type: "number", name: "启用缓存门槛(毫秒)", description: "当接口响应时间超过这个数,就会把这次查询结果存入缓存,-1 不开启缓存", tips: "", min: -1 }),
diff --git a/src/utils/string-util.ts b/src/utils/string-util.ts
index 9f6b48a..32ed817 100644
--- a/src/utils/string-util.ts
+++ b/src/utils/string-util.ts
@@ -90,6 +90,23 @@ export function isValidStr(s: any): boolean {
return true;
}
+/**
+ * 判定字符串是否有效
+ * @param s 需要检查的字符串(或其他类型的内容)
+ * @returns true / false 是否为有效的字符串
+ */
+export function isStrNotBlank(s: any): boolean {
+ if (s == undefined || s == null || s === '') {
+ return false;
+ }
+ return true;
+}
+
+export function isStrBlank(s: any): boolean {
+ return !isStrNotBlank(s);
+}
+
+
export function splitKeywordStringToArray(keywordStr: string): string[] {
let keywordArray = [];
if (!isValidStr(keywordStr)) {