mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
background images half-work; the url is hardcoded for now.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
function style2css(stylesheet, stylesxmldom) {
|
||||
|
||||
// helper constants
|
||||
var xlinkns = 'http://www.w3.org/1999/xlink';
|
||||
|
||||
var stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
|
||||
var officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
||||
@@ -9,6 +10,7 @@ function style2css(stylesheet, stylesxmldom) {
|
||||
var drawns="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";
|
||||
var tablens="urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
||||
var namespaces = {
|
||||
xlink: xlinkns,
|
||||
draw: drawns,
|
||||
fo: fons,
|
||||
office: officens,
|
||||
@@ -61,6 +63,10 @@ function style2css(stylesheet, stylesxmldom) {
|
||||
[ fons, 'font-size', 'font-size' ]
|
||||
];
|
||||
|
||||
var bgImageSimpleMapping = [
|
||||
[ xlinkns, 'href', 'background-image' ]
|
||||
];
|
||||
|
||||
var paragraphPropertySimpleMapping = [
|
||||
[ fons, 'text-align', 'text-align' ],
|
||||
[ fons, 'padding-left', 'padding-left' ],
|
||||
@@ -193,6 +199,13 @@ function style2css(stylesheet, stylesxmldom) {
|
||||
function getParagraphProperties(props) {
|
||||
var rule = '';
|
||||
rule += applySimpleMapping(props, paragraphPropertySimpleMapping);
|
||||
var imageProps = props.getElementsByTagNameNS(stylens, 'background-image');
|
||||
if (imageProps.length > 0) {
|
||||
//var url = imageProps.item(0).getAttributeNS(xlinkns, 'href');
|
||||
var url = "http://chani.ca/avatar.png";
|
||||
rule += "background-image: url('" + url + "');";
|
||||
rule += "background-repeat: repeat;"; //FIXME test
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user