From d41d1e6cef5f61d7bb89cdb3e0645aba48e136f9 Mon Sep 17 00:00:00 2001
From: troyeguo <13820674+troyeguo@users.noreply.github.com>
Date: Sun, 4 Sep 2022 11:33:23 +0800
Subject: [PATCH] fix bug
Former-commit-id: 00170948f9ad3ce71ce11adc530461fc57d88efa
---
README.md | 4 ++--
README_cn.md | 4 ++--
README_pt.md | 2 +-
src/components/dialogs/settingDialog/component.tsx | 2 +-
src/components/dialogs/settingDialog/settingDialog.css | 3 ++-
src/components/popups/popupMenu/component.tsx | 1 +
src/components/popups/popupTrans/component.tsx | 5 +++--
src/utils/fileUtils/bookUtil.tsx | 3 +++
src/utils/syncUtils/common.tsx | 6 ++++++
9 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 8e382317..f8c2fa3f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-[简体中文](https://github.com/troyeguo/koodo-reader/blob/master/README_cn.md) | English
+[简体中文](https://github.com/troyeguo/koodo-reader/blob/master/README_cn.md) | [Português](https://github.com/troyeguo/koodo-reader/blob/master/README_pt.md) |English
@@ -96,7 +96,7 @@ docker-compose up -d
## Develop
-Make sure that you have installed yarn and git, node's version on your computer is larger than 14.0.0.
+Make sure that you have installed yarn and git, node's version on your computer is 14.x.x.
1. Download the repo
diff --git a/README_cn.md b/README_cn.md
index b455128c..7832c60a 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -1,6 +1,6 @@
-简体中文 | [English](https://github.com/troyeguo/koodo-reader/blob/master/README.md)
+简体中文 | [Português](https://github.com/troyeguo/koodo-reader/blob/master/README_pt.md) | [English](https://github.com/troyeguo/koodo-reader/blob/master/README.md)
@@ -93,7 +93,7 @@ docker-compose up -d
## 运行源码
-请确保您电脑的 node 的版本大于 10.0.0,已配置好 yarn,git 的运行环境。
+请确保您电脑的 node 的版本为 14.x.x,已配置好 yarn,git 的运行环境。
1. 将项目源码下载到本地
diff --git a/README_pt.md b/README_pt.md
index 0cff0e5c..429fb9af 100644
--- a/README_pt.md
+++ b/README_pt.md
@@ -1,6 +1,6 @@
-[English](https://github.com/troyeguo/koodo-reader/blob/master/README.md) | English
+[简体中文](https://github.com/troyeguo/koodo-reader/blob/master/README_cn.md) | Português | [English](https://github.com/troyeguo/koodo-reader/blob/master/README.md)
diff --git a/src/components/dialogs/settingDialog/component.tsx b/src/components/dialogs/settingDialog/component.tsx
index 1871df98..3e3928ac 100644
--- a/src/components/dialogs/settingDialog/component.tsx
+++ b/src/components/dialogs/settingDialog/component.tsx
@@ -332,7 +332,7 @@ class SettingDialog extends React.Component<
this.handleChangeLocation();
}}
>
- Change location
+ Select
diff --git a/src/components/dialogs/settingDialog/settingDialog.css b/src/components/dialogs/settingDialog/settingDialog.css
index de265940..f1be41e9 100644
--- a/src/components/dialogs/settingDialog/settingDialog.css
+++ b/src/components/dialogs/settingDialog/settingDialog.css
@@ -135,13 +135,14 @@
opacity: 1;
border-radius: 11px;
position: relative;
- top: 4px;
+ top: 0px;
left: 2px;
cursor: pointer;
font-size: 13px;
display: flex;
justify-content: center;
align-items: center;
+ line-height: 1;
}
.theme-setting-item {
width: 25px;
diff --git a/src/components/popups/popupMenu/component.tsx b/src/components/popups/popupMenu/component.tsx
index 49e85c3e..d3543511 100644
--- a/src/components/popups/popupMenu/component.tsx
+++ b/src/components/popups/popupMenu/component.tsx
@@ -64,6 +64,7 @@ class PopupMenu extends React.Component
{
let doc = getIframeDoc();
if (!doc) return;
doc.addEventListener("mousedown", this.openMenu);
+ doc.addEventListener("touchend", this.openMenu);
if (this.props.currentBook.format === "PDF") {
setTimeout(() => {
this.renderHighlighters();
diff --git a/src/components/popups/popupTrans/component.tsx b/src/components/popups/popupTrans/component.tsx
index 8ddd9a3b..4ca91004 100644
--- a/src/components/popups/popupTrans/component.tsx
+++ b/src/components/popups/popupTrans/component.tsx
@@ -69,9 +69,10 @@ class PopupTrans extends React.Component {
) => {
StorageUtil.setReaderConfig("transService", event.target.value);
+ StorageUtil.setReaderConfig("transTarget", "en");
this.setState({ translateService: event.target.value });
this.handleTrans(
this.props.originalText.replace(/(\r\n|\n|\r)/gm, "")
@@ -97,7 +98,7 @@ class PopupTrans extends React.Component {
) => {
let targetLang = event.target.value;
StorageUtil.setReaderConfig("transTarget", targetLang);
diff --git a/src/utils/fileUtils/bookUtil.tsx b/src/utils/fileUtils/bookUtil.tsx
index 59493e7a..341913cb 100644
--- a/src/utils/fileUtils/bookUtil.tsx
+++ b/src/utils/fileUtils/bookUtil.tsx
@@ -28,6 +28,9 @@ class BookUtil {
reader.onload = async (event) => {
if (!event.target) return;
try {
+ if (!fs.existsSync(path.join(dataPath, "book"))) {
+ fs.mkdirSync(path.join(dataPath, "book"));
+ }
fs.writeFileSync(
path.join(dataPath, "book", key),
Buffer.from(event.target.result as any)
diff --git a/src/utils/syncUtils/common.tsx b/src/utils/syncUtils/common.tsx
index 67d30653..b66237a6 100644
--- a/src/utils/syncUtils/common.tsx
+++ b/src/utils/syncUtils/common.tsx
@@ -62,6 +62,9 @@ export const moveData = (
reader.readAsArrayBuffer(file);
reader.onload = async (event) => {
if (!event.target) return;
+ if (!fs.existsSync(path.join(dirPath))) {
+ fs.mkdirSync(path.join(dirPath));
+ }
fs.writeFileSync(
path.join(dirPath, file.name),
Buffer.from(event.target.result as any)
@@ -134,6 +137,9 @@ export const syncData = (blob: Blob, books: BookModel[] = [], isSync: true) => {
reader.readAsArrayBuffer(file);
reader.onload = async (event) => {
if (!event.target) return;
+ if (!fs.existsSync(path.join(dataPath))) {
+ fs.mkdirSync(path.join(dataPath));
+ }
fs.writeFileSync(
path.join(dataPath, file.name),
Buffer.from(event.target.result as any)