mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-05 06:19:43 +08:00
🎨 文件历史支持按文档名搜索 Fix https://github.com/siyuan-note/siyuan/issues/6257
This commit is contained in:
parent
ae98a6dba5
commit
16e2bc6904
@ -29,7 +29,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
|
|||||||
const mdElement = element.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;
|
const mdElement = element.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;
|
||||||
docElement.classList.add("fn__none");
|
docElement.classList.add("fn__none");
|
||||||
mdElement.classList.add("fn__none");
|
mdElement.classList.add("fn__none");
|
||||||
if (typeElement.value === "0") {
|
if (typeElement.value === "0" || typeElement.value === "1") {
|
||||||
opElement.removeAttribute("disabled");
|
opElement.removeAttribute("disabled");
|
||||||
notebookElement.removeAttribute("disabled");
|
notebookElement.removeAttribute("disabled");
|
||||||
assetElement.classList.add("fn__none");
|
assetElement.classList.add("fn__none");
|
||||||
@ -65,7 +65,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
|
|||||||
if (item.items.length > 0) {
|
if (item.items.length > 0) {
|
||||||
logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;
|
logsHTML += `<ul class="${index === 0 ? "" : "fn__none"}">`;
|
||||||
item.items.forEach((docItem) => {
|
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="b3-list-item__text">${escapeHtml(docItem.title)}</span>
|
||||||
<span class="fn__space"></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}">
|
<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>
|
</div>
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<select data-type="typeselect" class="b3-select" style="min-width: auto">
|
<select data-type="typeselect" class="b3-select" style="min-width: auto">
|
||||||
<option value="0" selected>${window.siyuan.languages.doc}</option>
|
<option value="0" selected>${window.siyuan.languages.docName}</option>
|
||||||
<option value="1">${window.siyuan.languages.assets}</option>
|
<option value="1">${window.siyuan.languages.doc}</option>
|
||||||
|
<option value="2">${window.siyuan.languages.assets}</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<select data-type="opselect" class="b3-select" style="min-width: auto">
|
<select data-type="opselect" class="b3-select" style="min-width: auto">
|
||||||
|
@ -343,7 +343,11 @@ func FullTextSearchHistory(query, box, op string, typ, page int) (ret []*History
|
|||||||
stmt += "1=1"
|
stmt += "1=1"
|
||||||
}
|
}
|
||||||
|
|
||||||
if HistoryTypeDoc == typ {
|
if HistoryTypeDocName == typ {
|
||||||
|
stmt = strings.ReplaceAll(stmt, "{title content}", "{title}")
|
||||||
|
}
|
||||||
|
|
||||||
|
if HistoryTypeDocName == typ || HistoryTypeDoc == typ {
|
||||||
if "all" != op {
|
if "all" != op {
|
||||||
stmt += " AND op = '" + op + "'"
|
stmt += " AND op = '" + op + "'"
|
||||||
}
|
}
|
||||||
@ -578,8 +582,9 @@ func ReindexHistory() (err error) {
|
|||||||
var validOps = []string{HistoryOpClean, HistoryOpUpdate, HistoryOpDelete, HistoryOpFormat, HistoryOpSync}
|
var validOps = []string{HistoryOpClean, HistoryOpUpdate, HistoryOpDelete, HistoryOpFormat, HistoryOpSync}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HistoryTypeDoc = 0
|
HistoryTypeDocName = 0
|
||||||
HistoryTypeAsset = 1
|
HistoryTypeDoc = 1
|
||||||
|
HistoryTypeAsset = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
func indexHistoryDir(name string, luteEngine *lute.Lute) {
|
func indexHistoryDir(name string, luteEngine *lute.Lute) {
|
||||||
|
Loading…
Reference in New Issue
Block a user