2023-06-24 20:39:55 +08:00
|
|
|
|
// SiYuan - Refactor your thinking
|
2022-05-26 15:18:53 +08:00
|
|
|
|
// Copyright (c) 2020-present, b3log.org
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
package conf
|
|
|
|
|
|
|
2024-04-26 12:08:01 +08:00
|
|
|
|
import "github.com/siyuan-note/siyuan/kernel/util"
|
|
|
|
|
|
|
2022-05-26 15:18:53 +08:00
|
|
|
|
type Editor struct {
|
2024-04-27 23:01:31 +08:00
|
|
|
|
AllowHTMLBLockScript bool `json:"allowHTMLBLockScript"` // 允许执行 HTML 块内脚本
|
2024-04-26 12:08:01 +08:00
|
|
|
|
FontSize int `json:"fontSize"` // 字体大小
|
|
|
|
|
|
FontSizeScrollZoom bool `json:"fontSizeScrollZoom"` // 字体大小是否支持滚轮缩放
|
|
|
|
|
|
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"` // 常用表情
|
|
|
|
|
|
VirtualBlockRef bool `json:"virtualBlockRef"` // 是否启用虚拟引用
|
|
|
|
|
|
VirtualBlockRefExclude string `json:"virtualBlockRefExclude"` // 虚拟引用关键字排除列表
|
|
|
|
|
|
VirtualBlockRefInclude string `json:"virtualBlockRefInclude"` // 虚拟引用关键字包含列表
|
|
|
|
|
|
BlockRefDynamicAnchorTextMaxLen int `json:"blockRefDynamicAnchorTextMaxLen"` // 块引动态锚文本最大长度
|
|
|
|
|
|
PlantUMLServePath string `json:"plantUMLServePath"` // PlantUML 伺服地址
|
|
|
|
|
|
FullWidth bool `json:"fullWidth"` // 是否使用最大宽度
|
|
|
|
|
|
KaTexMacros string `json:"katexMacros"` // KeTex 宏定义
|
|
|
|
|
|
ReadOnly bool `json:"readOnly"` // 只读模式
|
|
|
|
|
|
EmbedBlockBreadcrumb bool `json:"embedBlockBreadcrumb"` // 嵌入块是否显示面包屑
|
|
|
|
|
|
ListLogicalOutdent bool `json:"listLogicalOutdent"` // 列表逻辑反向缩进
|
|
|
|
|
|
ListItemDotNumberClickFocus bool `json:"listItemDotNumberClickFocus"` // 单击列表项标记聚焦
|
|
|
|
|
|
FloatWindowMode int `json:"floatWindowMode"` // 浮窗触发模式,0:光标悬停,1:按住 Ctrl 悬停,2:不触发浮窗
|
|
|
|
|
|
DynamicLoadBlocks int `json:"dynamicLoadBlocks"` // 块动态数,可配置区间 [48, 1024]
|
|
|
|
|
|
Justify bool `json:"justify"` // 是否两端对齐
|
|
|
|
|
|
RTL bool `json:"rtl"` // 是否从右到左显示
|
|
|
|
|
|
Spellcheck bool `json:"spellcheck"` // 是否启用拼写检查
|
|
|
|
|
|
OnlySearchForDoc bool `json:"onlySearchForDoc"` // 是否启用 [[ 仅搜索文档块
|
|
|
|
|
|
BacklinkExpandCount int `json:"backlinkExpandCount"` // 反向链接默认展开数量
|
|
|
|
|
|
BackmentionExpandCount int `json:"backmentionExpandCount"` // 反链提及默认展开数量
|
2024-10-21 23:40:51 +08:00
|
|
|
|
BacklinkContainChildren bool `json:"backlinkContainChildren"` // 反向链接是否包含子块进行计算
|
2025-09-25 16:54:01 +08:00
|
|
|
|
HeadingEmbedMode int `json:"headingEmbedMode"` // 标题嵌入块模式,0:显示标题与下方的块,1:仅显示标题,2:仅显示标题下方的块
|
2024-04-26 12:08:01 +08:00
|
|
|
|
Markdown *util.Markdown `json:"markdown"` // Markdown 配置
|
2022-05-26 15:18:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-06 10:50:25 +08:00
|
|
|
|
const (
|
|
|
|
|
|
MinDynamicLoadBlocks = 48
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2022-05-26 15:18:53 +08:00
|
|
|
|
func NewEditor() *Editor {
|
|
|
|
|
|
return &Editor{
|
|
|
|
|
|
FontSize: 16,
|
2023-05-27 22:21:05 +08:00
|
|
|
|
FontSizeScrollZoom: false,
|
2023-09-13 20:13:32 +08:00
|
|
|
|
CodeSyntaxHighlightLineNum: false,
|
2022-05-26 15:18:53 +08:00
|
|
|
|
CodeTabSpaces: 0,
|
|
|
|
|
|
CodeLineWrap: false,
|
|
|
|
|
|
CodeLigatures: false,
|
|
|
|
|
|
DisplayBookmarkIcon: true,
|
2022-06-03 11:45:42 +08:00
|
|
|
|
DisplayNetImgMark: true,
|
2022-05-26 15:18:53 +08:00
|
|
|
|
GenerateHistoryInterval: 10,
|
|
|
|
|
|
HistoryRetentionDays: 30,
|
|
|
|
|
|
Emoji: []string{},
|
|
|
|
|
|
VirtualBlockRef: false,
|
2022-06-08 00:39:18 +08:00
|
|
|
|
BlockRefDynamicAnchorTextMaxLen: 96,
|
2022-05-26 15:18:53 +08:00
|
|
|
|
PlantUMLServePath: "https://www.plantuml.com/plantuml/svg/~1",
|
2022-08-19 23:30:41 +08:00
|
|
|
|
FullWidth: true,
|
2022-08-27 21:46:32 +08:00
|
|
|
|
KaTexMacros: "{}",
|
2022-10-11 20:00:59 +08:00
|
|
|
|
ReadOnly: false,
|
2022-10-17 10:37:01 +08:00
|
|
|
|
EmbedBlockBreadcrumb: false,
|
2022-10-24 11:17:10 +08:00
|
|
|
|
ListLogicalOutdent: false,
|
2024-02-25 10:57:54 +08:00
|
|
|
|
ListItemDotNumberClickFocus: true,
|
2022-10-28 20:01:30 +08:00
|
|
|
|
FloatWindowMode: 0,
|
2023-10-04 10:40:02 +08:00
|
|
|
|
DynamicLoadBlocks: 192,
|
2022-10-31 15:54:58 +08:00
|
|
|
|
Justify: false,
|
|
|
|
|
|
RTL: false,
|
2023-01-09 22:51:16 +08:00
|
|
|
|
BacklinkExpandCount: 8,
|
2024-05-11 16:24:04 +08:00
|
|
|
|
BackmentionExpandCount: -1,
|
2025-01-05 00:56:37 +08:00
|
|
|
|
BacklinkContainChildren: true,
|
2025-09-25 16:54:01 +08:00
|
|
|
|
HeadingEmbedMode: 0,
|
2024-04-26 12:08:01 +08:00
|
|
|
|
Markdown: util.MarkdownSettings,
|
2022-05-26 15:18:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|