Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/appearance/langs/ar_SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "إلغاء القفل المؤقت",
"addFilter": "إضافة عامل تصفية",
"removeFilters": "مسح عامل تصفية",
"addSort": "إضافة ترتيب",
"removeSorts": "مسح الترتيب",
"checked": "مكتمل",
"unchecked": "غير مكتمل",
"percentChecked": "نسبة المكتمل",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Temporäres Entsperren abbrechen",
"addFilter": "Filter hinzufügen",
"removeFilters": "Filter zurücksetzen",
"addSort": "Sortierung hinzufügen",
"removeSorts": "Sortierung zurücksetzen",
"checked": "Überprüft",
"unchecked": "Nicht überprüft",
"percentChecked": "Prozent geprüft",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Cancel temporary unlock",
"addFilter": "Add filter",
"removeFilters": "Clear filter",
"addSort": "Add sort",
"removeSorts": "Clear sort",
"checked": "Checked",
"unchecked": "Unchecked",
"percentChecked": "Percent checked",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Cancelar desbloqueo temporal",
"addFilter": "Agregar filtro",
"removeFilters": "Borrar filtro",
"addSort": "Agregar ordenación",
"removeSorts": "Borrar ordenación",
"checked": "marcado",
"unchecked": "desmarcado",
"percentChecked": "Porcentaje comprobado",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Annuler le déverrouillage temporaire",
"addFilter": "Ajouter un filtre",
"removeFilters": "Effacer le filtre",
"addSort": "Ajouter un tri",
"removeSorts": "Effacer le tri",
"checked": "Coché",
"unchecked": "Décoché",
"percentChecked": "Pourcentage vérifié",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/he_IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "בטל שחרור זמני",
"addFilter": "הוסף מסנן",
"removeFilters": "נקה מסננים",
"addSort": "הוסף מיון",
"removeSorts": "נקה מיון",
"checked": "נבדק",
"unchecked": "לא נבדק",
"percentChecked": "אחוז נבדק",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Annulla sblocco temporaneo",
"addFilter": "Aggiungi filtro",
"removeFilters": "Pulisci filtro",
"addSort": "Aggiungi ordinamento",
"removeSorts": "Pulisci ordinamento",
"checked": "Selezionato",
"unchecked": "Deselezionato",
"percentChecked": "Percentuale selezionata",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "一時的なロック解除をキャンセル",
"addFilter": "フィルタを追加",
"removeFilters": "フィルタを削除",
"addSort": "ソートを追加",
"removeSorts": "ソートを削除",
"checked": "チェック済み",
"unchecked": "未チェック",
"percentChecked": "チェック済みの割合",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Anuluj tymczasowe odblokowanie",
"addFilter": "Dodaj filtr",
"removeFilters": "Wyczyść filtr",
"addSort": "Dodaj sortowanie",
"removeSorts": "Wyczyść sortowanie",
"checked": "Zaznaczone",
"unchecked": "Nie zaznaczone",
"percentChecked": "Procent zaznaczonych",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Cancelar desbloqueio temporário",
"addFilter": "Adicionar filtro",
"removeFilters": "Limpar filtro",
"addSort": "Adicionar ordenação",
"removeSorts": "Limpar ordenação",
"checked": "Marcado",
"unchecked": "Desmarcado",
"percentChecked": "Porcentagem marcada",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "Отменить временную разблокировку",
"addFilter": "Добавить фильтр",
"removeFilters": "Очистить фильтр",
"addSort": "Добавить сортировку",
"removeSorts": "Очистить сортировку",
"checked": "Отмечено",
"unchecked": "Не отмечено",
"percentChecked": "Процент отмеченных",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/zh_CHT.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "取消暫時解鎖",
"addFilter": "新增篩選條件",
"removeFilters": "清空篩選規則",
"addSort": "新增排序條件",
"removeSorts": "清空排序規則",
"checked": "已完成",
"unchecked": "未完成",
"percentChecked": "已完成佔比",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"cancelTempUnlock": "取消临时解锁",
"addFilter": "添加筛选条件",
"removeFilters": "清空筛选规则",
"addSort": "添加排序条件",
"removeSorts": "清空排序规则",
"checked": "已完成",
"unchecked": "未完成",
"percentChecked": "已完成占比",
Expand Down
2 changes: 1 addition & 1 deletion app/src/ai/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
elements.forEach(item => {
ids.push(item.getAttribute("data-node-id"));
});
const menu = new Menu("ai", () => {
const menu = new Menu(Constants.MENU_AI, () => {
focusByRange(protyle.toolbar.range);
});
let customHTML = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/block/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
} else {
// 浮窗上点击菜单,浮窗不能消失 https://ld246.com/article/1632668091023
const menuElement = hasClosestByClassName(target, "b3-menu");
if (menuElement && menuElement.getAttribute("data-name") !== "docTreeMore") {
if (menuElement && menuElement.getAttribute("data-name") !== Constants.MENU_DOC_TREE_MORE) {
const blockPanel = window.siyuan.blockPanels.find((item) => {
if (item.element.style.zIndex < menuElement.style.zIndex) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion app/src/boot/globalEvent/command/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export const execByCommand = async (options: {
case "move":
if (!isFileFocus) {
const nodeElement = hasClosestBlock(range.startContainer);
if (protyle.title?.editElement.contains(range.startContainer) || !nodeElement || window.siyuan.menus.menu.element.getAttribute("data-name") === "titleMenu") {
if (protyle.title?.editElement.contains(range.startContainer) || !nodeElement || window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_TITLE) {
movePathTo((toPath, toNotebook) => {
moveToPath([protyle.path], toNotebook[0], toPath[0]);
}, [protyle.path], range);
Expand Down
62 changes: 62 additions & 0 deletions app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,68 @@ export abstract class Constants {
public static readonly DIALOG_OPENWORKSPACE = "dialog-openworkspace"; // 打开工作空间
public static readonly DIALOG_SAVEWORKSPACE = "dialog-saveworkspace"; // 保存工作空间

// menu
public static readonly MENU_BAR_WORKSPACE = "barWorkspace"; // 顶栏主菜单
public static readonly MENU_BAR_PLUGIN = "topBarPlugin"; // 顶栏插件菜单
public static readonly MENU_BAR_ZOOM = "barZoom"; // 顶栏缩放菜单
public static readonly MENU_BAR_MORE = "barmore"; // 顶栏外观菜单
public static readonly MENU_STATUS_HELP = "statusHelp"; // 状态栏帮助菜单
public static readonly MENU_STATUS_BACKGROUND_TASK = "statusBackgroundTask"; // 状态栏后台任务菜单
public static readonly MENU_DOCK_MOBILE = "dockMobileMenu"; // 移动端侧栏插件选项菜单

public static readonly MENU_BLOCK_SINGLE = "block-single"; // 单选块菜单
public static readonly MENU_BLOCK_MULTI = "block-multi"; // 多选块菜单
public static readonly MENU_TITLE = "titleMenu"; // 文档块菜单
public static readonly MENU_TITLE_PROTYLE = "title-protyle"; // 在 Protyle 触发的文档块菜单
public static readonly MENU_TITLE_BREADCRUMB = "title-breadcrumb"; // 在面包屑触发的文档块菜单
public static readonly MENU_BREADCRUMB_MORE = "breadcrumbMore"; // 面包屑更多菜单
public static readonly MENU_BREADCRUMB_MOBILE_PATH = "breadcrumb-mobile-path"; // 移动端面包屑菜单

public static readonly MENU_DOC_TREE_MORE = "docTreeMore"; // 侧栏文档树右键菜单
public static readonly MENU_DOC_TREE_MORE_NOTEBOOK = "docTreeMore-notebook"; // 侧栏文档树右键菜单,单个笔记本
public static readonly MENU_DOC_TREE_MORE_DOC = "docTreeMore-doc"; // 侧栏文档树右键菜单,单个文档
public static readonly MENU_DOC_TREE_MORE_DOCS = "docTreeMore-docs"; // 侧栏文档树右键菜单,多个文档
public static readonly MENU_TAG = "tagMenu"; // 侧栏标签菜单
public static readonly MENU_BOOKMARK = "bookmarkMenu"; // 侧栏书签菜单
public static readonly MENU_OUTLINE_CONTEXT = "outline-context"; // 大纲标题右键菜单
public static readonly MENU_OUTLINE_EXPAND_LEVEL = "outline-expand-level"; // 大纲展开层级菜单

public static readonly MENU_AV_VIEW = "av-view"; // 数据库视图标题菜单
public static readonly MENU_AV_HEADER_CELL = "av-header-cell"; // 数据库字段标题菜单
public static readonly MENU_AV_HEADER_ADD = "av-header-add"; // 数据库添加字段菜单
public static readonly MENU_AV_ADD_FILTER = "av-add-filter"; // 数据库添加筛选条件菜单
public static readonly MENU_AV_ADD_SORT = "av-add-sort"; // 数据库添加排序条件菜单
public static readonly MENU_AV_COL_OPTION = "av-col-option"; // 数据库单选多选字段的选项编辑菜单
public static readonly MENU_AV_COL_FORMAT_NUMBER = "av-col-format-number"; // 数据库数字字段格式化菜单
public static readonly MENU_AV_GROUP_DATE = "avGroupDate"; // 数据库日期字段分组菜单的日期菜单
public static readonly MENU_AV_GROUP_SORT = "avGroupSort"; // 数据库日期字段分组菜单的排序菜单
public static readonly MENU_AV_ASSET_EDIT = "av-asset-edit"; // 数据库资源字段链接或资源文件菜单
public static readonly MENU_AV_CALC = "av-calc"; // 数据库计算菜单
public static readonly MENU_AV_PAGE_SIZE = "av-page-size"; // 数据库条目数菜单

public static readonly MENU_SEARCH_MORE = "searchMore"; // 搜索更多菜单
public static readonly MENU_SEARCH_METHOD = "searchMethod"; // 搜索方式菜单
public static readonly MENU_SEARCH_ASSET_MORE = "searchAssetMore"; // 资源文件搜索更多菜单
public static readonly MENU_SEARCH_ASSET_METHOD = "searchAssetMethod"; // 资源文件搜索方式菜单
public static readonly MENU_SEARCH_UNREF_MORE = "searchUnRefMore"; // 列出引用失效的块的更多菜单
public static readonly MENU_SEARCH_HISTORY = "search-history"; // 搜索历史菜单
public static readonly MENU_SEARCH_REPLACE_HISTORY = "search-replace-history"; // 替换历史菜单
public static readonly MENU_SEARCH_ASSET_HISTORY = "search-asset-history"; // 资源文件搜索历史菜单
public static readonly MENU_MOVE_PATH_HISTORY = "move-path-history"; // 移动文档窗口搜索历史菜单

public static readonly MENU_BACKGROUND_ASSET = "background-asset"; // 资源文件选择器菜单
public static readonly MENU_AI = "ai"; // 块 AI 菜单
public static readonly MENU_TAB = "tab"; // 页签右键菜单
public static readonly MENU_TAB_LIST = "tabList"; // 页签切换菜单

public static readonly MENU_INLINE_CONTEXT = "inline-context"; // 文本右键菜单
public static readonly MENU_INLINE_IMG = "inline-img"; // 图片元素菜单
public static readonly MENU_INLINE_FILE_ANNOTATION_REF = "inline-file-annotation-ref"; // PDF 标注元素菜单
public static readonly MENU_INLINE_REF = "inline-block-ref"; // 块引用元素菜单
public static readonly MENU_INLINE_A = "inline-a"; // 超链接元素菜单
public static readonly MENU_INLINE_TAG = "inline-tag"; // 行级标签元素菜单
public static readonly MENU_INLINE_MATH = "inline-math"; // 行级公式元素菜单

// timeout
public static readonly TIMEOUT_OPENDIALOG = 50;
public static readonly TIMEOUT_DBLCLICK = 190;
Expand Down
2 changes: 1 addition & 1 deletion app/src/dialog/processSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export const progressBackgroundTask = (tasks: { action: string }[]) => {
if (tasks.length === 0) {
backgroundTaskElement.classList.add("fn__none");
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
window.siyuan.menus.menu.element.getAttribute("data-name") === "statusBackgroundTask") {
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_STATUS_BACKGROUND_TASK) {
window.siyuan.menus.menu.remove();
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/src/layout/Wnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ export class Wnd {

private renderTabList(target: HTMLElement) {
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
window.siyuan.menus.menu.element.getAttribute("data-name") === "tabList") {
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_TAB_LIST) {
window.siyuan.menus.menu.remove();
return;
}
Expand Down Expand Up @@ -703,7 +703,7 @@ export class Wnd {
current: item.classList.contains("item--focus")
}).element);
});
window.siyuan.menus.menu.element.setAttribute("data-name", "tabList");
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_TAB_LIST);
const rect = target.getBoundingClientRect();
window.siyuan.menus.menu.popup({
x: rect.left + rect.width,
Expand Down
23 changes: 20 additions & 3 deletions app/src/layout/dock/Outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,10 @@ export class Outline extends Model {
*/
private showExpandLevelMenu(target: HTMLElement) {
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_OUTLINE_EXPAND_LEVEL);
for (let i = 1; i <= 6; i++) {
window.siyuan.menus.menu.append(new MenuItem({
id: `heading${i}`,
icon: `iconH${i}`,
label: window.siyuan.languages[`heading${i}`],
click: () => this.expandToLevel(i)
Expand Down Expand Up @@ -867,9 +869,11 @@ export class Outline extends Model {
}
const currentLevel = this.getHeadingLevel(element);
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_OUTLINE_CONTEXT);
// 升级
if (currentLevel > 1) {
window.siyuan.menus.menu.append(new MenuItem({
id: "upgrade",
icon: "iconUp",
label: window.siyuan.languages.upgrade,
click: () => {
Expand All @@ -889,6 +893,7 @@ export class Outline extends Model {
// 降级
if (currentLevel < 6) {
window.siyuan.menus.menu.append(new MenuItem({
id: "downgrade",
icon: "iconDown",
label: window.siyuan.languages.downgrade,
click: () => {
Expand Down Expand Up @@ -945,10 +950,11 @@ export class Outline extends Model {
}).element);
}

window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({id: "separator_1", type: "separator"}).element);

// 在前面插入同级标题
window.siyuan.menus.menu.append(new MenuItem({
id: "insertSameLevelHeadingBefore",
icon: "iconBefore",
label: window.siyuan.languages.insertSameLevelHeadingBefore,
click: () => {
Expand All @@ -973,6 +979,7 @@ export class Outline extends Model {

// 在后面插入同级标题
window.siyuan.menus.menu.append(new MenuItem({
id: "insertSameLevelHeadingAfter",
icon: "iconAfter",
label: window.siyuan.languages.insertSameLevelHeadingAfter,
click: () => {
Expand Down Expand Up @@ -1006,6 +1013,7 @@ export class Outline extends Model {
// 添加子标题
if (currentLevel < 6) { // 只有当前级别小于6时才能添加子标题
window.siyuan.menus.menu.append(new MenuItem({
id: "addChildHeading",
icon: "iconAdd",
label: window.siyuan.languages.addChildHeading,
click: () => {
Expand Down Expand Up @@ -1045,10 +1053,11 @@ export class Outline extends Model {
}).element);
}

window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({id: "separator_2", type: "separator"}).element);

// 复制带子标题
window.siyuan.menus.menu.append(new MenuItem({
id: "copyHeadings1",
icon: "iconCopy",
label: `${window.siyuan.languages.copy} ${window.siyuan.languages.headings1}`,
click: () => {
Expand All @@ -1070,6 +1079,7 @@ export class Outline extends Model {

// 剪切带子标题
window.siyuan.menus.menu.append(new MenuItem({
id: "cutHeadings1",
icon: "iconCut",
label: `${window.siyuan.languages.cut} ${window.siyuan.languages.headings1}`,
click: () => {
Expand Down Expand Up @@ -1117,6 +1127,7 @@ export class Outline extends Model {

// 删除
window.siyuan.menus.menu.append(new MenuItem({
id: "deleteHeadings1",
icon: "iconTrashcan",
label: `${window.siyuan.languages.delete} ${window.siyuan.languages.headings1}`,
click: () => {
Expand Down Expand Up @@ -1150,10 +1161,11 @@ export class Outline extends Model {
}
}).element);

window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({id: "separator_3", type: "separator"}).element);

// 展开子标题
window.siyuan.menus.menu.append(new MenuItem({
id: "expandChildHeading",
icon: "iconExpand",
label: window.siyuan.languages.expandChildHeading,
accelerator: updateHotkeyTip("⌘") + window.siyuan.languages.clickArrow,
Expand All @@ -1162,6 +1174,7 @@ export class Outline extends Model {

// 折叠子标题
window.siyuan.menus.menu.append(new MenuItem({
id: "foldChildHeading",
icon: "iconContract",
label: window.siyuan.languages.foldChildHeading,
accelerator: updateHotkeyTip("⌘") + window.siyuan.languages.clickArrow,
Expand All @@ -1170,6 +1183,7 @@ export class Outline extends Model {

// 展开同级标题
window.siyuan.menus.menu.append(new MenuItem({
id: "expandSameLevelHeading",
icon: "iconExpand",
label: window.siyuan.languages.expandSameLevelHeading,
accelerator: updateHotkeyTip("⌥") + window.siyuan.languages.clickArrow,
Expand All @@ -1178,6 +1192,7 @@ export class Outline extends Model {

// 折叠同级标题
window.siyuan.menus.menu.append(new MenuItem({
id: "foldSameLevelHeading",
icon: "iconContract",
label: window.siyuan.languages.foldSameLevelHeading,
accelerator: updateHotkeyTip("⌥") + window.siyuan.languages.clickArrow,
Expand All @@ -1186,6 +1201,7 @@ export class Outline extends Model {

// 全部展开
window.siyuan.menus.menu.append(new MenuItem({
id: "expandAll",
icon: "iconExpand",
label: window.siyuan.languages.expandAll,
click: () => {
Expand All @@ -1196,6 +1212,7 @@ export class Outline extends Model {

// 全部折叠
window.siyuan.menus.menu.append(new MenuItem({
id: "foldAll",
icon: "iconContract",
label: window.siyuan.languages.foldAll,
click: () => {
Expand Down
Loading