From cafc4ea38b8a3266ec8b6f1894ec16c9db2c36e0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 09:49:58 +0800 Subject: [PATCH 001/138] :bug: Unable to roll back document history https://github.com/siyuan-note/siyuan/issues/10846 --- kernel/model/history.go | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/model/history.go b/kernel/model/history.go index a9683a6513..4ea4001acd 100644 --- a/kernel/model/history.go +++ b/kernel/model/history.go @@ -263,7 +263,6 @@ func RollbackDocHistory(boxID, historyPath string) (err error) { } } - util.ReloadUI() FullReindex() IncSync() return nil From 50faacd1291a67cca78be38279607334d296e87c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 10:24:51 +0800 Subject: [PATCH 002/138] :art: Export PDF and add watermarks no longer covered by images https://github.com/siyuan-note/siyuan/issues/10818 --- kernel/model/export.go | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/model/export.go b/kernel/model/export.go index 38b39563f6..be8fd4a4ad 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1057,6 +1057,7 @@ func processPDFWatermark(pdfCtx *pdfcpu.Context, watermark bool) { return } + wm.OnTop = true // Export PDF and add watermarks no longer covered by images https://github.com/siyuan-note/siyuan/issues/10818 err = pdfCtx.AddWatermarks(nil, wm) if nil != err { logging.LogErrorf("add watermark failed: %s", err) From 7981945bd36a438e604a5f31f48caea9ad8ae305 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 10:43:34 +0800 Subject: [PATCH 003/138] :art: fix https://github.com/siyuan-note/siyuan/issues/10821 --- app/src/block/popover.ts | 4 ++-- app/src/menus/Menu.ts | 2 ++ app/src/menus/protyle.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index 55ee973351..92e1272a8a 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -177,7 +177,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => { if (!popoverTargetElement && linkElement && linkElement.getAttribute("data-href")?.startsWith("siyuan://blocks")) { popoverTargetElement = linkElement; } - if (!popoverTargetElement) { + if (!popoverTargetElement || window.siyuan.menus.menu?.data.isSameNode(popoverTargetElement)) { // 移动到弹窗的 loading 元素上,但经过 settimeout 后 loading 已经被移除了 // https://ld246.com/article/1673596577519/comment/1673767749885#comments let targetElement = target; @@ -269,7 +269,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: false }; export const showPopover = async (app: App, showRef = false) => { - if (!popoverTargetElement) { + if (!popoverTargetElement || window.siyuan.menus.menu.data?.isSameNode(popoverTargetElement)) { return; } let ids: string[]; diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts index bf434f5b02..461c92f4e1 100644 --- a/app/src/menus/Menu.ts +++ b/app/src/menus/Menu.ts @@ -6,6 +6,7 @@ import {Constants} from "../constants"; export class Menu { public element: HTMLElement; + public data: any; // 用于记录当前菜单的数据 public removeCB: () => void; private wheelEvent: string; @@ -111,6 +112,7 @@ export class Menu { this.element.removeAttribute("style"); // zIndex window.siyuan.menus.menu.element.removeAttribute("data-name"); // 标识再次点击不消失 window.siyuan.menus.menu.element.removeAttribute("data-from"); // 标识是否在浮窗内打开 + window.siyuan.menus.menu.data = undefined; // 移除数据 } public append(element?: HTMLElement, index?: number) { diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 5e39c93ce8..43c9e38729 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -604,6 +604,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { h: 26 }); const popoverElement = hasTopClosestByClassName(protyle.element, "block__popover", true); + window.siyuan.menus.menu.data = element; window.siyuan.menus.menu.element.setAttribute("data-from", popoverElement ? popoverElement.dataset.level + "popover" : "app"); if (!protyle.disabled) { window.siyuan.menus.menu.element.querySelector("input").select(); From eae61fd4a716bc65916d952b5726b7cde52a5f19 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 10:54:23 +0800 Subject: [PATCH 004/138] :bug: Abnormal sorting of database relation fields https://github.com/siyuan-note/siyuan/issues/10835 --- kernel/av/av.go | 2 +- kernel/av/value.go | 12 +++++++++--- kernel/model/attribute_view.go | 14 +++++--------- kernel/treenode/node.go | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/kernel/av/av.go b/kernel/av/av.go index eeb54627b1..db829fb950 100644 --- a/kernel/av/av.go +++ b/kernel/av/av.go @@ -420,7 +420,7 @@ func SaveAttributeView(av *AttributeView) (err error) { } if 0 == v.UpdatedAt { - v.UpdatedAt = v.CreatedAt + v.UpdatedAt = v.CreatedAt + 1000 } } } diff --git a/kernel/av/value.go b/kernel/av/value.go index 3901084d4b..f6e8e4b8f0 100644 --- a/kernel/av/value.go +++ b/kernel/av/value.go @@ -57,6 +57,13 @@ type Value struct { Rollup *ValueRollup `json:"rollup,omitempty"` } +func (value *Value) SetUpdatedAt(mills int64) { + value.UpdatedAt = mills + if value.CreatedAt == value.UpdatedAt { + value.UpdatedAt += 1000 // 防止更新时间和创建时间一样 + } +} + func (value *Value) String() string { if nil == value { return "" @@ -198,9 +205,8 @@ func (value *Value) IsEdited() bool { return true } - if value.IsEmpty() { - // 空数据认为是未编辑过的 - return false + if !value.IsEmpty() { + return true } return value.CreatedAt != value.UpdatedAt } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 5a9dbdb46e..ffd62d553f 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -687,7 +687,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page, } if 0 == v.UpdatedAt { - v.UpdatedAt = v.CreatedAt + v.UpdatedAt = v.CreatedAt + 1000 } } } @@ -2913,18 +2913,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, if nil != blockVal { blockVal.Block.Updated = now - blockVal.UpdatedAt = now - if val.CreatedAt == val.UpdatedAt { - val.UpdatedAt += 1000 // 防止更新时间和创建时间一样 - } + blockVal.SetUpdatedAt(now) if isUpdatingBlockKey { blockVal.IsDetached = val.IsDetached } } - val.UpdatedAt = now - if val.CreatedAt == val.UpdatedAt { - val.UpdatedAt += 1000 // 防止更新时间和创建时间一样 - } + val.SetUpdatedAt(now) key, _ := attrView.GetKey(val.KeyID) if nil != key && av.KeyTypeRelation == key.Type && nil != key.Relation { @@ -2956,6 +2950,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, destVal.Relation.BlockIDs = append(destVal.Relation.BlockIDs, rowID) destVal.Relation.BlockIDs = gulu.Str.RemoveDuplicatedElem(destVal.Relation.BlockIDs) + destVal.SetUpdatedAt(now) break } } @@ -2974,6 +2969,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, for _, value := range keyValues.Values { if value.BlockID == blockID { value.Relation.BlockIDs = gulu.Str.RemoveElem(value.Relation.BlockIDs, rowID) + value.SetUpdatedAt(now) break } } diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 8258651962..f3bfbbd75d 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -995,7 +995,7 @@ func GetAttributeViewDefaultValue(valueID, keyID, blockID string, typ av.KeyType ret.CreatedAt = time.Now().UnixMilli() } if 0 == ret.UpdatedAt { - ret.UpdatedAt = ret.CreatedAt + ret.UpdatedAt = ret.CreatedAt + 1000 } switch typ { From 455f348e913b576a2b21e8b0260a437019c87583 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 11:12:48 +0800 Subject: [PATCH 005/138] :art: Improve block ref search ID extraction https://github.com/siyuan-note/siyuan/issues/10848 --- kernel/model/search.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/kernel/model/search.go b/kernel/model/search.go index b29ae1ab30..e1a93c31cd 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -1045,8 +1045,8 @@ func removeLimitClause(stmt string) string { func fullTextSearchRefBlock(keyword string, beforeLen int, onlyDoc bool) (ret []*Block) { keyword = filterQueryInvisibleChars(keyword) - if ast.IsNodeIDPattern(keyword) { - ret, _, _ = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+keyword+"'", 36, 1, 32) + if id := extractID(keyword); "" != id { + ret, _, _ = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+id+"'", 36, 1, 32) return } @@ -1106,6 +1106,21 @@ func fullTextSearchRefBlock(keyword string, beforeLen int, onlyDoc bool) (ret [] return } +func extractID(content string) (ret string) { + if 22 > len(content) { + return + } + + // 从第一个字符开始循环,直到找到一个合法的 ID 为止 + for i := 0; i < len(content)-21; i++ { + if ast.IsNodeIDPattern(content[i : i+22]) { + ret = content[i : i+22] + return + } + } + return +} + func fullTextSearchByQuerySyntax(query, boxFilter, pathFilter, typeFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) { query = filterQueryInvisibleChars(query) if ast.IsNodeIDPattern(query) { From c2cd20436312fce5518c977e615fdce22dee93b2 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 11:13:48 +0800 Subject: [PATCH 006/138] :art: Improve block ref search ID extraction https://github.com/siyuan-note/siyuan/issues/10848 --- kernel/model/search.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/model/search.go b/kernel/model/search.go index e1a93c31cd..d36a500a9f 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -1107,6 +1107,8 @@ func fullTextSearchRefBlock(keyword string, beforeLen int, onlyDoc bool) (ret [] } func extractID(content string) (ret string) { + // Improve block ref search ID extraction https://github.com/siyuan-note/siyuan/issues/10848 + if 22 > len(content) { return } From d9c9b2dd6cea6c12899b9828078c998caa429210 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 15:05:32 +0800 Subject: [PATCH 007/138] :art: arrowdown --- app/src/block/popover.ts | 8 ++------ app/src/protyle/wysiwyg/keydown.ts | 33 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index 92e1272a8a..a4f33634b7 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -1,9 +1,5 @@ import {BlockPanel} from "./Panel"; -import { - hasClosestBlock, - hasClosestByAttribute, - hasClosestByClassName, -} from "../protyle/util/hasClosest"; +import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName,} from "../protyle/util/hasClosest"; import {fetchPost, fetchSyncPost} from "../util/fetch"; import {hideTooltip, showTooltip} from "../dialog/tooltip"; import {getIdFromSYProtocol, isLocalPath} from "../util/pathName"; @@ -177,7 +173,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => { if (!popoverTargetElement && linkElement && linkElement.getAttribute("data-href")?.startsWith("siyuan://blocks")) { popoverTargetElement = linkElement; } - if (!popoverTargetElement || window.siyuan.menus.menu?.data.isSameNode(popoverTargetElement)) { + if (!popoverTargetElement || (popoverTargetElement && window.siyuan.menus.menu.data?.isSameNode(popoverTargetElement))) { // 移动到弹窗的 loading 元素上,但经过 settimeout 后 loading 已经被移除了 // https://ld246.com/article/1673596577519/comment/1673767749885#comments let targetElement = target; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index f5cca53770..49069ccd6e 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -5,8 +5,11 @@ import { focusByRange, focusByWbr, getEditorRange, - getSelectionOffset, getSelectionPosition, - selectAll, setFirstNodeRange, setLastNodeRange, + getSelectionOffset, + getSelectionPosition, + selectAll, + setFirstNodeRange, + setLastNodeRange, } from "../util/selection"; import { hasClosestBlock, @@ -28,11 +31,7 @@ import { import {matchHotKey} from "../util/hotKey"; import {enter, softEnter} from "./enter"; import {fixTable} from "../util/table"; -import { - turnsIntoOneTransaction, turnsIntoTransaction, - updateBatchTransaction, - updateTransaction -} from "./transaction"; +import {turnsIntoOneTransaction, turnsIntoTransaction, updateBatchTransaction, updateTransaction} from "./transaction"; import {fontEvent} from "../toolbar/Font"; import {listIndent, listOutdent} from "./list"; import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename"; @@ -42,7 +41,8 @@ import {isLocalPath} from "../../util/pathName"; import {openBy, openFileById} from "../../editor/util"; /// #endif import { - alignImgCenter, alignImgLeft, + alignImgCenter, + alignImgLeft, commonHotkey, downSelect, duplicateBlock, @@ -674,6 +674,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } } if (event.key === "ArrowDown") { + if (nodeElement.isSameNode(protyle.wysiwyg.element.lastElementChild)) { + setLastNodeRange(getContenteditableElement(nodeEditableElement), range, false); + range.collapse(false) + event.stopPropagation(); + event.preventDefault(); + return; + } const foldElement = hasClosestByAttribute(range.startContainer, "fold", "1"); if (foldElement) { // 本身为折叠块 @@ -687,9 +694,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } focusBlock(nextElement); scrollCenter(protyle, nextElement); - } else { - setLastNodeRange(nodeEditableElement, range, false); - range.collapse(false) } event.stopPropagation(); event.preventDefault(); @@ -699,12 +703,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (nextFoldElement && nextFoldElement.getAttribute("fold") === "1") { focusBlock(nextFoldElement); scrollCenter(protyle, nextFoldElement); - } else { - setLastNodeRange(nodeEditableElement, range, false); - range.collapse(false) + event.stopPropagation(); + event.preventDefault(); } - event.stopPropagation(); - event.preventDefault(); } } return; From c5a4c620164dd94c680bff7ec4d197f66b00afb7 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 15:18:40 +0800 Subject: [PATCH 008/138] :art: Improve user guide https://ld246.com/article/1712117460760 --- .../20201204184532-3qm9l8n.sy | 84 +++---------------- .../20201204181006-7bkppue.sy | 52 +++--------- .../20211226123004-dplpw0o.sy | 51 ++--------- 3 files changed, 29 insertions(+), 158 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy index 646562c2a8..780987f901 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy @@ -6,7 +6,7 @@ "id": "20201204184532-3qm9l8n", "title": "Template snippet", "type": "doc", - "updated": "20240308162730" + "updated": "20240403151002" }, "Children": [ { @@ -214,7 +214,7 @@ "ListData": {}, "Properties": { "id": "20210104091444-mwbvc9m", - "updated": "20240308162730" + "updated": "20240403151002" }, "Children": [ { @@ -378,7 +378,8 @@ "Marker": "Kg==" }, "Properties": { - "id": "20210121193829-wfzsf6m" + "id": "20210121193829-wfzsf6m", + "updated": "20240403150956" }, "Children": [ { @@ -386,7 +387,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210131162138-7ufhbho", - "updated": "20210504093006" + "updated": "20240403150956" }, "Children": [ { @@ -400,40 +401,7 @@ }, { "Type": "NodeText", - "Data": "​: This function is used to query the " - }, - { - "Type": "NodeText", - "Data": "database" - }, - { - "Type": "NodeText", - "Data": ", and the return value is " - }, - { - "Type": "NodeText", - "Data": "a" - }, - { - "Type": "NodeText", - "Data": " list of blocks, and the parameter is " - }, - { - "Type": "NodeText", - "Data": "a" - }, - { - "Type": "NodeText", - "Data": " SQL statement: " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​: This function is used to query the database, and the return value is a list of blocks, please refer to the example below" } ] } @@ -447,7 +415,8 @@ "Marker": "Kg==" }, "Properties": { - "id": "20210504093232-vukp34t" + "id": "20210504093232-vukp34t", + "updated": "20240403151002" }, "Children": [ { @@ -455,7 +424,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210504093232-6wxl589", - "updated": "20210504093302" + "updated": "20240403151002" }, "Children": [ { @@ -469,40 +438,7 @@ }, { "Type": "NodeText", - "Data": "​: This function is used to query the " - }, - { - "Type": "NodeText", - "Data": "database" - }, - { - "Type": "NodeText", - "Data": ", and the return value is " - }, - { - "Type": "NodeText", - "Data": "a" - }, - { - "Type": "NodeText", - "Data": " list of spans, and the parameter is " - }, - { - "Type": "NodeText", - "Data": "a" - }, - { - "Type": "NodeText", - "Data": " SQL statement: " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​: This function is used to query the database, and the return value is a list of spans, please refer to the example below" } ] } diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy index 79f6a2339a..7e81f607f5 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy @@ -6,7 +6,7 @@ "id": "20201204181006-7bkppue", "title": "模板片段", "type": "doc", - "updated": "20240308162603" + "updated": "20240403150838" }, "Children": [ { @@ -236,7 +236,7 @@ "ListData": {}, "Properties": { "id": "20210104091309-gjkg3u5", - "updated": "20240308162603" + "updated": "20240403150838" }, "Children": [ { @@ -401,7 +401,8 @@ "Marker": "Kg==" }, "Properties": { - "id": "20210121193601-uwo8s5h" + "id": "20210121193601-uwo8s5h", + "updated": "20240403150712" }, "Children": [ { @@ -409,7 +410,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210131155558-ghlchbx", - "updated": "20210504092933" + "updated": "20240403150712" }, "Children": [ { @@ -423,24 +424,7 @@ }, { "Type": "NodeText", - "Data": "​:该函数用于查询" - }, - { - "Type": "NodeText", - "Data": "数据库" - }, - { - "Type": "NodeText", - "Data": ",返回值为 blocks 列表,参数为 SQL 语句:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​:该函数用于查询数据库,返回值为 blocks 列表,请参考下面的例子" } ] } @@ -454,7 +438,8 @@ "Marker": "Kg==" }, "Properties": { - "id": "20210504093313-4aoyxd0" + "id": "20210504093313-4aoyxd0", + "updated": "20240403150838" }, "Children": [ { @@ -462,7 +447,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20210504093313-ya53o58", - "updated": "20210504093332" + "updated": "20240403150838" }, "Children": [ { @@ -476,24 +461,7 @@ }, { "Type": "NodeText", - "Data": "​:该函数用于查询" - }, - { - "Type": "NodeText", - "Data": "数据库" - }, - { - "Type": "NodeText", - "Data": ",返回值为 spans 列表,参数为 SQL 语句:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​:该函数用于查询数据库,返回值为 spans 列表,请参考下面的例子" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy index 75063039be..83be92f376 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy @@ -5,7 +5,8 @@ "Properties": { "id": "20211226123004-dplpw0o", "title": "範本片段", - "updated": "20220605170337" + "type": "doc", + "updated": "20240403150944" }, "Children": [ { @@ -207,7 +208,7 @@ "ListData": {}, "Properties": { "id": "20211226123024-pjvw31z", - "updated": "20220605170337" + "updated": "20240403150944" }, "Children": [ { @@ -372,7 +373,7 @@ }, "Properties": { "id": "20211226123024-e42d7xq", - "updated": "20211228141606" + "updated": "20240403150942" }, "Children": [ { @@ -380,7 +381,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226123024-vxjdsno", - "updated": "20211228141606" + "updated": "20240403150942" }, "Children": [ { @@ -394,24 +395,7 @@ }, { "Type": "NodeText", - "Data": "​:該函數用於查詢" - }, - { - "Type": "NodeText", - "Data": "資料庫" - }, - { - "Type": "NodeText", - "Data": ",返回值為 blocks 列表,參數為 SQL 語句:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​:該函數用於查詢資料庫,返回值為 blocks 列表,請參考下面的例子" } ] } @@ -426,7 +410,7 @@ }, "Properties": { "id": "20211226123024-69kddle", - "updated": "20211228141602" + "updated": "20240403150944" }, "Children": [ { @@ -434,7 +418,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226123024-4qwyf3w", - "updated": "20211228141602" + "updated": "20240403150944" }, "Children": [ { @@ -448,24 +432,7 @@ }, { "Type": "NodeText", - "Data": "​:該函數用於查詢" - }, - { - "Type": "NodeText", - "Data": "資料庫" - }, - { - "Type": "NodeText", - "Data": ",返回值為 spans 列表,參數為 SQL 語句:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "code", - "TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}" - }, - { - "Type": "NodeText", - "Data": "​" + "Data": "​:該函數用於查詢資料庫,返回值為 spans 列表,請參考下面的例子" } ] } From 17670cab2a8c9c6665efc574aa3f7a83fded7991 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:43:45 +0800 Subject: [PATCH 009/138] =?UTF-8?q?[i18n]=20=E5=B0=86=E3=80=8C=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E3=80=8D=E6=94=B9=E4=B8=BA=E3=80=8C=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E4=B8=BA=E5=89=AF=E6=9C=AC=E3=80=8D=EF=BC=88=E5=8F=AA=E6=94=B9?= =?UTF-8?q?=E7=AE=80=E4=BD=93=E4=B8=AD=E6=96=87=EF=BC=89=20(#10854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [i18n] 将「重复」改为「复制为副本」 * Revert "[i18n] 将「重复」改为「复制为副本」" This reverts commit 908965710b74309042080eda61ec5db25b68acbf. * [i18n] 将「重复」改为「复制为副本」(只改简体中文) --- app/appearance/langs/zh_CN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 2111384a70..198da0c616 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -731,7 +731,7 @@ "sub": "下标", "enter": "聚焦", "enterBack": "聚焦到上层", - "duplicate": "重复", + "duplicate": "复制为副本", "turnInto": "转换为", "split": "分屏", "underline": "下划线", From ffe1431da51eea07731eb48310bb2d63a0eaa9d0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 16:01:48 +0800 Subject: [PATCH 010/138] :memo: Update changelogs --- app/changelogs/v3.0.7/v3.0.7.md | 31 ++++++++++++++++++++++++++ app/changelogs/v3.0.7/v3.0.7_zh_CHT.md | 31 ++++++++++++++++++++++++++ app/changelogs/v3.0.7/v3.0.7_zh_CN.md | 31 ++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 app/changelogs/v3.0.7/v3.0.7.md create mode 100644 app/changelogs/v3.0.7/v3.0.7_zh_CHT.md create mode 100644 app/changelogs/v3.0.7/v3.0.7_zh_CN.md diff --git a/app/changelogs/v3.0.7/v3.0.7.md b/app/changelogs/v3.0.7/v3.0.7.md new file mode 100644 index 0000000000..7b626be2c0 --- /dev/null +++ b/app/changelogs/v3.0.7/v3.0.7.md @@ -0,0 +1,31 @@ +## Overview + +This version fixes some bugs that affected general use. + +## Changelogs + +Below are the detailed changes in this version. + +### Enhancement + +* [Export PDF and add watermarks no longer covered by images](https://github.com/siyuan-note/siyuan/issues/10818) +* [Don't show floating window when editing ref](https://github.com/siyuan-note/siyuan/issues/10821) +* [Improve database template empty date rendering](https://github.com/siyuan-note/siyuan/issues/10830) +* [Document title supports `Paste as plain text`](https://github.com/siyuan-note/siyuan/issues/10832) +* [Generate document history when dragging outline](https://github.com/siyuan-note/siyuan/issues/10834) +* [`↓` Support jump to the end of the line](https://github.com/siyuan-note/siyuan/issues/10847) +* [Improve block ref search ID extraction](https://github.com/siyuan-note/siyuan/issues/10848) + +### Bugfix + +* [Outline drag function is abnormal](https://github.com/siyuan-note/siyuan/issues/10828) +* [Abnormal sorting of database relation fields](https://github.com/siyuan-note/siyuan/issues/10835) +* [Side panel auto hide on the mobile](https://github.com/siyuan-note/siyuan/issues/10837) +* [Database rollup calculation misses null values](https://github.com/siyuan-note/siyuan/issues/10843) +* [Last row misaligned after adjusting column width](https://github.com/siyuan-note/siyuan/issues/10844) +* [Unable to roll back document history](https://github.com/siyuan-note/siyuan/issues/10846) + +## Download + +* [B3log](https://b3log.org/siyuan/en/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) diff --git a/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md b/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md new file mode 100644 index 0000000000..26fdd0313a --- /dev/null +++ b/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md @@ -0,0 +1,31 @@ +## 概述 + +該版本修復了一些影響常規使用的缺陷。 + +## 變更記錄 + +以下是此版本中的詳細變更。 + +### 改進功能 + +* [匯出 PDF 新增浮水印不再被圖片覆蓋](https://github.com/siyuan-note/siyuan/issues/10818) +* [編輯引用時不顯示浮動視窗](https://github.com/siyuan-note/siyuan/issues/10821) +* [改進資料庫範本空日期渲染](https://github.com/siyuan-note/siyuan/issues/10830) +* [文件標題支援 `貼為純文字`](https://github.com/siyuan-note/siyuan/issues/10832) +* [拖曳大綱時產生文件歷史](https://github.com/siyuan-note/siyuan/issues/10834) +* [`↓` 支援跳到行尾](https://github.com/siyuan-note/siyuan/issues/10847) +* [改進區塊引用搜尋ID擷取](https://github.com/siyuan-note/siyuan/issues/10848) + +### 修復缺陷 + +* [大綱拖曳功能異常](https://github.com/siyuan-note/siyuan/issues/10828) +* [資料庫關聯欄位排序異常](https://github.com/siyuan-note/siyuan/issues/10835) +* [行動端側邊欄自動隱藏](https://github.com/siyuan-note/siyuan/issues/10837) +* [資料庫總計欄位計算遺漏空值](https://github.com/siyuan-note/siyuan/issues/10843) +* [調整列寬後最後一行未對齊](https://github.com/siyuan-note/siyuan/issues/10844) +* [無法回溯文件歷史](https://github.com/siyuan-note/siyuan/issues/10846) + +## 下載 + +* [B3log](https://b3log.org/siyuan/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) diff --git a/app/changelogs/v3.0.7/v3.0.7_zh_CN.md b/app/changelogs/v3.0.7/v3.0.7_zh_CN.md new file mode 100644 index 0000000000..8437eba7dc --- /dev/null +++ b/app/changelogs/v3.0.7/v3.0.7_zh_CN.md @@ -0,0 +1,31 @@ +## 概述 + +该版本修复了一些影响常规使用的缺陷。 + +## 变更记录 + +以下是此版本中的详细变更。 + +### 改进功能 + +* [导出 PDF 添加水印不再被图片覆盖](https://github.com/siyuan-note/siyuan/issues/10818) +* [编辑引用时不显示浮动窗口](https://github.com/siyuan-note/siyuan/issues/10821) +* [改进数据库模板空日期渲染](https://github.com/siyuan-note/siyuan/issues/10830) +* [文档标题支持 `粘贴为纯文本`](https://github.com/siyuan-note/siyuan/issues/10832) +* [拖动大纲时生成文档历史](https://github.com/siyuan-note/siyuan/issues/10834) +* [`↓` 支持跳转到行尾](https://github.com/siyuan-note/siyuan/issues/10847) +* [改进块引用搜索ID提取](https://github.com/siyuan-note/siyuan/issues/10848) + +### 修复缺陷 + +* [大纲拖动功能异常](https://github.com/siyuan-note/siyuan/issues/10828) +* [数据库关联字段排序异常](https://github.com/siyuan-note/siyuan/issues/10835) +* [移动端侧边栏自动隐藏](https://github.com/siyuan-note/siyuan/issues/10837) +* [数据库汇总字段计算遗漏空值](https://github.com/siyuan-note/siyuan/issues/10843) +* [调整列宽后最后一行未对齐](https://github.com/siyuan-note/siyuan/issues/10844) +* [无法回滚文档历史](https://github.com/siyuan-note/siyuan/issues/10846) + +## 下载 + +* [B3log](https://b3log.org/siyuan/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) From 27f0586d1f42fbb6a845fdf4403b7c808da1bd9c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 16:02:58 +0800 Subject: [PATCH 011/138] :bookmark: Release v3.0.7 --- .github/workflows/dockerimage.yml | 2 +- app/appx/AppxManifest.xml | 2 +- app/package.json | 2 +- kernel/util/working.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 4267c6ac16..08e9f18686 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -49,4 +49,4 @@ jobs: - name: Build the Docker image run: | - docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v3.0.6 . \ No newline at end of file + docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v3.0.7 . \ No newline at end of file diff --git a/app/appx/AppxManifest.xml b/app/appx/AppxManifest.xml index eb0308f76d..0b9be71c5c 100644 --- a/app/appx/AppxManifest.xml +++ b/app/appx/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="3.0.7.0"/> SiYuan 云南链滴科技有限公司 diff --git a/app/package.json b/app/package.json index 07c84e4050..b8e2c83b1a 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "SiYuan", - "version": "3.0.6", + "version": "3.0.7", "description": "Refactor your thinking", "homepage": "https://b3log.org/siyuan", "main": "./electron/main.js", diff --git a/kernel/util/working.go b/kernel/util/working.go index cef43399f0..d3941f7e90 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -43,7 +43,7 @@ import ( var Mode = "prod" const ( - Ver = "3.0.6" + Ver = "3.0.7" IsInsider = false ) From 5807ce7d3525391c4b117acce8f9cd139ee272af Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 16:04:13 +0800 Subject: [PATCH 012/138] :bookmark: Release v3.0.7 --- app/src/boot/globalEvent/click.ts | 8 ++++---- app/src/layout/dock/Outline.ts | 2 +- app/src/mobile/util/touch.ts | 16 ++++++---------- app/src/protyle/wysiwyg/index.ts | 2 +- app/src/protyle/wysiwyg/keydown.ts | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/src/boot/globalEvent/click.ts b/app/src/boot/globalEvent/click.ts index 6ba8c45207..7e0a51bb42 100644 --- a/app/src/boot/globalEvent/click.ts +++ b/app/src/boot/globalEvent/click.ts @@ -6,13 +6,13 @@ import {writeText} from "../../protyle/util/compatibility"; import {showMessage} from "../../dialog/message"; export const globalClick = (event: MouseEvent & { target: HTMLElement }) => { - const ghostElement = document.getElementById("dragGhost") + const ghostElement = document.getElementById("dragGhost"); if (ghostElement) { - const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement - startElement ? startElement.style.opacity = "" : "" + const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement; + startElement ? startElement.style.opacity = "" : ""; ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => { item.classList.remove("dragover__top", "dragover__bottom", "dragover"); - item.style.opacity = "" + item.style.opacity = ""; }); ghostElement.remove(); } diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 05a330d749..bf34eec9eb 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -234,7 +234,7 @@ export class Outline extends Model { } const documentSelf = document; documentSelf.ondragstart = () => false; - let ghostElement: HTMLElement + let ghostElement: HTMLElement; let selectItem: HTMLElement; documentSelf.onmousemove = (moveEvent: MouseEvent) => { if (moveEvent.clientY === event.clientY && moveEvent.clientX === event.clientX) { diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 667c295cb1..552b966251 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -1,8 +1,4 @@ -import { - hasClosestByAttribute, - hasClosestByClassName, - hasTopClosestByClassName, -} from "../../protyle/util/hasClosest"; +import {hasClosestByAttribute, hasClosestByClassName, hasTopClosestByClassName,} from "../../protyle/util/hasClosest"; import {closeModel, closePanel} from "./closePanel"; import {popMenu} from "../menu"; import {activeBlur, hideKeyboardToolbar} from "./keyboardToolbar"; @@ -160,7 +156,7 @@ export const handleTouchStart = (event: TouchEvent) => { }; let previousClientX: number; -const sideMaskElement = document.querySelector(".side-mask") as HTMLElement +const sideMaskElement = document.querySelector(".side-mask") as HTMLElement; export const handleTouchMove = (event: TouchEvent) => { const target = event.target as HTMLElement; if (!clientX || !clientY || @@ -189,15 +185,15 @@ export const handleTouchMove = (event: TouchEvent) => { // 上下滚动防止左右滑动 if (!firstXY) { if (Math.abs(xDiff) > Math.abs(yDiff)) { - firstXY = "x" + firstXY = "x"; } else { - firstXY = "y" + firstXY = "y"; } if (firstXY === "x") { if ((hasClosestByAttribute(target, "id", "menu") && firstDirection === "toLeft") || (hasClosestByAttribute(target, "id", "sidebar") && firstDirection === "toRight")) { - firstXY = "y" - yDiff = undefined + firstXY = "y"; + yDiff = undefined; } } } diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index c3f145835e..bcc169aae1 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -420,7 +420,7 @@ export class WYSIWYG { documentSelf.onmousemove = (moveEvent: MouseEvent) => { newWidth = Math.max(oldWidth + (moveEvent.clientX - event.clientX), 25); scrollElement.querySelectorAll(".av__row, .av__row--footer").forEach(item => { - const cellElement = item.querySelector(`[data-col-id="${dragColId}"]`) as HTMLElement + const cellElement = item.querySelector(`[data-col-id="${dragColId}"]`) as HTMLElement; if (cellElement.previousElementSibling) { cellElement.style.width = newWidth + "px"; } else { diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 49069ccd6e..50bd50bead 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -676,7 +676,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (event.key === "ArrowDown") { if (nodeElement.isSameNode(protyle.wysiwyg.element.lastElementChild)) { setLastNodeRange(getContenteditableElement(nodeEditableElement), range, false); - range.collapse(false) + range.collapse(false); event.stopPropagation(); event.preventDefault(); return; From d0fbace122f786c181c0fd5f6fc0a39e6999b762 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 16:04:47 +0800 Subject: [PATCH 013/138] :bookmark: Release v3.0.7 --- app/changelogs/v3.0.7/v3.0.7_zh_CHT.md | 2 +- app/changelogs/v3.0.7/v3.0.7_zh_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md b/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md index 26fdd0313a..202d429ea7 100644 --- a/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md +++ b/app/changelogs/v3.0.7/v3.0.7_zh_CHT.md @@ -14,7 +14,7 @@ * [文件標題支援 `貼為純文字`](https://github.com/siyuan-note/siyuan/issues/10832) * [拖曳大綱時產生文件歷史](https://github.com/siyuan-note/siyuan/issues/10834) * [`↓` 支援跳到行尾](https://github.com/siyuan-note/siyuan/issues/10847) -* [改進區塊引用搜尋ID擷取](https://github.com/siyuan-note/siyuan/issues/10848) +* [改進區塊引用搜尋 ID 擷取](https://github.com/siyuan-note/siyuan/issues/10848) ### 修復缺陷 diff --git a/app/changelogs/v3.0.7/v3.0.7_zh_CN.md b/app/changelogs/v3.0.7/v3.0.7_zh_CN.md index 8437eba7dc..fa5c81774e 100644 --- a/app/changelogs/v3.0.7/v3.0.7_zh_CN.md +++ b/app/changelogs/v3.0.7/v3.0.7_zh_CN.md @@ -14,7 +14,7 @@ * [文档标题支持 `粘贴为纯文本`](https://github.com/siyuan-note/siyuan/issues/10832) * [拖动大纲时生成文档历史](https://github.com/siyuan-note/siyuan/issues/10834) * [`↓` 支持跳转到行尾](https://github.com/siyuan-note/siyuan/issues/10847) -* [改进块引用搜索ID提取](https://github.com/siyuan-note/siyuan/issues/10848) +* [改进块引用搜索 ID 提取](https://github.com/siyuan-note/siyuan/issues/10848) ### 修复缺陷 From 193993d11095744c183fa361797a3d897a44d780 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:40:30 +0800 Subject: [PATCH 014/138] =?UTF-8?q?[i18n]=20=E5=B0=86=E3=80=8C=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E3=80=8D=E6=94=B9=E4=B8=BA=E3=80=8C=E6=8E=92?= =?UTF-8?q?=E7=89=88=E3=80=8D=20(#10859)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/appearance/langs/zh_CHT.json | 14 +++++++------- app/appearance/langs/zh_CN.json | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 9fc0d5fd2c..3b987573b4 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -437,13 +437,13 @@ "downloaded": "已下載", "allOp": "所有操作", "allNotebooks": "所有筆記本", - "historyClean": "清理  (clean)", - "historyUpdate": "更新  (update)", - "historyDelete": "刪除  (delete)", - "historyFormat": "格式化 (format)", - "historySync": "同步  (sync)", - "historyReplace": "替換  (replace)", - "historyOutline": "大綱  (outline)", + "historyClean": "清理 (clean)", + "historyUpdate": "更新 (update)", + "historyDelete": "刪除 (delete)", + "historyFormat": "排版 (format)", + "historySync": "同步 (sync)", + "historyReplace": "替換 (replace)", + "historyOutline": "大綱 (outline)", "htmlBlockError": "以下 script 執行會影響界面顯示,已經停止運行該腳本", "fileHistory": "文件歷史", "htmlBlockTip": "形成了多個 HTML 塊,為防止資料丟失請使用 <div> 標籤包裹並去掉空行", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 198da0c616..b65bcba0bb 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -437,13 +437,13 @@ "downloaded": "已下载", "allOp": "所有操作", "allNotebooks": "所有笔记本", - "historyClean": "清理  (clean)", - "historyUpdate": "更新  (update)", - "historyDelete": "删除  (delete)", - "historyFormat": "格式化 (format)", - "historySync": "同步  (sync)", - "historyReplace": "替换  (replace)", - "historyOutline": "大纲  (outline)", + "historyClean": "清理 (clean)", + "historyUpdate": "更新 (update)", + "historyDelete": "删除 (delete)", + "historyFormat": "排版 (format)", + "historySync": "同步 (sync)", + "historyReplace": "替换 (replace)", + "historyOutline": "大纲 (outline)", "htmlBlockError": "以下 script 执行会影响界面显示,已经停止运行该脚本", "fileHistory": "文件历史", "htmlBlockTip": "形成了多个 HTML 块,为防止数据丢失请使用 <div> 标签包裹并去掉空行", From be67ffa288afe7066f2e6b6db6702b6db15c807f Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 21:17:54 +0800 Subject: [PATCH 015/138] :art: Auto verify the database name when clicking the block superscript icon https://github.com/siyuan-note/siyuan/issues/10861 --- kernel/model/attribute_view.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index ffd62d553f..e99d1bdcbb 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -289,6 +289,13 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) { return } + if !attrView.ExistBlock(blockID) { + // 比如剪切后粘贴,块 ID 会变,但是属性还在块上,这里做一次数据订正 + // Auto verify the database name when clicking the block superscript icon https://github.com/siyuan-note/siyuan/issues/10861 + unbindBlockAv(nil, avID, blockID) + return + } + var keyValues []*av.KeyValues for _, kv := range attrView.KeyValues { kValues := &av.KeyValues{Key: kv.Key} From 16dd27d6561988e1543fcce466345ab964082991 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 21:18:45 +0800 Subject: [PATCH 016/138] :art: Remove legacy incorrect history data --- kernel/model/conf.go | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/model/conf.go b/kernel/model/conf.go index c2cac4b807..a7a6fb1bc5 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -986,6 +986,7 @@ func clearWorkspaceTemp() { os.RemoveAll(filepath.Join(util.DataDir, ".siyuan", "history")) os.RemoveAll(filepath.Join(util.WorkspaceDir, "backup")) os.RemoveAll(filepath.Join(util.WorkspaceDir, "sync")) + os.RemoveAll(filepath.Join(util.DataDir, "%")) // v3.0.6 生成的错误历史文件夹 logging.LogInfof("cleared workspace temp") } From 60e2b51763ac92ed9411291e2365b19a07317093 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 21:32:00 +0800 Subject: [PATCH 017/138] :art: https://github.com/siyuan-note/siyuan/issues/10828 --- app/src/layout/dock/Outline.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index bf34eec9eb..4e3f636c42 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -237,7 +237,7 @@ export class Outline extends Model { let ghostElement: HTMLElement; let selectItem: HTMLElement; documentSelf.onmousemove = (moveEvent: MouseEvent) => { - if (moveEvent.clientY === event.clientY && moveEvent.clientX === event.clientX) { + if (moveEvent.clientY === event.clientY && moveEvent.clientX === event.clientX || this.element.getAttribute("data-loading") === "true") { return; } moveEvent.preventDefault(); @@ -310,6 +310,7 @@ export class Outline extends Model { previousID = selectItem.getAttribute("data-node-id"); selectItem.after(item); } + this.element.setAttribute("data-loading", "true"); transaction(editItem.editor.protyle, [{ action: "moveOutlineHeading", id: item.dataset.nodeId, @@ -469,5 +470,6 @@ export class Outline extends Model { currentElement.classList.add("b3-list-item--focus"); } } + this.element.removeAttribute("data-loading") } } From 24363ad7171bbe54ed910de9824ea018a3ebd4c9 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 21:33:53 +0800 Subject: [PATCH 018/138] :art: Refresh the corresponding rollup after deleting rows from the database https://github.com/siyuan-note/siyuan/issues/10858 --- kernel/av/relation.go | 3 +++ kernel/model/attribute_view.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/kernel/av/relation.go b/kernel/av/relation.go index 28a4eb1f3c..7d6ccdab96 100644 --- a/kernel/av/relation.go +++ b/kernel/av/relation.go @@ -41,6 +41,9 @@ func GetSrcAvIDs(destAvID string) []string { if nil == srcAvIDs { return nil } + + // 排除自己 + srcAvIDs = gulu.Str.RemoveElem(srcAvIDs, destAvID) return srcAvIDs } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index e99d1bdcbb..ce9fa5b1f0 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2186,6 +2186,11 @@ func removeAttributeViewBlock(srcIDs []string, avID string, tx *Transaction) (er } } + relatedAvIDs := av.GetSrcAvIDs(avID) + for _, relatedAvID := range relatedAvIDs { + util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": relatedAvID}) + } + err = av.SaveAttributeView(attrView) return } From e6591d9e43b16d0450f3fdfe0e7ca4849f17d651 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 23:06:07 +0800 Subject: [PATCH 019/138] :art: https://github.com/siyuan-note/siyuan/issues/10818 --- app/appearance/langs/en_US.json | 1 + app/appearance/langs/es_ES.json | 1 + app/appearance/langs/fr_FR.json | 1 + app/appearance/langs/zh_CHT.json | 1 + app/appearance/langs/zh_CN.json | 1 + app/src/config/exportConfig.ts | 5 ++++- 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index c12fc3b1fa..f948870f35 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -989,6 +989,7 @@ "fileTree19": "Some operating systems have technical limitations that may prevent manual copying of workspace data after creating sub-documents greater than 7 levels", "fileTree20": "Save with a single line", "fileTree21": "After enabling, the single-line JSON format will be used when saving .sy docs and database .json files, which can reduce the file size by about 30% and improve read and write efficiency by 50%", + "export10": "For example <span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\">SiYuan</span>, if empty, use watermark text or watermark file path.", "export11": "Content handling method of content ref block when exporting", "export12": "Content handling method of content embed block when exporting", "export13": "Anchor text wrapping symbol", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index d72faf4ef6..3c5ede9dba 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -989,6 +989,7 @@ "fileTree19": "Algunos sistemas operativos tienen limitaciones técnicas que pueden impedir la copia manual de los datos del espacio de trabajo después de crear subdocumentos de más de 7 niveles", "fileTree20": "Guardar con una sola línea", "fileTree21": "Después de habilitarlo, se utilizará el formato JSON de una sola línea al guardar documentos .sy y archivos .json de bases de datos, lo que puede reducir el tamaño del archivo en aproximadamente un 30 % y mejorar la eficiencia de lectura y escritura en un 50 %.", + "export10": "Por ejemplo <span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\">SiYuan</span>, si está vacío, utilice texto de marca de agua o ruta del archivo de marca de agua.", "export11": "Método de manejo de contenido del bloque de referencia de contenido al exportar", "export12": "Método de manejo de contenido del bloque de incrustación de contenido al exportar", "export13": "Símbolo de envoltura de texto ancla", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 2f32377348..10aa4d9a67 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -989,6 +989,7 @@ "fileTree19": "Certains systèmes d'exploitation ont des limitations techniques qui peuvent empêcher la copie manuelle des données de l'espace de travail après la création de sous-documents supérieurs à 7 niveaux", "fileTree20": "Enregistrer avec une seule ligne", "fileTree21": "Après activation, le format JSON sur une seule ligne sera utilisé lors de l'enregistrement des documents .sy et des fichiers .json de base de données, ce qui peut réduire la taille du fichier d'environ 30 % et améliorer l'efficacité de lecture et d'écriture de 50 %", + "export10": "Par exemple <span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\">SiYuan</span>, s'il est vide, utilisez le texte du filigrane ou le chemin du fichier du filigrane.", "export11": "Traitement du contenu des blocs de référence lors de l'exportation", "export12": "Gestion du contenu des blocs intégrés lors de l'exportation", "export13": "Symbole d'enveloppement du texte d'ancrage", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 3b987573b4..4213ba3791 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -989,6 +989,7 @@ "fileTree19": "一些操作系統存在技術限制導致建立大於 7 層的子文檔後可能無法正常手動複製工作空間資料", "fileTree20": "使用單行保存", "fileTree21": "啟用後儲存 .sy 文件和資料庫 .json 時將使用單行 JSON 格式,大約能減少 30% 檔案大小並提升 50% 讀寫效率", + "export10": "例如 <span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\">SiYuan</span> ,為空時使用水印文字或浮水印檔案路徑。", "export11": "匯出時關於引用塊內容的處理方式", "export12": "匯出時關於嵌入塊內容的處理方式", "export13": "錨文字包裹符號", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index b65bcba0bb..197eb8aac9 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -989,6 +989,7 @@ "fileTree19": "一些操作系统存在技术限制导致创建大于 7 层的子文档后可能无法正常手动复制工作空间数据", "fileTree20": "使用单行保存", "fileTree21": "启用后保存 .sy 文档和数据库 .json 时将使用单行 JSON 格式,大约能减少 30% 文件大小并提升 50% 读写效率", + "export10": "例如 <span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\">SiYuan</span> ,为空时使用水印文本或水印文件路径。", "export11": "导出时关于引用块内容的处理方式", "export12": "导出时关于嵌入块内容的处理方式", "export13": "锚文本包裹符号", diff --git a/app/src/config/exportConfig.ts b/app/src/config/exportConfig.ts index f25b5e8959..a9f6f9a010 100644 --- a/app/src/config/exportConfig.ts +++ b/app/src/config/exportConfig.ts @@ -94,7 +94,10 @@ export const exportConfig = {
-
${window.siyuan.languages.export29}
+
+ ${window.siyuan.languages.export29}
+ ${window.siyuan.languages.export10} +
From ffc8b41c50d9fd804bc2e95651520ae072a2d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F=E9=A3=9E=E5=90=8C=E5=AD=A6?= <61930212+tengfei-xy@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:23:57 +0800 Subject: [PATCH 020/138] =?UTF-8?q?=E4=BF=AE=E6=94=B9exportResources?= =?UTF-8?q?=E8=BF=99=E4=B8=AAAPI=E7=9A=84=E5=8F=82=E6=95=B0=20(#10855)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修改exportResources这个API,使得能够同时识别path和paths参数 * 修改exportResources这个API的说明文档 * 设定exportResources这个API的paths参数是必须的 * 重新修改exportResources的参数示例 * 设定exportResources这个API的返回值为1 --- kernel/api/export.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/api/export.go b/kernel/api/export.go index 9acb9f0f69..e0b46dbdc3 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -283,11 +283,16 @@ func exportResources(c *gin.Context) { name = time.Now().Format("export-2006-01-02_15-04-05") // 生成的 *.zip 文件主文件名 } + if arg["paths"] == nil { + ret.Code = 1 + ret.Data = "" + ret.Msg = "paths is required" + return + } + var resourcePaths []string // 文件/文件夹在工作空间中的路径 - if nil != arg["paths"] { - for _, resourcePath := range arg["paths"].([]interface{}) { - resourcePaths = append(resourcePaths, resourcePath.(string)) - } + for _, resourcePath := range arg["paths"].([]interface{}) { + resourcePaths = append(resourcePaths, resourcePath.(string)) } zipFilePath, err := model.ExportResources(resourcePaths, name) From 8815e361f5ea70b78405f410953c1f34f1f2a85f Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Apr 2024 23:25:47 +0800 Subject: [PATCH 021/138] :art: Clean code https://github.com/siyuan-note/siyuan/pull/10855 --- kernel/api/export.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/api/export.go b/kernel/api/export.go index e0b46dbdc3..7657b277f7 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -283,7 +283,7 @@ func exportResources(c *gin.Context) { name = time.Now().Format("export-2006-01-02_15-04-05") // 生成的 *.zip 文件主文件名 } - if arg["paths"] == nil { + if nil == arg["paths"] { ret.Code = 1 ret.Data = "" ret.Msg = "paths is required" From 200fce90e804d85b6c37acde3b6c0fbb3d93d705 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 23:40:43 +0800 Subject: [PATCH 022/138] =?UTF-8?q?:art:=20=E4=BF=AE=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E5=90=8E=E6=9B=B4=E6=96=B0=E5=88=97=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E3=80=82=E5=90=8D=E5=AD=97=E4=BC=9A=E8=A2=AB=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E4=BB=A5=E5=89=8D=E7=9A=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/col.ts | 34 +++++++++++----------- app/src/protyle/render/av/openMenuPanel.ts | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 4ba4bd57b4..956ab62670 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -216,21 +216,21 @@ export const getEditHTML = (options: { ${window.siyuan.languages.edit} - ${genUpdateColItem("text", colData.type, colData.name)} - ${genUpdateColItem("number", colData.type, colData.name)} - ${genUpdateColItem("select", colData.type, colData.name)} - ${genUpdateColItem("mSelect", colData.type, colData.name)} - ${genUpdateColItem("date", colData.type, colData.name)} - ${genUpdateColItem("mAsset", colData.type, colData.name)} - ${genUpdateColItem("checkbox", colData.type, colData.name)} - ${genUpdateColItem("url", colData.type, colData.name)} - ${genUpdateColItem("email", colData.type, colData.name)} - ${genUpdateColItem("phone", colData.type, colData.name)} - ${genUpdateColItem("template", colData.type, colData.name)} - ${genUpdateColItem("relation", colData.type, colData.name)} - ${genUpdateColItem("rollup", colData.type, colData.name)} - ${genUpdateColItem("created", colData.type, colData.name)} - ${genUpdateColItem("updated", colData.type, colData.name)} + ${genUpdateColItem("text", colData.type)} + ${genUpdateColItem("number", colData.type)} + ${genUpdateColItem("select", colData.type)} + ${genUpdateColItem("mSelect", colData.type)} + ${genUpdateColItem("date", colData.type)} + ${genUpdateColItem("mAsset", colData.type)} + ${genUpdateColItem("checkbox", colData.type)} + ${genUpdateColItem("url", colData.type)} + ${genUpdateColItem("email", colData.type)} + ${genUpdateColItem("phone", colData.type)} + ${genUpdateColItem("template", colData.type)} + ${genUpdateColItem("relation", colData.type)} + ${genUpdateColItem("rollup", colData.type)} + ${genUpdateColItem("created", colData.type)} + ${genUpdateColItem("updated", colData.type)} `; }; @@ -850,8 +850,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen } }; -const genUpdateColItem = (type: TAVCol, oldType: TAVCol, name: string) => { - return ``; @@ -34,6 +35,7 @@ export const initMessage = () => { // type: info/error; timeout: 0 手动关闭;-1 用不关闭 export const showMessage = (message: string, timeout = 6000, type = "info", messageId?: string) => { + window.sout.tracker("invoked"); const messagesElement = document.getElementById("message").firstElementChild; if (!messagesElement) { alert(message); @@ -86,6 +88,7 @@ export const showMessage = (message: string, timeout = 6000, type = "info", mess }; export const hideMessage = (id?: string) => { + window.sout.tracker("invoked"); const messagesElement = document.getElementById("message").firstElementChild; if (!messagesElement) { return; diff --git a/app/src/dialog/moveResize.ts b/app/src/dialog/moveResize.ts index f89956bb63..946e9bfd23 100644 --- a/app/src/dialog/moveResize.ts +++ b/app/src/dialog/moveResize.ts @@ -4,6 +4,7 @@ import {hideAllElements} from "../protyle/ui/hideElements"; import {setStorageVal} from "../protyle/util/compatibility"; export const moveResize = (element: HTMLElement, afterCB?: (type: string) => void) => { + window.sout.tracker("invoked"); element.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => { // https://github.com/siyuan-note/siyuan/issues/8746 if (hasClosestByClassName(event.target, "protyle-util") && !element.classList.contains("protyle-util")) { diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index 561cf8bea5..f2fc2852f5 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -26,6 +26,7 @@ import {isInAndroid, isInIOS, setStorageVal} from "../protyle/util/compatibility import {Plugin} from "../plugin"; const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => { + window.sout.tracker("invoked"); fetchPost("/api/block/getDocInfo", { id: rootID }, (response) => { @@ -37,6 +38,7 @@ const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => { }; export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRootIDs: string[] }, hideMsg = true) => { + window.sout.tracker("invoked"); if (hideMsg) { hideMessage(); } @@ -134,6 +136,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot }; export const lockScreen = (app: App) => { + window.sout.tracker("invoked"); if (window.siyuan.config.readonly) { return; } @@ -151,6 +154,7 @@ export const lockScreen = (app: App) => { }; export const kernelError = () => { + window.sout.tracker("invoked"); if (document.querySelector("#errorLog")) { return; } @@ -188,6 +192,7 @@ export const kernelError = () => { export const exitSiYuan = () => { + window.sout.tracker("invoked"); const overlay = document.querySelector('#SillotOverlay') as HTMLElement; overlay.style.display = "block"; exportIDB().then(() => { @@ -257,6 +262,7 @@ export const exitSiYuan = () => { }; export const transactionError = () => { + window.sout.tracker("invoked"); if (document.getElementById("transactionError")) { return; } @@ -291,6 +297,7 @@ export const transactionError = () => { }; export const progressStatus = (data: IWebSocketData) => { + // window.sout.tracker("invoked"); // 这里调用频繁 const statusElement = document.querySelector("#status") as HTMLElement; if (!statusElement) { return; @@ -311,6 +318,7 @@ export const progressStatus = (data: IWebSocketData) => { }; export const progressLoading = (data: IWebSocketData) => { + window.sout.tracker("invoked"); let progressElement = document.getElementById("progress"); if (!progressElement) { document.body.insertAdjacentHTML("beforeend", `
`); @@ -342,6 +350,7 @@ export const progressLoading = (data: IWebSocketData) => { }; export const progressBackgroundTask = (tasks: { action: string }[]) => { + // window.sout.tracker("invoked"); // 这里调用频繁 const backgroundTaskElement = document.querySelector(".status__backgroundtask"); if (!backgroundTaskElement) { return; @@ -360,6 +369,7 @@ export const progressBackgroundTask = (tasks: { action: string }[]) => { }; export const bootSync = () => { + window.sout.tracker("invoked"); fetchPost("/api/sync/getBootSync", {}, response => { if (response.code === 1) { const dialog = new Dialog({ @@ -393,6 +403,7 @@ export const bootSync = () => { }; export const setTitle = (title: string) => { + window.sout.tracker("invoked"); const dragElement = document.getElementById("drag"); const workspaceName = getWorkspaceName(); if (title === window.siyuan.languages.siyuanNote) { @@ -414,6 +425,7 @@ export const setTitle = (title: string) => { }; export const downloadProgress = (data: { id: string, percent: number }) => { + window.sout.tracker("invoked"); const bazzarSideElement = document.querySelector("#configBazaarReadme .item__side"); if (!bazzarSideElement) { return; @@ -436,6 +448,7 @@ export const downloadProgress = (data: { id: string, percent: number }) => { }; export const processSync = (data?: IWebSocketData, plugins?: Plugin[]) => { + window.sout.tracker("invoked"); /// #if MOBILE const menuSyncUseElement = document.querySelector("#menuSyncNow use"); const barSyncUseElement = document.querySelector("#toolbarSync use"); diff --git a/app/src/editor/deleteFile.ts b/app/src/editor/deleteFile.ts index 1832cc5ff6..178bfb14ea 100644 --- a/app/src/editor/deleteFile.ts +++ b/app/src/editor/deleteFile.ts @@ -7,6 +7,7 @@ import {showMessage} from "../dialog/message"; import {escapeHtml} from "../util/escape"; export const deleteFile = (notebookId: string, pathString: string) => { + window.sout.tracker("invoked"); if (window.siyuan.config.fileTree.removeDocWithoutConfirm) { fetchPost("/api/filetree/removeDoc", { notebook: notebookId, @@ -32,6 +33,7 @@ export const deleteFile = (notebookId: string, pathString: string) => { }; export const deleteFiles = (liElements: Element[]) => { + window.sout.tracker("invoked"); if (liElements.length === 1) { const itemTopULElement = hasTopClosestByTag(liElements[0], "UL"); if (itemTopULElement) { diff --git a/app/src/editor/getIcon.ts b/app/src/editor/getIcon.ts index a2dedeff96..13c9fc015d 100644 --- a/app/src/editor/getIcon.ts +++ b/app/src/editor/getIcon.ts @@ -1,4 +1,5 @@ export const getIconByType = (type: string, sub?: string) => { + // window.sout.tracker("invoked"); // 这里调用频繁 let iconName = ""; switch (type) { case "NodeDocument": diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts index 2a77c1af9f..3e4ba8b788 100644 --- a/app/src/editor/rename.ts +++ b/app/src/editor/rename.ts @@ -10,6 +10,7 @@ import {Constants} from "../constants"; import {showTooltip} from "../dialog/tooltip"; export const validateName = (name: string, targetElement?: HTMLElement) => { + window.sout.tracker("invoked"); if (/\r\n|\r|\n|\u2028|\u2029|\t|\//.test(name)) { if (targetElement) { showTooltip(window.siyuan.languages.fileNameRule, targetElement, true); @@ -30,10 +31,12 @@ export const validateName = (name: string, targetElement?: HTMLElement) => { }; export const replaceFileName = (name: string) => { + window.sout.tracker("invoked"); return name.replace(/\r\n|\r|\n|\u2028|\u2029|\t|\//g, "").substring(0, Constants.SIZE_TITLE); }; export const replaceLocalPath = (name: string) => { + window.sout.tracker("invoked"); return name.replace(/\\\\|\/|"|:|\*|\?|\\|'|<|>|\|/g, ""); }; @@ -44,6 +47,7 @@ export const rename = (options: { type: "notebook" | "file" range?: Range, }) => { + window.sout.tracker("invoked"); if (window.siyuan.config.readonly) { return; } @@ -105,6 +109,7 @@ export const rename = (options: { }; export const renameAsset = (assetPath: string) => { + window.sout.tracker("invoked"); const dialog = new Dialog({ title: window.siyuan.languages.rename, content: `
@@ -137,6 +142,7 @@ export const renameAsset = (assetPath: string) => { }; export const newFileContentBySelect = (protyle: IProtyle) => { + window.sout.tracker("invoked"); if (getSelection().rangeCount === 0) { return; } diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index f8e641576e..3eb003a10c 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -40,6 +40,7 @@ export const openFileById = async (options: { removeCurrentTab?: boolean afterOpen?: () => void }) => { + window.sout.tracker("invoked"); const response = await fetchSyncPost("/api/block/getBlockInfo", {id: options.id}); if (response.code === -1) { return; @@ -65,6 +66,7 @@ export const openFileById = async (options: { }; export const openAsset = (app: App, assetPath: string, page: number | string, position?: string) => { + window.sout.tracker("invoked"); const suffix = pathPosix().extname(assetPath.split("?page")[0]); if (!Constants.SIYUAN_ASSETS_EXTS.includes(suffix)) { return; @@ -79,6 +81,7 @@ export const openAsset = (app: App, assetPath: string, page: number | string, po }; export const openFile = async (options: IOpenFileOptions) => { + window.sout.tracker("invoked"); if (typeof options.removeCurrentTab === "undefined") { options.removeCurrentTab = true; } @@ -298,6 +301,7 @@ export const openFile = async (options: IOpenFileOptions) => { // 没有初始化的页签无法检测到 const getUnInitTab = (options: IOpenFileOptions) => { + window.sout.tracker("invoked"); return getAllTabs().find(item => { const initData = item.headElement?.getAttribute("data-initdata"); if (initData) { @@ -323,6 +327,7 @@ const getUnInitTab = (options: IOpenFileOptions) => { }; const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IModels) => { + window.sout.tracker("invoked"); if (options.keepCursor) { editor.parent.headElement.setAttribute("keep-cursor", options.id); return true; @@ -385,6 +390,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod }; const newTab = (options: IOpenFileOptions) => { + window.sout.tracker("invoked"); let tab: Tab; if (options.assetPath) { const suffix = pathPosix().extname(options.assetPath.split("?page")[0]); @@ -496,6 +502,7 @@ export const updatePanelByEditor = (options: { reload: boolean, resize: boolean }) => { + window.sout.tracker("invoked"); if (options.protyle && options.protyle.path) { // https://ld246.com/article/1637636106054/comment/1641485541929#comments if (options.protyle.element.classList.contains("fn__none") || @@ -543,6 +550,7 @@ export const updatePanelByEditor = (options: { }; export const isCurrentEditor = (blockId: string) => { + window.sout.tracker("invoked"); const activeElement = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus"); if (activeElement) { const tab = getInstanceById(activeElement.getAttribute("data-id")); @@ -558,6 +566,7 @@ export const isCurrentEditor = (blockId: string) => { }; export const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => { + window.sout.tracker("invoked"); models.outline.find(item => { if (reload || (item.type === "pin" && (!protyle || item.blockId !== protyle.block?.rootID))) { let blockId = ""; @@ -599,6 +608,7 @@ export const updateOutline = (models: IModels, protyle: IProtyle, reload = false }; export const updateBacklinkGraph = (models: IModels, protyle: IProtyle) => { + window.sout.tracker("invoked"); // https://ld246.com/article/1637636106054/comment/1641485541929#comments if (protyle?.element.classList.contains("fn__none") || (protyle && !hasClosestByClassName(protyle.element, "layout__wnd--active") && @@ -653,6 +663,7 @@ export const updateBacklinkGraph = (models: IModels, protyle: IProtyle) => { }; export const openBy = (url: string, type: "folder" | "app") => { + window.sout.tracker("invoked"); /// #if !BROWSER if (url.startsWith("assets/")) { fetchPost("/api/asset/resolveAssetPath", {path: url.replace(/\.pdf\?page=\d{1,}$/, ".pdf")}, (response) => { diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts index 57f51fcd15..6eb8bf2b80 100644 --- a/app/src/emoji/index.ts +++ b/app/src/emoji/index.ts @@ -12,6 +12,7 @@ import {Dialog} from "../dialog"; import {setPosition} from "../util/setPosition"; export const getRandomEmoji = () => { + window.sout.tracker("invoked"); const emojis = window.siyuan.emojis[getRandom(0, window.siyuan.emojis.length - 1)]; if (typeof emojis.items[getRandom(0, emojis.items.length - 1)] === "undefined") { return "1f600"; @@ -20,6 +21,7 @@ export const getRandomEmoji = () => { }; export const unicode2Emoji = (unicode: string, className = "", needSpan = false, lazy = false) => { + window.sout.tracker("invoked"); if (!unicode) { return ""; } @@ -47,6 +49,7 @@ export const unicode2Emoji = (unicode: string, className = "", needSpan = false, }; export const lazyLoadEmoji = (element: HTMLElement) => { + window.sout.tracker("invoked"); const emojiIntersectionObserver = new IntersectionObserver((entries) => { entries.forEach((entrie: IntersectionObserverEntry & { target: HTMLImageElement }) => { const index = entrie.target.getAttribute("data-index"); @@ -67,6 +70,7 @@ ${unicode2Emoji(emoji.unicode)}`; }; export const lazyLoadEmojiImg = (element: Element) => { + window.sout.tracker("invoked"); const emojiIntersectionObserver = new IntersectionObserver((entries) => { entries.forEach((entrie: IntersectionObserverEntry & { target: HTMLImageElement }) => { const src = entrie.target.getAttribute("data-src"); @@ -82,6 +86,7 @@ export const lazyLoadEmojiImg = (element: Element) => { }; export const filterEmoji = (key = "", max?: number) => { + window.sout.tracker("invoked"); let html = ""; const recentEmojis: { unicode: string, @@ -182,6 +187,7 @@ ${unicode2Emoji(emoji[0].unicode, undefined, false, true)} }; export const addEmoji = (unicode: string) => { + window.sout.tracker("invoked"); window.siyuan.config.editor.emoji.unshift(unicode); if (window.siyuan.config.editor.emoji.length > Constants.SIZE_UNDO) { window.siyuan.config.editor.emoji.pop(); @@ -192,6 +198,7 @@ export const addEmoji = (unicode: string) => { }; export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", position: IPosition, avCB?: (emoji: string) => void) => { + window.sout.tracker("invoked"); if (type !== "av") { window.siyuan.menus.menu.remove(); } else { @@ -474,6 +481,7 @@ ${unicode2Emoji(emoji.unicode)}`; }; export const updateOutlineEmoji = (unicode: string, id: string) => { + window.sout.tracker("invoked"); /// #if !MOBILE getAllModels().outline.forEach(model => { if (model.blockId === id) { @@ -484,6 +492,7 @@ export const updateOutlineEmoji = (unicode: string, id: string) => { }; export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFile") => { + window.sout.tracker("invoked"); let emojiElement; /// #if MOBILE emojiElement = document.querySelector(`#sidebar [data-type="sidebar-file"] [data-node-id="${id}"] .b3-list-item__icon`); diff --git a/app/src/history/diff.ts b/app/src/history/diff.ts index dba832b689..5690fda880 100644 --- a/app/src/history/diff.ts +++ b/app/src/history/diff.ts @@ -139,6 +139,7 @@ const renderCompare = (app: App, element: HTMLElement) => { }; export const showDiff = (app: App, data: { id: string, time: string }[]) => { + window.sout.tracker("invoked"); if (data.length !== 2) { return; } @@ -207,6 +208,7 @@ export const showDiff = (app: App, data: { id: string, time: string }[]) => { }; const genHTML = (left: string, right: string, dialog: Dialog, direct: string) => { + window.sout.tracker("invoked"); leftEditor = undefined; rightEditor = undefined; const isPhone = isMobile(); diff --git a/app/src/history/doc.ts b/app/src/history/doc.ts index 983ad0fbe8..5385c598cc 100644 --- a/app/src/history/doc.ts +++ b/app/src/history/doc.ts @@ -12,6 +12,7 @@ let historyEditor: Protyle; let isLoading = false; const renderDoc = (element: HTMLElement, currentPage: number, id: string) => { + window.sout.tracker("invoked"); const previousElement = element.querySelector('[data-type="docprevious"]'); const nextElement = element.querySelector('[data-type="docnext"]'); element.setAttribute("data-page", currentPage.toString()); @@ -60,6 +61,7 @@ export const openDocHistory = (options: { notebookId: string, pathString: string }) => { + window.sout.tracker("invoked"); const contentHTML = `
${isMobile() ? "" : options.pathString} @@ -182,6 +184,7 @@ export const openDocHistory = (options: { }; const getHistoryPath = (target: Element, op: string, id: string, cb: (path: string) => void) => { + window.sout.tracker("invoked"); isLoading = true; const path = target.getAttribute("data-path"); if (path) { diff --git a/app/src/history/history.ts b/app/src/history/history.ts index 8b48f63421..c427019ce5 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -19,6 +19,7 @@ import {App} from "../index"; let historyEditor: Protyle; const renderDoc = (element: HTMLElement, currentPage: number) => { + window.sout.tracker("invoked"); const previousElement = element.querySelector('[data-type="docprevious"]'); const nextElement = element.querySelector('[data-type="docnext"]'); element.setAttribute("data-page", currentPage.toString()); @@ -78,6 +79,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => { }; const renderRepoItem = (response: IWebSocketData, element: Element, type: string) => { + window.sout.tracker("invoked"); if (response.data.snapshots.length === 0) { element.lastElementChild.innerHTML = `
  • ${window.siyuan.languages.emptyContent}
  • `; return; @@ -220,6 +222,7 @@ ${actionHTML} }; const renderRepo = (element: Element, currentPage: number) => { + window.sout.tracker("invoked"); const selectValue = (element.querySelector(".b3-select") as HTMLSelectElement).value; element.lastElementChild.innerHTML = '
  • '; const previousElement = element.querySelector('[data-type="previous"]'); @@ -257,6 +260,7 @@ const renderRepo = (element: Element, currentPage: number) => { }; const renderRmNotebook = (element: HTMLElement) => { + window.sout.tracker("invoked"); element.setAttribute("data-init", "true"); fetchPost("/api/history/getNotebookHistory", {}, (response) => { if (response.data.histories.length === 0) { @@ -291,6 +295,7 @@ const renderRmNotebook = (element: HTMLElement) => { }; export const openHistory = (app: App) => { + window.sout.tracker("invoked"); if (window.siyuan.config.readonly) { return; } @@ -433,6 +438,7 @@ export const openHistory = (app: App) => { }; const bindEvent = (app: App, element: Element, dialog?: Dialog) => { + window.sout.tracker("invoked"); const firstPanelElement = element.querySelector("#historyContainer [data-type=doc]") as HTMLElement; firstPanelElement.querySelectorAll(".b3-select").forEach((itemElement) => { itemElement.addEventListener("change", () => { diff --git a/app/src/history/keydown.ts b/app/src/history/keydown.ts index 5d9d374751..00702f65fc 100644 --- a/app/src/history/keydown.ts +++ b/app/src/history/keydown.ts @@ -1,6 +1,7 @@ import {Dialog} from "../dialog"; export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => { + window.sout.tracker("invoked"); let currentItem = dialog.element.querySelector(".history__diff .b3-list-item--focus"); const items = Array.from(dialog.element.querySelectorAll(".history__diff .b3-list-item[data-id]")); if (items.length < 2) { diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts index 91669de4f3..8df07f2aca 100644 --- a/app/src/layout/dock/util.ts +++ b/app/src/layout/dock/util.ts @@ -16,6 +16,7 @@ export const openBacklink = async (options: { title?: string, useBlockId?: boolean, }) => { + window.sout.tracker("invoked"); const backlink = getAllModels().backlink.find(item => { if (item.blockId === options.blockId && item.type === "local") { item.parent.parent.removeTab(item.parent.id); @@ -72,6 +73,7 @@ export const openGraph = async (options: { title?: string, useBlockId?: boolean, }) => { + window.sout.tracker("invoked"); const graph = getAllModels().graph.find(item => { if (item.blockId === options.blockId && item.type === "local") { item.parent.parent.removeTab(item.parent.id); @@ -121,6 +123,7 @@ export const openGraph = async (options: { }; export const openOutline = async (protyle: IProtyle) => { + window.sout.tracker("invoked"); const outlinePanel = getAllModels().outline.find(item => { if (item.blockId === protyle.block.rootID && item.type === "local") { item.parent.parent.removeTab(item.parent.id); @@ -167,6 +170,7 @@ export const openOutline = async (protyle: IProtyle) => { }; export const resetFloatDockSize = () => { + window.sout.tracker("invoked"); if (!window.siyuan.layout.leftDock.pin && window.siyuan.layout.leftDock.layout.element.style.opacity === "1") { window.siyuan.layout.leftDock.showDock(true); } @@ -179,6 +183,7 @@ export const resetFloatDockSize = () => { }; export const toggleDockBar = (useElement: Element) => { + window.sout.tracker("invoked"); const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock"; if (dockIsShow) { useElement.setAttribute("xlink:href", "#iconDock"); diff --git a/app/src/layout/getAll.ts b/app/src/layout/getAll.ts index ef51f90368..c7e69a712f 100644 --- a/app/src/layout/getAll.ts +++ b/app/src/layout/getAll.ts @@ -14,6 +14,7 @@ import {Protyle} from "../protyle"; import {Wnd} from "./Wnd"; export const getAllEditor = () => { + window.sout.tracker("invoked"); const models = getAllModels(); const editors: Protyle[] = []; models.editor.forEach(item => { @@ -49,6 +50,7 @@ export const getAllEditor = () => { }; export const getAllModels = () => { + // window.sout.tracker("invoked"); // 这里调用频繁 const models: IModels = { editor: [], graph: [], @@ -101,6 +103,7 @@ export const getAllModels = () => { }; export const getAllWnds = (layout: Layout, wnds: Wnd[]) => { + window.sout.tracker("invoked"); for (let i = 0; i < layout.children.length; i++) { const item = layout.children[i]; if (item instanceof Wnd) { @@ -112,6 +115,7 @@ export const getAllWnds = (layout: Layout, wnds: Wnd[]) => { }; export const getAllTabs = () => { + window.sout.tracker("invoked"); const tabs: Tab[] = []; const getTabs = (layout: Layout) => { for (let i = 0; i < layout.children.length; i++) { @@ -131,6 +135,7 @@ export const getAllTabs = () => { }; export const getAllDocks = () => { + window.sout.tracker("invoked"); const docks: Config.IUILayoutDockTab[] = []; window.siyuan.config.uiLayout.left.data.forEach((item) => { item.forEach((dock) => { diff --git a/app/src/layout/status.ts b/app/src/layout/status.ts index f43f1608a7..a0ed7438ef 100644 --- a/app/src/layout/status.ts +++ b/app/src/layout/status.ts @@ -14,6 +14,7 @@ import SillotDrawer from "./SillotDrawer"; import {updateHotkeyTip} from "../protyle/util/compatibility"; export const initStatus = (isWindow = false) => { + window.sout.tracker("invoked"); /// #if !MOBILE let barDockHTML = ""; if (!isWindow) { @@ -143,6 +144,7 @@ export const initStatus = (isWindow = false) => { let countRootId: string; let countTimeout: number; export const countSelectWord = (range: Range, rootID?: string) => { + window.sout.tracker("invoked"); /// #if !MOBILE if (document.getElementById("status").classList.contains("fn__none")) { return; @@ -166,6 +168,7 @@ export const countSelectWord = (range: Range, rootID?: string) => { }; export const countBlockWord = (ids: string[], rootID?: string, clearCache = false) => { + window.sout.tracker("invoked"); /// #if !MOBILE if (document.getElementById("status").classList.contains("fn__none")) { return; @@ -191,6 +194,7 @@ export const countBlockWord = (ids: string[], rootID?: string, clearCache = fals }; export const clearCounter = () => { + window.sout.tracker("invoked"); countRootId = ""; document.querySelector("#status .status__counter").innerHTML = ""; clearTimeout(countTimeout); @@ -203,6 +207,7 @@ export const renderStatusbarCounter = (stat: { imageCount: number, refCount: number }) => { + window.sout.tracker("invoked"); if(!stat) { return; } diff --git a/app/src/layout/tabUtil.ts b/app/src/layout/tabUtil.ts index 796c79bbdd..34ac3c0988 100644 --- a/app/src/layout/tabUtil.ts +++ b/app/src/layout/tabUtil.ts @@ -25,6 +25,7 @@ import {mountHelp, newNotebook} from "../util/mount"; import {Constants} from "../constants"; export const getActiveTab = (wndActive = true) => { + window.sout.tracker("invoked"); const activeTabElement = document.querySelector(".layout__wnd--active .item--focus"); let tab; if (activeTabElement) { @@ -41,6 +42,7 @@ export const getActiveTab = (wndActive = true) => { }; export const switchTabByIndex = (index: number) => { + window.sout.tracker("invoked"); const activeDockIcoElement = document.querySelector(".dock .dock__item--activefocus"); if (activeDockIcoElement) { let indexElement = activeDockIcoElement.parentElement.children[index]; @@ -100,6 +102,7 @@ export const switchTabByIndex = (index: number) => { let resizeTimeout: number; export const resizeTabs = (isSaveLayout = true) => { + window.sout.tracker("invoked"); clearTimeout(resizeTimeout); // .layout .fn__flex-shrink {width .15s cubic-bezier(0, 0, .2, 1) 0ms} 时需要再次计算 padding // PDF 避免分屏多次调用后,页码跳转到1 https://github.com/siyuan-note/siyuan/issues/5646 @@ -143,6 +146,7 @@ export const resizeTabs = (isSaveLayout = true) => { }; export const getDockByType = (type: string) => { + window.sout.tracker("invoked"); if (!window.siyuan.layout.leftDock) { return undefined; } @@ -158,6 +162,7 @@ export const getDockByType = (type: string) => { }; export const newCenterEmptyTab = (app: App) => { + window.sout.tracker("invoked"); return new Tab({ panel: `
    @@ -246,6 +251,7 @@ export const newCenterEmptyTab = (app: App) => { }; export const copyTab = (app: App, tab: Tab) => { + window.sout.tracker("invoked"); return new Tab({ icon: tab.icon, docIcon: tab.docIcon, @@ -335,6 +341,7 @@ export const copyTab = (app: App, tab: Tab) => { }; export const closeTabByType = async (tab: Tab, type: "closeOthers" | "closeAll" | "other", tabs?: Tab[]) => { + window.sout.tracker("invoked"); if (type === "closeOthers") { for (let index = 0; index < tab.parent.children.length; index++) { if (tab.parent.children[index].id !== tab.id && !tab.parent.children[index].headElement.classList.contains("item--pin")) { diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts index 4e3ea3b028..8222017b5a 100644 --- a/app/src/layout/topBar.ts +++ b/app/src/layout/topBar.ts @@ -22,6 +22,7 @@ import {commandPanel} from "../plugin/commandPanel"; import {exportLayout} from "./util"; export const initBar = (app: App) => { + window.sout.tracker("invoked"); const toolbarElement = document.getElementById("toolbar"); toolbarElement.innerHTML = `
    @@ -254,6 +255,7 @@ export const initBar = (app: App) => { }; export const setZoom = (type: "zoomIn" | "zoomOut" | "restore") => { + window.sout.tracker("invoked"); /// #if !BROWSER const isTabWindow = isWindow(); let zoom = 1; @@ -293,6 +295,7 @@ export const setZoom = (type: "zoomIn" | "zoomOut" | "restore") => { }; const openPlugin = (app: App, target: Element) => { + window.sout.tracker("invoked"); const menu = new Menu("topBarPlugin"); if (!isHuawei()) { menu.addItem({ diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 036ba3fc2a..0cc1dbdd4b 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -36,6 +36,7 @@ import { newCenterEmptyTab, resizeTabs } from "./tabUtil"; import { setStorageVal } from "../protyle/util/compatibility"; export const setPanelFocus = (element: Element) => { + window.sout.tracker("invoked"); if (element.getAttribute("data-type") === "wnd") { setTitle(element.querySelector('.layout-tab-bar .item--focus[data-type="tab-header"] .item__text')?.textContent || window.siyuan.languages.siyuanNote); } @@ -72,6 +73,7 @@ export const setPanelFocus = (element: Element) => { }; export const switchWnd = (newWnd: Wnd, targetWnd: Wnd) => { + window.sout.tracker("invoked"); // DOM 移动后 range 会变化 const rangeDatas: { id: string, @@ -123,6 +125,7 @@ export const switchWnd = (newWnd: Wnd, targetWnd: Wnd) => { }; export const getWndByLayout: (layout: Layout) => Wnd = (layout: Layout) => { + window.sout.tracker("invoked"); for (let i = 0; i < layout.children.length; i++) { const item = layout.children[i]; if (item instanceof Wnd) { @@ -134,6 +137,7 @@ export const getWndByLayout: (layout: Layout) => Wnd = (layout: Layout) => { }; const dockToJSON = (dock: Dock) => { + window.sout.tracker("invoked"); const json = []; const subDockToJSON = (index: number) => { const data: Config.IUILayoutDockTab[] = []; @@ -169,6 +173,7 @@ const dockToJSON = (dock: Dock) => { }; export const resetLayout = () => { + window.sout.tracker("invoked"); fetchPost("/api/system/setUILayout", { layout: {} }, () => { window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {}; setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]); @@ -180,6 +185,7 @@ export const resetLayout = () => { let saveCount = 0; export const saveLayout = () => { + window.sout.tracker("invoked"); const breakObj = {}; let layoutJSON: any = {}; if (isWindow()) { @@ -223,6 +229,7 @@ export const exportLayout = (options: { cb: () => void, errorExit: boolean }) => { + window.sout.tracker("invoked"); if (isWindow()) { const layoutJSON: any = { layout: {}, @@ -259,6 +266,7 @@ export const exportLayout = (options: { }; export const getAllLayout = () => { + window.sout.tracker("invoked"); const layoutJSON: any = { hideDock: document.querySelector("#barDock use").getAttribute("xlink:href") === "#iconDock", layout: {}, @@ -271,6 +279,7 @@ export const getAllLayout = () => { }; const initInternalDock = (dockItem: Config.IUILayoutDockTab[]) => { + window.sout.tracker("invoked"); dockItem.forEach((existSubItem) => { if (existSubItem.hotkeyLangId) { existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId]; @@ -280,6 +289,7 @@ const initInternalDock = (dockItem: Config.IUILayoutDockTab[]) => { }; const JSONToDock = (json: any, app: App) => { + window.sout.tracker("invoked"); json.left.data.forEach((existItem: Config.IUILayoutDockTab[]) => { initInternalDock(existItem); }); @@ -300,6 +310,7 @@ export const JSONToCenter = ( json: Config.TUILayoutItem, layout?: Layout | Wnd | Tab | Model, ) => { + window.sout.tracker("invoked"); let child: Layout | Wnd | Tab | Model; if (json.instance === "Layout") { if (!layout) { @@ -424,6 +435,7 @@ export const JSONToCenter = ( }; export const JSONToLayout = (app: App, isStart: boolean) => { + window.sout.tracker("invoked"); JSONToCenter(app, window.siyuan.config.uiLayout.layout, undefined); JSONToDock(window.siyuan.config.uiLayout, app); // 启动时不打开页签,需要移除没有钉住的页签 @@ -494,6 +506,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => { }; export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, breakObj?: IObject) => { + // window.sout.tracker("invoked"); // 这里调用频繁 if (layout instanceof Layout) { json.direction = layout.direction; if (layout.parent) { @@ -629,6 +642,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, brea }; export const resizeTopBar = () => { + window.sout.tracker("invoked"); const toolbarElement = document.querySelector("#toolbar"); if (!toolbarElement) { return; @@ -689,6 +703,7 @@ export const resizeTopBar = () => { }; export const newModelByInitData = (app: App, tab: Tab, json: any) => { + window.sout.tracker("invoked"); let model: Model; if (json.instance === "Custom") { if (json.customModelType === "siyuan-card") { @@ -722,6 +737,7 @@ export const newModelByInitData = (app: App, tab: Tab, json: any) => { }; export const pdfIsLoading = (element: HTMLElement) => { + window.sout.tracker("invoked"); const isLoading = element.querySelector('.layout-tab-container > [data-loading="true"]') ? true : false; if (isLoading) { showMessage(window.siyuan.languages.pdfIsLoading); @@ -730,6 +746,7 @@ export const pdfIsLoading = (element: HTMLElement) => { }; export const getInstanceById = (id: string, layout = window.siyuan.layout.centerLayout) => { + window.sout.tracker("invoked"); const _getInstanceById = (item: Layout | Wnd, id: string) => { if (item.id === id) { return item; @@ -749,6 +766,7 @@ export const getInstanceById = (id: string, layout = window.siyuan.layout.center }; export const addResize = (obj: Layout | Wnd) => { + window.sout.tracker("invoked"); if (!obj.resize) { return; } @@ -875,6 +893,7 @@ export const addResize = (obj: Layout | Wnd) => { }; export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.parent) => { + window.sout.tracker("invoked"); layout.children.forEach((item: Layout | Wnd) => { item.element.style.maxWidth = ""; if (!item.element.style.width && !item.element.classList.contains("layout__center")) { diff --git a/app/src/menus/block.ts b/app/src/menus/block.ts index e8dd19ec87..ce5c097058 100644 --- a/app/src/menus/block.ts +++ b/app/src/menus/block.ts @@ -5,6 +5,7 @@ import {fetchPost} from "../util/fetch"; import {Constants} from "../constants"; export const transferBlockRef = (id: string) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.transferBlockRef, icon: "iconScrollHoriz", diff --git a/app/src/menus/bookmark.ts b/app/src/menus/bookmark.ts index e16ad77982..2801dc1409 100644 --- a/app/src/menus/bookmark.ts +++ b/app/src/menus/bookmark.ts @@ -10,6 +10,7 @@ import {MobileBookmarks} from "../mobile/dock/MobileBookmarks"; import {Constants} from "../constants"; export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookmarkObj: Bookmark | MobileBookmarks) => { + window.sout.tracker("invoked"); if (!window.siyuan.menus.menu.element.classList.contains("fn__none") && window.siyuan.menus.menu.element.getAttribute("data-name") === "bookmarkMenu") { window.siyuan.menus.menu.remove(); diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 8400866e01..27975b130d 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -33,6 +33,7 @@ const bindAttrInput = (inputElement: HTMLInputElement, id: string) => { }; export const openWechatNotify = (nodeElement: Element) => { + window.sout.tracker("invoked"); const id = nodeElement.getAttribute("data-node-id"); const range = getEditorRange(nodeElement); const reminder = nodeElement.getAttribute(Constants.CUSTOM_REMINDER_WECHAT); @@ -98,6 +99,7 @@ export const openWechatNotify = (nodeElement: Element) => { }; export const openFileWechatNotify = (protyle: IProtyle) => { + window.sout.tracker("invoked"); fetchPost("/api/block/getDocInfo", { id: protyle.block.rootID }, (response) => { @@ -154,6 +156,7 @@ export const openFileWechatNotify = (protyle: IProtyle) => { }; export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: IProtyle) => { + window.sout.tracker("invoked"); let customHTML = ""; let notifyHTML = ""; let hasAV = false; @@ -362,6 +365,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I }; export const openAttr = (nodeElement: Element, focusName = "bookmark", protyle?: IProtyle) => { + window.sout.tracker("invoked"); if (nodeElement.getAttribute("data-type") === "NodeThematicBreak") { return; } @@ -372,6 +376,7 @@ export const openAttr = (nodeElement: Element, focusName = "bookmark", protyle?: }; export const copySubMenu = (id: string, accelerator = true, focusElement?: Element) => { + window.sout.tracker("invoked"); return [{ icon: "iconRef", accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyBlockRef.custom : undefined, @@ -438,6 +443,7 @@ export const copySubMenu = (id: string, accelerator = true, focusElement?: Eleme }; export const exportMd = (id: string) => { + window.sout.tracker("invoked"); return new MenuItem({ label: window.siyuan.languages.export, type: "submenu", @@ -680,6 +686,7 @@ export const exportMd = (id: string) => { }; export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerator: boolean) => { + window.sout.tracker("invoked"); const submenu = []; /// #if MOBILE submenu.push({ @@ -784,7 +791,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat accelerator: showAccelerator ? "Click" : "", click: () => { const uri = src.startsWith("/") ? "" : "/" + src; - console.log(uri); + window.sout.log(uri); openByMobile(uri); } }); @@ -807,6 +814,7 @@ export const renameMenu = (options: { name: string, type: "notebook" | "file" }) => { + window.sout.tracker("invoked"); return new MenuItem({ accelerator: window.siyuan.config.keymap.editor.general.rename.custom, icon: "iconEdit", @@ -818,6 +826,7 @@ export const renameMenu = (options: { }; export const movePathToMenu = (paths: string[]) => { + window.sout.tracker("invoked"); return new MenuItem({ label: window.siyuan.languages.move, icon: "iconMove", diff --git a/app/src/menus/dock.ts b/app/src/menus/dock.ts index 844903966d..e2d7b6a6e1 100644 --- a/app/src/menus/dock.ts +++ b/app/src/menus/dock.ts @@ -2,6 +2,7 @@ import {MenuItem} from "./Menu"; import {saveLayout} from "../layout/util"; const moveMenuItem = (label: string, target: Element) => { + window.sout.tracker("invoked"); return new MenuItem({ label: window.siyuan.languages[label], icon: label.replace("moveTo", "icon"), @@ -19,6 +20,7 @@ const moveMenuItem = (label: string, target: Element) => { }; export const initDockMenu = (target: Element) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.append(moveMenuItem("moveToLeftTop", target).element); window.siyuan.menus.menu.append(moveMenuItem("moveToLeftBottom", target).element); diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts index 5eb1904bb4..aa3425d985 100644 --- a/app/src/menus/navigation.ts +++ b/app/src/menus/navigation.ts @@ -31,6 +31,7 @@ import {emitOpenMenu} from "../plugin/EventBus"; import {openByMobile} from "../protyle/util/compatibility"; const initMultiMenu = (selectItemElements: NodeListOf, app: App) => { + window.sout.tracker("invoked"); const fileItemElement = Array.from(selectItemElements).find(item => { if (item.getAttribute("data-type") === "navigation-file") { return true; @@ -121,6 +122,7 @@ const initMultiMenu = (selectItemElements: NodeListOf, app: App) => { }; export const initNavigationMenu = (app: App, liElement: HTMLElement) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const fileElement = hasClosestByTag(liElement, "DIV"); if (!fileElement) { @@ -355,6 +357,7 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => { }; export const initFileMenu = (app: App, notebookId: string, pathString: string, liElement: Element) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const fileElement = hasClosestByTag(liElement, "DIV"); if (!fileElement) { @@ -638,6 +641,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l }; export const genImportMenu = (notebookId: string, pathString: string) => { + window.sout.tracker("invoked"); if (window.siyuan.config.readonly) { return; } @@ -716,6 +720,7 @@ export const genImportMenu = (notebookId: string, pathString: string) => { }; export const sortMenu = (type: "notebooks" | "notebook", sortMode: number, clickEvent: (sort: number) => void) => { + window.sout.tracker("invoked"); const sortMenu: IMenu[] = [{ icon: sortMode === 0 ? "iconSelect" : undefined, label: window.siyuan.languages.fileNameASC, diff --git a/app/src/menus/onGetnotebookconf.ts b/app/src/menus/onGetnotebookconf.ts index 01112e0f5c..57beaa6ee7 100644 --- a/app/src/menus/onGetnotebookconf.ts +++ b/app/src/menus/onGetnotebookconf.ts @@ -19,6 +19,7 @@ declare interface INotebookConf { } export const onGetnotebookconf = (data: INotebookConf) => { + window.sout.tracker("invoked"); const titleHTML = `
    ${escapeHtml(data.name)}
    `; @@ -69,6 +70,7 @@ export const onGetnotebookconf = (data: INotebookConf) => { }; const bindSettingEvent = (contentElement: Element, data: INotebookConf) => { + window.sout.tracker("invoked"); contentElement.querySelector(".b3-button--small").addEventListener("click", () => { writeText(data.box); showMessage(window.siyuan.languages.copied); diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 17a2c1cda0..1d9342ac4c 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -58,6 +58,7 @@ import {Menu} from "../plugin/Menu"; import {getFirstBlock} from "../protyle/wysiwyg/getBlock"; const renderAssetList = (element: Element, k: string, position: IPosition, exts: string[] = []) => { + window.sout.tracker("invoked"); fetchPost("/api/search/searchAsset", { k, exts @@ -88,6 +89,7 @@ const renderAssetList = (element: Element, k: string, position: IPosition, exts: }; export const assetMenu = (protyle: IProtyle, position: IPosition, callback?: (url: string, name: string) => void, exts?: string[]) => { + window.sout.tracker("invoked"); const menu = new Menu("background-asset"); if (menu.isOpen) { return; @@ -199,6 +201,7 @@ export const assetMenu = (protyle: IProtyle, position: IPosition, callback?: (ur }; export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement) => { + window.sout.tracker("invoked"); const nodeElement = hasClosestBlock(refElement); if (!nodeElement) { return; @@ -314,6 +317,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement }; export const refMenu = (protyle: IProtyle, element: HTMLElement) => { + window.sout.tracker("invoked"); const nodeElement = hasClosestBlock(element); if (!nodeElement) { return; @@ -623,6 +627,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { }; export const contentMenu = (protyle: IProtyle, nodeElement: Element) => { + window.sout.tracker("invoked"); const range = getEditorRange(nodeElement); window.siyuan.menus.menu.remove(); /// #if MOBILE @@ -756,6 +761,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => { }; export const enterBack = (protyle: IProtyle, id: string) => { + window.sout.tracker("invoked"); if (!protyle.block.showAll) { const ids = protyle.path.split("/"); if (ids.length > 2) { @@ -782,6 +788,7 @@ export const zoomOut = (options: { callback?: () => void, reload?: boolean }) => { + window.sout.tracker("invoked"); if (options.protyle.options.backlinkData) { return; } @@ -886,6 +893,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme clientX: number, clientY: number }) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const nodeElement = hasClosestBlock(assetElement); if (!nodeElement) { @@ -1115,6 +1123,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme }; export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText = false) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const nodeElement = hasClosestBlock(linkElement); if (!nodeElement) { @@ -1322,6 +1331,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText }; export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const nodeElement = hasClosestBlock(tagElement); if (!nodeElement) { @@ -1437,6 +1447,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => { }; const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => { + window.sout.tracker("invoked"); return { iconHTML: "", label, @@ -1460,6 +1471,7 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement: }; export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => { + window.sout.tracker("invoked"); const id = nodeElement.getAttribute("data-node-id"); const iframeElement = nodeElement.querySelector("iframe"); let html = nodeElement.outerHTML; @@ -1530,6 +1542,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => { }; export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string) => { + window.sout.tracker("invoked"); const id = nodeElement.getAttribute("data-node-id"); const videoElement = nodeElement.querySelector(type === "NodeVideo" ? "video" : "audio"); let html = nodeElement.outerHTML; @@ -1575,6 +1588,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string) }; export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement: HTMLTableCellElement, range: Range) => { + window.sout.tracker("invoked"); const menus: IMenu[] = []; const colIndex = getColIndex(cellElement); if (cellElement.rowSpan > 1 || cellElement.colSpan > 1) { @@ -1875,6 +1889,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement: }; export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolean, isRemove?: boolean) => { + window.sout.tracker("invoked"); if (nodeElement.getAttribute("data-type") === "NodeListItem" && nodeElement.childElementCount < 4) { // 没有子列表或多个块的列表项不进行折叠 return -1; diff --git a/app/src/menus/search.ts b/app/src/menus/search.ts index 1f0eab4b55..17281dfc50 100644 --- a/app/src/menus/search.ts +++ b/app/src/menus/search.ts @@ -2,6 +2,7 @@ import {MenuItem} from "./Menu"; import {copySubMenu} from "./commonMenuItem"; export const initSearchMenu = (id: string) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.copy, diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.ts index d21b696652..f0148cc3f0 100644 --- a/app/src/menus/tab.ts +++ b/app/src/menus/tab.ts @@ -12,6 +12,7 @@ import {Wnd} from "../layout/Wnd"; import {getAllWnds} from "../layout/getAll"; const closeMenu = (tab: Tab) => { + window.sout.tracker("invoked"); const unmodifiedTabs: Tab[] = []; const leftTabs: Tab[] = []; const rightTabs: Tab[] = []; @@ -86,6 +87,7 @@ const closeMenu = (tab: Tab) => { }; const splitSubMenu = (app: App, tab: Tab) => { + window.sout.tracker("invoked"); const subMenus: IMenu[] = [{ icon: "iconSplitLR", accelerator: window.siyuan.config.keymap.general.splitLR.custom, @@ -163,6 +165,7 @@ const splitSubMenu = (app: App, tab: Tab) => { }; export const initTabMenu = (app: App, tab: Tab) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); closeMenu(tab); window.siyuan.menus.menu.append(new MenuItem({ @@ -221,6 +224,7 @@ export const initTabMenu = (app: App, tab: Tab) => { }; const unsplitWnd = (target: Wnd | Layout, layout: Layout, onlyWnd: boolean) => { + window.sout.tracker("invoked"); let wnd: Wnd = target as Wnd; while (wnd instanceof Layout) { wnd = wnd.children[0] as Wnd; diff --git a/app/src/menus/tag.ts b/app/src/menus/tag.ts index b5bb1b3979..44bd4cd808 100644 --- a/app/src/menus/tag.ts +++ b/app/src/menus/tag.ts @@ -5,6 +5,7 @@ import {escapeHtml} from "../util/escape"; import {renameTag} from "../util/noRelyPCFunction"; export const openTagMenu = (element: HTMLElement, event: MouseEvent, labelName: string) => { + window.sout.tracker("invoked"); if (!window.siyuan.menus.menu.element.classList.contains("fn__none") && window.siyuan.menus.menu.element.getAttribute("data-name") === "tagMenu") { window.siyuan.menus.menu.remove(); diff --git a/app/src/menus/util.ts b/app/src/menus/util.ts index ba2bf0d625..dc6202b0ea 100644 --- a/app/src/menus/util.ts +++ b/app/src/menus/util.ts @@ -13,6 +13,7 @@ import {isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility"; import {checkFold} from "../util/noRelyPCFunction"; export const exportAsset = (src: string) => { + window.sout.tracker("invoked"); /// #if !BROWSER return { label: window.siyuan.languages.export, @@ -33,6 +34,7 @@ export const exportAsset = (src: string) => { export const openEditorTab = (app: App, id: string, notebookId?: string, pathString?: string) => { + window.sout.tracker("invoked"); /// #if !MOBILE const openSubmenus: IMenu[] = [{ icon: "iconLayoutRight", @@ -141,6 +143,7 @@ export const openEditorTab = (app: App, id: string, notebookId?: string, pathStr }; export const copyPNG = (imgElement: HTMLImageElement) => { + window.sout.tracker("invoked"); if (isInAndroid()) { window.JSAndroid.writeImageClipboard(imgElement.getAttribute("src")); return; diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.ts index b89b5dfdad..407a42a620 100644 --- a/app/src/menus/workspace.ts +++ b/app/src/menus/workspace.ts @@ -127,6 +127,7 @@ const togglePinDock = (dock: Dock, icon: string) => { }; export const workspaceMenu = (app: App, rect: DOMRect) => { + window.sout.tracker("invoked"); if (!window.siyuan.menus.menu.element.classList.contains("fn__none") && window.siyuan.menus.menu.element.getAttribute("data-name") === "barWorkspace") { window.siyuan.menus.menu.remove(); @@ -481,6 +482,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => { }; const openWorkspace = (workspace: string) => { + window.sout.tracker("invoked"); /// #if !BROWSER if (workspace === window.siyuan.config.system.workspaceDir) { return; @@ -497,6 +499,7 @@ const openWorkspace = (workspace: string) => { }; const workspaceItem = (item: IWorkspace) => { + window.sout.tracker("invoked"); /// #if !BROWSER return { label: `
    diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index f2d70e6611..9f252a840c 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -20,6 +20,7 @@ export const getCurrentEditor = () => { }; export const openMobileFileById = (app: App, id: string, action = [Constants.CB_GET_HL]) => { + window.sout.tracker("invoked"); window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id}; setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]); if (window.siyuan.mobile.editor) { diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts index 11add753a1..cbfaa61575 100644 --- a/app/src/mobile/index.ts +++ b/app/src/mobile/index.ts @@ -117,9 +117,9 @@ class App { window.siyuan.emojis = emojiResponse.data as IEmoji[]; setNoteBook(() => { initRightMenu(this); // 前置避免 initFramework crash 影响 - console.log("initRightMenu() resolved"); + window.sout.tracker("initRightMenu() resolved"); initFramework(this, confResponse.data.start); - console.log("initFramework() resolved"); + window.sout.tracker("initFramework() resolved"); openChangelog(); }); }); diff --git a/app/src/mobile/menu/getRecentDocs.ts b/app/src/mobile/menu/getRecentDocs.ts index bde4ebb549..d70ac00ed6 100644 --- a/app/src/mobile/menu/getRecentDocs.ts +++ b/app/src/mobile/menu/getRecentDocs.ts @@ -8,6 +8,7 @@ import {openMobileFileById} from "../editor"; import {App} from "../../index"; export const getRecentDocs = (app: App) => { + window.sout.tracker("invoked"); fetchPost("/api/storage/getRecentDocs", {}, (response) => { let html = ""; response.data.forEach((item: any, index: number) => { diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts index 17a4a7823e..0978a65bca 100644 --- a/app/src/mobile/menu/index.ts +++ b/app/src/mobile/menu/index.ts @@ -23,12 +23,14 @@ import {Menu} from "../../plugin/Menu"; import {commandPanel} from "../../plugin/commandPanel"; export const popMenu = () => { + window.sout.tracker("invoked"); activeBlur(); hideKeyboardToolbar(); document.getElementById("menu").style.transform = "translateX(0px)"; }; export const initRightMenu = (app: App) => { + window.sout.tracker("invoked"); const menuElement = document.getElementById("menu"); let accountHTML = ""; if (window.siyuan.user && !window.siyuan.config.readonly) { diff --git a/app/src/mobile/menu/model.ts b/app/src/mobile/menu/model.ts index 3870ed0c13..f7648109d6 100644 --- a/app/src/mobile/menu/model.ts +++ b/app/src/mobile/menu/model.ts @@ -4,6 +4,7 @@ export const openModel = (obj: { title: string, bindEvent: (element: HTMLElement) => void }) => { + window.sout.tracker("invoked"); const modelElement = document.getElementById("model"); modelElement.style.transform = "translateY(0px)"; modelElement.querySelector(".toolbar__icon use").setAttribute("xlink:href", "#" + obj.icon); diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts index 108740a411..83e8d6c82d 100644 --- a/app/src/mobile/menu/search.ts +++ b/app/src/mobile/menu/search.ts @@ -28,6 +28,7 @@ import {checkFold} from "../../util/noRelyPCFunction"; import {getDefaultType} from "../../search/getDefault"; const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAll: boolean) => { + window.sout.tracker("invoked"); if (config.method === 1 || config.method === 2) { showMessage(window.siyuan.languages._kernel[132]); return; @@ -107,6 +108,7 @@ const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAl }; const updateConfig = (element: Element, newConfig: Config.IUILayoutTabSearchConfig, config: Config.IUILayoutTabSearchConfig) => { + window.sout.tracker("invoked"); if (config.hasReplace !== newConfig.hasReplace) { if (newConfig.hasReplace) { element.querySelector('[data-type="toggle-replace"]').classList.add("toolbar__icon--active"); @@ -163,6 +165,7 @@ const updateConfig = (element: Element, newConfig: Config.IUILayoutTabSearchConf }; const onRecentBlocks = (data: IBlock[], config: Config.IUILayoutTabSearchConfig, response?: IWebSocketData) => { + window.sout.tracker("invoked"); const listElement = document.querySelector("#searchList"); let resultHTML = ""; data.forEach((item: IBlock, index: number) => { @@ -213,6 +216,7 @@ ${unicode2Emoji(childItem.ial.icon, "b3-list-item__graphic", true)} let toolbarSearchTimeout = 0; export const updateSearchResult = (config: Config.IUILayoutTabSearchConfig, element: Element, rmCurrentCriteria = false) => { + window.sout.tracker("invoked"); clearTimeout(toolbarSearchTimeout); toolbarSearchTimeout = window.setTimeout(() => { if (rmCurrentCriteria) { @@ -261,6 +265,7 @@ export const updateSearchResult = (config: Config.IUILayoutTabSearchConfig, elem }; const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTabSearchConfig) => { + window.sout.tracker("invoked"); const searchInputElement = document.getElementById("toolbarSearch") as HTMLInputElement; searchInputElement.value = config.k || ""; searchInputElement.addEventListener("compositionend", (event: InputEvent) => { @@ -617,6 +622,7 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab }; export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOCAL_SEARCHDATA] as Config.IUILayoutTabSearchConfig) => { + window.sout.tracker("invoked"); activeBlur(); hideKeyboardToolbar(); let includeChild = true; @@ -726,6 +732,7 @@ export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOC }; const goAsset = () => { + window.sout.tracker("invoked"); const assetsElement = document.querySelector("#searchAssetsPanel"); assetsElement.classList.remove("fn__none"); const listElement = assetsElement.querySelector("#searchAssetList"); @@ -758,6 +765,7 @@ const goAsset = () => { }; export const goUnRef = () => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const unRefElement = document.querySelector("#searchUnRefPanel"); unRefElement.classList.remove("fn__none"); @@ -769,6 +777,7 @@ export const goUnRef = () => { }; const getUnRefListMobile = (element: Element, page = 1) => { + window.sout.tracker("invoked"); const previousElement = element.querySelector('[data-type="unRefPrevious"]'); if (page > 1) { previousElement.removeAttribute("disabled"); diff --git a/app/src/mobile/settings/about.ts b/app/src/mobile/settings/about.ts index 272e732856..1b5151c5af 100644 --- a/app/src/mobile/settings/about.ts +++ b/app/src/mobile/settings/about.ts @@ -13,6 +13,7 @@ import {isBrowser} from "../../util/functions"; import {isAppMode} from "sofill/env" export const initAbout = () => { + window.sout.tracker("invoked"); if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 || (window.siyuan.config.localIPs.length === 1 && window.siyuan.config.localIPs[0] === "")) { window.siyuan.config.localIPs = ["127.0.0.1"]; @@ -399,6 +400,7 @@ ${ }; const genWorkspace = (workspaceDirElement: Element) => { + window.sout.tracker("invoked"); fetchPost("/api/system/getWorkspaces", {}, (response) => { let html = ""; response.data.forEach((item: IWorkspace) => { diff --git a/app/src/mobile/settings/account.ts b/app/src/mobile/settings/account.ts index c9b0e3560c..9a393bce48 100644 --- a/app/src/mobile/settings/account.ts +++ b/app/src/mobile/settings/account.ts @@ -13,6 +13,7 @@ import {hideElements} from "../../protyle/ui/hideElements"; import {Constants} from "../../constants"; export const showAccountInfo = () => { + window.sout.tracker("invoked"); const payHTML = ` ${window.siyuan.languages[window.siyuan.user?.userSiYuanOneTimePayStatus === 1 ? "account4" : "account1"]} @@ -147,6 +148,7 @@ ${renewHTML}`; }; const getLoginHTML = (deactivate = false) => { + window.sout.tracker("invoked"); let confirmHTML: string; if (deactivate) { confirmHTML = `
    @@ -209,6 +211,7 @@ const getLoginHTML = (deactivate = false) => { }; const afterLogin = (response: IWebSocketData, deactive = false) => { + window.sout.tracker("invoked"); if (deactive) { hideElements(["dialog"]); confirmDialog("⚠️ " + window.siyuan.languages.deactivateUser, window.siyuan.languages.deactivateUserTip, () => { @@ -233,6 +236,7 @@ const afterLogin = (response: IWebSocketData, deactive = false) => { }; const bindLoginEvent = (modelMainElement: HTMLElement, deactive = false) => { + window.sout.tracker("invoked"); const agreeLoginElement = modelMainElement.querySelector("#agreeLogin") as HTMLInputElement; const userNameElement = modelMainElement.querySelector("#userName") as HTMLInputElement; const userPasswordElement = modelMainElement.querySelector("#userPassword") as HTMLInputElement; @@ -309,6 +313,7 @@ const bindLoginEvent = (modelMainElement: HTMLElement, deactive = false) => { }; export const login = () => { + window.sout.tracker("invoked"); openModel({ title: window.siyuan.languages.login, icon: "iconAccount", diff --git a/app/src/mobile/settings/ai.ts b/app/src/mobile/settings/ai.ts index 9b9cebe804..fef915ba3b 100644 --- a/app/src/mobile/settings/ai.ts +++ b/app/src/mobile/settings/ai.ts @@ -2,6 +2,7 @@ import {openModel} from "../menu/model"; import {ai} from "../../config/ai"; export const initAI = () => { + window.sout.tracker("invoked"); openModel({ title: "AI", icon: "iconSparkles", diff --git a/app/src/mobile/settings/appearance.ts b/app/src/mobile/settings/appearance.ts index 33dd49b6ba..1a1342064f 100644 --- a/app/src/mobile/settings/appearance.ts +++ b/app/src/mobile/settings/appearance.ts @@ -3,6 +3,7 @@ import {genOptions} from "../../util/genOptions"; import {openModel} from "../menu/model"; export const initAppearance = () => { + window.sout.tracker("invoked"); openModel({ title: window.siyuan.languages.appearance, icon:"iconTheme", diff --git a/app/src/mobile/settings/editor.ts b/app/src/mobile/settings/editor.ts index 4e5d805210..84fade5db2 100644 --- a/app/src/mobile/settings/editor.ts +++ b/app/src/mobile/settings/editor.ts @@ -5,6 +5,7 @@ import {setInlineStyle} from "../../util/assets"; import {confirmDialog} from "../../dialog/confirmDialog"; const setEditor = (modelMainElement: Element) => { + window.sout.tracker("invoked"); let dynamicLoadBlocks = parseInt((modelMainElement.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value); if (48 > dynamicLoadBlocks) { dynamicLoadBlocks = 48; @@ -48,6 +49,7 @@ const setEditor = (modelMainElement: Element) => { }; export const initEditor = () => { + window.sout.tracker("invoked"); openModel({ title: window.siyuan.languages.editor, icon: "iconEdit", diff --git a/app/src/mobile/settings/riffCard.ts b/app/src/mobile/settings/riffCard.ts index 6f325a5cb0..3a0716da1d 100644 --- a/app/src/mobile/settings/riffCard.ts +++ b/app/src/mobile/settings/riffCard.ts @@ -2,6 +2,7 @@ import {openModel} from "../menu/model"; import {flashcard} from "../../config/flashcard"; export const initRiffCard = () => { + window.sout.tracker("invoked"); openModel({ title: window.siyuan.languages.riffCard, icon: "iconRiffCard", diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts index e47ffe06f0..7100e41f0d 100644 --- a/app/src/mobile/util/MobileBackFoward.ts +++ b/app/src/mobile/util/MobileBackFoward.ts @@ -17,6 +17,7 @@ import {setTitle} from "../../dialog/processSystem"; const forwardStack: IBackStack[] = []; const focusStack = (backStack: IBackStack) => { + window.sout.tracker("invoked"); const protyle = getCurrentEditor().protyle; window.siyuan.storage[Constants.LOCAL_DOCINFO] = { id: backStack.id, @@ -99,6 +100,7 @@ const focusStack = (backStack: IBackStack) => { }; export const pushBack = () => { + window.sout.tracker("invoked"); const protyle = getCurrentEditor().protyle; if (protyle.wysiwyg.element.firstElementChild) { window.siyuan.backStack.push({ @@ -117,6 +119,7 @@ export const pushBack = () => { }; export const goForward = () => { + window.sout.tracker("invoked"); if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) { window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"})); @@ -139,6 +142,7 @@ export const goForward = () => { }; export const goBack = () => { + window.sout.tracker("invoked"); const editor = getCurrentEditor(); if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) { diff --git a/app/src/mobile/util/closePanel.ts b/app/src/mobile/util/closePanel.ts index 60be93d65d..9e4bb22e87 100644 --- a/app/src/mobile/util/closePanel.ts +++ b/app/src/mobile/util/closePanel.ts @@ -1,6 +1,7 @@ import {activeBlur, hideKeyboardToolbar} from "./keyboardToolbar"; export const closePanel = () => { + window.sout.tracker("invoked"); document.getElementById("menu").style.transform = ""; document.getElementById("sidebar").style.transform = ""; document.getElementById("model").style.transform = ""; @@ -11,6 +12,7 @@ export const closePanel = () => { }; export const closeModel = () => { + window.sout.tracker("invoked"); document.getElementById("model").style.transform = ""; activeBlur(); hideKeyboardToolbar(); diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts index 04e26ea3c9..a4ef80d579 100644 --- a/app/src/mobile/util/initFramework.ts +++ b/app/src/mobile/util/initFramework.ts @@ -28,6 +28,7 @@ import {showMessage} from "../../dialog/message"; let custom: MobileCustom; const openDockMenu = (app: App) => { + window.sout.tracker("invoked"); const menu = new Menu("dockMobileMenu"); if (menu.isOpen) { return; @@ -60,11 +61,11 @@ const openDockMenu = (app: App) => { export const initFramework = (app: App, isStart: boolean) => { setInlineStyle(); - console.log("initFramework()->setInlineStyle() resolved"); + window.sout.tracker("initFramework() -> setInlineStyle() resolved"); renderSnippet(); - console.log("initFramework()->renderSnippet() resolved"); + window.sout.tracker("initFramework() -> renderSnippet() resolved"); initKeyboardToolbar(); - console.log("initFramework()->initKeyboardToolbar() resolved"); + window.sout.tracker("initFramework() -> initKeyboardToolbar() resolved"); const sidebarElement = document.getElementById("sidebar"); let outline: MobileOutline; let backlink: MobileBacklinks; @@ -167,13 +168,13 @@ export const initFramework = (app: App, isStart: boolean) => { closeModel(); }); initEditorName(); - console.log("initFramework()->initEditorName() resolved"); + window.sout.tracker("initFramework() -> initEditorName() resolved"); if (getOpenNotebookCount() > 0) { if (window.JSAndroid && window.openFileByURL(window.JSAndroid.getBlockURL())) { return; } const idZoomIn = getIdZoomInByPath(); - console.log("initFramework()->getIdZoomInByPath() resolved"); + window.sout.tracker("initFramework() -> getIdZoomInByPath() resolved"); if (idZoomIn.id) { openMobileFileById(app, idZoomIn.id, idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); @@ -205,6 +206,7 @@ export const initFramework = (app: App, isStart: boolean) => { }; const initEditorName = () => { + window.sout.tracker("invoked"); const inputElement = document.getElementById("toolbarName") as HTMLInputElement; inputElement.setAttribute("placeholder", window.siyuan.languages._kernel[16]); inputElement.addEventListener("blur", () => { diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts index 09a0dc3014..6aa3a38015 100644 --- a/app/src/mobile/util/keyboardToolbar.ts +++ b/app/src/mobile/util/keyboardToolbar.ts @@ -18,6 +18,7 @@ let renderKeyboardToolbarTimeout: number; let showUtil = false; const getSlashItem = (value: string, icon: string, text: string, focus = "false") => { + window.sout.tracker("invoked"); let iconHTML; if (icon?.startsWith("icon")) { iconHTML = ``; @@ -31,6 +32,7 @@ const getSlashItem = (value: string, icon: string, text: string, focus = "false" }; export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => { + window.sout.tracker("invoked"); let colorHTML = ""; ["var(--b3-font-color1)", "var(--b3-font-color2)", "var(--b3-font-color3)", "var(--b3-font-color4)", "var(--b3-font-color5)", "var(--b3-font-color6)", "var(--b3-font-color7)", "var(--b3-font-color8)", @@ -193,7 +195,8 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => { }; const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => { - console.log("renderSlashMenu protyle", protyle); + window.sout.tracker("invoked"); + window.sout.tracker("protyle: ", protyle); protyle.hint.splitChar = "/"; protyle.hint.lastIndex = -1; let pluginHTML = ""; @@ -268,6 +271,7 @@ const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => { }; export const showKeyboardToolbarUtil = (oldScrollTop: number) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); showUtil = true; @@ -288,6 +292,7 @@ export const showKeyboardToolbarUtil = (oldScrollTop: number) => { }; const hideKeyboardToolbarUtil = () => { + window.sout.tracker("invoked"); const toolbarElement = document.getElementById("keyboardToolbar"); toolbarElement.style.height = ""; const editor = getCurrentEditor(); @@ -300,6 +305,7 @@ const hideKeyboardToolbarUtil = () => { }; const renderKeyboardToolbar = () => { + window.sout.tracker("invoked"); clearTimeout(renderKeyboardToolbarTimeout); renderKeyboardToolbarTimeout = window.setTimeout(() => { if (getSelection().rangeCount === 0 || @@ -393,6 +399,7 @@ const renderKeyboardToolbar = () => { }; export const showKeyboardToolbar = () => { + window.sout.tracker("invoked"); if (!showUtil) { hideKeyboardToolbarUtil(); } @@ -433,6 +440,7 @@ export const showKeyboardToolbar = () => { }; export const hideKeyboardToolbar = () => { + window.sout.tracker("invoked"); if (showUtil) { return; } @@ -460,6 +468,7 @@ export const activeBlur = () => { }; export const initKeyboardToolbar = () => { + window.sout.tracker("invoked"); let preventRender = false; document.addEventListener("selectionchange", () => { if (!preventRender) { diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.ts index f1b0737432..9101e78b76 100644 --- a/app/src/mobile/util/onMessage.ts +++ b/app/src/mobile/util/onMessage.ts @@ -5,6 +5,7 @@ import {App} from "../../index"; import {reloadPlugin} from "../../plugin/loader"; export const onMessage = (app: App, data: IWebSocketData) => { + window.sout.tracker("invoked"); if (data) { switch (data.cmd) { case "reloadPlugin": diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.ts index 6eb97f0094..2476537985 100644 --- a/app/src/mobile/util/setEmpty.ts +++ b/app/src/mobile/util/setEmpty.ts @@ -8,6 +8,7 @@ import {App} from "../../index"; import {setTitle} from "../../dialog/processSystem"; export const setEmpty = (app: App) => { + window.sout.tracker("invoked"); setTitle(window.siyuan.languages.siyuanNote); document.getElementById("toolbarName").classList.add("fn__hidden"); document.getElementById("editor").classList.add("fn__none"); @@ -77,6 +78,7 @@ export const setEmpty = (app: App) => { }; export const setEditor = () => { + window.sout.tracker("invoked"); const toolbarNameElement = document.getElementById("toolbarName") as HTMLInputElement; setTitle(toolbarNameElement.value); toolbarNameElement.classList.remove("fn__hidden"); diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 667c295cb1..2463b0f5a7 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -21,6 +21,7 @@ let lastClientX: number; // 和起始方向不一致时,记录最后一次 let scrollBlock: boolean; const popSide = (render = true) => { + window.sout.tracker("invoked"); if (render) { document.getElementById("toolbarFile").dispatchEvent(new CustomEvent("click")); } else { @@ -31,6 +32,7 @@ const popSide = (render = true) => { }; export const handleTouchEnd = (event: TouchEvent, app: App) => { + // window.sout.tracker("invoked"); // 这里调用频繁 if (isIPhone() && globalTouchEnd(event, yDiff, time, app)) { event.stopImmediatePropagation(); event.preventDefault(); @@ -137,6 +139,7 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => { }; export const handleTouchStart = (event: TouchEvent) => { + // window.sout.tracker("invoked"); // 这里调用频繁 if (globalTouchStart(event)) { return; } @@ -162,6 +165,7 @@ export const handleTouchStart = (event: TouchEvent) => { let previousClientX: number; const sideMaskElement = document.querySelector(".side-mask") as HTMLElement export const handleTouchMove = (event: TouchEvent) => { + // window.sout.tracker("invoked"); // 这里调用频繁 const target = event.target as HTMLElement; if (!clientX || !clientY || target.tagName === "AUDIO" || diff --git a/app/src/plugin/EventBus.ts b/app/src/plugin/EventBus.ts index f470ada025..1bf8e354d9 100644 --- a/app/src/plugin/EventBus.ts +++ b/app/src/plugin/EventBus.ts @@ -33,6 +33,7 @@ export const emitOpenMenu = (options: { detail: any, separatorPosition?: "top" | "bottom", }) => { + window.sout.tracker("invoked"); const pluginSubMenu = new subMenu(); options.detail.menu = pluginSubMenu; options.plugins.forEach((plugin) => { diff --git a/app/src/plugin/customBlockRender.ts b/app/src/plugin/customBlockRender.ts index d8887ac475..a85d7394a7 100644 --- a/app/src/plugin/customBlockRender.ts +++ b/app/src/plugin/customBlockRender.ts @@ -3,6 +3,7 @@ import {Constants} from "../constants"; import {genIconHTML} from "../protyle/render/util"; export const customBlockRender = (app: App, element: Element) => { + window.sout.tracker("invoked"); // TODO let abcElements: Element[] = []; if (element.getAttribute("data-subtype") === "abc") { diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts index 9ab3682048..fd60801bba 100644 --- a/app/src/plugin/loader.ts +++ b/app/src/plugin/loader.ts @@ -22,10 +22,12 @@ if (window.require instanceof Function) { } const runCode = (code: string, sourceURL: string) => { + window.sout.tracker("-> code:", code); return window.eval("(function anonymous(require, module, exports){".concat(code, "\n})\n//# sourceURL=").concat(sourceURL, "\n")); }; export const loadPlugins = async (app: App) => { + window.sout.tracker("invoked"); const response = await fetchSyncPost("/api/petal/loadPetals", {frontend: getFrontend()}); let css = ""; // 为加快启动速度,不进行 await @@ -42,6 +44,7 @@ export const loadPlugins = async (app: App) => { }; const loadPluginJS = async (app: App, item: IPluginData) => { + window.sout.tracker("invoked"); const exportsObj: { [key: string]: any } = {}; const moduleObj = {exports: exportsObj}; try { @@ -76,6 +79,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => { // 启用插件 export const loadPlugin = async (app: App, item: IPluginData) => { + window.sout.tracker("invoked"); const plugin = await loadPluginJS(app, item); const styleElement = document.createElement("style"); styleElement.textContent = item.css; @@ -87,6 +91,7 @@ export const loadPlugin = async (app: App, item: IPluginData) => { const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin: Plugin, type: string) => { + window.sout.tracker("invoked"); const dockKeys = Object.keys(plugin.docks); dockItem.forEach((tabItem: Config.IUILayoutDockTab, tabIndex: number) => { if (dockKeys.includes(tabItem.type)) { @@ -105,6 +110,7 @@ const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin: }; export const afterLoadPlugin = (plugin: Plugin) => { + window.sout.tracker("invoked"); try { plugin.onLayoutReady(); } catch (e) { @@ -198,6 +204,7 @@ export const afterLoadPlugin = (plugin: Plugin) => { }; export const reloadPlugin = (app: App) => { + window.sout.tracker("invoked"); app.plugins.forEach((item) => { uninstall(this, item.name); }); diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.ts index fcc7c7ecd4..40af8e5b3b 100644 --- a/app/src/plugin/uninstall.ts +++ b/app/src/plugin/uninstall.ts @@ -6,6 +6,7 @@ import {resizeTopBar} from "../layout/util"; /// #endif export const uninstall = (app: App, name: string, isUninstall = false) => { + window.sout.tracker("invoked"); app.plugins.find((plugin: Plugin, index) => { if (plugin.name === name) { // rm command diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.ts index 5925d7cb79..3fd1c6dfba 100644 --- a/app/src/protyle/breadcrumb/action.ts +++ b/app/src/protyle/breadcrumb/action.ts @@ -13,6 +13,7 @@ import {isWindow} from "../../util/functions"; import {Wnd} from "../../layout/Wnd"; export const net2LocalAssets = (protyle: IProtyle, type: "Assets" | "Img") => { + window.sout.tracker("invoked"); if (protyle.element.querySelector(".wysiwygLoading")) { return; } @@ -34,6 +35,7 @@ export const net2LocalAssets = (protyle: IProtyle, type: "Assets" | "Img") => { }; export const fullscreen = (element: Element, btnElement?: Element) => { + window.sout.tracker("invoked"); setTimeout(() => { hideAllElements(["gutter"]); }, Constants.TIMEOUT_TRANSITION); // 等待页面动画结束 @@ -100,6 +102,7 @@ export const fullscreen = (element: Element, btnElement?: Element) => { }; export const updateReadonly = (target: Element, protyle: IProtyle) => { + window.sout.tracker("invoked"); if (!window.siyuan.config.readonly) { const isReadonly = target.querySelector("use").getAttribute("xlink:href") !== "#iconUnlock"; if (window.siyuan.config.editor.readOnly) { diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index 34ecb7e29b..43e1f531c5 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -16,6 +16,7 @@ import {setStorageVal} from "../util/compatibility"; import {isPaidUser} from "../../util/needSubscribe"; export const saveExport = (option: IExportOptions) => { + window.sout.tracker("invoked"); /// #if !BROWSER if (option.type === "pdf") { if (window.siyuan.config.appearance.mode === 1) { @@ -71,6 +72,7 @@ export const saveExport = (option: IExportOptions) => { }; const getSnippetCSS = () => { + window.sout.tracker("invoked"); let snippetCSS = ""; document.querySelectorAll("style").forEach((item) => { if (item.id.startsWith("snippet")) { @@ -82,6 +84,7 @@ const getSnippetCSS = () => { /// #if !BROWSER const renderPDF = async (id: string) => { + window.sout.tracker("invoked"); const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF]; const servePath = window.location.protocol + "//" + window.location.host; const isDefault = (window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === "midnight") || (window.siyuan.config.appearance.mode === 0 && window.siyuan.config.appearance.themeLight === "daylight"); @@ -566,6 +569,7 @@ const renderPDF = async (id: string) => { }; const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubdocs?: boolean) => { + window.sout.tracker("invoked"); fetchPost("/api/block/getBlockInfo", { id: option.id }, async (response) => { @@ -627,6 +631,7 @@ const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubd }; const onExport = (data: IWebSocketData, filePath: string, exportOption: IExportOptions, removeAssets?: boolean, msgId?: string) => { + window.sout.tracker("invoked"); let themeName = window.siyuan.config.appearance.themeLight; let mode = 0; if (["html", "htmlmd"].includes(exportOption.type) && window.siyuan.config.appearance.mode === 1) { diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.ts index 55e91bac98..f1f847400a 100644 --- a/app/src/protyle/export/util.ts +++ b/app/src/protyle/export/util.ts @@ -15,6 +15,7 @@ import {showFileInFolder} from "../../util/pathName"; import {isPaidUser} from "../../util/needSubscribe"; export const afterExport = (exportPath: string, msgId: string) => { + window.sout.tracker("invoked"); /// #if !BROWSER showMessage(`${window.siyuan.languages.exported} ${escapeHtml(exportPath)}
    @@ -27,6 +28,7 @@ export const afterExport = (exportPath: string, msgId: string) => { }; export const exportImage = (id: string) => { + window.sout.tracker("invoked"); const exportDialog = new Dialog({ title: window.siyuan.languages.exportAsImage, content: `
    diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index 94d0142c30..d2d2005ebf 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -25,6 +25,7 @@ import {openSearchAV} from "../render/av/relation"; import {transaction} from "../wysiwyg/transaction"; export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { + window.sout.tracker("invoked"); hideTooltip(); if (!window.siyuan.menus.menu.element.classList.contains("fn__none") && window.siyuan.menus.menu.element.getAttribute("data-name") === "titleMenu") { @@ -34,7 +35,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { fetchPost("/api/block/getDocInfo", { id: protyle.block.rootID }, (response) => { - console.log(response.data); + window.sout.tracker("/api/block/getDocInfo -> ", response.data); window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.element.setAttribute("data-name", "titleMenu"); window.siyuan.menus.menu.append(new MenuItem({ diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 166e7b8cc7..e34cd725fe 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -22,6 +22,7 @@ import {unicode2Emoji} from "../../emoji"; import {avRender} from "../render/av/render"; export const hintSlash = (key: string, protyle: IProtyle) => { + window.sout.tracker("invoked"); const allList: IHintData[] = [{ filter: ["模版", "moban", "mb", "template"], value: Constants.ZWSP, @@ -280,6 +281,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => { }; export const hintTag = (key: string, protyle: IProtyle): IHintData[] => { + window.sout.tracker("invoked"); protyle.hint.genLoading(protyle); fetchPost("/api/search/searchTag", { k: key, @@ -312,6 +314,7 @@ export const hintTag = (key: string, protyle: IProtyle): IHintData[] => { }; export const genHintItemHTML = (item: IBlock) => { + window.sout.tracker("invoked"); let iconHTML; if (item.type === "NodeDocument" && item.ial.icon) { iconHTML = unicode2Emoji(item.ial.icon, "b3-list-item__graphic popover__block", true); @@ -341,6 +344,7 @@ export const genHintItemHTML = (item: IBlock) => { }; export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IHintData[] => { + window.sout.tracker("invoked"); const nodeElement = hasClosestBlock(getEditorRange(protyle.wysiwyg.element).startContainer); protyle.hint.genLoading(protyle); fetchPost("/api/search/searchRefBlock", { @@ -387,6 +391,7 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH }; export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { + window.sout.tracker("invoked"); if (key.endsWith("}}") || key.endsWith("」」")) { return []; } @@ -417,6 +422,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { }; export const hintRenderTemplate = (value: string, protyle: IProtyle, nodeElement: Element) => { + window.sout.tracker("invoked"); fetchPost("/api/template/render", { id: protyle.block.parentID, path: value @@ -441,6 +447,7 @@ export const hintRenderTemplate = (value: string, protyle: IProtyle, nodeElement }; export const hintRenderWidget = (value: string, protyle: IProtyle) => { + window.sout.tracker("invoked"); focusByRange(protyle.toolbar.range); // src 地址以 / 结尾 // Use the path ending with `/` when loading the widget https://github.com/siyuan-note/siyuan/issues/10520 @@ -449,6 +456,7 @@ export const hintRenderWidget = (value: string, protyle: IProtyle) => { }; export const hintRenderAssets = (value: string, protyle: IProtyle) => { + window.sout.tracker("invoked"); focusByRange(protyle.toolbar.range); const type = pathPosix().extname(value).toLowerCase(); const filename = value.startsWith("assets/") ? getAssetName(value) : value; @@ -457,6 +465,7 @@ export const hintRenderAssets = (value: string, protyle: IProtyle) => { }; export const hintMoveBlock = (pathString: string, sourceElements: Element[], protyle: IProtyle) => { + window.sout.tracker("invoked"); if (pathString === "/") { return; } diff --git a/app/src/protyle/preview/image.ts b/app/src/protyle/preview/image.ts index 66447a3cf8..ce3907d977 100644 --- a/app/src/protyle/preview/image.ts +++ b/app/src/protyle/preview/image.ts @@ -3,6 +3,7 @@ import {addScript} from "../util/addScript"; import {fetchPost} from "../../util/fetch"; export const previewImage = (src: string) => { + window.sout.tracker("invoked"); addScript(`${Constants.PROTYLE_CDN}/js/viewerjs/viewer.js?v=1.10.4`, "protyleViewerScript").then(() => { const imagesElement = document.createElement("ul"); imagesElement.innerHTML = `
  • `; @@ -42,6 +43,7 @@ export const previewImage = (src: string) => { }; export const previewDocImage = (src: string, id: string) => { + window.sout.tracker("invoked"); addScript(`${Constants.PROTYLE_CDN}/js/viewerjs/viewer.js?v=1.10.4`, "protyleViewerScript").then(() => { fetchPost("/api/asset/getDocImageAssets", {id}, (response) => { const imagesElement = document.createElement("ul"); diff --git a/app/src/protyle/render/abcRender.ts b/app/src/protyle/render/abcRender.ts index c7ab4ff914..9adc14e3c9 100644 --- a/app/src/protyle/render/abcRender.ts +++ b/app/src/protyle/render/abcRender.ts @@ -4,6 +4,7 @@ import {genIconHTML} from "./util"; import {hasClosestByClassName} from "../util/hasClosest"; export const abcRender = (element: Element, cdn = Constants.PROTYLE_CDN) => { + window.sout.tracker("invoked"); let abcElements: Element[] = []; if (element.getAttribute("data-subtype") === "abc") { // 编辑器内代码块编辑渲染 diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 505549396b..0024558e0b 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -36,6 +36,7 @@ import {addView, openViewMenu} from "./view"; import {isOnlyMeta, openByMobile, writeText} from "../../util/compatibility"; export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => { + window.sout.tracker("invoked"); const blockElement = hasClosestBlock(event.target); if (!blockElement) { return false; @@ -276,6 +277,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle }; export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, position: IPosition) => { + window.sout.tracker("invoked"); if (rowElement.classList.contains("av__row--header")) { return false; } @@ -419,6 +421,7 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", ' { + window.sout.tracker("invoked"); if (headerValue) { updateHeaderCell(cellElement, headerValue); } else { @@ -480,6 +484,7 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAV }; export const removeAttrViewColAnimation = (blockElement: Element, id: string) => { + window.sout.tracker("invoked"); blockElement.querySelectorAll(`.av__cell[data-col-id="${id}"]`).forEach(item => { item.remove(); }); diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts index 4ba0ca5beb..7665d2a3f9 100644 --- a/app/src/protyle/render/av/asset.ts +++ b/app/src/protyle/render/av/asset.ts @@ -23,6 +23,7 @@ export const bindAssetEvent = (options: { cellElements: HTMLElement[], blockElement: Element }) => { + window.sout.tracker("invoked"); options.menuElement.querySelector("input").addEventListener("change", (event: InputEvent & { target: HTMLInputElement }) => { @@ -52,6 +53,7 @@ export const bindAssetEvent = (options: { }; export const getAssetHTML = (cellElements: HTMLElement[]) => { + window.sout.tracker("invoked"); let html = ""; genCellValueByElement("mAsset", cellElements[0]).mAsset.forEach(item => { if (!item.content) { @@ -100,6 +102,7 @@ export const updateAssetCell = (options: { removeContent?: string, blockElement: Element }) => { + window.sout.tracker("invoked"); const colId = options.cellElements[0].dataset.colId; const cellDoOperations: IOperation[] = []; const cellUndoOperations: IOperation[] = []; @@ -200,6 +203,7 @@ export const updateAssetCell = (options: { }; export const editAssetItem = (protyle: IProtyle, data: IAV, cellElements: HTMLElement[], target: HTMLElement, blockElement: Element) => { + window.sout.tracker("invoked"); const linkAddress = target.dataset.content; const type = target.dataset.type as "image" | "file"; const menu = new Menu("av-asset-edit", () => { @@ -271,6 +275,7 @@ export const editAssetItem = (protyle: IProtyle, data: IAV, cellElements: HTMLEl }; export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLElement[], target: HTMLElement, blockElement: Element) => { + window.sout.tracker("invoked"); const menu = new Menu("av-asset-link", () => { const textElements = menu.element.querySelectorAll("textarea"); if (!textElements[0].value) { @@ -311,6 +316,7 @@ ${window.siyuan.languages.title} }; export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string) => { + window.sout.tracker("invoked"); const msgId = showMessage(window.siyuan.languages.uploading, 0); fetchPost("/api/asset/insertLocalAssets", { assetPaths: files, diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts index 7695e4fbe0..298c0415fe 100644 --- a/app/src/protyle/render/av/blockAttr.ts +++ b/app/src/protyle/render/av/blockAttr.ts @@ -10,6 +10,7 @@ import {transaction} from "../../wysiwyg/transaction"; import {openMenuPanel} from "./openMenuPanel"; const genAVRollupHTML = (value: IAVCellValue) => { + window.sout.tracker("invoked"); let html = ""; switch (value.type) { case "block": @@ -50,6 +51,7 @@ const genAVRollupHTML = (value: IAVCellValue) => { }; export const genAVValueHTML = (value: IAVCellValue) => { + window.sout.tracker("invoked"); let html = ""; switch (value.type) { case "block": @@ -142,6 +144,7 @@ export const genAVValueHTML = (value: IAVCellValue) => { }; export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IProtyle, cb?: (element: HTMLElement) => void) => { + window.sout.tracker("invoked"); fetchPost("/api/av/getAttributeViewKeys", {id}, (response) => { let html = ""; response.data.forEach((table: { diff --git a/app/src/protyle/render/av/calc.ts b/app/src/protyle/render/av/calc.ts index 844ff9911f..489d09d4fc 100644 --- a/app/src/protyle/render/av/calc.ts +++ b/app/src/protyle/render/av/calc.ts @@ -14,6 +14,7 @@ const calcItem = (options: { avId: string, blockID: string }) => { + window.sout.tracker("invoked"); options.menu.addItem({ iconHTML: "", label: getNameByOperator(options.operator, !!options.data), @@ -80,6 +81,7 @@ export const openCalcMenu = async (protyle: IProtyle, calcElement: HTMLElement, colId: string, blockID: string }) => { + window.sout.tracker("invoked"); let rowElement: HTMLElement | false; let type; let colId: string; @@ -393,6 +395,7 @@ export const openCalcMenu = async (protyle: IProtyle, calcElement: HTMLElement, }; export const getCalcValue = (column: IAVColumn) => { + window.sout.tracker("invoked"); if (!column.calc || !column.calc.result) { return ""; } @@ -465,6 +468,7 @@ export const getCalcValue = (column: IAVColumn) => { }; export const getNameByOperator = (operator: string, isRollup: boolean) => { + window.sout.tracker("invoked"); switch (operator) { case undefined: case "": diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index a48eb41b8b..94e5b37f4e 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -15,6 +15,7 @@ import {Constants} from "../../../constants"; import {hintRef} from "../../hint/extend"; const renderCellURL = (urlContent: string) => { + window.sout.tracker("invoked"); let host = urlContent; let suffix = ""; try { @@ -34,6 +35,7 @@ const renderCellURL = (urlContent: string) => { }; export const getCellText = (cellElement: HTMLElement | false) => { + window.sout.tracker("invoked"); if (!cellElement) { return ""; } @@ -57,6 +59,7 @@ export const getCellText = (cellElement: HTMLElement | false) => { }; export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) => { + window.sout.tracker("invoked"); const cellValue: IAVCellValue = { type: colType, id: cellElement.dataset.id, @@ -130,6 +133,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement) }; export const genCellValue = (colType: TAVCol, value: string | any) => { + window.sout.tracker("invoked"); let cellValue: IAVCellValue = { type: colType, [colType === "select" ? "mSelect" : colType]: value as IAVCellDateValue @@ -242,6 +246,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => { }; export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Element, onlyHeight = true) => { + window.sout.tracker("invoked"); const cellRect = cellElement.getBoundingClientRect(); if (!onlyHeight) { const avScrollElement = blockElement.querySelector(".av__scroll"); @@ -298,6 +303,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme }; export const getTypeByCellElement = (cellElement: Element) => { + window.sout.tracker("invoked"); const scrollElement = hasClosestByClassName(cellElement, "av__scroll"); if (!scrollElement) { return; @@ -306,6 +312,7 @@ export const getTypeByCellElement = (cellElement: Element) => { }; export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type?: TAVCol) => { + window.sout.tracker("invoked"); if (cellElements.length === 0 || (cellElements.length === 1 && !cellElements[0])) { return; } @@ -449,6 +456,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type }; const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, blockElement: HTMLElement, cellElements: HTMLElement[]) => { + window.sout.tracker("invoked"); const rowElement = hasClosestByClassName(cellElements[0], "av__row"); if (!rowElement) { return; @@ -497,6 +505,7 @@ const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, blockElement: H }; export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, value?: any, cElements?: HTMLElement[]) => { + window.sout.tracker("invoked"); const doOperations: IOperation[] = []; const undoOperations: IOperation[] = []; @@ -610,6 +619,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va }; export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => { + window.sout.tracker("invoked"); if (value.type === "checkbox") { if (value.checkbox.checked) { cellElement.classList.add("av__cell-check"); @@ -627,6 +637,7 @@ export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => { }; export const renderCell = (cellValue: IAVCellValue) => { + window.sout.tracker("invoked"); let text = ""; if (["text", "template"].includes(cellValue.type)) { text = `${cellValue ? (cellValue[cellValue.type as "text"].content || "") : ""}`; @@ -703,6 +714,7 @@ export const renderCell = (cellValue: IAVCellValue) => { }; const renderRollup = (cellValue: IAVCellValue) => { + window.sout.tracker("invoked"); let text = ""; if (["text"].includes(cellValue.type)) { text = cellValue ? (cellValue[cellValue.type as "text"].content || "") : ""; @@ -744,6 +756,7 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: { name?: string, pin?: boolean, }) => { + window.sout.tracker("invoked"); if (typeof headerValue.icon !== "undefined") { cellElement.dataset.icon = headerValue.icon; cellElement.querySelector(".av__cellheadericon").outerHTML = headerValue.icon ? unicode2Emoji(headerValue.icon, "av__cellheadericon", true) : ``; @@ -764,6 +777,7 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: { }; export const getPositionByCellElement = (cellElement: HTMLElement) => { + window.sout.tracker("invoked"); let rowElement = hasClosestByClassName(cellElement, "av__row"); if (!rowElement) { return; @@ -787,6 +801,7 @@ export const getPositionByCellElement = (cellElement: HTMLElement) => { export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, originData: { [key: string]: IAVCellValue[] }, originCellIds: string[]) => { + window.sout.tracker("invoked"); nodeElement.querySelector(".av__drag-fill")?.remove(); const newData: { [key: string]: Array } = {}; nodeElement.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => { @@ -854,6 +869,7 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, }; export const addDragFill = (cellElement: Element) => { + window.sout.tracker("invoked"); if (!cellElement) { return; } diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index ef6d87b91a..0a7384f1bf 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -24,6 +24,7 @@ export const duplicateCol = (options: { viewID: string, blockElement: Element }) => { + window.sout.tracker("invoked"); const id = Lute.NewNodeID(); const nameMatch = options.newValue.match(/^(.*) \((\d+)\)$/); if (nameMatch) { @@ -114,6 +115,7 @@ export const getEditHTML = (options: { data: IAV, isCustomAttr: boolean }) => { + window.sout.tracker("invoked"); let colData: IAVColumn; options.data.view.columns.find((item) => { if (item.id === options.colId) { @@ -241,6 +243,7 @@ export const bindEditEvent = (options: { menuElement: HTMLElement, isCustomAttr: boolean }) => { + window.sout.tracker("invoked"); const avID = options.data.id; const colId = options.menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id"); const colData = options.data.view.columns.find((item: IAVColumn) => item.id === colId); @@ -396,6 +399,7 @@ export const bindEditEvent = (options: { }; export const getColNameByType = (type: TAVCol) => { + window.sout.tracker("invoked"); switch (type) { case "text": case "number": @@ -425,6 +429,7 @@ export const getColNameByType = (type: TAVCol) => { }; export const getColIconByType = (type: TAVCol) => { + window.sout.tracker("invoked"); switch (type) { case "text": return "iconAlignLeft"; @@ -469,6 +474,7 @@ const addAttrViewColAnimation = (options: { icon?: string, previousID: string }) => { + window.sout.tracker("invoked"); if (!options.blockElement) { return; } @@ -520,6 +526,7 @@ const addAttrViewColAnimation = (options: { }; export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElement: HTMLElement) => { + window.sout.tracker("invoked"); const type = cellElement.getAttribute("data-dtype") as TAVCol; const colId = cellElement.getAttribute("data-col-id"); const avID = blockElement.getAttribute("data-av-id"); @@ -852,6 +859,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen }; const genUpdateColItem = (type: TAVCol, oldType: TAVCol, name: string) => { + window.sout.tracker("invoked"); return `
    `; let searchTimeout: number; const updateSearch = (e: HTMLElement, protyle: IProtyle) => { + window.sout.tracker("invoked"); clearTimeout(searchTimeout); searchTimeout = window.setTimeout(() => { e.removeAttribute("data-render"); @@ -371,6 +373,7 @@ const refreshTimeouts: { [key: string]: number; } = {}; export const refreshAV = (protyle: IProtyle, operation: IOperation) => { + window.sout.tracker("invoked"); if (operation.action === "setAttrViewName") { Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => { const titleElement = item.querySelector(".av__title") as HTMLElement; diff --git a/app/src/protyle/render/av/rollup.ts b/app/src/protyle/render/av/rollup.ts index 4c38c8ea37..7e5afa7f02 100644 --- a/app/src/protyle/render/av/rollup.ts +++ b/app/src/protyle/render/av/rollup.ts @@ -16,6 +16,7 @@ const updateCol = (options: { colId: string, isRelation: boolean, }, itemElement: HTMLElement) => { + window.sout.tracker("invoked"); if (itemElement.classList.contains("b3-list--empty")) { return; } @@ -59,6 +60,7 @@ const updateCol = (options: { }; const genSearchList = (element: Element, keyword: string, avId: string, isRelation: boolean, cb?: () => void) => { + window.sout.tracker("invoked"); if (!isRelation && !avId) { showMessage(window.siyuan.languages.selectRelation); return; @@ -88,6 +90,7 @@ export const goSearchRollupCol = (options: { colId: string, isRelation: boolean, }) => { + window.sout.tracker("invoked"); window.siyuan.menus.menu.remove(); const menu = new Menu(); menu.addItem({ @@ -145,6 +148,7 @@ export const goSearchRollupCol = (options: { }; export const getRollupHTML = (options: { data?: IAV, cellElements?: HTMLElement[], colData?: IAVColumn }) => { + window.sout.tracker("invoked"); let colData: IAVColumn; if (options.colData) { colData = options.colData; @@ -178,6 +182,7 @@ export const bindRollupData = (options: { data: IAV, menuElement: HTMLElement }) => { + window.sout.tracker("invoked"); const goSearchRollupColElement = options.menuElement.querySelector('[data-type="goSearchRollupCol"]') as HTMLElement; if (goSearchRollupColElement) { const oldValue = JSON.parse(goSearchRollupColElement.dataset.oldValue) as IAVCellRollupValue; diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts index 3cff6a9c38..517870f497 100644 --- a/app/src/protyle/render/av/row.ts +++ b/app/src/protyle/render/av/row.ts @@ -9,6 +9,7 @@ import {showMessage} from "../../../dialog/message"; import {formatDate} from "sofill/mid"; export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect" | "unselectAll") => { + window.sout.tracker("invoked"); const rowElement = hasClosestByClassName(checkElement, "av__row"); if (!rowElement) { return; @@ -46,6 +47,7 @@ export const selectRow = (checkElement: Element, type: "toggle" | "select" | "un }; export const updateHeader = (rowElement: HTMLElement) => { + window.sout.tracker("invoked"); const blockElement = hasClosestBlock(rowElement); if (!blockElement) { return; @@ -75,6 +77,7 @@ export const updateHeader = (rowElement: HTMLElement) => { }; const setPage = (blockElement: Element) => { + window.sout.tracker("invoked"); const pageSize = parseInt(blockElement.getAttribute("data-page-size")); if (pageSize) { const currentCount = blockElement.querySelectorAll(".av__row:not(.av__row--header)").length; @@ -93,6 +96,7 @@ const setPage = (blockElement: Element) => { * @param avId 存在为新增否则为拖拽插入 */ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: Element, srcIDs: string[], previousId: string, avId?: string,) => { + window.sout.tracker("invoked"); if ((blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement).value !== "") { showMessage(window.siyuan.languages.insertRowTip); return; @@ -182,6 +186,7 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat }; export const stickyRow = (blockElement: HTMLElement, elementRect: DOMRect, status: "top" | "bottom" | "all") => { + window.sout.tracker("invoked"); if (blockElement.querySelector(".av__title").getAttribute("contenteditable") === "false") { return; } @@ -218,6 +223,7 @@ const updatePageSize = (options: { avID: string, nodeElement: Element }) => { + window.sout.tracker("invoked"); if (options.currentPageSize === options.newPageSize) { return; } @@ -243,6 +249,7 @@ export const setPageSize = (options: { avID: string, nodeElement: Element }) => { + window.sout.tracker("invoked"); const menu = new Menu("av-page-size"); if (menu.isOpen) { return; @@ -312,6 +319,7 @@ export const setPageSize = (options: { }; export const deleteRow = (blockElement: HTMLElement, protyle: IProtyle) => { + window.sout.tracker("invoked"); const avID = blockElement.getAttribute("data-av-id"); const undoOperations: IOperation[] = []; const rowElements = blockElement.querySelectorAll(".av__row--select:not(.av__row--header)"); @@ -353,6 +361,7 @@ export const deleteRow = (blockElement: HTMLElement, protyle: IProtyle) => { }; export const insertRows = (blockElement: HTMLElement, protyle: IProtyle, count: number, previousID: string) => { + window.sout.tracker("invoked"); const avID = blockElement.getAttribute("data-av-id"); const srcIDs: string[] = []; new Array(count).fill(0).forEach(() => { diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index c4ca82982f..4c7f4f1cc9 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -10,6 +10,7 @@ import {escapeAttr} from "../../../util/escape"; import {genCellValueByElement, getTypeByCellElement} from "./cell"; const filterSelectHTML = (key: string, options: { name: string, color: string }[], selected: string[] = []) => { + window.sout.tracker("invoked"); let html = ""; let hasMatch = false; if (selected.length === 0) { @@ -62,6 +63,7 @@ const filterSelectHTML = (key: string, options: { name: string, color: string }[ }; export const removeCellOption = (protyle: IProtyle, data: IAV, cellElements: HTMLElement[], target: HTMLElement, blockElement: Element) => { + window.sout.tracker("invoked"); if (!target) { return; } @@ -131,6 +133,7 @@ export const removeCellOption = (protyle: IProtyle, data: IAV, cellElements: HTM }; export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement, blockElement: Element, isCustomAttr: boolean, cellElements?: HTMLElement[]) => { + window.sout.tracker("invoked"); const menuElement = hasClosestByClassName(target, "b3-menu"); if (!menuElement) { return; @@ -393,6 +396,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement, }; export const bindSelectEvent = (protyle: IProtyle, data: IAV, menuElement: HTMLElement, cellElements: HTMLElement[], blockElement: Element) => { + window.sout.tracker("invoked"); const inputElement = menuElement.querySelector("input"); const colId = cellElements[0].dataset.colId; let colData: IAVColumn; @@ -439,6 +443,7 @@ export const bindSelectEvent = (protyle: IProtyle, data: IAV, menuElement: HTMLE }; export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: HTMLElement[], currentElement: HTMLElement, menuElement: HTMLElement, blockElement: Element) => { + window.sout.tracker("invoked"); let hasSelected = false; Array.from(menuElement.querySelectorAll(".b3-chips .b3-chip")).find((item: HTMLElement) => { if (item.dataset.content === currentElement.dataset.name) { @@ -572,6 +577,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H }; export const getSelectHTML = (data: IAVTable, cellElements: HTMLElement[]) => { + window.sout.tracker("invoked"); const colId = cellElements[0].dataset["colId"]; const colData = data.columns.find(item => { if (item.id === colId) { diff --git a/app/src/protyle/render/av/sort.ts b/app/src/protyle/render/av/sort.ts index af727019b4..973b70f0f0 100644 --- a/app/src/protyle/render/av/sort.ts +++ b/app/src/protyle/render/av/sort.ts @@ -13,6 +13,7 @@ export const addSort = (options: { protyle: IProtyle, blockID: string, }) => { + window.sout.tracker("invoked"); const menu = new Menu("av-add-sort"); options.data.view.columns.forEach((column) => { let hasSort = false; @@ -58,6 +59,7 @@ export const addSort = (options: { }; export const bindSortsEvent = (protyle: IProtyle, menuElement: HTMLElement, data: IAV, blockID: string) => { + window.sout.tracker("invoked"); menuElement.querySelectorAll("select").forEach((item: HTMLSelectElement) => { item.addEventListener("change", () => { const colId = item.parentElement.getAttribute("data-id"); @@ -89,6 +91,7 @@ export const bindSortsEvent = (protyle: IProtyle, menuElement: HTMLElement, data }; export const getSortsHTML = (columns: IAVColumn[], sorts: IAVSort[]) => { + window.sout.tracker("invoked"); let html = ""; const genSortItem = (id: string) => { let sortHTML = ""; diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts index 190bfdb3ac..8adf5254ed 100644 --- a/app/src/protyle/render/av/view.ts +++ b/app/src/protyle/render/av/view.ts @@ -7,6 +7,7 @@ import {getEditorRange} from "../../util/selection"; import {Constants} from "../../../constants"; export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLElement, element: HTMLElement }) => { + window.sout.tracker("invoked"); const menu = new Menu("av-view"); if (menu.isOpen) { return; @@ -89,6 +90,7 @@ export const bindViewEvent = (options: { data: IAV, menuElement: HTMLElement }) => { + window.sout.tracker("invoked"); const inputElement = options.menuElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement; inputElement.addEventListener("blur", () => { if (inputElement.value !== inputElement.dataset.value) { @@ -120,6 +122,7 @@ export const bindViewEvent = (options: { }; export const getViewHTML = (data: IAVTable) => { + window.sout.tracker("invoked"); return `