Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 文件历史支持按文档名搜索 Fix https://github.com/siyuan-note/siyuan/issues/6257

Liang Ding16e2bc6904b6
diff --git a/app/src/util/history.ts b/app/src/util/history.ts
index e7f26c24e5..874e8f56e7 100644
--- a/app/src/util/history.ts
+++ b/app/src/util/history.ts
@@ -29,7 +29,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
const mdElement = element.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;
docElement.classList.add("fn__none");
mdElement.classList.add("fn__none");
- if (typeElement.value === "0") {
+ if (typeElement.value === "0" || typeElement.value === "1") {
opElement.removeAttribute("disabled");
notebookElement.removeAttribute("disabled");
assetElement.classList.add("fn__none");
@@ -65,7 +65,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
if (item.items.length > 0) {
logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;
item.items.forEach((docItem) => {
- logsHTML += `<li title="${escapeHtml(docItem.title)}" data-type="${typeElement.value === "1" ? "assets" : "doc"}" data-path="${docItem.path}" class="b3-list-item b3-list-item--hide-action" style="padding-left: 32px">
+ logsHTML += `<li title="${escapeHtml(docItem.title)}" data-type="${typeElement.value === "2" ? "assets" : "doc"}" data-path="${docItem.path}" class="b3-list-item b3-list-item--hide-action" style="padding-left: 32px">
<span class="b3-list-item__text">${escapeHtml(docItem.title)}</span>
<span class="fn__space"></span>
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}">
@@ -239,8 +239,9 @@ export const openHistory = () => {
</div>
<span class="fn__space"></span>
<select data-type="typeselect" class="b3-select" style="min-width: auto">
- <option value="0" selected>${window.siyuan.languages.doc}</option>
- <option value="1">${window.siyuan.languages.assets}</option>
+ <option value="0" selected>${window.siyuan.languages.docName}</option>
+ <option value="1">${window.siyuan.languages.doc}</option>
+ <option value="2">${window.siyuan.languages.assets}</option>
</select>
<span class="fn__space"></span>
<select data-type="opselect" class="b3-select" style="min-width: auto">
diff --git a/kernel/model/history.go b/kernel/model/history.go
index 3e345363d1..854c4ea695 100644
--- a/kernel/model/history.go
+++ b/kernel/model/history.go
@@ -343,7 +343,11 @@ func FullTextSearchHistory(query, box, op string, typ, page int) (ret []*History
stmt += "1=1"
}
- if HistoryTypeDoc == typ {
+ if HistoryTypeDocName == typ {
+ stmt = strings.ReplaceAll(stmt, "{title content}", "{title}")
+ }
+
+ if HistoryTypeDocName == typ || HistoryTypeDoc == typ {
if "all" != op {
stmt += " AND op = '" + op + "'"
}
@@ -578,8 +582,9 @@ func ReindexHistory() (err error) {
var validOps = []string{HistoryOpClean, HistoryOpUpdate, HistoryOpDelete, HistoryOpFormat, HistoryOpSync}
const (
- HistoryTypeDoc = 0
- HistoryTypeAsset = 1
+ HistoryTypeDocName = 0
+ HistoryTypeDoc = 1
+ HistoryTypeAsset = 2
)
func indexHistoryDir(name string, luteEngine *lute.Lute) {