Skip to content

Commit

Permalink
Merge pull request #8 from TCOTC/dev
Browse files Browse the repository at this point in the history
pr
  • Loading branch information
TCOTC authored May 17, 2024
2 parents 64cf8c8 + ca6833b commit a823ee8
Show file tree
Hide file tree
Showing 21 changed files with 2,296 additions and 941 deletions.
4 changes: 4 additions & 0 deletions app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"confirmDeleteTip": "Are you sure to delete <b>${x}</b>?<br>After deletion, it can be restored in [Data History], retained <code class= 'fn__code'>${y}</code> days according to [Settings - Editor - History Retention Days]",
"newView": "Add View",
"newCol": "Add column",
"newRow": "Add entry",
"enterKey": "Enter",
"doubleClick": "Double Click",
"click": "Click",
Expand Down
4 changes: 4 additions & 0 deletions app/appearance/langs/es_ES.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"confirmDeleteTip": "¿Está seguro de eliminar <b>${x}</b>?<br>Después de la eliminación, se puede restaurar en [Historial de datos] y se conserva <code class= 'fn__code'>${y }</code> días según [Configuración - Editor - Días de retención del historial]",
"newView": "Agregar vista",
"newCol": "Agregar columna",
"newRow": "Agregar entrada",
"enterKey": "Entrar",
"doubleClick": "Doble clic",
"click": "Hacer clic",
Expand Down
4 changes: 4 additions & 0 deletions app/appearance/langs/fr_FR.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"confirmDeleteTip": "Êtes-vous sûr de supprimer <b>${x}</b> ?<br>Après la suppression, il peut être restauré dans [Historique des données], conservé <code class= 'fn__code'>${y }</code> jours selon [Paramètres - Éditeur - Jours de rétention de l'historique]",
"newView": "Ajouter une vue",
"newCol": "Ajouter une colonne",
"newRow": "Ajouter une entrée",
"enterKey": "Entrer",
"doubleClick": "Double-clic",
"click": "Cliquez sur",
Expand Down
4 changes: 4 additions & 0 deletions app/appearance/langs/ja_JP.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"confirmDeleteTip": "<b>${x}</b> を削除してもよろしいですか?<br>削除後は [データ履歴] で復元でき、<code class= 'fn__code'>${y}</code> は保持されます。 [設定 - エディター - 履歴の保存日数] による日数",
"newView": "ビューを追加",
"newCol": "列を追加",
"newRow": "エントリを追加",
"enterKey": "入力",
"doubleClick": "ダブルクリック",
"click": "クリック",
Expand Down
4 changes: 4 additions & 0 deletions app/appearance/langs/zh_CHT.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"confirmDeleteTip": "確定刪除<b>${x}</b> 嗎?<br>刪除後可在 [資料歷史] 中恢復,按 [設定- 編輯器- 歷史保留天數] 保留<code class= 'fn__code'>${y}</code> 天",
"newView": "新增視圖",
"newCol": "新增列",
"newRow": "新增項目",
"enterKey": "回車",
"doubleClick": "雙擊",
"click": "點擊",
Expand Down
7 changes: 6 additions & 1 deletion app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"andSubFile": "确定删除 <b>${x}</b> 及其 <b>${y}</b> 个子文档吗?",
"confirmDeleteTip": "确定删除 <b>${x}</b> 吗?",
"rollbackTip": "删除后可在 [数据历史] 中恢复,按 [设置 - 编辑器 - 历史保留天数] 保留 <code class='fn__code'>${x}</code> 天",
"newView": "添加视图",
"newCol": "添加列",
"newRow": "添加条目",
"enterKey": "回车",
"doubleClick": "双击",
"click": "点击",
Expand Down Expand Up @@ -682,7 +688,6 @@
"customEmoji": "添加自定义表情",
"customEmojiTip": "打开 <a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">Emoji 文件夹</a> 放入图片后并点击刷新按钮",
"recentEmoji": "常用表情",
"andSubFile": "及其 <b>x</b> 个子文档",
"changeIcon": "修改图标",
"addIcon": "添加图标",
"includeSubFile": "\n包含 x 个子文档",
Expand Down
24 changes: 11 additions & 13 deletions app/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ const initMainWindow = () => {
height: defaultHeight,
}, oldWindowState);

// writeLog("windowStat [width=" + windowState.width + ", height=" + windowState.height + "], default [width=" + defaultWidth + ", height=" + defaultHeight + "], workArea [width=" + workArea.width + ", height=" + workArea.height + "]");
writeLog("windowStat [x=" + windowState.x + ", y=" + windowState.y + ", width=" + windowState.width + ", height=" + windowState.height + "], default [width=" + defaultWidth + ", height=" + defaultHeight + "], workArea [width=" + workArea.width + ", height=" + workArea.height + "]");

let resetToCenter = false
let x = windowState.x;
let y = windowState.y;
if (workArea) {
Expand All @@ -278,25 +279,22 @@ const initMainWindow = () => {
windowState.width = Math.min(defaultWidth, workArea.width);
windowState.height = Math.min(defaultHeight, workArea.height);
}
if (x > workArea.width) {
x = 0;
}
if (y > workArea.height) {
y = 0;

if (x >= workArea.width * 0.8 || y >= workArea.height * 0.8) {
resetToCenter = true;
}
}

if (x < 0 || y < 0) {
resetToCenter = true;
}

if (windowState.width < 493) {
windowState.width = 493;
}
if (windowState.height < 376) {
windowState.height = 376;
}
if (x < 0) {
x = 0;
}
if (y < 0) {
y = 0;
}

// 创建主窗体
const currentWindow = new BrowserWindow({
Expand All @@ -321,7 +319,7 @@ const initMainWindow = () => {
});
remote.enable(currentWindow.webContents);

windowStateInitialized ? currentWindow.setPosition(x, y) : currentWindow.center();
resetToCenter ? currentWindow.center() : currentWindow.setPosition(x, y);
currentWindow.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + currentWindow.webContents.userAgent;

// set proxy
Expand Down
Loading

0 comments on commit a823ee8

Please sign in to comment.