diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue
index 14f212a3..1f327133 100644
--- a/client/components/Reader/Reader.vue
+++ b/client/components/Reader/Reader.vue
@@ -201,7 +201,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') {
diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue
index b9d54666..d9440de4 100644
--- a/client/components/Reader/SettingsPage/SettingsPage.vue
+++ b/client/components/Reader/SettingsPage/SettingsPage.vue
@@ -203,6 +203,16 @@
+
+
+ Выносить все изображения в центр экрана
+
+ Инлайн в центр
+
+
+
+
+ Размер изображения
Определяет высоту изображения количеством строк.
@@ -212,7 +222,6 @@
-
diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue
index 7e0a845d..f5d93345 100644
--- a/client/components/Reader/TextPage/TextPage.vue
+++ b/client/components/Reader/TextPage/TextPage.vue
@@ -219,6 +219,7 @@ class TextPage extends Vue {
this.parsed.measureText = this.drawHelper.measureText.bind(this.drawHelper);
this.parsed.lineHeight = this.lineHeight;
this.parsed.showImages = this.showImages;
+ this.parsed.showInlineImagesInCenter = this.showInlineImagesInCenter;
this.parsed.imageHeightLines = this.imageHeightLines;
}
diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js
index e00fd081..0548cb98 100644
--- a/client/components/Reader/share/BookParser.js
+++ b/client/components/Reader/share/BookParser.js
@@ -5,7 +5,11 @@ import {sleep} from '../../../share/utils';
const maxImageLineCount = 100;
export default class BookParser {
- constructor() {
+ constructor(settings) {
+ if (settings) {
+ this.showInlineImagesInCenter = settings.showInlineImagesInCenter;
+ }
+
// defaults
this.p = 30;// px, отступ параграфа
this.w = 300;// px, ширина страницы
@@ -151,10 +155,13 @@ export default class BookParser {
if (tag == 'image') {
let attrs = sax.getAttrsSync(tail);
if (attrs.href.value) {
- if (inPara)
+ if (inPara && !this.showInlineImagesInCenter)
growParagraph(``, 0);
else
newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount);
+
+ if (inPara && this.showInlineImagesInCenter)
+ newParagraph(' ', 1);
}
}
diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js
index 1d91b0dc..12215372 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.recentChanged1 = true;
@@ -131,7 +132,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 f00c2a56..c365f737 100644
--- a/client/store/modules/reader.js
+++ b/client/store/modules/reader.js
@@ -1,5 +1,3 @@
-import Vue from 'vue';
-
const fonts = [
{name: 'ReaderDefault', label: 'По-умолчанию', fontVertShift: 0},
{name: 'GEO_1', label: 'BPG Arial', fontVertShift: 10},
@@ -164,6 +162,7 @@ const settingDefaults = {
addEmptyParagraphs: 0,
blinkCachedLoad: true,
showImages: true,
+ showInlineImagesInCenter: false,
imageHeightLines: 100,
fontShifts: {},
diff --git a/package.json b/package.json
index 8e5830c0..df59f11e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "Liberama",
- "version": "0.4.0",
+ "version": "0.4.1",
"engines": {
"node": ">=10.0.0"
},