🎨 查询嵌入块支持设置是否显示面包屑 https://github.com/siyuan-note/siyuan/issues/6184

This commit is contained in:
Liang Ding 2022-10-17 10:37:01 +08:00
parent 82ffe82c81
commit 3bc24f89c5
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
10 changed files with 62 additions and 35 deletions

View file

@ -1,4 +1,6 @@
{
"embedBlockBreadcrumb": "Embed Block Breadcrumb",
"embedBlockBreadcrumbTip": "After enabling embed block will show breadcrumbs",
"appearanceMode": "Appearance Mode",
"editMode": "Edit Mode",
"editReadonly": "Read-only mode",

View file

@ -1,4 +1,6 @@
{
"embedBlockBreadcrumb": "Incrustar migas de pan de bloque",
"embedBlockBreadcrumbTip": "Después de habilitar el bloque incrustado, se mostrarán migas de pan",
"appearanceMode": "Modo de apariencia",
"editMode": "Modo de edición",
"editReadonly": "Modo de solo lectura",

View file

@ -1,4 +1,6 @@
{
"embedBlockBreadcrumb": "Intégrer le fil d'Ariane du bloc",
"embedBlockBreadcrumbTip": "Après avoir activé le bloc d'intégration, le fil d'Ariane s'affichera",
"appearanceMode": "Mode d'apparence",
"editMode": "Mode d'édition",
"editReadonly": "Mode lecture seule",

View file

@ -1,4 +1,6 @@
{
"embedBlockBreadcrumb": "嵌入塊麵包屑",
"embedBlockBreadcrumbTip": "啟用後嵌入塊將顯示麵包屑",
"appearanceMode": "外觀模式",
"editMode": "編輯模式",
"editReadonly": "只讀模式",
@ -14,7 +16,7 @@
"tWithSubtitle": "帶子標題轉換",
"clear": "清空",
"autoDownloadUpdatePkg": "自動下載更新安裝包",
"autoDownloadUpdatePkgTip": "啟後會每隔兩小時自動檢查版本更新,如果有更新版本則自動下載安裝包並提示安裝",
"autoDownloadUpdatePkgTip": "後會每隔兩小時自動檢查版本更新,如果有更新版本則自動下載安裝包並提示安裝",
"downloaded": "已下載",
"allOp": "所有操作",
"htmlBlockError": "以下 script 執行會影響界面顯示,已經停止運行該腳本",
@ -48,7 +50,7 @@
"newDocBelow": "在下方新建文檔",
"newDocAbove": "在上方新建文檔",
"fullWidth": "自適應寬度",
"fullWidthTip": "啟後將盡可能寬地顯示編輯區",
"fullWidthTip": "後將盡可能寬地顯示編輯區",
"tabLimit": "頁簽打開最大數量",
"tabLimit1": "按照打開時間排序,關閉最早打開的頁簽",
"pasteEscaped": "粘貼轉義文本",
@ -552,27 +554,27 @@
"appearance10": "關閉按鈕設置",
"appearance11": "點擊關閉按鈕後縮小到託盤中",
"appearance14": "文檔圖示使用系統原生 Emoji",
"appearance15": "桌面端預設使用 Twitter Emoji啟後將使用系統原生的 Emoji",
"appearance15": "桌面端預設使用 Twitter Emoji後將使用系統原生的 Emoji",
"appearance16": "隱藏底部狀態欄",
"appearance17": "啟後將隱藏桌面端底部狀態欄",
"appearance17": "後將隱藏桌面端底部狀態欄",
"min": "最小化",
"restore": "向下還原",
"max": "最大化",
"md2": "代碼塊連字",
"md3": "開啟後,代碼塊將顯示連字",
"md3": "啟用後代碼塊將顯示連字",
"md4": "自動進行段首縮進,以符合傳統中文排版習慣",
"md7": "是否顯示網路圖片角標",
"md8": "啟後如果圖片是網路檔(非本地資源檔)則會顯示角標",
"md8": "後如果圖片是網路檔(非本地資源檔)則會顯示角標",
"md12": "是否顯示書簽、命名、別名、備註和引用計數",
"md16": "啟後如果存在這些資訊則將在塊的右上側進行顯示",
"md16": "後如果存在這些資訊則將在塊的右上側進行顯示",
"md27": "代碼塊顯示行號",
"md28": "啟後代碼塊會顯示行號",
"md28": "後代碼塊會顯示行號",
"md29": "Tab 空格數",
"md30": "僅在按下 Tab 時替換為空格,不會將剪切板中的 Tab 替換為空格",
"md31": "代碼塊換行",
"md32": "啟後代碼塊中的內容將自動換行",
"md32": "後代碼塊中的內容將自動換行",
"md33": "虛擬引用",
"md34": "啟後將自動根據已有塊引的命名、別名和錨文本來標識出可能存在的引用關係",
"md34": "後將自動根據已有塊引的命名、別名和錨文本來標識出可能存在的引用關係",
"md35": "虛擬引用關鍵字排除列表",
"md36": "使用英文狀態下的逗號 <code class='fn__code'>,</code> 進行分隔,逗號自身可通過 <code class='fn__code'>\\,</code> 轉義",
"md37": "塊引動態錨文本最大長度",
@ -611,7 +613,7 @@
"theme11": "淺色模式下使用主題",
"theme12": "深色模式下使用主題",
"theme13": "自訂當前主題",
"theme14": "啟後會使用自訂後的主題,關閉後將使用原有主題",
"theme14": "後會使用自訂後的主題,關閉後將使用原有主題",
"theme2": "選擇外觀使用的圖示",
"language1": "選擇外觀的顯示語言",
"summary": "摘要",
@ -685,7 +687,7 @@
"about7": "工作空間目錄",
"about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中<br>如果需要復制數據,請手動在文件系統上將當前工作空間 <code class='fn__code'>data</code> 文件夾拷貝到目標工作空間下<br>修改後會自動關閉應用,請手動重啟",
"about9": "自動上傳報錯信息和診斷數據",
"about10": "啟後會通過 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自動上傳報錯信息和診斷數據等不涉及個人隱私的數據,以便開發者修復缺陷和提升用戶體驗。修改後會自動關閉應用,請手動重啟",
"about10": "後會通過 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自動上傳報錯信息和診斷數據等不涉及個人隱私的數據,以便開發者修復缺陷和提升用戶體驗。修改後會自動關閉應用,請手動重啟",
"about11": "網路伺服",
"about12": "啟用後將允許同一區域網內的其他設備進行存取。修改後會自動關閉應用,請手動重啟",
"about13": "API token",

View file

@ -1,4 +1,6 @@
{
"embedBlockBreadcrumb": "嵌入块面包屑",
"embedBlockBreadcrumbTip": "启用后嵌入块将显示面包屑",
"appearanceMode": "外观模式",
"editMode": "编辑模式",
"editReadonly": "只读模式",
@ -14,7 +16,7 @@
"tWithSubtitle": "带子标题转换",
"clear": "清空",
"autoDownloadUpdatePkg": "自动下载更新安装包",
"autoDownloadUpdatePkgTip": "启后会每隔两小时自动检查版本更新,如果有更新版本则自动下载安装包并提示安装",
"autoDownloadUpdatePkgTip": "后会每隔两小时自动检查版本更新,如果有更新版本则自动下载安装包并提示安装",
"downloaded": "已下载",
"allOp": "所有操作",
"htmlBlockError": "以下 script 执行会影响界面显示,已经停止运行该脚本",
@ -48,7 +50,7 @@
"newDocBelow": "在下方新建文档",
"newDocAbove": "在上方新建文档",
"fullWidth": "自适应宽度",
"fullWidthTip": "启后将尽可能宽地显示编辑区",
"fullWidthTip": "后将尽可能宽地显示编辑区",
"tabLimit": "页签打开最大数量",
"tabLimit1": "按照打开时间排序,关闭最早打开的页签",
"pasteEscaped": "粘贴转义文本",
@ -552,27 +554,27 @@
"appearance10": "关闭按钮设置",
"appearance11": "点击关闭按钮后缩小到托盘中",
"appearance14": "文档图标使用系统原生 Emoji",
"appearance15": "桌面端默认使用 Twitter Emoji启后将使用系统原生的 Emoji",
"appearance15": "桌面端默认使用 Twitter Emoji后将使用系统原生的 Emoji",
"appearance16": "隐藏底部状态栏",
"appearance17": "启后将隐藏桌面端底部状态栏",
"appearance17": "后将隐藏桌面端底部状态栏",
"min": "最小化",
"restore": "向下还原",
"max": "最大化",
"md2": "代码块连字",
"md3": "开启后,代码块将显示连字",
"md3": "启用后代码块将显示连字",
"md4": "自动进行段首缩进,以符合传统中文排版习惯",
"md7": "是否显示网络图片角标",
"md8": "启后如果图片是网络文件(非本地资源文件)则会显示角标",
"md8": "后如果图片是网络文件(非本地资源文件)则会显示角标",
"md12": "是否显示书签、命名、别名、备注和引用计数",
"md16": "启后如果存在这些信息则将在块的右上侧进行显示",
"md16": "后如果存在这些信息则将在块的右上侧进行显示",
"md27": "代码块显示行号",
"md28": "启后代码块会显示行号",
"md28": "后代码块会显示行号",
"md29": "Tab 空格数",
"md30": "仅在按下 Tab 时替换为空格,不会将剪切板中的 Tab 替换为空格",
"md31": "代码块换行",
"md32": "启后代码块中的内容将自动换行",
"md32": "后代码块中的内容将自动换行",
"md33": "虚拟引用",
"md34": "启后将自动根据已有块引的命名、别名和锚文本来标识出可能存在的引用关系",
"md34": "后将自动根据已有块引的命名、别名和锚文本来标识出可能存在的引用关系",
"md35": "虚拟引用关键字排除列表",
"md36": "使用英文状态下的逗号 <code class='fn__code'>,</code> 进行分隔,逗号自身可通过 <code class='fn__code'>\\,</code> 转义",
"md37": "块引动态锚文本最大长度",
@ -611,7 +613,7 @@
"theme11": "明亮模式下使用主题",
"theme12": "暗黑模式下使用主题",
"theme13": "自定义当前主题",
"theme14": "启后会使用自定义后的主题,关闭后将使用原有主题",
"theme14": "后会使用自定义后的主题,关闭后将使用原有主题",
"theme2": "选择外观使用的图标",
"language1": "选择外观的显示语言",
"summary": "摘要",
@ -685,7 +687,7 @@
"about7": "工作空间目录",
"about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中<br>如果需要复制数据,请手动在文件系统上将当前工作空间 <code class='fn__code'>data</code> 文件夹拷贝到目标工作空间下<br>修改后会自动关闭应用,请手动重启",
"about9": "自动上传报错信息和诊断数据",
"about10": "启后会通过 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自动上传报错信息和诊断数据等不涉及个人隐私的数据,以便开发者修复缺陷和提升用户体验。修改后会自动关闭应用,请手动重启",
"about10": "后会通过 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自动上传报错信息和诊断数据等不涉及个人隐私的数据,以便开发者修复缺陷和提升用户体验。修改后会自动关闭应用,请手动重启",
"about11": "网络伺服",
"about12": "启用后将允许同一局域网内的其他设备进行访问。修改后会自动关闭应用,请手动重启",
"about13": "API token",

View file

@ -116,6 +116,14 @@ export const editor = {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="codeSyntaxHighlightLineNum" type="checkbox"${window.siyuan.config.editor.codeSyntaxHighlightLineNum ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.embedBlockBreadcrumb}
<div class="b3-label__text">${window.siyuan.languages.embedBlockBreadcrumbTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="embedBlockBreadcrumb" type="checkbox"${window.siyuan.config.editor.embedBlockBreadcrumb ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.md33}
@ -224,6 +232,7 @@ export const editor = {
displayBookmarkIcon: (editor.element.querySelector("#displayBookmarkIcon") as HTMLInputElement).checked,
displayNetImgMark: (editor.element.querySelector("#displayNetImgMark") as HTMLInputElement).checked,
codeSyntaxHighlightLineNum: (editor.element.querySelector("#codeSyntaxHighlightLineNum") as HTMLInputElement).checked,
embedBlockBreadcrumb: (editor.element.querySelector("#embedBlockBreadcrumb") as HTMLInputElement).checked,
plantUMLServePath: (editor.element.querySelector("#plantUMLServePath") as HTMLInputElement).value,
katexMacros: (editor.element.querySelector("#katexMacros") as HTMLTextAreaElement).value,
codeLineWrap: (editor.element.querySelector("#codeLineWrap") as HTMLInputElement).checked,

View file

@ -241,6 +241,7 @@ declare interface IEditor {
displayBookmarkIcon: boolean;
displayNetImgMark: boolean;
codeSyntaxHighlightLineNum: boolean;
embedBlockBreadcrumb: boolean;
plantUMLServePath: string;
codeLigatures: boolean;
codeTabSpaces: number;

View file

@ -17,14 +17,14 @@
package conf
type Editor struct {
FontSize int `json:"fontSize"`
FontFamily string `json:"fontFamily"`
CodeSyntaxHighlightLineNum bool `json:"codeSyntaxHighlightLineNum"`
CodeTabSpaces int `json:"codeTabSpaces"` // 代码块中 Tab 转换空格数,配置为 0 则表示不转换
CodeLineWrap bool `json:"codeLineWrap"` // 代码块是否自动折行
CodeLigatures bool `json:"codeLigatures"` // 代码块是否连字
DisplayBookmarkIcon bool `json:"displayBookmarkIcon"`
DisplayNetImgMark bool `json:"displayNetImgMark"`
FontSize int `json:"fontSize"` // 字体大小
FontFamily string `json:"fontFamily"` // 字体
CodeSyntaxHighlightLineNum bool `json:"codeSyntaxHighlightLineNum"` // 代码块是否显示行号
CodeTabSpaces int `json:"codeTabSpaces"` // 代码块中 Tab 转换空格数,配置为 0 则表示不转换
CodeLineWrap bool `json:"codeLineWrap"` // 代码块是否自动折行
CodeLigatures bool `json:"codeLigatures"` // 代码块是否连字
DisplayBookmarkIcon bool `json:"displayBookmarkIcon"` // 是否显示书签图标
DisplayNetImgMark bool `json:"displayNetImgMark"` // 是否显示网络图片角标
GenerateHistoryInterval int `json:"generateHistoryInterval"` // 生成历史时间间隔,单位:分钟
HistoryRetentionDays int `json:"historyRetentionDays"` // 历史保留天数
Emoji []string `json:"emoji"` // 常用表情
@ -35,6 +35,7 @@ type Editor struct {
FullWidth bool `json:"fullWidth"` // 是否使用最大宽度
KaTexMacros string `json:"katexMacros"` // KeTex 宏定义
ReadOnly bool `json:"readOnly"` // 只读模式
EmbedBlockBreadcrumb bool `json:"embedBlockBreadcrumb"` // 嵌入块是否显示面包屑
}
func NewEditor() *Editor {
@ -55,5 +56,6 @@ func NewEditor() *Editor {
FullWidth: true,
KaTexMacros: "{}",
ReadOnly: false,
EmbedBlockBreadcrumb: false,
}
}

View file

@ -381,7 +381,7 @@ func getBlock(id string) (ret *Block, err error) {
return
}
func getBlockRendered(trees map[string]*parse.Tree, sqlBlock *sql.Block, headingMode int) (block *Block, blockPaths []*BlockPath) {
func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, headingMode int) (block *Block, blockPaths []*BlockPath) {
tree, _ := trees[sqlBlock.RootID]
if nil == tree {
tree, _ = loadTreeByBlockID(sqlBlock.RootID)
@ -434,6 +434,11 @@ func getBlockRendered(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
luteEngine.RenderOptions.ProtyleContenteditable = false // 不可编辑
dom := renderBlockDOMByNodes(nodes, luteEngine)
block = &Block{Box: def.Box, Path: def.Path, HPath: b.HPath, ID: def.ID, Type: def.Type.String(), Content: dom}
blockPaths = buildBlockBreadcrumb(def)
if Conf.Editor.EmbedBlockBreadcrumb {
blockPaths = buildBlockBreadcrumb(def)
}
if 1 > len(blockPaths) {
blockPaths = []*BlockPath{}
}
return
}

View file

@ -76,7 +76,7 @@ func searchEmbedBlock(stmt string, excludeIDs []string, headingMode int) (ret []
}
for _, sb := range sqlBlocks {
block, blockPaths := getBlockRendered(trees, sb, headingMode)
block, blockPaths := getEmbeddedBlock(trees, sb, headingMode)
if nil == block {
continue
}