mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2025-12-23 23:17:55 -05:00
fix bug
Former-commit-id: ba0ecc0fee5def107e94845f6d2e2997d8bfbcc2
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"Update to": "更新至",
|
||||
"Not supported yet": "暂不支持",
|
||||
"Unauthorize": "取消授权",
|
||||
"New Version": "新",
|
||||
"New Version": "下载新版本",
|
||||
"Unauthorize Successfully": "取消授权成功",
|
||||
|
||||
"Update Complete": "更新成功",
|
||||
@@ -172,7 +172,7 @@
|
||||
"Project link": "开源地址",
|
||||
"View Mode": "视图模式",
|
||||
"About developer": "关于开发者",
|
||||
"Disable update notification": "暂停接收更新",
|
||||
"Disable update notification": "关闭更新提醒",
|
||||
"Speak the text": "朗读文字",
|
||||
"Theme Color": "选择主题色",
|
||||
"Roadmap": "开发计划",
|
||||
@@ -186,7 +186,8 @@
|
||||
"Minute": "分钟",
|
||||
"Empty": "这里什么都没有",
|
||||
"Less": "收起",
|
||||
"Disable analytics service": "禁用统计功能",
|
||||
"Disable analytics service": "关闭统计功能",
|
||||
"Hide navigation button": "不显示翻页按钮",
|
||||
"More": "显示笔记出处",
|
||||
"Pick Up Color": "选择颜色",
|
||||
"Highlight Successfully": "高亮成功",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"Text Shadow": "Text shadow",
|
||||
"Import Failed": "Import Failed",
|
||||
"New Version Available": "New Version Available",
|
||||
"New Version": "New",
|
||||
"New Version": "New Version",
|
||||
"Customize": "Customize",
|
||||
"Auto open book in fullscreen": "Auto open book in fullscreen",
|
||||
"System Font": "System Font",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"My Shelves": "我的書架",
|
||||
"Sort": "排序",
|
||||
"Import Failed": "導入失敗",
|
||||
"New Version": "新",
|
||||
"New Version": "下载新版本",
|
||||
"Access token expired": "憑證過期,重新取得中",
|
||||
"Access token received, please continue": "取得憑證成功,請繼續之前的操作",
|
||||
"Fetching Acess token failed": "取得憑證失敗",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//高亮,下划线颜色选择
|
||||
import React from "react";
|
||||
import OtherUtil from "../../utils/otherUtil";
|
||||
import "./colorOption.css";
|
||||
import { ColorProps, ColorStates } from "./interface";
|
||||
|
||||
@@ -7,10 +8,10 @@ class ColorOption extends React.Component<ColorProps, ColorStates> {
|
||||
constructor(props: ColorProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isLine: false,
|
||||
isLine: this.props.color > 3 ? true : false,
|
||||
};
|
||||
}
|
||||
handleChangeOptiion = () => {
|
||||
handleChangeOption = () => {
|
||||
this.setState({ isLine: !this.state.isLine });
|
||||
};
|
||||
render() {
|
||||
@@ -25,6 +26,10 @@ class ColorOption extends React.Component<ColorProps, ColorStates> {
|
||||
key={item}
|
||||
onClick={() => {
|
||||
this.props.handleColor(index + 4);
|
||||
OtherUtil.setReaderConfig(
|
||||
"highlightIndex",
|
||||
(index + 4).toString()
|
||||
);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
@@ -47,6 +52,7 @@ class ColorOption extends React.Component<ColorProps, ColorStates> {
|
||||
key={item}
|
||||
onClick={() => {
|
||||
this.props.handleColor(index);
|
||||
OtherUtil.setReaderConfig("highlightIndex", index.toString());
|
||||
}}
|
||||
></div>
|
||||
);
|
||||
@@ -58,7 +64,7 @@ class ColorOption extends React.Component<ColorProps, ColorStates> {
|
||||
<span
|
||||
className="icon-sort popup-color-more"
|
||||
onClick={() => {
|
||||
this.handleChangeOptiion();
|
||||
this.handleChangeOption();
|
||||
}}
|
||||
></span>
|
||||
{this.state.isLine && renderLine()}
|
||||
|
||||
@@ -26,11 +26,15 @@ class AboutDialog extends React.Component<AboutDialogProps, AboutDialogState> {
|
||||
onMouseEnter={() => {
|
||||
this.props.handleAbout(true);
|
||||
}}
|
||||
style={{
|
||||
left: "525px",
|
||||
height: "180px",
|
||||
width: "120px",
|
||||
}}
|
||||
style={
|
||||
this.props.isNewWarning
|
||||
? { left: "525px", height: "200px", width: "120px" }
|
||||
: {
|
||||
left: "525px",
|
||||
height: "180px",
|
||||
width: "120px",
|
||||
}
|
||||
}
|
||||
>
|
||||
<ul className="sort-by-category">
|
||||
<li
|
||||
@@ -107,6 +111,17 @@ class AboutDialog extends React.Component<AboutDialogProps, AboutDialogState> {
|
||||
>
|
||||
<Trans>Github Repo</Trans>
|
||||
</li>
|
||||
{this.props.isNewWarning && (
|
||||
<li
|
||||
className="sort-by-category-list"
|
||||
onClick={() => {
|
||||
this.handleJump("https://koodo.960960.xyz/download");
|
||||
}}
|
||||
style={{ color: "rgb(35, 170, 242)" }}
|
||||
>
|
||||
<Trans>New Version</Trans>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ const mapStateToProps = (state: stateType) => {
|
||||
return {
|
||||
isSettingOpen: state.manager.isSettingOpen,
|
||||
isAboutOpen: state.manager.isAboutOpen,
|
||||
isNewWarning: state.manager.isNewWarning,
|
||||
};
|
||||
};
|
||||
const actionCreator = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export interface AboutDialogProps {
|
||||
isSettingOpen: boolean;
|
||||
isAboutOpen: boolean;
|
||||
isNewWarning: boolean;
|
||||
handleSetting: (isSettingOpen: boolean) => void;
|
||||
handleAbout: (isAboutOpen: boolean) => void;
|
||||
}
|
||||
|
||||
@@ -65,9 +65,7 @@ class SettingDialog extends React.Component<
|
||||
].setAttribute("selected", "selected");
|
||||
}
|
||||
handleRest = (bool: boolean) => {
|
||||
bool
|
||||
? this.props.handleMessage("Turn Off Successfully")
|
||||
: this.props.handleMessage("Turn On Successfully");
|
||||
this.props.handleMessage("Change Successfully");
|
||||
this.props.handleMessageBox(true);
|
||||
};
|
||||
changeLanguage = (lng: string) => {
|
||||
|
||||
@@ -46,9 +46,12 @@ class UpdateInfo extends React.Component<UpdateInfoProps, UpdateInfoState> {
|
||||
const newVersion = res.data.log.version;
|
||||
setTimeout(() => {
|
||||
if (version !== newVersion) {
|
||||
this.setState({ updateLog: res.data.log });
|
||||
|
||||
this.props.handleNewDialog(true);
|
||||
if (OtherUtil.getReaderConfig("isDisableUpdate") !== "yes") {
|
||||
this.setState({ updateLog: res.data.log });
|
||||
this.props.handleNewDialog(true);
|
||||
} else {
|
||||
this.props.handleNewWarning(true);
|
||||
}
|
||||
} else if (
|
||||
OtherUtil.getReaderConfig("version") !== newVersion &&
|
||||
OtherUtil.getReaderConfig("isFirst")
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
handleMessageBox,
|
||||
handleMessage,
|
||||
handleNewDialog,
|
||||
handleNewWarning,
|
||||
} from "../../../store/actions";
|
||||
import UpdateInfo from "./component";
|
||||
import { withTranslation } from "react-i18next";
|
||||
@@ -20,6 +21,7 @@ const actionCreator = {
|
||||
handleMessageBox,
|
||||
handleMessage,
|
||||
handleNewDialog,
|
||||
handleNewWarning,
|
||||
};
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface UpdateInfoProps {
|
||||
handleMessage: (message: string) => void;
|
||||
handleMessageBox: (isShow: boolean) => void;
|
||||
handleNewDialog: (isShowNew: boolean) => void;
|
||||
handleNewWarning: (isNewWarning: boolean) => void;
|
||||
}
|
||||
export interface UpdateInfoState {
|
||||
updateLog: any;
|
||||
|
||||
@@ -56,18 +56,17 @@ class SettingSwitch extends React.Component<
|
||||
this.setState({ [stateName]: !this.state[stateName] } as any);
|
||||
OtherUtil.setReaderConfig(stateName, this.state[stateName] ? "no" : "yes");
|
||||
|
||||
this.state[stateName]
|
||||
? this.props.handleMessage("Turn On Successfully")
|
||||
: this.props.handleMessage("Turn Off Successfully");
|
||||
this.props.handleMessage("Change Successfully");
|
||||
this.props.handleMessageBox(true);
|
||||
setTimeout(() => {
|
||||
this._handleRest();
|
||||
}, 500);
|
||||
};
|
||||
render() {
|
||||
console.log(this.props.currentEpub);
|
||||
return (
|
||||
<>
|
||||
{this.props.currentEpub.archived && <TextToSpeech />}
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && <TextToSpeech />}
|
||||
{(this.props.currentEpub.rendition
|
||||
? readerSettingList
|
||||
: htmlSettingList
|
||||
|
||||
@@ -2,6 +2,7 @@ export interface SettingSwitchProps {
|
||||
currentEpub: any;
|
||||
locations: any;
|
||||
isReading: boolean;
|
||||
htmlBook;
|
||||
handleMessageBox: (isShow: boolean) => void;
|
||||
handleMessage: (message: string) => void;
|
||||
renderFunc: () => void;
|
||||
|
||||
@@ -247,7 +247,12 @@ class Header extends React.Component<HeaderProps, HeaderState> {
|
||||
position="top"
|
||||
trigger="mouseenter"
|
||||
>
|
||||
<span className="icon-setting setting-icon"></span>
|
||||
<span
|
||||
className="icon-setting setting-icon"
|
||||
style={
|
||||
this.props.isNewWarning ? { color: "rgb(35, 170, 242)" } : {}
|
||||
}
|
||||
></span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{isElectron && (
|
||||
@@ -313,10 +318,7 @@ class Header extends React.Component<HeaderProps, HeaderState> {
|
||||
handleDrag: this.props.handleDrag,
|
||||
}}
|
||||
/>
|
||||
{isElectron &&
|
||||
OtherUtil.getReaderConfig("isDisableUpdate") !== "yes" && (
|
||||
<UpdateInfo />
|
||||
)}
|
||||
{isElectron && <UpdateInfo />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const mapStateToProps = (state: stateType) => {
|
||||
isAboutOpen: state.manager.isAboutOpen,
|
||||
bookmarks: state.reader.bookmarks,
|
||||
books: state.manager.books,
|
||||
isNewWarning: state.manager.isNewWarning,
|
||||
notes: state.reader.notes,
|
||||
isCollapsed: state.sidebar.isCollapsed,
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface HeaderProps {
|
||||
isSortDisplay: boolean;
|
||||
isAboutOpen: boolean;
|
||||
isCollapsed: boolean;
|
||||
isNewWarning: boolean;
|
||||
|
||||
bookmarks: BookmarkModel[];
|
||||
notes: NoteModel[];
|
||||
|
||||
@@ -21,6 +21,7 @@ import OtherUtil from "../../utils/otherUtil";
|
||||
import RecordLocation from "../../utils/readUtils/recordLocation";
|
||||
import { mimetype } from "../../constants/mimetype";
|
||||
import styleUtil from "../../utils/readUtils/styleUtil";
|
||||
import { isElectron } from "react-device-detect";
|
||||
|
||||
declare var window: any;
|
||||
|
||||
@@ -127,12 +128,26 @@ class Viewer extends React.Component<ViewerProps, ViewerState> {
|
||||
return;
|
||||
}
|
||||
let imgs = doc.getElementsByTagName("img");
|
||||
let links = doc.getElementsByTagName("a");
|
||||
console.log(links);
|
||||
for (let item of links) {
|
||||
item.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
console.log(item);
|
||||
this.handleJump(item.href);
|
||||
});
|
||||
}
|
||||
for (let item of imgs) {
|
||||
item.setAttribute("style", "max-width: 100%");
|
||||
}
|
||||
this.bindEvent(doc);
|
||||
}, 1);
|
||||
};
|
||||
handleJump = (url: string) => {
|
||||
isElectron
|
||||
? window.require("electron").shell.openExternal(url)
|
||||
: window.open(url);
|
||||
};
|
||||
bindEvent = (doc: any) => {
|
||||
let isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
|
||||
// 鼠标滚轮翻页
|
||||
|
||||
@@ -238,7 +238,7 @@ class NavigationPanel extends React.Component<
|
||||
|
||||
<Trans>Minute</Trans>
|
||||
</span>
|
||||
{this.props.currentEpub.archived && (
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && (
|
||||
<div className="navigation-search-box">
|
||||
<SearchBox {...searchProps} />
|
||||
</div>
|
||||
|
||||
@@ -57,7 +57,7 @@ class SettingPanel extends React.Component<
|
||||
<Trans>Reading Option</Trans>
|
||||
</div>
|
||||
<div className="setting-panel">
|
||||
{this.props.currentEpub.archived && <ModeControl />}
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && <ModeControl />}
|
||||
<ThemeList />
|
||||
<SliderList
|
||||
{...{
|
||||
@@ -70,7 +70,7 @@ class SettingPanel extends React.Component<
|
||||
title: "Font Size",
|
||||
}}
|
||||
/>
|
||||
{this.props.currentEpub.archived && (
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && (
|
||||
<SliderList
|
||||
{...{
|
||||
maxValue: 80,
|
||||
@@ -94,7 +94,7 @@ class SettingPanel extends React.Component<
|
||||
title: "Letter Spacing",
|
||||
}}
|
||||
/>
|
||||
{this.props.currentEpub.archived && (
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && (
|
||||
<SliderList
|
||||
{...{
|
||||
maxValue: 60,
|
||||
|
||||
@@ -171,7 +171,7 @@ class Reader extends React.Component<ReaderProps, ReaderState> {
|
||||
this.handleEnterReader("top");
|
||||
}}
|
||||
></div>
|
||||
{this.props.currentEpub.archived && (
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && (
|
||||
<div
|
||||
className="bottom-panel"
|
||||
onMouseEnter={() => {
|
||||
@@ -216,7 +216,7 @@ class Reader extends React.Component<ReaderProps, ReaderState> {
|
||||
>
|
||||
<NavigationPanel {...{ time: this.state.time }} />
|
||||
</div>
|
||||
{this.props.currentEpub.archived && (
|
||||
{Object.keys(this.props.currentEpub).length !== 0 && (
|
||||
<div
|
||||
className="progress-panel-container"
|
||||
onMouseLeave={(event) => {
|
||||
|
||||
@@ -48,6 +48,9 @@ export function handleLoadingDialog(isShowLoading: boolean) {
|
||||
export function handleNewDialog(isShowNew: boolean) {
|
||||
return { type: "HANDLE_SHOW_NEW", payload: isShowNew };
|
||||
}
|
||||
export function handleNewWarning(isNewWarning: boolean) {
|
||||
return { type: "HANDLE_NEW_WARNING", payload: isNewWarning };
|
||||
}
|
||||
export function handleBookSort(isBookSort: boolean) {
|
||||
return { type: "HANDLE_BOOK_SORT", payload: isBookSort };
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ export type stateType = {
|
||||
isAboutOpen: boolean;
|
||||
isShowLoading: boolean;
|
||||
isShowNew: boolean;
|
||||
isNewWarning: boolean;
|
||||
isTipDialog: boolean;
|
||||
bookSortCode: { sort: number; order: number };
|
||||
noteSortCode: { sort: number; order: number };
|
||||
|
||||
@@ -11,6 +11,7 @@ const initState = {
|
||||
viewMode: "card",
|
||||
isSortDisplay: false,
|
||||
isShowLoading: false,
|
||||
isNewWarning: false,
|
||||
isTipDialog: false,
|
||||
isShowNew: false,
|
||||
bookSortCode: { sort: 0, order: 1 },
|
||||
@@ -96,6 +97,11 @@ export function manager(
|
||||
...state,
|
||||
isShowNew: action.payload,
|
||||
};
|
||||
case "HANDLE_NEW_WARNING":
|
||||
return {
|
||||
...state,
|
||||
isNewWarning: action.payload,
|
||||
};
|
||||
case "HANDLE_MESSAGE":
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -6,7 +6,11 @@ const initState = {
|
||||
chapters: null,
|
||||
currentChapter: "",
|
||||
flattenChapters: null,
|
||||
color: OtherUtil.getReaderConfig("isDisplayDark") === "yes" ? 3 : 0,
|
||||
color: parseInt(OtherUtil.getReaderConfig("highlightIndex"))
|
||||
? parseInt(OtherUtil.getReaderConfig("highlightIndex"))
|
||||
: OtherUtil.getReaderConfig("isDisplayDark") === "yes"
|
||||
? 3
|
||||
: 0,
|
||||
noteKey: "",
|
||||
originalText: "",
|
||||
htmlBook: null,
|
||||
|
||||
Reference in New Issue
Block a user