Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-04-20 01:08:35 +08:00
commit b274513c08
3 changed files with 34 additions and 18 deletions

View file

@ -135,6 +135,12 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => {
};
export const handleTouchStart = (event: TouchEvent) => {
if (0 < event.touches.length && ((event.touches[0].target as HTMLElement).tagName === "VIDEO" || (event.touches[0].target as HTMLElement).tagName === "AUDIO")) {
// https://github.com/siyuan-note/siyuan/issues/14569
activeBlur();
return;
}
if (globalTouchStart(event)) {
return;
}

View file

@ -2,7 +2,8 @@ import {getTextStar, paste} from "../util/paste";
import {
hasClosestBlock,
hasClosestByAttribute,
hasClosestByClassName, hasClosestByTag,
hasClosestByClassName,
hasClosestByTag,
hasTopClosestByClassName,
isInEmbedBlock,
} from "../util/hasClosest";
@ -13,7 +14,8 @@ import {
focusSideBlock,
getEditorRange,
getSelectionOffset,
setFirstNodeRange, setInsertWbrHTML,
setFirstNodeRange,
setInsertWbrHTML,
setLastNodeRange,
} from "../util/selection";
import {Constants} from "../../constants";
@ -39,7 +41,8 @@ import {
getNextBlock,
getTopAloneElement,
hasNextSibling,
hasPreviousSibling, isEndOfBlock,
hasPreviousSibling,
isEndOfBlock,
isNotEditBlock
} from "./getBlock";
import {transaction, updateTransaction} from "./transaction";
@ -2175,14 +2178,6 @@ export class WYSIWYG {
});
});
hideElements(["hint", "util"], protyle);
/// #if MOBILE
// https://github.com/siyuan-note/siyuan/issues/14569
if (event.target.tagName === "VIDEO") {
mobileBlur = true;
activeBlur();
return;
}
/// #endif
const ctrlIsPressed = isOnlyMeta(event);
const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item");
if (backlinkBreadcrumbItemElement) {

View file

@ -1406,19 +1406,34 @@ func searchBySQL(stmt string, beforeLen, page, pageSize int) (ret []*Block, matc
}
stmt = strings.ToLower(stmt)
if strings.HasPrefix(stmt, "select a.* ") { // 多个搜索关键字匹配文档 https://github.com/siyuan-note/siyuan/issues/7350
stmt = strings.ReplaceAll(stmt, "select a.* ", "select COUNT(a.id) AS `matches`, COUNT(DISTINCT(a.root_id)) AS `docs` ")
} else {
stmt = strings.ReplaceAll(stmt, "select * ", "select COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` ")
stdQuery := !strings.Contains(stmt, "with recursive") && !strings.Contains(stmt, "union")
if stdQuery {
if strings.HasPrefix(stmt, "select a.* ") { // 多个搜索关键字匹配文档 https://github.com/siyuan-note/siyuan/issues/7350
stmt = strings.ReplaceAll(stmt, "select a.* ", "select COUNT(a.id) AS `matches`, COUNT(DISTINCT(a.root_id)) AS `docs` ")
} else {
stmt = strings.ReplaceAll(stmt, "select * ", "select COUNT(id) AS `matches`, COUNT(DISTINCT(root_id)) AS `docs` ")
}
}
stmt = removeLimitClause(stmt)
result, _ := sql.QueryNoLimit(stmt)
if 1 > len(ret) {
if 1 > len(result) {
return
}
matchedBlockCount = int(result[0]["matches"].(int64))
matchedRootCount = int(result[0]["docs"].(int64))
if !stdQuery {
var rootIDs, blockIDs []string
for _, queryResult := range result {
rootIDs = append(rootIDs, queryResult["root_id"].(string))
blockIDs = append(blockIDs, queryResult["id"].(string))
}
rootIDs = gulu.Str.RemoveDuplicatedElem(rootIDs)
blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs)
matchedRootCount = len(rootIDs)
matchedBlockCount = len(blockIDs)
} else {
matchedBlockCount = int(result[0]["matches"].(int64))
matchedRootCount = int(result[0]["docs"].(int64))
}
return
}