diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index f1dbbea37..2ef93b861 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1317,7 +1317,7 @@ "102": "Processing completed", "103": "The update installation package has been automatically downloaded in the background. When exiting, you will be asked whether to install the new version", "104": "The update installation package failed to download, please check the network connection", - "105": "TODO", + "105": "Untitled", "106": "Maximum length is limited to 512 characters", "107": "Moved document [%s]", "108": "Data sync found conflicts, you can view the generated conflict content in [Data History]", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 797201069..8074c9f87 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1317,7 +1317,7 @@ "102": "Procesamiento completado", "103": "El paquete de instalación de la actualización se ha descargado automáticamente en segundo plano. Al salir, se le preguntará si desea instalar la nueva versión", "104": "El paquete de instalación de la actualización no se pudo descargar, verifique la conexión de red", - "105": "TODO", + "105": "Sin título", "106": "La longitud máxima está limitada a 512 caracteres", "107": "Documento movido [%s]", "108": "La sincronizaci\u00f3n de datos encontr\u00f3 en conflictos, puede ver el contenido del conflicto generado en [Historial de datos]", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index adb80e644..550c67a25 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1317,7 +1317,7 @@ "102": "Traitement terminé", "103": "Le package d'installation de la mise à jour a été automatiquement téléchargé en arrière-plan. En quittant, il vous sera demandé si vous souhaitez installer la nouvelle version", "104": "Le package d'installation de la mise à jour n'a pas pu être téléchargé, veuillez vérifier la connexion réseau", - "105": "TODO", + "105": "Sans titre", "106": "La longueur maximale est limitée à 512 caractères", "107": "Document déplacé [%s]", "108": "La synchronisation des données a trouvé des conflits, vous pouvez afficher le contenu du conflit généré dans [Historique des données]", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index d45fe3277..c2acd85a4 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -648,7 +648,7 @@ "changeIcon": "修改圖示", "randomIcon": "隨機圖標", "includeSubFile": "\n包含 x 個子文檔", - "untitled": "新文檔", + "untitled": "未命名", "lockScreen": "鎖定畫面", "cloudIntro1": "端到端加密資料同步", "cloudIntro2": "加密和解密過程完全在本地設備上進行", @@ -1317,7 +1317,7 @@ "102": "處理完畢", "103": "已經在後台開始自動下載更新安裝檔,退出時將詢問是否安裝新版本", "104": "更新安裝檔下載失敗,請檢查網絡連接", - "105": "TODO", + "105": "未命名", "106": "最大長度限制為 512 字元", "107": "已經移動文檔 [%s]", "108": "資料同步發現衝突,可在 [資料歷史] 中查看生成的衝突內容", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index b3738b36d..443dd1f45 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -648,7 +648,7 @@ "changeIcon": "修改图标", "randomIcon": "随机图标", "includeSubFile": "\n包含 x 个子文档", - "untitled": "新文档", + "untitled": "未命名", "lockScreen": "锁屏", "cloudIntro1": "端到端加密数据同步", "cloudIntro2": "加密和解密过程完全在本地设备上进行", @@ -1317,7 +1317,7 @@ "102": "处理完毕", "103": "已经在后台开始自动下载更新安装包,退出时将询问是否安装新版本", "104": "更新安装包下载失败,请检查网络连接", - "105": "TODO", + "105": "未命名", "106": "最大长度限制为 512 字符", "107": "已经移动文档 [%s]", "108": "数据同步发现冲突,可在 [数据历史] 中查看生成的冲突内容", diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index 71625b02b..c9c85d2f4 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -18,8 +18,7 @@ import {newFile} from "../../util/newFile"; import {Constants} from "../../constants"; import {openSetting} from "../../config"; import {getInstanceById} from "../../layout/util"; -import {closeTabByType, copyTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil"; -import {getActiveTab} from "../../layout/tabUtil"; +import {closeTabByType, copyTab, getActiveTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil"; import {Tab} from "../../layout/Tab"; import {Editor} from "../../editor"; import {setEditMode} from "../../protyle/util/setEditMode"; @@ -369,7 +368,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { } if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) { fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => { - openCardByData(app, response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || "Untitled"); + openCardByData(app, response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || window.siyuan.languages.untitled); }); event.preventDefault(); return true; @@ -428,7 +427,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { blockId: protyle.block.id, rootId: protyle.block.rootID, useBlockId: protyle.block.showAll, - title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null, + title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null, }); return true; } @@ -449,7 +448,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { blockId: protyle.block.id, rootId: protyle.block.rootID, useBlockId: protyle.block.showAll, - title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null, + title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null, }); return true; } diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index a046faf32..5cbf26dcf 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -54,7 +54,7 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot id: window.siyuan.mobile.editor.protyle.block.rootID }, (response) => { setTitle(response.data.name); - (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name; + (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === window.siyuan.languages.untitled ? "" : response.data.name; }); } } @@ -389,7 +389,7 @@ export const setTitle = (title: string) => { dragElement.setAttribute("title", versionTitle); } } else { - title = title || "Untitled"; + title = title || window.siyuan.languages.untitled; document.title = `${title} - ${workspaceName} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}`; if (!dragElement) { return; diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts index fe72f0373..d51c2eb6f 100644 --- a/app/src/editor/rename.ts +++ b/app/src/editor/rename.ts @@ -82,7 +82,7 @@ export const rename = (options: { return false; } if (inputElement.value.trim() === "") { - inputElement.value = "Untitled"; + inputElement.value = window.siyuan.languages.untitled; } else { inputElement.value = replaceFileName(inputElement.value); } diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts index 69847f702..91669de4f 100644 --- a/app/src/layout/dock/util.ts +++ b/app/src/layout/dock/util.ts @@ -40,13 +40,13 @@ export const openBacklink = async (options: { } options.rootId = response.data.rootID; options.useBlockId = response.data.rootID !== response.data.id; - options.title = response.data.name || "Untitled"; + options.title = response.data.name || window.siyuan.languages.untitled; } else if (!options.title) { const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); if (response.code === -1) { return; } - options.title = response.data.name || "Untitled"; + options.title = response.data.name || window.siyuan.languages.untitled; } const newWnd = wnd.split("lr"); newWnd.addTab(new Tab({ @@ -96,13 +96,13 @@ export const openGraph = async (options: { } options.rootId = response.data.rootID; options.useBlockId = response.data.rootID !== response.data.id; - options.title = response.data.name || "Untitled"; + options.title = response.data.name || window.siyuan.languages.untitled; } else if (!options.title) { const response = await fetchSyncPost("api/block/getDocInfo", {id: options.blockId}); if (response.code === -1) { return; } - options.title = response.data.name || "Untitled"; + options.title = response.data.name || window.siyuan.languages.untitled; } const newWnd = wnd.split("lr"); newWnd.addTab(new Tab({ @@ -142,9 +142,9 @@ export const openOutline = async (protyle: IProtyle) => { let title = ""; if (!protyle.title) { const response = await fetchSyncPost("api/block/getDocInfo", {id: protyle.block.rootID}); - title = response.data.name || "Untitled"; + title = response.data.name || window.siyuan.languages.untitled; } else { - title = protyle.title.editElement.textContent || "Untitled"; + title = protyle.title.editElement.textContent || window.siyuan.languages.untitled; } newWnd.addTab(new Tab({ icon: "iconAlignCenter", diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 79b6de468..6fe2a1934 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -476,7 +476,7 @@ export const exportMd = (id: string) => { }); btnsElement[1].addEventListener("click", () => { if (inputElement.value.trim() === "") { - inputElement.value = "Untitled"; + inputElement.value = window.siyuan.languages.untitled; } else { inputElement.value = replaceFileName(inputElement.value); } diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index 2524a6a3d..055946fe0 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -91,7 +91,7 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_ } else { window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions); } - (document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === "Untitled" ? "" : data.data.rootTitle; + (document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === window.siyuan.languages.untitled ? "" : data.data.rootTitle; setEditor(); closePanel(); }); diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts index 4bb1e5d39..ef2961193 100644 --- a/app/src/mobile/util/MobileBackFoward.ts +++ b/app/src/mobile/util/MobileBackFoward.ts @@ -44,7 +44,7 @@ const focusStack = (backStack: IBackStack) => { id: backStack.id, }, (response) => { setTitle(response.data.name); - (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name; + (document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === window.siyuan.languages.untitled ? "" : response.data.name; protyle.background.render(response.data.ial, protyle.block.rootID); protyle.wysiwyg.renderCustom(response.data.ial); }); diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts index 7625db6d5..21e7396ca 100644 --- a/app/src/protyle/header/Title.ts +++ b/app/src/protyle/header/Title.ts @@ -1,14 +1,15 @@ import { - focusBlock, focusByOffset, - focusByRange, focusByWbr, - getEditorRange, getSelectionOffset, + focusBlock, + focusByOffset, + focusByRange, + focusByWbr, + getEditorRange, + getSelectionOffset, } from "../util/selection"; import {fetchPost} from "../../util/fetch"; import {replaceFileName, validateName} from "../../editor/rename"; import {MenuItem} from "../../menus/Menu"; -import { - openFileAttr, -} from "../../menus/commonMenuItem"; +import {openFileAttr,} from "../../menus/commonMenuItem"; import {Constants} from "../../constants"; import {matchHotKey} from "../util/hotKey"; import {isMac, readText, writeText} from "../util/compatibility"; @@ -264,7 +265,7 @@ export class Title { public setTitle(title: string) { if (code160to32(title) !== code160to32(this.editElement.textContent)) { - this.editElement.textContent = title === "Untitled" ? "" : title; + this.editElement.textContent = title === window.siyuan.languages.untitled ? "" : title; } } diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index 28a1d324d..e366d1f44 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -1,12 +1,6 @@ import {fetchPost, fetchSyncPost} from "../../util/fetch"; import {MenuItem} from "../../menus/Menu"; -import { - copySubMenu, - exportMd, - movePathToMenu, - openFileAttr, - openFileWechatNotify, -} from "../../menus/commonMenuItem"; +import {copySubMenu, exportMd, movePathToMenu, openFileAttr, openFileWechatNotify,} from "../../menus/commonMenuItem"; import {deleteFile} from "../../editor/deleteFile"; import {updateHotkeyTip} from "../util/compatibility"; /// #if !MOBILE @@ -105,7 +99,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { blockId: protyle.block.id, rootId: protyle.block.rootID, useBlockId: protyle.block.showAll, - title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null + title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null }); } }).element); @@ -119,7 +113,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { blockId: protyle.block.id, rootId: protyle.block.rootID, useBlockId: protyle.block.showAll, - title: protyle.title ? (protyle.title.editElement.textContent || "Untitled") : null + title: protyle.title ? (protyle.title.editElement.textContent || window.siyuan.languages.untitled) : null }); } }).element); diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 166bfa16c..72ba693ae 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -619,7 +619,7 @@ ${genHintItemHTML(item)} fetchPost("/api/filetree/createDoc", { notebook: protyle.notebookId, path: pathPosix().join(getDisplayName(protyle.path, false, true), newSubDocId + ".sy"), - title: "Untitled", + title: window.siyuan.languages.untitled, md: "" }, () => { insertHTML(`Untitled`, protyle); diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts index a51936040..f6ca9bf0e 100644 --- a/app/src/protyle/render/av/blockAttr.ts +++ b/app/src/protyle/render/av/blockAttr.ts @@ -13,9 +13,9 @@ const genAVRollupHTML = (value: IAVCellValue) => { switch (value.type) { case "block": if (value?.isDetached) { - html = `${value.block?.content || "Untitled"}`; + html = `${value.block?.content || window.siyuan.languages.untitled}`; } else { - html = `${value.block?.content || "Untitled"}`; + html = `${value.block?.content || window.siyuan.languages.untitled}`; } break; case "text": diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 527dcaeb6..0e144aaf1 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -613,7 +613,7 @@ export const renderCell = (cellValue: IAVCellValue) => { text = `${cellValue.block.content || ""} ${window.siyuan.languages.more}`; } else { - text = `${cellValue.block.content || "Untitled"} + text = `${cellValue.block.content || window.siyuan.languages.untitled} ${window.siyuan.languages.update}`; } } else if (cellValue.type === "number") { @@ -691,9 +691,9 @@ const renderRollup = (cellValue: IAVCellValue) => { } } else if (cellValue.type === "block") { if (cellValue?.isDetached) { - text = `${cellValue.block?.content || "Untitled"}`; + text = `${cellValue.block?.content || window.siyuan.languages.untitled}`; } else { - text = `${cellValue.block?.content || "Untitled"}`; + text = `${cellValue.block?.content || window.siyuan.languages.untitled}`; } } else if (cellValue.type === "number") { text = cellValue?.number.formattedContent || cellValue?.number.content.toString() || ""; diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts index dc3c0353f..78a5380e1 100644 --- a/app/src/protyle/render/av/relation.ts +++ b/app/src/protyle/render/av/relation.ts @@ -240,11 +240,11 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str const hasIds: string[] = []; cellElement.querySelectorAll("span").forEach((item) => { hasIds.push(item.dataset.id); - selectHTML += ``; + selectHTML += ``; }); cells.forEach((item) => { if (!hasIds.includes(item.block.id)) { - html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled"); + html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled); } }); menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML || genSelectItemHTML("empty")} @@ -270,11 +270,11 @@ export const bindRelationEvent = (options: { const hasIds: string[] = []; options.cellElements[0].querySelectorAll("span").forEach((item) => { hasIds.push(item.dataset.id); - selectHTML += ``; + selectHTML += ``; }); cells.forEach((item) => { if (!hasIds.includes(item.block.id)) { - html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled"); + html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled); } }); options.menuElement.querySelector(".b3-menu__label").innerHTML = response.data.name; diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index db99efc6d..0d175872a 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -96,7 +96,7 @@ export const newFile = (optios: { if (data.data.path.startsWith("/") || optios.currentPath === "/") { fetchPost("/api/filetree/createDocWithMd", { notebook: optios.notebookId, - path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")), + path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")), // 根目录时无法确定 parentID markdown: "" }, response => { @@ -117,7 +117,7 @@ export const newFile = (optios: { }, (responseHPath) => { fetchPost("/api/filetree/createDocWithMd", { notebook: optios.notebookId, - path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? "Untitled" : "")), + path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")), parentID: getDisplayName(optios.currentPath, true, true), markdown: "" }, response => { @@ -134,7 +134,7 @@ export const newFile = (optios: { }); } } else { - const title = pathPosix().basename(data.data.path || "Untitled"); + const title = pathPosix().basename(data.data.path || window.siyuan.languages.untitled); if (!validateName(title)) { return; } @@ -191,12 +191,12 @@ export const newFileByName = (app: App, value: string) => { newFile({ app, useSavePath: true, - name: replaceFileName(value.trim()) || "Untitled" + name: replaceFileName(value.trim()) || window.siyuan.languages.untitled }); }; export const newFileBySelect = (protyle: IProtyle, selectText: string, nodeElement: HTMLElement, pathDir: string) => { - const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || "Untitled"; + const newFileName = replaceFileName(selectText.trim() ? selectText.trim() : protyle.lute.BlockDOM2Content(nodeElement.outerHTML).replace(/\n/g, "")) || window.siyuan.languages.untitled; const hPath = pathPosix().join(pathDir, newFileName); fetchPost("/api/filetree/getIDsByHPath", { path: hPath, diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 52fc6e325..ff356fb4c 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1738,7 +1738,7 @@ func getAvNames(avIDs string) (ret string) { continue } if "" == nodeAvName { - nodeAvName = "Untitled" + nodeAvName = Conf.language(105) } tpl := strings.ReplaceAll(attrAvNameTpl, "${avID}", nodeAvID) diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index cd3702dd2..5b3ac3cc4 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -101,7 +101,7 @@ func GetDocInfo(blockID string) (ret *BlockInfo) { } if "" == avName { - avName = "Untitled" + avName = Conf.language(105) } attrView := &AttrView{ID: avID, Name: avName} diff --git a/kernel/model/export.go b/kernel/model/export.go index eba5ee4ec..38b39563f 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -76,7 +76,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) { name := util.FilterFileName(attrView.Name) if "" == name { - name = "Untitled" + name = Conf.language(105) } table, err := renderAttributeViewTable(attrView, view, "") @@ -1375,7 +1375,7 @@ func BatchExportMarkdown(boxID, folderPath string) (zipPath string) { baseFolderName = path.Base(block.HPath) } if "" == baseFolderName { - baseFolderName = "Untitled" + baseFolderName = Conf.language(105) } docFiles := box.ListFiles(folderPath) diff --git a/kernel/model/file.go b/kernel/model/file.go index 2e1a23663..90ce4656f 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1568,7 +1568,7 @@ func RenameDoc(boxID, p, title string) (err error) { return } if "" == title { - title = "Untitled" + title = Conf.language(105) } title = strings.ReplaceAll(title, "/", "") @@ -1604,6 +1604,10 @@ func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) { return } title = strings.ReplaceAll(title, "/", "") + title = strings.TrimSpace(title) + if "" == title { + title = Conf.Language(105) + } baseName := strings.TrimSpace(path.Base(p)) if "" == strings.TrimSuffix(baseName, ".sy") { diff --git a/kernel/model/history.go b/kernel/model/history.go index 35bff75a3..8fd1cdce8 100644 --- a/kernel/model/history.go +++ b/kernel/model/history.go @@ -687,7 +687,7 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) { title := tree.Root.IALAttr("title") if "" == title { - title = "Untitled" + title = Conf.language(105) } content := tree.Root.Content() p := strings.TrimPrefix(doc, util.HistoryDir) diff --git a/kernel/model/mount.go b/kernel/model/mount.go index 988f530e6..2d79e64e3 100644 --- a/kernel/model/mount.go +++ b/kernel/model/mount.go @@ -40,6 +40,9 @@ func CreateBox(name string) (id string, err error) { err = errors.New(Conf.Language(106)) return } + if "" == name { + name = Conf.language(105) + } WaitForWritingFiles() @@ -67,6 +70,16 @@ func RenameBox(boxID, name string) (err error) { return errors.New(Conf.Language(0)) } + if 512 < utf8.RuneCountInString(name) { + // 限制笔记本名和文档名最大长度为 `512` + err = errors.New(Conf.Language(106)) + return + } + + if "" == name { + name = Conf.language(105) + } + boxConf := box.GetConf() boxConf.Name = name box.Name = name