From a55f8a57414c16e6cff24e0ace802ad5f319b09d Mon Sep 17 00:00:00 2001 From: Fred Chasen Date: Tue, 31 Oct 2017 16:06:38 -0700 Subject: [PATCH] Fix width to pixel amount, add direction to html if present on body --- examples/hypothesis.js | 8 +++++++- src/contents.js | 11 ++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/hypothesis.js b/examples/hypothesis.js index d638ecb..bfd58d3 100644 --- a/examples/hypothesis.js +++ b/examples/hypothesis.js @@ -70,8 +70,14 @@ if (active) { active.classList.add("active"); } + + let urlParam = params && params.get("url"); + let url = ''; + if (urlParam) { + url = "url=" + urlParam + "&"; + } // Add CFI fragment to the history - history.pushState({}, '', "?loc=" + encodeURIComponent(section.href)); + history.pushState({}, '', "?" + url + "loc=" + encodeURIComponent(section.href)); // window.location.hash = "#/"+section.href }); diff --git a/src/contents.js b/src/contents.js index a15a638..4ac6b9d 100644 --- a/src/contents.js +++ b/src/contents.js @@ -779,15 +779,12 @@ class Contents { var COLUMN_WIDTH = prefixed("column-width"); var COLUMN_FILL = prefixed("column-fill"); - var isVertical = this.writingMode().indexOf("vertical") === 0; - - if (isVertical) { - this.width(width); - } else { - this.width("100%"); + // Fix body width issues if rtl is only set on body element + if (this.content.dir === "rtl") { + this.direction("rtl"); } - // this.width("100%"); + this.width(width); this.height(height); // Deal with Mobile trying to scale to viewport