mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2025-12-23 23:17:55 -05:00
fix bug
This commit is contained in:
@@ -2,5 +2,6 @@ module.exports = {
|
||||
// 其他配置
|
||||
rules: {
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
10
main.js
10
main.js
@@ -17,6 +17,7 @@ const configDir = app.getPath("userData");
|
||||
const dirPath = path.join(configDir, "uploads");
|
||||
let mainWin;
|
||||
let readerWindow;
|
||||
let urlWindow;
|
||||
let mainView;
|
||||
let dbConnection = {};
|
||||
const singleInstance = app.requestSingleInstanceLock();
|
||||
@@ -269,7 +270,8 @@ const createMainWin = () => {
|
||||
event.returnValue = dirPath;
|
||||
});
|
||||
ipcMain.handle("hide-reader", (event, arg) => {
|
||||
if (readerWindow && readerWindow.isFocused()) {
|
||||
console.log(readerWindow)
|
||||
if (!readerWindow.isDestroyed() && readerWindow && readerWindow.isFocused()) {
|
||||
readerWindow.minimize();
|
||||
event.returnvalue = true;
|
||||
} else if (mainWin && mainWin.isFocused()) {
|
||||
@@ -353,6 +355,12 @@ const createMainWin = () => {
|
||||
console.log("exit full");
|
||||
}
|
||||
});
|
||||
ipcMain.handle("open-url", (event, config) => {
|
||||
if (!urlWindow || urlWindow.isDestroyed()) {
|
||||
urlWindow = new BrowserWindow(options);
|
||||
}
|
||||
urlWindow.loadURL(config.url);
|
||||
});
|
||||
ipcMain.handle("switch-moyu", (event, arg) => {
|
||||
let id;
|
||||
if (store.get("isPreventSleep") === "yes") {
|
||||
|
||||
2
src/assets/lib/kookit.min.js
vendored
2
src/assets/lib/kookit.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -72,7 +72,7 @@ class FeedbackDialog extends Component<
|
||||
this.setState({ isSending: false });
|
||||
return;
|
||||
}
|
||||
toast(this.props.t("Sending"));
|
||||
toast.loading(this.props.t("Sending"), { id: "sending-id" });
|
||||
let version = packageInfo.version;
|
||||
const os = window.require("os");
|
||||
const system = os.platform() + " " + os.version();
|
||||
@@ -96,7 +96,9 @@ class FeedbackDialog extends Component<
|
||||
this.setState({ isSending: false });
|
||||
return;
|
||||
}
|
||||
toast.success(this.props.t("Sending successful"));
|
||||
toast.success(this.props.t("Sending successful"), {
|
||||
id: "sending-id",
|
||||
});
|
||||
this.props.handleFeedbackDialog(false);
|
||||
};
|
||||
handleJump = (url: string) => {
|
||||
@@ -171,43 +173,36 @@ class FeedbackDialog extends Component<
|
||||
: { marginTop: "30px" }
|
||||
}
|
||||
/>
|
||||
<div className="feedback-dialog-file-container">
|
||||
<div className="feedback-dialog-file-text">
|
||||
<Trans>Upload attachments</Trans>
|
||||
</div>
|
||||
<div></div>
|
||||
<input
|
||||
type="file"
|
||||
multiple={true}
|
||||
id="feedback-file-box"
|
||||
name="file"
|
||||
className="feedback-file-box"
|
||||
onChange={(event) => {
|
||||
if (!event || !event.target || !event.target.files) {
|
||||
toast.error("Empty files");
|
||||
|
||||
<input
|
||||
type="file"
|
||||
multiple={true}
|
||||
id="feedback-file-box"
|
||||
name="file"
|
||||
className="feedback-file-box"
|
||||
onChange={(event) => {
|
||||
if (!event || !event.target || !event.target.files) {
|
||||
toast.error("Empty files");
|
||||
}
|
||||
let files: any = event.target.files;
|
||||
let zip = new JSZip();
|
||||
for (let index = 0; index < files.length; index++) {
|
||||
const file = files[index];
|
||||
var fileSize = file.size;
|
||||
var fileSizeMB = fileSize / (1024 * 1024);
|
||||
if (fileSizeMB > 20) {
|
||||
toast.error(this.props.t("File size is larger than 20MB"));
|
||||
event.target.value = "";
|
||||
break;
|
||||
} else {
|
||||
zip.file(file.name, file);
|
||||
}
|
||||
let files: any = event.target.files;
|
||||
let zip = new JSZip();
|
||||
for (let index = 0; index < files.length; index++) {
|
||||
const file = files[index];
|
||||
var fileSize = file.size;
|
||||
var fileSizeMB = fileSize / (1024 * 1024);
|
||||
if (fileSizeMB > 20) {
|
||||
toast.error(
|
||||
this.props.t("File size is larger than 20MB")
|
||||
);
|
||||
event.target.value = "";
|
||||
break;
|
||||
} else {
|
||||
zip.file(file.name, file);
|
||||
}
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then((content) => {
|
||||
this.setState({ fileContent: content });
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then((content) => {
|
||||
this.setState({ fileContent: content });
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<textarea
|
||||
name="content"
|
||||
|
||||
@@ -10,30 +10,14 @@
|
||||
animation: popup 0.1s ease-in-out 0s 1;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.feedback-dialog-file-container {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
/* margin-top: 10px; */
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.feedback-file-box {
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
/* margin-left: 35px; */
|
||||
margin-left: 25px;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
color: rgb(35, 170, 242);
|
||||
}
|
||||
.feedback-dialog-file-text {
|
||||
margin-left: 25px;
|
||||
min-width: 100px;
|
||||
height: 30px;
|
||||
font-size: 15px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.feedback-file-box::placeholder {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
|
||||
@@ -77,7 +77,7 @@ class PopupDict extends React.Component<PopupDictProps, PopupDictState> {
|
||||
plugin.config
|
||||
);
|
||||
if (dictText.startsWith("https://")) {
|
||||
window.open(dictText);
|
||||
openExternalUrl(dictText, true);
|
||||
} else {
|
||||
this.setState(
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ class PopupTrans extends React.Component<PopupTransProps, PopupTransState> {
|
||||
)
|
||||
.then((res: string) => {
|
||||
if (res.startsWith("https://")) {
|
||||
window.open(res);
|
||||
openExternalUrl(res, true);
|
||||
} else {
|
||||
this.setState({
|
||||
translatedText: res,
|
||||
|
||||
@@ -157,10 +157,10 @@ export const reloadManager = () => {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
export const openExternalUrl = (url: string) => {
|
||||
export const openExternalUrl = (url: string, isPlugin: boolean = false) => {
|
||||
isElectron
|
||||
? ConfigService.getReaderConfig("isUseBuiltIn") === "yes"
|
||||
? window.open(url)
|
||||
? ConfigService.getReaderConfig("isUseBuiltIn") === "yes" || isPlugin
|
||||
? window.require("electron").ipcRenderer.invoke("open-url", { url })
|
||||
: window.require("electron").shell.openExternal(url)
|
||||
: window.open(url);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user