diff --git a/client/components/Reader/HelpPage/MouseHelpPage/MouseHelpPage.vue b/client/components/Reader/HelpPage/MouseHelpPage/MouseHelpPage.vue
index c1e2afe9..e1fe843b 100644
--- a/client/components/Reader/HelpPage/MouseHelpPage/MouseHelpPage.vue
+++ b/client/components/Reader/HelpPage/MouseHelpPage/MouseHelpPage.vue
@@ -9,6 +9,7 @@
ПКМ - показать/скрыть панель управления
СКМ - вкл./выкл. плавный скроллинг текста
+ * Для управления с помощью мыши/тачпада необходимо установить галочку "Включить управление кликом" в настройках
diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue
index d4fb7e8e..8dc1fe5e 100644
--- a/client/components/Reader/Reader.vue
+++ b/client/components/Reader/Reader.vue
@@ -199,7 +199,7 @@ class Reader extends Vue {
mounted() {
(async() => {
- await bookManager.init();
+ await bookManager.init(this.settings);
await restoreOldSettings(this.settings, bookManager, this.commit);
if (this.$root.rootRoute == '/reader') {
@@ -439,6 +439,12 @@ class Reader extends Vue {
}
}
+ refreshBook() {
+ if (this.mostRecentBook()) {
+ this.loadBook({url: this.mostRecentBook().url, force: true});
+ }
+ }
+
buttonClick(button) {
const activeClass = this.buttonActiveClass(button);
@@ -482,9 +488,7 @@ class Reader extends Vue {
this.historyToggle();
break;
case 'refresh':
- if (this.mostRecentBook()) {
- this.loadBook({url: this.mostRecentBook().url, force: true});
- }
+ this.refreshBook();
break;
case 'settings':
this.settingsToggle();
@@ -790,6 +794,9 @@ class Reader extends Vue {
event.preventDefault();
event.stopPropagation();
break;
+ case 'KeyZ':
+ this.scrollingToggle();
+ break;
case 'KeyP':
this.setPositionToggle();
break;
@@ -807,8 +814,8 @@ class Reader extends Vue {
event.stopPropagation();
}
break;
- case 'KeyZ':
- this.scrollingToggle();
+ case 'KeyR':
+ this.refreshBook();
break;
case 'KeyX':
this.historyToggle();
diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue
index 6e4af639..6610ad95 100644
--- a/client/components/Reader/SettingsPage/SettingsPage.vue
+++ b/client/components/Reader/SettingsPage/SettingsPage.vue
@@ -81,7 +81,7 @@
-
+
Примеры
@@ -112,10 +112,10 @@
-
+
-
+
@@ -123,7 +123,7 @@
Слева/справа
-
+
@@ -134,7 +134,7 @@
Сверху/снизу
-
+
@@ -184,6 +184,16 @@
По ширине
Перенос по слогам
+
+ Убирать пустые параграфы
+
+
+
+ Добавлять пустые
+
+
+
+
@@ -194,7 +204,7 @@
Вверху/внизу
-
+
@@ -234,6 +244,9 @@
+
+ Включить управление кликом
+
@@ -241,7 +254,7 @@
Показывать области управления кликом
-
+
@@ -384,6 +397,10 @@ class SettingsPage extends Vue {
];
}
+ needReload() {
+ this.$notify.warning({message: 'Необходимо обновить страницу (F5), чтобы изменения возымели эффект'});
+ }
+
close() {
this.$emit('settings-toggle');
}
diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue
index 4f4c08c0..198de402 100644
--- a/client/components/Reader/TextPage/TextPage.vue
+++ b/client/components/Reader/TextPage/TextPage.vue
@@ -4,18 +4,18 @@
-
+
-
+
-
@@ -23,6 +23,8 @@
@click.prevent.stop="onStatusBarClick">
+
@@ -63,6 +65,8 @@ export default @Component({
class TextPage extends Vue {
toggleLayout = false;
showStatusBar = false;
+ clickControl = true;
+
background = null;
page1 = null;
page2 = null;
diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js
index d8dedb39..c0c1f368 100644
--- a/client/components/Reader/share/BookParser.js
+++ b/client/components/Reader/share/BookParser.js
@@ -3,7 +3,7 @@ import sax from '../../../../server/core/BookConverter/sax';
import {sleep} from '../../../share/utils';
export default class BookParser {
- constructor() {
+ constructor(settings) {
// defaults
this.p = 30;// px, отступ параграфа
this.w = 300;// px, ширина страницы
@@ -13,6 +13,12 @@ export default class BookParser {
this.measureText = (text, style) => {// eslint-disable-line no-unused-vars
return text.length*20;
};
+
+ //настройки
+ if (settings) {
+ this.cutEmptyParagraphs = settings.cutEmptyParagraphs;
+ this.addEmptyParagraphs = settings.addEmptyParagraphs;
+ }
}
async parse(data, callback) {
@@ -48,7 +54,14 @@ export default class BookParser {
text: String //текст параграфа (или title или epigraph и т.д) с вложенными тегами
}
*/
- const newParagraph = (text, len) => {
+ const newParagraph = (text, len, noCut) => {
+ //схлопывание пустых параграфов
+ if (!noCut && this.cutEmptyParagraphs && paraIndex >= 0 && len == 1 && text[0] == ' ') {
+ let p = para[paraIndex];
+ if (p.length == 1 && p.text[0] == ' ')
+ return;
+ }
+
paraIndex++;
let p = {
index: paraIndex,
@@ -70,6 +83,16 @@ export default class BookParser {
let p = para[paraIndex];
if (p) {
+ //добавление пустых параграфов
+ if (this.addEmptyParagraphs && p.length == 1 && p.text[0] == ' ' && len > 0) {
+ let i = this.addEmptyParagraphs;
+ while (i > 0) {
+ newParagraph(' ', 1, true);
+ i--;
+ }
+ p = para[paraIndex];
+ }
+
paraOffset -= p.length;
if (p.length == 1 && p.text[0] == ' ' && len > 0) {
p.length = 0;
diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js
index bb6acd88..67b9b812 100644
--- a/client/components/Reader/share/bookManager.js
+++ b/client/components/Reader/share/bookManager.js
@@ -18,7 +18,8 @@ const bmRecentStore = localForage.createInstance({
});
class BookManager {
- async init() {
+ async init(settings) {
+ this.settings = settings;
this.books = {};
this.recent = {};
this.recentChanged = true;
@@ -130,7 +131,7 @@ class BookManager {
async parseBook(meta, data, callback) {
if (!this.books)
await this.init();
- const parsed = new BookParser();
+ const parsed = new BookParser(this.settings);
const parsedMeta = await parsed.parse(data, callback);
const result = Object.assign({}, meta, parsedMeta, {
diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js
index 7e79a600..db3f8d6b 100644
--- a/client/store/modules/reader.js
+++ b/client/store/modules/reader.js
@@ -159,6 +159,10 @@ const settingDefaults = {
lazyParseEnabled: false,
copyFullText: false,
showClickMapPage: true,
+ clickControl: true,
+ cutEmptyParagraphs: false,
+ addEmptyParagraphs: 0,
+
fontShifts: {},
};
diff --git a/package.json b/package.json
index 671143ac..a4579e2e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "Liberama",
- "version": "0.1.4",
+ "version": "0.1.5",
"engines": {
"node": ">=10.0.0"
},