This commit is contained in:
Vanessa 2024-05-21 00:24:54 +08:00
parent 8db6015709
commit 358047dea0
6 changed files with 11 additions and 20 deletions

View file

@ -236,17 +236,12 @@ const isOpenAsHidden = function () {
};
const initMainWindow = () => {
let windowStateInitialized = true;
// 恢复主窗体状态
let oldWindowState = {};
try {
oldWindowState = JSON.parse(fs.readFileSync(windowStatePath, "utf8"));
if (!oldWindowState.x) {
windowStateInitialized = false;
}
} catch (e) {
fs.writeFileSync(windowStatePath, "{}");
windowStateInitialized = false;
}
let defaultWidth;
let defaultHeight;
@ -270,7 +265,7 @@ const initMainWindow = () => {
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 resetToCenter = false;
let x = windowState.x;
let y = windowState.y;
if (workArea) {

View file

@ -7,7 +7,6 @@ import {
writeText
} from "../../protyle/util/compatibility";
import {matchAuxiliaryHotKey, matchHotKey} from "../../protyle/util/hotKey";
import {openSearch} from "../../search/spread";
import {
hasClosestBlock,
hasClosestByAttribute,
@ -18,7 +17,7 @@ import {newFile} from "../../util/newFile";
import {Constants} from "../../constants";
import {openSetting} from "../../config";
import {getInstanceById} from "../../layout/util";
import {copyTab, getActiveTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil";
import {getActiveTab, getDockByType, switchTabByIndex} from "../../layout/tabUtil";
import {Tab} from "../../layout/Tab";
import {Editor} from "../../editor";
import {setEditMode} from "../../protyle/util/setEditMode";
@ -29,10 +28,9 @@ import {hideElements} from "../../protyle/ui/hideElements";
import {fetchPost} from "../../util/fetch";
import {goBack, goForward} from "../../util/backForward";
import {onGet} from "../../protyle/util/onGet";
import {getDisplayName, getNotebookName, getTopPaths, movePathTo, moveToPath} from "../../util/pathName";
import {getDisplayName, getNotebookName} from "../../util/pathName";
import {openFileById} from "../../editor/util";
import {getAllDocks, getAllModels, getAllTabs} from "../../layout/getAll";
import {openGlobalSearch} from "../../search/util";
import {focusBlock, focusByOffset, focusByRange, getSelectionOffset} from "../../protyle/util/selection";
import {initFileMenu, initNavigationMenu} from "../../menus/navigation";
import {bindMenuKeydown} from "../../menus/Menu";
@ -65,7 +63,6 @@ import {transaction} from "../../protyle/wysiwyg/transaction";
import {quickMakeCard} from "../../card/makeCard";
import {getContentByInlineHTML} from "../../protyle/wysiwyg/keydown";
import {searchKeydown} from "./searchKeydown";
import {openNewWindow} from "../../window/openNewWindow";
import {historyKeydown} from "../../history/keydown";
import {zoomOut} from "../../menus/protyle";
import {getPlainText} from "../../protyle/util/paste";

View file

@ -3,7 +3,6 @@ import {fetchPost} from "../../util/fetch";
import {hasClosestByClassName} from "../../protyle/util/hasClosest";
import {MenuItem} from "../../menus/Menu";
import {popSearch} from "../menu/search";
import {Constants} from "../../constants";
import {App} from "../../index";
import {openTagMenu} from "../../menus/tag";

View file

@ -574,12 +574,12 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
let link = protyle.lute.GetLinkDest(value);
let name = "";
if (html) {
const tempElement = document.createElement("template")
tempElement.innerHTML = html
const aElement = tempElement.content.querySelector('[data-type~="a"]')
const tempElement = document.createElement("template");
tempElement.innerHTML = html;
const aElement = tempElement.content.querySelector('[data-type~="a"]');
if (aElement) {
link = aElement.getAttribute("data-href");
name = aElement.textContent
name = aElement.textContent;
}
}
if (!link && !name) {

View file

@ -583,7 +583,7 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID:
}
});
if (!needAdd) {
const newColor = ((column.options?.length || 0) % 13 + 1).toString()
const newColor = ((column.options?.length || 0) % 13 + 1).toString();
column.options.push({
name: item.content,
color: newColor
@ -594,7 +594,7 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID:
id: column.id,
avID,
data: column.options
})
});
undoOperations.push({
action: "removeAttrViewColOption",
id: column.id,
@ -607,4 +607,4 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID:
doOperations,
undoOperations
};
}
};

View file

@ -99,4 +99,4 @@ export const duplicateNameAddOne = (name:string) => {
name = `${name} (1)`;
}
return name;
}
};