Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Fix baseRasterizedExporter.js to write correct image URLs #737

Merged
merged 1 commit into from
Sep 21, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions app/content/pencil/exporter/baseRasterizedExporter.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
function BaseRasterizedExporter() {
this.name = Util.getMessage("rasterized.graphics.png.files");
this.id = "BaseRasterizedExporter";
this.name = Util.getMessage("rasterized.graphics.png.files");
this.id = "BaseRasterizedExporter";
}
BaseRasterizedExporter.prototype = new BaseExporter();

BaseRasterizedExporter.prototype.requireRasterizedData = function () {
return true;
BaseRasterizedExporter.prototype.requireRasterizedData = function() {
return true;
};
BaseRasterizedExporter.prototype.getRasterizedPageDestination = function (baseDir) {
return baseDir.clone();
BaseRasterizedExporter.prototype.getRasterizedPageDestination = function(
baseDir) {
return baseDir.clone();
};

BaseRasterizedExporter.prototype.export = function (doc, options, destFile, xmlFile, callback) {
callback();
BaseRasterizedExporter.prototype.export = function(doc, options, destFile,
xmlFile, callback) {
callback();
};
BaseRasterizedExporter.prototype.getWarnings = function () {
return Util.getMessage("no.linkings.are.preserved");
BaseRasterizedExporter.prototype.getWarnings = function() {
return Util.getMessage("no.linkings.are.preserved");
};
BaseRasterizedExporter.prototype.fixAbsoluteRasterizedPaths = function (sourceDOM, destDir) {
//changing rasterized path to relative
var pathPrefix = destDir.path + DirIO.sep;
Dom.workOn("//p:Page/@rasterized", sourceDOM, function (attr) {
var path = attr.nodeValue;
if (path.indexOf(pathPrefix) == 0) {
path = path.substring(pathPrefix.length);
attr.nodeValue = path;
}
});
BaseRasterizedExporter.prototype.fixAbsoluteRasterizedPaths = function(
sourceDOM, destDir) {
//changing rasterized path to relative
var pathPrefix = destDir.path + DirIO.sep;
Dom.workOn("//p:Page/@rasterized", sourceDOM, function(attr) {
var path = attr.nodeValue;
if (path.indexOf(pathPrefix) == 0) {
path = path.substring(pathPrefix.length);
attr.nodeValue = path.replace(DirIO.sep, "/");
}
});
};

Pencil.registerDocumentExporter(new BaseRasterizedExporter());