1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Merge pull request #961 from alidbc/master

Major RTL fixes
This commit is contained in:
Fred Chasen 2020-05-15 09:09:57 -07:00 committed by GitHub
commit 5081589d25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 33 deletions

View file

@ -577,10 +577,10 @@ class Contents {
if(range) {
try {
if (!range.endContainer ||
(range.startContainer == range.endContainer
(range.startContainer == range.endContainer
&& range.startOffset == range.endOffset)) {
// If the end for the range is not set, it results in collapsed becoming
// true. This in turn leads to inconsistent behaviour when calling
// true. This in turn leads to inconsistent behaviour when calling
// getBoundingRect. Wrong bounds lead to the wrong page being displayed.
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15684911/
let pos = range.startContainer.textContent.indexOf(" ", range.startOffset);
@ -1015,7 +1015,7 @@ class Contents {
* @param {number} columnWidth
* @param {number} gap
*/
columns(width, height, columnWidth, gap){
columns(width, height, columnWidth, gap, dir){
let COLUMN_AXIS = prefixed("column-axis");
let COLUMN_GAP = prefixed("column-gap");
let COLUMN_WIDTH = prefixed("column-width");
@ -1026,9 +1026,8 @@ class Contents {
this.layoutStyle("paginated");
// Fix body width issues if rtl is only set on body element
if (this.content.dir === "rtl") {
this.direction("rtl");
if (dir === "rtl") {
this.direction(dir);
}
this.width(width);