Comparing version 0.1.4 to 0.1.5
@@ -289,3 +289,2 @@ 'use strict'; | ||
enter: function enter(node, item, list) { | ||
// console.log("Dimension", node); | ||
var value = node.value, | ||
@@ -302,3 +301,3 @@ unit = node.unit; | ||
// Get size: a4 | ||
// Get size: 'A4' | ||
_cssTree2.default.walk(declaration, { | ||
@@ -316,7 +315,16 @@ visit: 'String', | ||
// Get Landscape or Portrait | ||
// Get Format or Landscape or Portrait | ||
_cssTree2.default.walk(declaration, { | ||
visit: "Identifier", | ||
enter: function enter(node, item, list) { | ||
orientation = node.name; | ||
var name = node.name; | ||
if (name === "landscape" || name === "portrait") { | ||
orientation = node.name; | ||
} else if (name !== "auto") { | ||
var s = _sizes2.default[name]; | ||
if (s) { | ||
width = s.width; | ||
height = s.height; | ||
} | ||
} | ||
} | ||
@@ -511,8 +519,5 @@ }); | ||
// Disabled due to causing issues with Chrome on print | ||
/* | ||
if (page.width) { | ||
this.addDimensions(page.width, page.height, children, children.first()); | ||
} | ||
*/ | ||
if (page.width) { | ||
this.addDimensions(page.width, page.height, children, children.first()); | ||
} | ||
@@ -545,18 +550,2 @@ if (page.marginalia) { | ||
value: function addDimensions(width, height, list, item) { | ||
// width dimension | ||
var widthList = new _cssTree2.default.List(); | ||
widthList.insert(widthList.createItem({ | ||
type: "Dimension", | ||
value: width.value, | ||
unit: width.unit | ||
})); | ||
var w = list.createItem({ | ||
type: 'Declaration', | ||
property: "width", | ||
value: { | ||
type: 'Value', | ||
children: widthList | ||
} | ||
}); | ||
list.append(w); | ||
// width variable | ||
@@ -573,18 +562,2 @@ var wVar = list.createItem({ | ||
// height dimension | ||
var heightList = new _cssTree2.default.List(); | ||
heightList.insert(heightList.createItem({ | ||
type: "Dimension", | ||
value: height.value, | ||
unit: height.unit | ||
})); | ||
var h = list.createItem({ | ||
type: 'Declaration', | ||
property: "height", | ||
value: { | ||
type: 'Value', | ||
children: heightList | ||
} | ||
}); | ||
list.append(h); | ||
// height variable | ||
@@ -600,2 +573,38 @@ var hVar = list.createItem({ | ||
list.append(hVar); | ||
// Disabled due to causing issues with Chrome on print | ||
/* | ||
// width dimension | ||
let widthList = new csstree.List(); | ||
widthList.insert(widthList.createItem({ | ||
type: "Dimension", | ||
value: width.value, | ||
unit: width.unit | ||
})); | ||
let w = list.createItem({ | ||
type: 'Declaration', | ||
property: "width", | ||
value: { | ||
type: 'Value', | ||
children: widthList | ||
} | ||
}); | ||
list.append(w); | ||
// height dimension | ||
let heightList = new csstree.List(); | ||
heightList.insert(heightList.createItem({ | ||
type: "Dimension", | ||
value: height.value, | ||
unit: height.unit | ||
})); | ||
let h = list.createItem({ | ||
type: 'Declaration', | ||
property: "height", | ||
value: { | ||
type: 'Value', | ||
children: heightList | ||
} | ||
}); | ||
list.append(h); | ||
*/ | ||
} | ||
@@ -602,0 +611,0 @@ }, { |
@@ -65,2 +65,14 @@ 'use strict'; | ||
// default size | ||
this.size = { | ||
width: { | ||
value: 8.5, | ||
unit: "in" | ||
}, | ||
height: { | ||
value: 11, | ||
unit: "in" | ||
} | ||
}; | ||
var counter = 0; | ||
@@ -67,0 +79,0 @@ this.chunker.on("page", function (page) { |
{ | ||
"name": "pagedjs", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Chunks up a document into paged media flows and applies print styles", | ||
@@ -5,0 +5,0 @@ "author": "Fred Chasen", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1519585
35517