mirror of
https://github.com/tbluemel/rtf.js.git
synced 2026-11-30 16:47:59 +01:00
Remove remaining jQuery dependencies
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## [3.0.0]
|
||||
- Dropped requirement for jquery and jquery filter
|
||||
- Bundles are still transpiled to ES5 but will require polyfills for older browsers
|
||||
|
||||
## [2.3.3] - 2020-01-11
|
||||
- More double width character improvements
|
||||
- Support for unicode characters outsider the basic multilingual plane (as used by new emojis etc.)
|
||||
|
||||
+1
-17
@@ -2,17 +2,11 @@ This guide shows how to use the library to render a basic rtf file
|
||||
|
||||
# Loading rtf.js as a script
|
||||
## Prerequisites
|
||||
- Download the files in the `dist` directory and [jquery](https://jquery.com/)
|
||||
- Include a promise polyfill if you have to support older browsers
|
||||
|
||||
## Code
|
||||
Put the following code into a html file:
|
||||
```html
|
||||
<script src="../vendor/jquery.min.js"></script>
|
||||
|
||||
<script src="../vendor/jquery.svg.js"></script>
|
||||
<script src="../vendor/jquery.svgfilter.js"></script>
|
||||
|
||||
<script src="../vendor/WMFJS.bundle.js"></script>
|
||||
<script src="../vendor/EMFJS.bundle.js"></script>
|
||||
<script src="../vendor/RTFJS.bundle.js"></script>
|
||||
@@ -84,7 +78,6 @@ doc.render().then(function(htmlElements) {
|
||||
# Importing rtf.js as a module (Typescript)
|
||||
## Prerequisites
|
||||
- Install rtf.js from npm (`npm install rtf.js`)
|
||||
- Install jquery types from npm (`npm install @types/jquery`)
|
||||
- Disable lib check in `tsconfig.json` (add `"skipLibCheck": true`)
|
||||
|
||||
## Code
|
||||
@@ -120,7 +113,7 @@ doc.render().then(function(htmlElements) {
|
||||
|
||||
# Node (using jsdom)
|
||||
## Prerequisites
|
||||
- Install rtf.js, jQuery and jsdom from npm (`npm install rtf.js jquery jsdom`)
|
||||
- Install rtf.js and jsdom from npm (`npm install rtf.js jsdom`)
|
||||
|
||||
## Code
|
||||
This is a minimal example for wrapper around rtf.js and jsdom:
|
||||
@@ -142,11 +135,6 @@ exports.runRtfjs = function(rtf, callback, errorCallback) {
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var dom = new JSDOM(`
|
||||
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
<script src="./node_modules/rtf.js/dist/jquery.svg.min.js"></script>
|
||||
<script src="./node_modules/rtf.js/dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="./node_modules/rtf.js/dist/WMFJS.bundle.js"></script>
|
||||
<script src="./node_modules/rtf.js/dist/EMFJS.bundle.js"></script>
|
||||
<script src="./node_modules/rtf.js/dist/RTFJS.bundle.js"></script>
|
||||
@@ -181,10 +169,6 @@ exports.runRtfjs = function(rtf, callback, errorCallback) {
|
||||
window.onerror = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
// Catch exceptions from jquery.svg.min.js
|
||||
window.alert = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
}});
|
||||
}
|
||||
```
|
||||
|
||||
@@ -23,11 +23,7 @@ For information on how to use the library see the [Getting Started Guide](GETTIN
|
||||
|
||||
# Dependencies
|
||||
* rtf.js requires:
|
||||
* [jquery](https://jquery.com/)
|
||||
* [js-codepage](https://github.com/SheetJS/js-codepage/) (Apache 2.0 license, included in the rtf.js bundle)
|
||||
* wmf.js and emf.js require:
|
||||
* [jquery](https://jquery.com/)
|
||||
* [jquery.svg.js plugin](https://github.com/kbwood/svg) with the jquery.svgfilter.js extension.
|
||||
* Rendering WMF and EMF images is accomplished by using HTML5's `<svg>` feature.
|
||||
* Rendering RTF documents often requires rendering embedded WMF and EMF images, however rtf.js can be used without wmf.js and emf.js or with just one of them, if rendering such images is not required.
|
||||
|
||||
|
||||
+264
-74
@@ -1,13 +1,13 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("./jquery.svg"), require("./jquery.svgfilter"), require("jquery"));
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["./jquery.svg", "./jquery.svgfilter", "jquery"], factory);
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["EMFJS"] = factory(require("./jquery.svg"), require("./jquery.svgfilter"), require("jquery"));
|
||||
exports["EMFJS"] = factory();
|
||||
else
|
||||
root["EMFJS"] = factory(root["$"], root["$"], root["$"]);
|
||||
})(this, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__4__) {
|
||||
root["EMFJS"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
@@ -100,17 +100,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var jquery_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
||||
/* harmony import */ var jquery_svg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery_svg__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var jquery_svgfilter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
||||
/* harmony import */ var jquery_svgfilter__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery_svgfilter__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _Renderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return _Renderer__WEBPACK_IMPORTED_MODULE_2__["Renderer"]; });
|
||||
/* harmony import */ var _Renderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return _Renderer__WEBPACK_IMPORTED_MODULE_0__["Renderer"]; });
|
||||
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Error", function() { return _Helper__WEBPACK_IMPORTED_MODULE_3__["EMFJSError"]; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Error", function() { return _Helper__WEBPACK_IMPORTED_MODULE_1__["EMFJSError"]; });
|
||||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "loggingEnabled", function() { return _Helper__WEBPACK_IMPORTED_MODULE_3__["loggingEnabled"]; });
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "loggingEnabled", function() { return _Helper__WEBPACK_IMPORTED_MODULE_1__["loggingEnabled"]; });
|
||||
|
||||
/*
|
||||
|
||||
@@ -142,34 +138,19 @@ SOFTWARE.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return Renderer; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMF", function() { return EMF; });
|
||||
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
||||
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _Blob__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
||||
/* harmony import */ var _EMFRecords__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
||||
/* harmony import */ var _GDIContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6);
|
||||
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
||||
/* harmony import */ var _Blob__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
||||
/* harmony import */ var _EMFRecords__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
|
||||
/* harmony import */ var _GDIContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -207,18 +188,13 @@ var Renderer = /** @class */ (function () {
|
||||
_Helper__WEBPACK_IMPORTED_MODULE_4__["Helper"].log("EMFJS.Renderer instantiated");
|
||||
}
|
||||
Renderer.prototype.render = function (info) {
|
||||
var _this = this;
|
||||
var img = jquery__WEBPACK_IMPORTED_MODULE_0__("<div>").svg({
|
||||
onLoad: function (svg) {
|
||||
return _this._render(svg, info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
|
||||
},
|
||||
settings: {
|
||||
viewBox: [0, 0, info.xExt, info.yExt].join(" "),
|
||||
preserveAspectRatio: "none",
|
||||
},
|
||||
});
|
||||
var svgContainer = jquery__WEBPACK_IMPORTED_MODULE_0__(img[0]).svg("get");
|
||||
return jquery__WEBPACK_IMPORTED_MODULE_0__(svgContainer.root()).attr("width", info.width).attr("height", info.height);
|
||||
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
this._render(new _util__WEBPACK_IMPORTED_MODULE_0__["SVG"](svgElement), info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
|
||||
svgElement.setAttribute("viewBox", [0, 0, info.xExt, info.yExt].join(" "));
|
||||
svgElement.setAttribute("preserveAspectRatio", "none"); // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
|
||||
svgElement.setAttribute("width", info.width);
|
||||
svgElement.setAttribute("height", info.height);
|
||||
return svgElement;
|
||||
};
|
||||
Renderer.prototype.parse = function (blob) {
|
||||
this._img = null;
|
||||
@@ -262,19 +238,233 @@ var EMF = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, exports) {
|
||||
/* 2 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _SVG__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVG", function() { return _SVG__WEBPACK_IMPORTED_MODULE_0__["SVG"]; });
|
||||
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Tom Zoehner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/* 3 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SVG", function() { return SVG; });
|
||||
var SVGFilters = /** @class */ (function () {
|
||||
function SVGFilters() {
|
||||
}
|
||||
SVGFilters.prototype.flood = function (filter, resultId, color, opacity, _settings) {
|
||||
var floodElement = document.createElementNS("http://www.w3.org/2000/svg", "feFlood");
|
||||
if (resultId) {
|
||||
floodElement.setAttribute("id", resultId);
|
||||
}
|
||||
floodElement.setAttribute("flood-color", color);
|
||||
floodElement.setAttribute("flood-opacity", opacity.toString());
|
||||
filter.appendChild(floodElement);
|
||||
};
|
||||
SVGFilters.prototype.composite = function (filter, resultId, in1, in2, k1, k2, k3, k4, _settings) {
|
||||
var compositeElement = document.createElementNS("http://www.w3.org/2000/svg", "feComposite");
|
||||
if (resultId) {
|
||||
compositeElement.setAttribute("id", resultId);
|
||||
}
|
||||
compositeElement.setAttribute("in", in1);
|
||||
compositeElement.setAttribute("in2", in2);
|
||||
filter.appendChild(compositeElement);
|
||||
};
|
||||
return SVGFilters;
|
||||
}());
|
||||
var SVG = /** @class */ (function () {
|
||||
function SVG(svg) {
|
||||
this.filters = new SVGFilters();
|
||||
this._defs = undefined;
|
||||
this._svg = svg;
|
||||
}
|
||||
SVG.prototype.svg = function (parent, x, y, width, height, settings) {
|
||||
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
svgElement.setAttribute("x", x.toString());
|
||||
svgElement.setAttribute("y", y.toString());
|
||||
svgElement.setAttribute("width", width + "px");
|
||||
svgElement.setAttribute("height", height + "px");
|
||||
this._appendSettings(settings, svgElement);
|
||||
if (parent != null) {
|
||||
parent.appendChild(svgElement);
|
||||
}
|
||||
else {
|
||||
this._svg.appendChild(svgElement);
|
||||
}
|
||||
return svgElement;
|
||||
};
|
||||
SVG.prototype.image = function (parent, x, y, width, height, url, settings) {
|
||||
var imageElement = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
||||
imageElement.setAttribute("x", x.toString());
|
||||
imageElement.setAttribute("y", y.toString());
|
||||
imageElement.setAttribute("width", width + "px");
|
||||
imageElement.setAttribute("height", height + "px");
|
||||
imageElement.setAttributeNS("http://www.w3.org/1999/xlink", "href", url);
|
||||
this._appendSettings(settings, imageElement);
|
||||
parent.appendChild(imageElement);
|
||||
return imageElement;
|
||||
};
|
||||
SVG.prototype.rect = function (parent, x, y, width, height, rx, ry, settings) {
|
||||
var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
rectElement.setAttribute("x", x.toString());
|
||||
rectElement.setAttribute("y", y.toString());
|
||||
rectElement.setAttribute("width", width + "px");
|
||||
rectElement.setAttribute("height", height + "px");
|
||||
if (rx !== undefined) {
|
||||
if (rx instanceof Number) {
|
||||
rectElement.setAttribute("rx", rx.toString());
|
||||
}
|
||||
else if (rx instanceof Object) {
|
||||
this._appendSettings(rx, rectElement);
|
||||
}
|
||||
}
|
||||
if (ry !== undefined) {
|
||||
rectElement.setAttribute("ry", ry.toString());
|
||||
}
|
||||
this._appendSettings(settings, rectElement);
|
||||
parent.appendChild(rectElement);
|
||||
return rectElement;
|
||||
};
|
||||
SVG.prototype.line = function (parent, x1, y1, x2, y2, settings) {
|
||||
var lineElement = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
||||
lineElement.setAttribute("x1", x1.toString());
|
||||
lineElement.setAttribute("y1", y1.toString());
|
||||
lineElement.setAttribute("x2", x2.toString());
|
||||
lineElement.setAttribute("y2", y2.toString());
|
||||
this._appendSettings(settings, lineElement);
|
||||
parent.appendChild(lineElement);
|
||||
return lineElement;
|
||||
};
|
||||
SVG.prototype.polygon = function (parent, points, settings) {
|
||||
var polygonElement = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
||||
polygonElement.setAttribute("points", points.join(","));
|
||||
this._appendSettings(settings, polygonElement);
|
||||
parent.appendChild(polygonElement);
|
||||
return polygonElement;
|
||||
};
|
||||
SVG.prototype.polyline = function (parent, points, settings) {
|
||||
var polylineElement = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
|
||||
polylineElement.setAttribute("points", points.join(","));
|
||||
this._appendSettings(settings, polylineElement);
|
||||
parent.appendChild(polylineElement);
|
||||
return polylineElement;
|
||||
};
|
||||
SVG.prototype.ellipse = function (parent, cx, cy, rx, ry, settings) {
|
||||
var ellipseElement = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
|
||||
ellipseElement.setAttribute("cx", cx.toString());
|
||||
ellipseElement.setAttribute("cy", cy.toString());
|
||||
ellipseElement.setAttribute("rx", rx.toString());
|
||||
ellipseElement.setAttribute("ry", ry.toString());
|
||||
this._appendSettings(settings, ellipseElement);
|
||||
parent.appendChild(ellipseElement);
|
||||
return ellipseElement;
|
||||
};
|
||||
SVG.prototype.text = function (parent, x, y, value, settings) {
|
||||
var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
||||
textElement.setAttribute("x", x.toString());
|
||||
textElement.setAttribute("y", y.toString());
|
||||
this._appendSettings(settings, textElement);
|
||||
var textNode = document.createTextNode(value);
|
||||
textElement.appendChild(textNode);
|
||||
parent.appendChild(textElement);
|
||||
return textElement;
|
||||
};
|
||||
SVG.prototype.filter = function (parent, id, x, y, width, height, settings) {
|
||||
var filterElement = document.createElementNS("http://www.w3.org/2000/svg", "filter");
|
||||
filterElement.setAttribute("x", x.toString());
|
||||
filterElement.setAttribute("y", y.toString());
|
||||
filterElement.setAttribute("width", width + "px");
|
||||
filterElement.setAttribute("height", height + "px");
|
||||
this._appendSettings(settings, filterElement);
|
||||
parent.appendChild(filterElement);
|
||||
return filterElement;
|
||||
};
|
||||
SVG.prototype.pattern = function (parent, resultId, x, y, width, height, settings) {
|
||||
var patternElement = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
|
||||
if (resultId) {
|
||||
patternElement.setAttribute("id", resultId);
|
||||
}
|
||||
patternElement.setAttribute("x", x.toString());
|
||||
patternElement.setAttribute("y", y.toString());
|
||||
patternElement.setAttribute("width", width + "px");
|
||||
patternElement.setAttribute("height", height + "px");
|
||||
this._appendSettings(settings, patternElement);
|
||||
parent.appendChild(patternElement);
|
||||
return patternElement;
|
||||
};
|
||||
SVG.prototype.defs = function () {
|
||||
if (this._defs === undefined) {
|
||||
var defsElement = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
||||
this._svg.appendChild(defsElement);
|
||||
this._defs = defsElement;
|
||||
}
|
||||
return this._defs;
|
||||
};
|
||||
SVG.prototype.clipPath = function (parent, resultId, units, settings) {
|
||||
var clipElement = document.createElementNS("http://www.w3.org/2000/svg", "clipPath");
|
||||
if (resultId) {
|
||||
clipElement.setAttribute("id", resultId);
|
||||
}
|
||||
if (units === undefined) {
|
||||
units = "userSpaceOnUse";
|
||||
}
|
||||
clipElement.setAttribute("clipPathUnits", units);
|
||||
this._appendSettings(settings, clipElement);
|
||||
parent.appendChild(clipElement);
|
||||
return clipElement;
|
||||
};
|
||||
SVG.prototype._appendSettings = function (settings, element) {
|
||||
if (settings !== undefined) {
|
||||
Object.keys(settings).forEach(function (key) {
|
||||
element.setAttribute(key, settings[key]);
|
||||
});
|
||||
}
|
||||
};
|
||||
return SVG;
|
||||
}());
|
||||
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Blob", function() { return Blob; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -426,7 +616,7 @@ var Blob = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/* 5 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -785,17 +975,17 @@ var Helper = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/* 6 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmfHeader", function() { return EmfHeader; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMFRecords", function() { return EMFRecords; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Region__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
|
||||
/* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
||||
/* harmony import */ var _Region__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -1367,7 +1557,7 @@ var EMFRecords = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/* 7 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -1377,7 +1567,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RectL", function() { return RectL; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SizeL", function() { return SizeL; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Obj", function() { return Obj; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -1519,7 +1709,7 @@ var Obj = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/* 8 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -1527,8 +1717,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Region", function() { return Region; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateSimpleRegion", function() { return CreateSimpleRegion; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scan", function() { return Scan; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -1969,7 +2159,7 @@ var Scan = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/* 9 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -1978,9 +2168,9 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Font", function() { return Font; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Brush", function() { return Brush; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pen", function() { return Pen; });
|
||||
/* harmony import */ var _Bitmap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Bitmap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -2229,7 +2419,7 @@ var Pen = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 11 */
|
||||
/* 10 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -2239,7 +2429,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BitmapInfoHeader", function() { return BitmapInfoHeader; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BitmapInfo", function() { return BitmapInfo; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DIBitmap", function() { return DIBitmap; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -2441,7 +2631,7 @@ var DIBitmap = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 12 */
|
||||
/* 11 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -2450,10 +2640,10 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_StockObjects", function() { return _StockObjects; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GDIContextState", function() { return GDIContextState; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GDIContext", function() { return GDIContext; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Region__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
|
||||
/* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
||||
/* harmony import */ var _Primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
||||
/* harmony import */ var _Region__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
||||
/* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -2510,7 +2700,7 @@ var Path = /** @class */ (function (_super) {
|
||||
return _this;
|
||||
}
|
||||
Path.prototype.clone = function () {
|
||||
return new Path(null, this.svgPath);
|
||||
return new Path(null, this);
|
||||
};
|
||||
Path.prototype.toString = function () {
|
||||
return "{[path]}";
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+114
-117
@@ -1,13 +1,13 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("jquery"), require("./EMFJS.bundle.js"), require("./WMFJS.bundle.js"));
|
||||
module.exports = factory(require("./EMFJS.bundle.js"), require("./WMFJS.bundle.js"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["jquery", "./EMFJS.bundle.js", "./WMFJS.bundle.js"], factory);
|
||||
define(["./EMFJS.bundle.js", "./WMFJS.bundle.js"], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["RTFJS"] = factory(require("jquery"), require("./EMFJS.bundle.js"), require("./WMFJS.bundle.js"));
|
||||
exports["RTFJS"] = factory(require("./EMFJS.bundle.js"), require("./WMFJS.bundle.js"));
|
||||
else
|
||||
root["RTFJS"] = factory(root["$"], root["EMFJS"], root["WMFJS"]);
|
||||
})(this, function(__WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__28__, __WEBPACK_EXTERNAL_MODULE__29__) {
|
||||
root["RTFJS"] = factory(root["EMFJS"], root["WMFJS"]);
|
||||
})(this, function(__WEBPACK_EXTERNAL_MODULE__27__, __WEBPACK_EXTERNAL_MODULE__28__) {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
@@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 13);
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 12);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
@@ -99,12 +99,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
/* 1 */,
|
||||
/* 2 */,
|
||||
/* 3 */,
|
||||
/* 4 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
||||
|
||||
/***/ }),
|
||||
/* 4 */,
|
||||
/* 5 */,
|
||||
/* 6 */,
|
||||
/* 7 */,
|
||||
@@ -112,16 +107,15 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
||||
/* 9 */,
|
||||
/* 10 */,
|
||||
/* 11 */,
|
||||
/* 12 */,
|
||||
/* 13 */
|
||||
/* 12 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _DocumentFacade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
||||
/* harmony import */ var _DocumentFacade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Document", function() { return _DocumentFacade__WEBPACK_IMPORTED_MODULE_0__["DocumentFacade"]; });
|
||||
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Error", function() { return _Helper__WEBPACK_IMPORTED_MODULE_1__["RTFJSError"]; });
|
||||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "loggingEnabled", function() { return _Helper__WEBPACK_IMPORTED_MODULE_1__["loggingEnabled"]; });
|
||||
@@ -156,16 +150,16 @@ SOFTWARE.
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 14 */
|
||||
/* 13 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentFacade", function() { return DocumentFacade; });
|
||||
/* harmony import */ var _Document__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
||||
/* harmony import */ var _parser_Parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
|
||||
/* harmony import */ var _renderer_Renderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(34);
|
||||
/* harmony import */ var _Document__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
|
||||
/* harmony import */ var _parser_Parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
|
||||
/* harmony import */ var _renderer_Renderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(33);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -220,13 +214,13 @@ var DocumentFacade = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 15 */
|
||||
/* 14 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Document", function() { return Document; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -284,7 +278,7 @@ var Document = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 16 */
|
||||
/* 15 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -541,20 +535,20 @@ var Helper = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 17 */
|
||||
/* 16 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; });
|
||||
/* harmony import */ var codepage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18);
|
||||
/* harmony import */ var codepage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17);
|
||||
/* harmony import */ var codepage__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(codepage__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
||||
/* harmony import */ var _renderer_RenderChp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20);
|
||||
/* harmony import */ var _renderer_RenderPap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21);
|
||||
/* harmony import */ var _Containers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22);
|
||||
/* harmony import */ var _destinations_DestinationBase__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23);
|
||||
/* harmony import */ var _destinations_Destinations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
|
||||
/* harmony import */ var _renderer_RenderChp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19);
|
||||
/* harmony import */ var _renderer_RenderPap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
|
||||
/* harmony import */ var _Containers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21);
|
||||
/* harmony import */ var _destinations_DestinationBase__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22);
|
||||
/* harmony import */ var _destinations_Destinations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -1019,7 +1013,7 @@ var Parser = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 18 */
|
||||
/* 17 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* cputils.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
@@ -1031,7 +1025,7 @@ var Parser = /** @class */ (function () {
|
||||
"use strict";
|
||||
if(typeof cptable === "undefined") {
|
||||
if(true){
|
||||
var cpt = __webpack_require__(19);
|
||||
var cpt = __webpack_require__(18);
|
||||
if ( true && module.exports && typeof DO_NOT_EXPORT_CODEPAGE === 'undefined') module.exports = factory(cpt);
|
||||
else root.cptable = factory(cpt);
|
||||
} else {}
|
||||
@@ -1553,7 +1547,7 @@ var Parser = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 19 */
|
||||
/* 18 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
@@ -7906,13 +7900,13 @@ if ( true && module.exports && typeof DO_NOT_EXPORT_CODEPAGE === 'undefined') mo
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 20 */
|
||||
/* 19 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderChp", function() { return RenderChp; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -7944,18 +7938,18 @@ var RenderChp = /** @class */ (function () {
|
||||
this._chp = chp;
|
||||
}
|
||||
RenderChp.prototype.apply = function (doc, el) {
|
||||
_Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].log("[rtf] RenderChp: " + el.text());
|
||||
_Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].log("[rtf] RenderChp: " + el.innerText);
|
||||
_Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].log("[rtf] RenderChp apply: " + JSON.stringify(this._chp));
|
||||
if (this._chp.bold) {
|
||||
el.css("font-weight", "bold");
|
||||
el.style.fontWeight = "bold";
|
||||
}
|
||||
if (this._chp.italic) {
|
||||
el.css("font-style", "italic");
|
||||
el.style.fontStyle = "italic";
|
||||
}
|
||||
if (this._chp.hasOwnProperty("fontfamily") && doc._fonts[this._chp.fontfamily]) {
|
||||
var fontFamily = doc._fonts[this._chp.fontfamily].fontname.replace(";", "");
|
||||
if (fontFamily !== "Symbol") {
|
||||
el.css("font-family", fontFamily);
|
||||
el.style.fontFamily = fontFamily;
|
||||
}
|
||||
}
|
||||
var deco = [];
|
||||
@@ -7966,15 +7960,15 @@ var RenderChp = /** @class */ (function () {
|
||||
deco.push("line-through");
|
||||
}
|
||||
if (deco.length > 0) {
|
||||
el.css("text-decoration", deco.join(" "));
|
||||
el.style.textDecoration = deco.join(" ");
|
||||
}
|
||||
if (this._chp.colorindex !== 0) {
|
||||
var color = doc._lookupColor(this._chp.colorindex);
|
||||
if (color != null) {
|
||||
el.css("color", _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._colorToStr(color));
|
||||
el.style.color = _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._colorToStr(color);
|
||||
}
|
||||
}
|
||||
el.css("font-size", Math.floor(this._chp.fontsize / 2) + "pt");
|
||||
el.style.fontSize = Math.floor(this._chp.fontsize / 2) + "pt";
|
||||
};
|
||||
return RenderChp;
|
||||
}());
|
||||
@@ -7982,13 +7976,13 @@ var RenderChp = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 21 */
|
||||
/* 20 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderPap", function() { return RenderPap; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -8024,34 +8018,34 @@ var RenderPap = /** @class */ (function () {
|
||||
+ " pap=" + JSON.stringify(this._pap) + " ismaindiv=" + ismaindiv);
|
||||
if (ismaindiv) {
|
||||
if (this._pap.spacebefore !== 0) {
|
||||
el.css("margin-top", _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._twipsToPt(this._pap.spacebefore) + "pt");
|
||||
el.style.marginTop = _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._twipsToPt(this._pap.spacebefore) + "pt";
|
||||
}
|
||||
else {
|
||||
el.css("margin-top", "");
|
||||
el.style.marginTop = "";
|
||||
}
|
||||
if (this._pap.spaceafter !== 0) {
|
||||
el.css("margin-bottom", _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._twipsToPt(this._pap.spaceafter) + "pt");
|
||||
el.style.marginBottom = _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"]._twipsToPt(this._pap.spaceafter) + "pt";
|
||||
}
|
||||
else {
|
||||
el.css("margin-bottom", "");
|
||||
el.style.marginBottom = "";
|
||||
}
|
||||
if (rchp != null) {
|
||||
el.css("min-height", Math.floor(rchp._chp.fontsize / 2) + "pt");
|
||||
el.style.minHeight = Math.floor(rchp._chp.fontsize / 2) + "pt";
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (this._pap.justification) {
|
||||
case _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].JUSTIFICATION.LEFT:
|
||||
el.css("text-align", "left");
|
||||
el.style.textAlign = "left";
|
||||
break;
|
||||
case _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].JUSTIFICATION.RIGHT:
|
||||
el.css("text-align", "right");
|
||||
el.style.textAlign = "right";
|
||||
break;
|
||||
case _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].JUSTIFICATION.CENTER:
|
||||
el.css("text-align", "center");
|
||||
el.style.textAlign = "center";
|
||||
break;
|
||||
case _Helper__WEBPACK_IMPORTED_MODULE_0__["Helper"].JUSTIFICATION.JUSTIFY:
|
||||
el.css("text-align", "justify");
|
||||
el.style.textAlign = "justify";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -8062,7 +8056,7 @@ var RenderPap = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 22 */
|
||||
/* 21 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -8075,7 +8069,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlobalState", function() { return GlobalState; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlainText", function() { return PlainText; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HexText", function() { return HexText; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -8275,7 +8269,7 @@ var HexText = /** @class */ (function () {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 23 */
|
||||
/* 22 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -8288,7 +8282,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericPropertyDestinationFactory", function() { return GenericPropertyDestinationFactory; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenericSubTextPropertyDestinationFactory", function() { return GenericSubTextPropertyDestinationFactory; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequiredDestinationFactory", function() { return RequiredDestinationFactory; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -8489,20 +8483,20 @@ var RequiredDestinationFactory = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 24 */
|
||||
/* 23 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Destinations", function() { return Destinations; });
|
||||
/* harmony import */ var _ColortblDestinations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _FieldDestinations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26);
|
||||
/* harmony import */ var _FonttblDestinations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30);
|
||||
/* harmony import */ var _MetaDestinations__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
|
||||
/* harmony import */ var _PictDestinations__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(27);
|
||||
/* harmony import */ var _RtfDestination__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(32);
|
||||
/* harmony import */ var _StylesheetDestination__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33);
|
||||
/* harmony import */ var _ColortblDestinations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/* harmony import */ var _FieldDestinations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25);
|
||||
/* harmony import */ var _FonttblDestinations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29);
|
||||
/* harmony import */ var _MetaDestinations__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30);
|
||||
/* harmony import */ var _PictDestinations__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26);
|
||||
/* harmony import */ var _RtfDestination__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31);
|
||||
/* harmony import */ var _StylesheetDestination__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(32);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -8586,14 +8580,14 @@ var Destinations = {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 25 */
|
||||
/* 24 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColortblDestination", function() { return ColortblDestination; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -8739,7 +8733,7 @@ var ColortblDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 26 */
|
||||
/* 25 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -8749,9 +8743,9 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldHyperlink", function() { return FieldHyperlink; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FldinstDestination", function() { return FldinstDestination; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FldrsltDestination", function() { return FldrsltDestination; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _PictDestinations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/* harmony import */ var _PictDestinations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -9034,19 +9028,19 @@ var FldrsltDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 27 */
|
||||
/* 26 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PictGroupDestinationFactory", function() { return PictGroupDestinationFactory; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PictDestination", function() { return PictDestination; });
|
||||
/* harmony import */ var EMFJS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28);
|
||||
/* harmony import */ var EMFJS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
|
||||
/* harmony import */ var EMFJS__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(EMFJS__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var WMFJS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
|
||||
/* harmony import */ var WMFJS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28);
|
||||
/* harmony import */ var WMFJS__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(WMFJS__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -9376,6 +9370,12 @@ var PictDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 27 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__27__;
|
||||
|
||||
/***/ }),
|
||||
/* 28 */
|
||||
/***/ (function(module, exports) {
|
||||
@@ -9384,20 +9384,14 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__28__;
|
||||
|
||||
/***/ }),
|
||||
/* 29 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__29__;
|
||||
|
||||
/***/ }),
|
||||
/* 30 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FonttblDestinationSub", function() { return FonttblDestinationSub; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FonttblDestination", function() { return FonttblDestination; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -9574,7 +9568,7 @@ var FonttblDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 31 */
|
||||
/* 30 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -9582,8 +9576,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfoDestination", function() { return InfoDestination; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MetaPropertyDestinationFactory", function() { return MetaPropertyDestinationFactory; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MetaPropertyTimeDestinationFactory", function() { return MetaPropertyTimeDestinationFactory; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -9732,17 +9726,17 @@ var MetaPropertyTimeDestinationFactory = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 32 */
|
||||
/* 31 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RtfDestination", function() { return RtfDestination; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _renderer_RenderChp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
|
||||
/* harmony import */ var _renderer_RenderPap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
|
||||
/* harmony import */ var _Containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _renderer_RenderChp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19);
|
||||
/* harmony import */ var _renderer_RenderPap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20);
|
||||
/* harmony import */ var _Containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -9995,15 +9989,15 @@ var RtfDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 33 */
|
||||
/* 32 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesheetDestinationSub", function() { return StylesheetDestinationSub; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesheetDestination", function() { return StylesheetDestination; });
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/* harmony import */ var _DestinationBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -10132,15 +10126,13 @@ var StylesheetDestination = /** @class */ (function (_super) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 34 */
|
||||
/* 33 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return Renderer; });
|
||||
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
||||
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
||||
/* harmony import */ var _Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -10167,7 +10159,6 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var Renderer = /** @class */ (function () {
|
||||
function Renderer(doc) {
|
||||
this._doc = doc;
|
||||
@@ -10199,22 +10190,24 @@ var Renderer = /** @class */ (function () {
|
||||
Renderer.prototype.popContainer = function () {
|
||||
var contel = this._curcont.pop();
|
||||
if (contel == null) {
|
||||
throw new _Helper__WEBPACK_IMPORTED_MODULE_1__["RTFJSError"]("No container on rendering stack");
|
||||
throw new _Helper__WEBPACK_IMPORTED_MODULE_0__["RTFJSError"]("No container on rendering stack");
|
||||
}
|
||||
};
|
||||
Renderer.prototype.buildHyperlinkElement = function (url) {
|
||||
return jquery__WEBPACK_IMPORTED_MODULE_0__("<a>").attr("href", url);
|
||||
var link = document.createElement("a");
|
||||
link.href = url;
|
||||
return link;
|
||||
};
|
||||
Renderer.prototype._appendToPar = function (el, newsubpar) {
|
||||
if (this._curpar == null) {
|
||||
this.startPar();
|
||||
}
|
||||
if (newsubpar === true) {
|
||||
var subpar = jquery__WEBPACK_IMPORTED_MODULE_0__("<div>");
|
||||
var subpar = document.createElement("div");
|
||||
if (this._cursubpar == null) {
|
||||
this._curpar.children().appendTo(subpar);
|
||||
subpar.append.apply(subpar, Array.from(this._curpar.childNodes));
|
||||
this._curpar.append(subpar);
|
||||
subpar = jquery__WEBPACK_IMPORTED_MODULE_0__("<div>");
|
||||
subpar = document.createElement("div");
|
||||
}
|
||||
if (el) {
|
||||
subpar.append(el);
|
||||
@@ -10239,7 +10232,7 @@ var Renderer = /** @class */ (function () {
|
||||
}
|
||||
};
|
||||
Renderer.prototype.startPar = function () {
|
||||
this._curpar = jquery__WEBPACK_IMPORTED_MODULE_0__("<div>");
|
||||
this._curpar = document.createElement("div");
|
||||
if (this._curRPap != null) {
|
||||
this._curRPap.apply(this._doc, this._curpar, this._curRChp, true);
|
||||
this._curRPap.apply(this._doc, this._curpar, this._curRChp, false);
|
||||
@@ -10270,7 +10263,8 @@ var Renderer = /** @class */ (function () {
|
||||
};
|
||||
Renderer.prototype.buildRenderedPicture = function (element) {
|
||||
if (element == null) {
|
||||
element = jquery__WEBPACK_IMPORTED_MODULE_0__("<span>").text("[failed to render image]");
|
||||
element = document.createElement("span");
|
||||
element.innerText = "[failed to render image]";
|
||||
}
|
||||
return element;
|
||||
};
|
||||
@@ -10279,16 +10273,18 @@ var Renderer = /** @class */ (function () {
|
||||
};
|
||||
Renderer.prototype.buildPicture = function (mime, data) {
|
||||
if (data != null) {
|
||||
return jquery__WEBPACK_IMPORTED_MODULE_0__("<img>", {
|
||||
src: "data:" + mime + ";base64," + btoa(data),
|
||||
});
|
||||
var image = document.createElement("img");
|
||||
image.src = "data:" + mime + ";base64," + btoa(data);
|
||||
return image;
|
||||
}
|
||||
else {
|
||||
var err = "image type not supported";
|
||||
if (typeof mime === "string" && mime !== "") {
|
||||
err = mime;
|
||||
}
|
||||
return jquery__WEBPACK_IMPORTED_MODULE_0__("<span>").text("[" + err + "]");
|
||||
var span = document.createElement("span");
|
||||
span.innerText = "[" + err + "]";
|
||||
return span;
|
||||
}
|
||||
};
|
||||
Renderer.prototype.picture = function (mime, data) {
|
||||
@@ -10306,7 +10302,8 @@ var Renderer = /** @class */ (function () {
|
||||
for (var i = 0; i < len; i++) {
|
||||
var ins = this._doc._ins[i];
|
||||
if (typeof ins === "string") {
|
||||
var span = jquery__WEBPACK_IMPORTED_MODULE_0__("<span>").text(ins);
|
||||
var span = document.createElement("span");
|
||||
span.innerText = ins;
|
||||
if (this._curRChp != null) {
|
||||
this._curRChp.apply(this._doc, span);
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+358
-171
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
-1379
File diff suppressed because it is too large
Load Diff
-8
File diff suppressed because one or more lines are too long
-395
@@ -1,395 +0,0 @@
|
||||
/* http://keith-wood.name/svg.html
|
||||
SVG filters for jQuery v1.5.0.
|
||||
Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
|
||||
Available under the MIT (http://keith-wood.name/licence.html) license.
|
||||
Please attribute the author if you use it. */
|
||||
|
||||
// Follow the UMD template https://github.com/umdjs/umd/blob/master/templates/jqueryPlugin.js
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node/CommonJS
|
||||
module.exports = function( root, jQuery ) {
|
||||
if ( jQuery === undefined ) {
|
||||
// require('jQuery') returns a factory that requires window to
|
||||
// build a jQuery instance, we normalize how we use modules
|
||||
// that require this pattern but the window provided is a noop
|
||||
// if it's defined (how jquery works)
|
||||
if ( typeof window !== 'undefined' ) {
|
||||
jQuery = require('jquery');
|
||||
}
|
||||
else {
|
||||
jQuery = require('jquery')(root);
|
||||
}
|
||||
}
|
||||
factory(jQuery);
|
||||
return jQuery;
|
||||
};
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
$.svg.addExtension('filters', SVGFilter);
|
||||
|
||||
$.extend($.svg._wrapperClass.prototype, {
|
||||
|
||||
/** Add a filter definition.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param id {string} The ID for this filter.
|
||||
@param x {number} The x-coordinate for the left edge of the filter.
|
||||
@param y {number} The y-coordinate for the top edge of the filter.
|
||||
@param width {number} The width of the filter.
|
||||
@param height {number} The height of the filter.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
filter: function(parent, id, x, y, width, height, settings) {
|
||||
var args = this._args(arguments, ['id', 'x', 'y', 'width', 'height']);
|
||||
return this._makeNode(args.parent, 'filter', $.extend(
|
||||
{id: args.id, x: args.x, y: args.y, width: args.width, height: args.height}, args.settings || {}));
|
||||
}
|
||||
});
|
||||
|
||||
/** The SVG filters manager.
|
||||
<p>Use the singleton instance of this class, $.svg.filters,
|
||||
to interact with the SVG filters functionality.</p>
|
||||
@module SVGFilter */
|
||||
function SVGFilter(wrapper) {
|
||||
this._wrapper = wrapper; // The attached SVG wrapper object
|
||||
}
|
||||
|
||||
$.extend(SVGFilter.prototype, {
|
||||
|
||||
/** Add a distant light filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param azimuth {number} The angle (degrees) in the XY plane for the light source.
|
||||
@param elevation {number} The angle (degrees) in the YZ plane for the light source.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
distantLight: function(parent, result, azimuth, elevation, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'azimuth', 'elevation']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDistantLight', $.extend(
|
||||
{result: args.result, azimuth: args.azimuth, elevation: args.elevation}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a point light filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param x {number} The x-coordinate for the light source.
|
||||
@param y {number} The y-coordinate for the light source.
|
||||
@param z {number} The z-coordinate for the light source.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
pointLight: function(parent, result, x, y, z, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z']);
|
||||
return this._wrapper._makeNode(args.parent, 'fePointLight', $.extend(
|
||||
{result: args.result, x: args.x, y: args.y, z: args.z}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a spot light filter.
|
||||
<p>Specify all of <code>toX</code>, <code>toY</code>, <code>toZ</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param x {number} The x-coordinate for the light source.
|
||||
@param y {number} The y-coordinate for the light source.
|
||||
@param z {number} The z-coordinate for the light source.
|
||||
@param [toX] {number} The x-coordinate for where the light is pointing.
|
||||
@param [toY] {number} The y-coordinate for where the light is pointing.
|
||||
@param [toZ] {number} The z-coordinate for where the light is pointing.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
spotLight: function(parent, result, x, y, z, toX, toY, toZ, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z', 'toX', 'toY', 'toZ'], ['toX']);
|
||||
var sets = $.extend({result: args.result, x: args.x, y: args.y, z: args.z},
|
||||
(args.toX != null ? {pointsAtX: args.toX, pointsAtY: args.toY, pointsAtZ: args.toZ} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feSpotLight', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a blend filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param mode {string} One of 'normal', 'multiply', 'screen', 'darken', 'lighten'.
|
||||
@param in1 {string} The first image to blend.
|
||||
@param in2 {string} The second image to blend.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
blend: function(parent, result, mode, in1, in2, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'mode', 'in1', 'in2']);
|
||||
return this._wrapper._makeNode(args.parent, 'feBlend', $.extend(
|
||||
{result: args.result, mode: args.mode, in_: args.in1, in2: args.in2}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a colour matrix filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source to colour.
|
||||
@param type {string} One of 'matrix', 'saturate', 'hueRotate', 'luminanceToAlpha'.
|
||||
@param values {number[][]|number} For 'matrix' the matrix (5x4) values to apply, for 'saturate' 0.0 to 1.0,
|
||||
for 'hueRotate' degrees, for 'luminanceToAlpha' nothing.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
colorMatrix: function(parent, result, in1, type, values, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'type', 'values']);
|
||||
if ($.isArray(args.values)) {
|
||||
var vs = '';
|
||||
for (var i = 0; i < args.values.length; i++) {
|
||||
vs += (i === 0 ? '' : ' ') + args.values[i].join(' ');
|
||||
}
|
||||
args.values = vs;
|
||||
}
|
||||
else if (typeof args.values === 'object') {
|
||||
args.settings = args.values;
|
||||
args.values = null;
|
||||
}
|
||||
var sets = $.extend({result: args.result, in_: args.in1, type: args.type},
|
||||
(args.values != null ? {values: args.values} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feColorMatrix', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a component transfer filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param functions {object[]} One for each of RGB and A (alpha, optional), for each entry:
|
||||
[0] {string} one of 'identity', 'table', 'discrete', 'linear', 'gamma',
|
||||
[1] {number[]|number} for 'table' or 'discrete' the list of interpolation or step values OR
|
||||
for 'linear' the slope, for 'gamma' the amplitude,
|
||||
[2] {number} for 'linear' the intercept, for 'gamma' the exponent,
|
||||
[3] {number} for 'gamma' the offset.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
componentTransfer: function(parent, result, functions, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'functions']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feComponentTransfer',
|
||||
$.extend({result: args.result}, args.settings || {}));
|
||||
var rgba = ['R', 'G', 'B', 'A'];
|
||||
for (var i = 0; i < Math.min(4, args.functions.length); i++) {
|
||||
var props = args.functions[i];
|
||||
var sets = $.extend({type: props[0]},
|
||||
(props[0] === 'table' || props[0] === 'discrete' ? {tableValues: props[1].join(' ')} :
|
||||
(props[0] === 'linear' ? {slope: props[1], intercept: props[2]} :
|
||||
(props[0] === 'gamma' ? {amplitude: props[1], exponent: props[2], offset: props[3]} : {}))));
|
||||
this._wrapper._makeNode(node, 'feFunc' + rgba[i], sets);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a composite filter.
|
||||
<p>Specify all of <code>k1</code>, <code>k2</code>, <code>k3</code>, <code>k4</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param operator {string} One of 'over', 'in', 'out', 'atop', 'xor', 'arithmetic'.
|
||||
@param in1 {string} The first filter to compose.
|
||||
@param in2 {string} The second filter to compose.
|
||||
@param [k1] {number} For 'arithmetic'.
|
||||
@param [k2] {number} For 'arithmetic'.
|
||||
@param [k3] {number} For 'arithmetic'.
|
||||
@param [k4] {number} For 'arithmetic'.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
composite: function(parent, result, operator, in1, in2, k1, k2, k3, k4, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'operator', 'in1', 'in2', 'k1', 'k2', 'k3', 'k4'], ['k1']);
|
||||
var sets = $.extend({result: args.result, operator: args.operator, 'in': args.in1, in2: args.in2},
|
||||
(args.k1 != null ? {k1: args.k1, k2: args.k2, k3: args.k3, k4: args.k4} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feComposite', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a convolve matrix filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter
|
||||
@param order {number|string} The size(s) of the matrix
|
||||
optionally separated into x- and y-components ('number number').
|
||||
@param matrix {number[][]} The kernel matrix for the convolution.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
convolveMatrix: function(parent, result, order, matrix, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'order', 'matrix']);
|
||||
var mx = '';
|
||||
for (var i = 0; i < args.matrix.length; i++) {
|
||||
mx += (i === 0 ? '' : ' ') + args.matrix[i].join(' ');
|
||||
}
|
||||
args.matrix = mx;
|
||||
return this._wrapper._makeNode(args.parent, 'feConvolveMatrix', $.extend(
|
||||
{result: args.result, order: args.order, kernelMatrix: args.matrix}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a diffuse lighting filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param [colour] {string} The lighting colour.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
diffuseLighting: function(parent, result, colour, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'colour'], ['colour']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDiffuseLighting', $.extend($.extend({result: args.result},
|
||||
(args.colour ? {lightingColor: args.colour} : {})), args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a displacement map filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source image.
|
||||
@param in2 {string} The displacement image.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
displacementMap: function(parent, result, in1, in2, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'in2']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDisplacementMap',
|
||||
$.extend({result: args.result, in_: args.in1, in2: args.in2}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a flood filter.
|
||||
<p>Specify all of <code>x</code>, <code>y</code>, <code>width</code>, <code>height</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param [x] {number} The left coordinate of the rectangle.
|
||||
@param [y] {number} The top coordinate of the rectangle.
|
||||
@param [width] {number} The width of the rectangle.
|
||||
@param [height] {number} The height of the rectangle.
|
||||
@param colour {string} The colour to fill with.
|
||||
@param opacity {number} The opacity 0.0-1.0.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
flood: function(parent, result, x, y, width, height, colour, opacity, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'width', 'height', 'colour', 'opacity']);
|
||||
if (arguments.length < 6) {
|
||||
args.colour = args.x;
|
||||
args.opacity = args.y;
|
||||
args.settings = args.width;
|
||||
args.x = null;
|
||||
}
|
||||
var sets = $.extend({result: args.result, floodColor: args.colour,
|
||||
floodOpacity: args.opacity}, (args.x != null ?
|
||||
{x: args.x, y: args.y, width: args.width, height: args.height} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feFlood', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a Gaussian blur filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param stdDevX {number} The standard deviation along the x-axis.
|
||||
@param [stdDevY] {number} The standard deviation along the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
gaussianBlur: function(parent, result, in1, stdDevX, stdDevY, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'stdDevX', 'stdDevY'], ['stdDevY']);
|
||||
return this._wrapper._makeNode(args.parent, 'feGaussianBlur', $.extend(
|
||||
{result: args.result, in_: args.in1, stdDeviation: args.stdDevX +
|
||||
(args.stdDevY ? ' ' + args.stdDevY : '')}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add an image filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} the ID of this filter.
|
||||
@param href {string} The URL of the image.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
image: function(parent, result, href, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'href']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feImage', $.extend({result: args.result}, args.settings || {}));
|
||||
node.setAttributeNS($.svg.xlinkNS, 'href', args.href);
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a merge filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param refs {string[])} The IDs of the filters to merge.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
merge: function(parent, result, refs, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'refs']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feMerge', $.extend({result: args.result}, args.settings || {}));
|
||||
for (var i = 0; i < args.refs.length; i++) {
|
||||
this._wrapper._makeNode(node, 'feMergeNode', {in_: args.refs[i]});
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a morphology filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param operator {string} One of 'erode', 'dilate'.
|
||||
@param radiusX {number} The size of the operation in the x-axis.
|
||||
@param [radiusY] {number} The size of the operation in the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
morphology: function(parent, result, in1, operator, radiusX, radiusY, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'operator', 'radiusX', 'radiusY'], ['radiusY']);
|
||||
return this._wrapper._makeNode(args.parent, 'feMorphology', $.extend(
|
||||
{result: args.result, in_: args.in1, operator: args.operator,
|
||||
radius: args.radiusX + (args.radiusY ? ' ' + args.radiusY : '')}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add an offset filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param dX {number} The offset in the x-axis.
|
||||
@param dY {number} The offset in the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
offset: function(parent, result, in1, dx, dy, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'dx', 'dy']);
|
||||
return this._wrapper._makeNode(args.parent, 'feOffset', $.extend(
|
||||
{result: args.result, in_: args.in1, dx: args.dx, dy: args.dy}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a specular lighting filter.
|
||||
<p>Numeric params are only optional if following numeric params are also omitted.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string}The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param [surfaceScale] {number} The surface height when Ain = 1.
|
||||
@param [specularConstant] {number} The ks in Phong lighting model.
|
||||
@param [specularExponent] {number} The shininess 1.0-128.0.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
specularLighting: function(parent, result, in1, surfaceScale, specularConstant, specularExponent, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'surfaceScale', 'specularConstant', 'specularExponent'],
|
||||
['surfaceScale', 'specularConstant', 'specularExponent']);
|
||||
return this._wrapper._makeNode(args.parent, 'feSpecularLighting', $.extend(
|
||||
{result: args.result, in_: args.in1, surfaceScale: args.surfaceScale,
|
||||
specularConstant: args.specularConstant, specularExponent: args.specularExponent}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a tile filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param x {number} The left coordinate of the rectangle.
|
||||
@param y {number} The top coordinate of the rectangle.
|
||||
@param width {number} The width of the rectangle.
|
||||
@param height {number} The height of the rectangle.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
tile: function(parent, result, in1, x, y, width, height, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'x', 'y', 'width', 'height']);
|
||||
return this._wrapper._makeNode(args.parent, 'feTile', $.extend(
|
||||
{result: args.result, in_: args.in1, x: args.x, y: args.y,
|
||||
width: args.width, height: args.height}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a turbulence filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param type {string} One of 'fractalNoise', 'turbulence'.
|
||||
@param [baseFreq] {number|string} The base frequency,
|
||||
optionally separated into x- and y-components ('number number').
|
||||
@param [octaves] {number} The amount of turbulence.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
turbulence: function(parent, result, type, baseFreq, octaves, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'type', 'baseFreq', 'octaves'], ['octaves']);
|
||||
return this._wrapper._makeNode(args.parent, 'feTurbulence', $.extend(
|
||||
{result: args.result, type: args.type, baseFrequency: args.baseFreq,
|
||||
numOctaves: args.octaves}, args.settings || {}));
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
-8
File diff suppressed because one or more lines are too long
Generated
+1302
-1298
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/tbluemel/rtf.js#readme",
|
||||
"devDependencies": {
|
||||
"@types/jquery": "^3.3.31",
|
||||
"chai": "^4.2.0",
|
||||
"chai-html": "^1.3.0",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
<script src="../.common/dep/jquery.min.js"></script>
|
||||
|
||||
<script src="../../dist/jquery.svg.min.js"></script>
|
||||
<script src="../../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../../dist/WMFJS.bundle.min.js"></script>
|
||||
<script src="../../dist/EMFJS.bundle.min.js"></script>
|
||||
<script src="../../dist/RTFJS.bundle.min.js"></script>
|
||||
@@ -44,8 +41,8 @@ function displayRtfFile(blob) {
|
||||
onPicture: function(isLegacy, create) {
|
||||
// isLegacy is null if it's the only available picture (e.g. legacy rtf)
|
||||
if (isLegacy == null || isLegacy == legacyPictures) {
|
||||
var elem = create().attr("class", "rtfpict"); // WHY does addClass not work on <svg>?!
|
||||
return setPictBorder(elem, showPicBorder);
|
||||
var elem = $(create()).attr("class", "rtfpict"); // WHY does addClass not work on <svg>?!
|
||||
return setPictBorder(elem, showPicBorder)[0];
|
||||
}
|
||||
},
|
||||
onHyperlink: function(create, hyperlink) {
|
||||
@@ -63,7 +60,7 @@ function displayRtfFile(blob) {
|
||||
});
|
||||
return {
|
||||
content: lnk,
|
||||
element: span
|
||||
element: span[0]
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<script src="../.common/dep/jquery.min.js"></script>
|
||||
<script src="../.common/dep/jquery.binarytransport.js"></script>
|
||||
|
||||
<script src="../../dist/jquery.svg.min.js"></script>
|
||||
<script src="../../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../../dist/WMFJS.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
@@ -50,7 +47,7 @@ function displayWMF(blob) {
|
||||
mapMode: 8 // preserve aspect ratio checkbox
|
||||
};
|
||||
var renderer = new WMFJS.Renderer(blob);
|
||||
var svg = setPictBorder(renderer.render(settings), $("#showpicborder").prop("checked"));
|
||||
var svg = setPictBorder($(renderer.render(settings)), $("#showpicborder").prop("checked"));
|
||||
$("#content").empty().append(svg.attr("class", "wmfpict"));
|
||||
$("#closebutton").show();
|
||||
$("#tools").show();
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<script src="../.common/dep/jquery.min.js"></script>
|
||||
<script src="../.common/dep/jquery.binarytransport.js"></script>
|
||||
|
||||
<script src="../../dist/jquery.svg.min.js"></script>
|
||||
<script src="../../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../../dist/EMFJS.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
@@ -52,7 +49,7 @@ function displayEMF(blob) {
|
||||
mapMode: 8 // preserve aspect ratio checkbox
|
||||
};
|
||||
var renderer = new EMFJS.Renderer(blob);
|
||||
var svg = setPictBorder(renderer.render(settings), $("#showpicborder").prop("checked"));
|
||||
var svg = setPictBorder($(renderer.render(settings)), $("#showpicborder").prop("checked"));
|
||||
$("#content").empty().append(svg.attr("class", "emfpict"));
|
||||
$("#closebutton").show();
|
||||
$("#tools").show();
|
||||
|
||||
@@ -20,7 +20,7 @@ function displayRtfFile(blob, configs={}) {
|
||||
let allow_append = !isLegacy || legacyPictures
|
||||
let elem
|
||||
if (allow_append) {
|
||||
elem = create()
|
||||
elem = $(create())
|
||||
elem.attr("class", "rtfpict")
|
||||
setPictBorder(elem, showPicBorder)
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<script src="../.common/dep/jquery.min.js"></script>
|
||||
<script src="../.common/dep/jquery.binarytransport.js"></script>
|
||||
|
||||
<script src="../../dist/jquery.svg.min.js"></script>
|
||||
<script src="../../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../../dist/WMFJS.bundle.min.js"></script>
|
||||
<script src="../../dist/EMFJS.bundle.min.js"></script>
|
||||
<script src="../../dist/RTFJS.bundle.min.js"></script>
|
||||
|
||||
+18
-17
@@ -25,6 +25,7 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import { SVG } from "../util";
|
||||
import { EMFJSError, Helper } from "./Helper";
|
||||
import { Obj, PointL, PointS, RectL } from "./Primitives";
|
||||
import { CreateSimpleRegion, Region } from "./Region";
|
||||
@@ -52,7 +53,7 @@ export class Path extends Obj {
|
||||
}
|
||||
|
||||
public clone() {
|
||||
return new Path(null, this.svgPath);
|
||||
return new Path(null, this);
|
||||
}
|
||||
|
||||
public toString() {
|
||||
@@ -60,7 +61,7 @@ export class Path extends Obj {
|
||||
}
|
||||
}
|
||||
|
||||
function createStockObjects(): {[key: string]: Obj} {
|
||||
function createStockObjects(): { [key: string]: Obj } {
|
||||
// Create global stock objects
|
||||
const createSolidBrush = (r: number, g: number, b: number) => {
|
||||
return new Brush(null, {
|
||||
@@ -71,7 +72,7 @@ function createStockObjects(): {[key: string]: Obj} {
|
||||
const createSolidPen = (r: number, g: number, b: number) => {
|
||||
return new Pen(null, Helper.GDI.PenStyle.PS_SOLID, 1, new ColorRef(null, r, g, b), null);
|
||||
};
|
||||
const stockObjs: {[key: string]: Obj} = {
|
||||
const stockObjs: { [key: string]: Obj } = {
|
||||
WHITE_BRUSH: createSolidBrush(255, 255, 255),
|
||||
LTGRAY_BRUSH: createSolidBrush(212, 208, 200),
|
||||
GRAY_BRUSH: createSolidBrush(128, 128, 128),
|
||||
@@ -93,9 +94,9 @@ function createStockObjects(): {[key: string]: Obj} {
|
||||
DEFAULT_GUI_FONT: null, // TODO
|
||||
};
|
||||
|
||||
const objs: {[key: string]: Obj} = {};
|
||||
const objs: { [key: string]: Obj } = {};
|
||||
for (const t in stockObjs) {
|
||||
const stockObjects: {[key: string]: number} = Helper.GDI.StockObject as {[key: string]: number};
|
||||
const stockObjects: { [key: string]: number } = Helper.GDI.StockObject as { [key: string]: number };
|
||||
const idx = stockObjects[t] - 0x80000000;
|
||||
objs[idx.toString()] = stockObjs[t];
|
||||
}
|
||||
@@ -105,9 +106,9 @@ function createStockObjects(): {[key: string]: Obj} {
|
||||
export const _StockObjects = createStockObjects();
|
||||
|
||||
export class GDIContextState {
|
||||
public _svggroup: any;
|
||||
public _svggroup: SVGElement;
|
||||
public _svgclipChanged: boolean;
|
||||
public _svgtextbkfilter: any;
|
||||
public _svgtextbkfilter: SVGFilterElement;
|
||||
public mapmode: number;
|
||||
public stretchmode: number;
|
||||
public textalign: number;
|
||||
@@ -209,17 +210,17 @@ export class GDIContextState {
|
||||
}
|
||||
|
||||
export class GDIContext {
|
||||
private _svg: any;
|
||||
private _svgdefs: any;
|
||||
private _svgPatterns: {[key: string]: Brush};
|
||||
private _svgClipPaths: {[key: string]: Region};
|
||||
private _svg: SVG;
|
||||
private _svgdefs: SVGDefsElement;
|
||||
private _svgPatterns: { [key: string]: Brush };
|
||||
private _svgClipPaths: { [key: string]: Region };
|
||||
private _svgPath: any;
|
||||
private defObjects: ISelectedStyle;
|
||||
private state: GDIContextState;
|
||||
private statestack: GDIContextState[];
|
||||
private objects: {[key: string]: Obj};
|
||||
private objects: { [key: string]: Obj };
|
||||
|
||||
constructor(svg: any) {
|
||||
constructor(svg: SVG) {
|
||||
this._svg = svg;
|
||||
this._svgdefs = null;
|
||||
this._svgPatterns = {};
|
||||
@@ -427,7 +428,7 @@ export class GDIContext {
|
||||
const pts = [];
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
const point = points[i];
|
||||
pts.push({ x: this._todevX(point.x), y: this._todevY(point.y)});
|
||||
pts.push({x: this._todevX(point.x), y: this._todevY(point.y)});
|
||||
}
|
||||
|
||||
if (this._svgPath != null) {
|
||||
@@ -693,7 +694,7 @@ export class GDIContext {
|
||||
this._todevY(region.bounds.top),
|
||||
this._todevW(region.bounds.right - region.bounds.left),
|
||||
this._todevH(region.bounds.bottom - region.bounds.top),
|
||||
{ fill: "black", strokeWidth: 0 });
|
||||
{fill: "black", strokeWidth: 0});
|
||||
break;
|
||||
case 2:
|
||||
for (let i = 0; i < region.scans.length; i++) {
|
||||
@@ -702,7 +703,7 @@ export class GDIContext {
|
||||
const scanline = scan.scanlines[j];
|
||||
this._svg.rect(sclip, this._todevX(scanline.left), this._todevY(scan.top),
|
||||
this._todevW(scanline.right - scanline.left), this._todevH(scan.bottom - scan.top),
|
||||
{ fill: "black", strokeWidth: 0 });
|
||||
{fill: "black", strokeWidth: 0});
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -846,7 +847,7 @@ export class GDIContext {
|
||||
if (usePen) {
|
||||
const pen = this.state.selected.pen;
|
||||
if (pen.style !== Helper.GDI.PenStyle.PS_NULL) {
|
||||
opts.stroke = "#" + pen.color.toHex(); // TODO: pen style
|
||||
opts.stroke = "#" + pen.color.toHex(); // TODO: pen style
|
||||
opts.strokeWidth = pen.width;
|
||||
|
||||
opts["stroke-miterlimit"] = this.state.miterlimit;
|
||||
|
||||
+17
-14
@@ -25,7 +25,7 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import * as $ from "jquery";
|
||||
import { SVG } from "../util";
|
||||
import { Blob } from "./Blob";
|
||||
import { EMFRecords } from "./EMFRecords";
|
||||
import { GDIContext } from "./GDIContext";
|
||||
@@ -49,18 +49,21 @@ export class Renderer {
|
||||
Helper.log("EMFJS.Renderer instantiated");
|
||||
}
|
||||
|
||||
public render(info: IRendererSettings) {
|
||||
const img = ($("<div>") as any).svg({
|
||||
onLoad: (svg: any) => {
|
||||
return this._render(svg, info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
|
||||
},
|
||||
settings: {
|
||||
viewBox: [0, 0, info.xExt, info.yExt].join(" "),
|
||||
preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
|
||||
},
|
||||
});
|
||||
const svgContainer = ($(img[0]) as any).svg("get");
|
||||
return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
|
||||
public render(info: IRendererSettings): SVGElement {
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
|
||||
this._render(
|
||||
new SVG(svgElement),
|
||||
info.mapMode,
|
||||
info.wExt,
|
||||
info.hExt,
|
||||
info.xExt,
|
||||
info.yExt);
|
||||
svgElement.setAttribute("viewBox", [0, 0, info.xExt, info.yExt].join(" "));
|
||||
svgElement.setAttribute("preserveAspectRatio", "none"); // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
|
||||
svgElement.setAttribute("width", info.width);
|
||||
svgElement.setAttribute("height", info.height);
|
||||
return svgElement;
|
||||
}
|
||||
|
||||
private parse(blob: ArrayBuffer) {
|
||||
@@ -84,7 +87,7 @@ export class Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
private _render(svg: any, mapMode: number, w: number, h: number, xExt: number, yExt: number) {
|
||||
private _render(svg: SVG, mapMode: number, w: number, h: number, xExt: number, yExt: number) {
|
||||
const gdi = new GDIContext(svg);
|
||||
gdi.setWindowExtEx(w, h);
|
||||
gdi.setViewportExtEx(xExt, yExt);
|
||||
|
||||
@@ -25,7 +25,5 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import "jquery.svg";
|
||||
import "jquery.svgfilter";
|
||||
export { Renderer, IRendererSettings } from "./Renderer";
|
||||
export { EMFJSError as Error, loggingEnabled } from "./Helper";
|
||||
|
||||
@@ -30,8 +30,8 @@ import { Parser } from "./parser/Parser";
|
||||
import {IContainerElement, Renderer} from "./renderer/Renderer";
|
||||
|
||||
export interface ISettings {
|
||||
onHyperlink?(create: () => void, hyperlink: {url: () => string}): IContainerElement;
|
||||
onPicture?(isLegacy: boolean, create: () => void): JQuery;
|
||||
onHyperlink?(create: () => HTMLElement, hyperlink: {url: () => string}): IContainerElement;
|
||||
onPicture?(isLegacy: boolean, create: () => HTMLElement): HTMLElement;
|
||||
onImport?(relUrls: string, callback: (data: {error?: Error, keyword?: string, blob?: ArrayBuffer,
|
||||
width?: number, height?: number}) => void): void;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export class DocumentFacade {
|
||||
return this._document._meta;
|
||||
}
|
||||
|
||||
public render(): Promise<JQuery[]> {
|
||||
public render(): Promise<HTMLElement[]> {
|
||||
return this._parsed
|
||||
.then(() => {
|
||||
return this._renderer.buildDom();
|
||||
|
||||
@@ -71,7 +71,7 @@ export class PictDestination extends DestinationTextBase {
|
||||
};
|
||||
|
||||
private _pictTypeHandler: { [key: string]
|
||||
: string | ((param?: number) => { load: () => any, render: (img: any) => HTMLElement }) } = {
|
||||
: string | ((param?: number) => { load: () => any, render: (img: any) => Element }) } = {
|
||||
emfblip: (() => {
|
||||
if (typeof EMFJS !== "undefined") {
|
||||
return () => {
|
||||
@@ -96,7 +96,7 @@ export class PictDestination extends DestinationTextBase {
|
||||
xExt: this._size.width,
|
||||
yExt: this._size.height,
|
||||
mapMode: 8,
|
||||
}).get()[0] as HTMLElement;
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,19 +35,19 @@ export class RenderChp {
|
||||
this._chp = chp;
|
||||
}
|
||||
|
||||
public apply(doc: Document, el: JQuery) {
|
||||
Helper.log("[rtf] RenderChp: " + el.text());
|
||||
public apply(doc: Document, el: HTMLElement) {
|
||||
Helper.log("[rtf] RenderChp: " + el.innerText);
|
||||
Helper.log("[rtf] RenderChp apply: " + JSON.stringify(this._chp));
|
||||
if (this._chp.bold) {
|
||||
el.css("font-weight", "bold");
|
||||
el.style.fontWeight = "bold";
|
||||
}
|
||||
if (this._chp.italic) {
|
||||
el.css("font-style", "italic");
|
||||
el.style.fontStyle = "italic";
|
||||
}
|
||||
if (this._chp.hasOwnProperty("fontfamily") && doc._fonts[this._chp.fontfamily]) {
|
||||
const fontFamily = doc._fonts[this._chp.fontfamily].fontname.replace(";", "");
|
||||
if (fontFamily !== "Symbol") {
|
||||
el.css("font-family", fontFamily);
|
||||
el.style.fontFamily = fontFamily;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ export class RenderChp {
|
||||
}
|
||||
|
||||
if (deco.length > 0) {
|
||||
el.css("text-decoration", deco.join(" "));
|
||||
el.style.textDecoration = deco.join(" ");
|
||||
}
|
||||
if (this._chp.colorindex !== 0) {
|
||||
const color = doc._lookupColor(this._chp.colorindex);
|
||||
if (color != null) {
|
||||
el.css("color", Helper._colorToStr(color));
|
||||
el.style.color = Helper._colorToStr(color);
|
||||
}
|
||||
}
|
||||
el.css("font-size", Math.floor(this._chp.fontsize / 2) + "pt");
|
||||
el.style.fontSize = Math.floor(this._chp.fontsize / 2) + "pt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,36 +36,36 @@ export class RenderPap {
|
||||
this._pap = pap;
|
||||
}
|
||||
|
||||
public apply(doc: Document, el: JQuery, rchp: RenderChp, ismaindiv: boolean) {
|
||||
public apply(doc: Document, el: HTMLElement, rchp: RenderChp, ismaindiv: boolean) {
|
||||
Helper.log("[rtf] RenderPap apply:" + (rchp != null ? " chp=" + JSON.stringify(rchp._chp) : "")
|
||||
+ " pap=" + JSON.stringify(this._pap) + " ismaindiv=" + ismaindiv);
|
||||
if (ismaindiv) {
|
||||
if (this._pap.spacebefore !== 0) {
|
||||
el.css("margin-top", Helper._twipsToPt(this._pap.spacebefore) + "pt");
|
||||
el.style.marginTop = Helper._twipsToPt(this._pap.spacebefore) + "pt";
|
||||
} else {
|
||||
el.css("margin-top", "");
|
||||
el.style.marginTop = "";
|
||||
}
|
||||
if (this._pap.spaceafter !== 0) {
|
||||
el.css("margin-bottom", Helper._twipsToPt(this._pap.spaceafter) + "pt");
|
||||
el.style.marginBottom = Helper._twipsToPt(this._pap.spaceafter) + "pt";
|
||||
} else {
|
||||
el.css("margin-bottom", "");
|
||||
el.style.marginBottom = "";
|
||||
}
|
||||
if (rchp != null) {
|
||||
el.css("min-height", Math.floor(rchp._chp.fontsize / 2) + "pt");
|
||||
el.style.minHeight = Math.floor(rchp._chp.fontsize / 2) + "pt";
|
||||
}
|
||||
} else {
|
||||
switch (this._pap.justification) {
|
||||
case Helper.JUSTIFICATION.LEFT:
|
||||
el.css("text-align", "left");
|
||||
el.style.textAlign = "left";
|
||||
break;
|
||||
case Helper.JUSTIFICATION.RIGHT:
|
||||
el.css("text-align", "right");
|
||||
el.style.textAlign = "right";
|
||||
break;
|
||||
case Helper.JUSTIFICATION.CENTER:
|
||||
el.css("text-align", "center");
|
||||
el.style.textAlign = "center";
|
||||
break;
|
||||
case Helper.JUSTIFICATION.JUSTIFY:
|
||||
el.css("text-align", "justify");
|
||||
el.style.textAlign = "justify";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,25 +24,24 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import * as $ from "jquery";
|
||||
import { Document } from "../Document";
|
||||
import { RTFJSError } from "../Helper";
|
||||
import { RenderChp } from "./RenderChp";
|
||||
import { RenderPap } from "./RenderPap";
|
||||
|
||||
export interface IContainerElement {
|
||||
element: JQuery;
|
||||
content: JQuery;
|
||||
element: HTMLElement;
|
||||
content: HTMLElement;
|
||||
}
|
||||
|
||||
export class Renderer {
|
||||
public _doc: Document;
|
||||
private _dom: JQuery[];
|
||||
private _dom: HTMLElement[];
|
||||
|
||||
private _curRChp: RenderChp;
|
||||
private _curRPap: RenderPap;
|
||||
private _curpar: JQuery;
|
||||
private _cursubpar: JQuery;
|
||||
private _curpar: HTMLElement;
|
||||
private _cursubpar: HTMLElement;
|
||||
private _curcont: IContainerElement[];
|
||||
|
||||
constructor(doc: Document) {
|
||||
@@ -81,20 +80,22 @@ export class Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
public buildHyperlinkElement(url: string): JQuery {
|
||||
return $("<a>").attr("href", url);
|
||||
public buildHyperlinkElement(url: string): HTMLElement {
|
||||
const link: HTMLAnchorElement = document.createElement("a");
|
||||
link.href = url;
|
||||
return link;
|
||||
}
|
||||
|
||||
public _appendToPar(el: JQuery, newsubpar?: boolean) {
|
||||
public _appendToPar(el: HTMLElement, newsubpar?: boolean) {
|
||||
if (this._curpar == null) {
|
||||
this.startPar();
|
||||
}
|
||||
if (newsubpar === true) {
|
||||
let subpar = $("<div>");
|
||||
let subpar: HTMLDivElement = document.createElement("div");
|
||||
if (this._cursubpar == null) {
|
||||
this._curpar.children().appendTo(subpar);
|
||||
subpar.append(...Array.from(this._curpar.childNodes));
|
||||
this._curpar.append(subpar);
|
||||
subpar = $("<div>");
|
||||
subpar = document.createElement("div");
|
||||
}
|
||||
if (el) {
|
||||
subpar.append(el);
|
||||
@@ -118,7 +119,7 @@ export class Renderer {
|
||||
}
|
||||
|
||||
public startPar() {
|
||||
this._curpar = $("<div>");
|
||||
this._curpar = document.createElement("div");
|
||||
if (this._curRPap != null) {
|
||||
this._curRPap.apply(this._doc, this._curpar, this._curRChp, true);
|
||||
this._curRPap.apply(this._doc, this._curpar, this._curRChp, false);
|
||||
@@ -147,32 +148,35 @@ export class Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
public appendElement(element: JQuery) {
|
||||
public appendElement(element: HTMLElement) {
|
||||
this._appendToPar(element);
|
||||
}
|
||||
|
||||
public buildRenderedPicture(element: JQuery): JQuery {
|
||||
public buildRenderedPicture(element: HTMLElement): HTMLElement {
|
||||
if (element == null) {
|
||||
element = $("<span>").text("[failed to render image]");
|
||||
element = document.createElement("span");
|
||||
element.innerText = "[failed to render image]";
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public renderedPicture(element: JQuery) {
|
||||
public renderedPicture(element: HTMLElement) {
|
||||
this._appendToPar(this.buildRenderedPicture(element));
|
||||
}
|
||||
|
||||
public buildPicture(mime: string, data: string): JQuery {
|
||||
public buildPicture(mime: string, data: string): HTMLElement {
|
||||
if (data != null) {
|
||||
return $("<img>", {
|
||||
src: "data:" + mime + ";base64," + btoa(data),
|
||||
});
|
||||
const image: HTMLImageElement = document.createElement("img");
|
||||
image.src = "data:" + mime + ";base64," + btoa(data);
|
||||
return image;
|
||||
} else {
|
||||
let err = "image type not supported";
|
||||
if (typeof mime === "string" && mime !== "") {
|
||||
err = mime;
|
||||
}
|
||||
return $("<span>").text("[" + err + "]");
|
||||
const span: HTMLSpanElement = document.createElement("span");
|
||||
span.innerText = "[" + err + "]";
|
||||
return span;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +184,7 @@ export class Renderer {
|
||||
this._appendToPar(this.buildPicture(mime, data));
|
||||
}
|
||||
|
||||
public buildDom(): JQuery[] {
|
||||
public buildDom(): HTMLElement[] {
|
||||
if (this._dom != null) {
|
||||
return this._dom;
|
||||
}
|
||||
@@ -195,7 +199,8 @@ export class Renderer {
|
||||
for (let i = 0; i < len; i++) {
|
||||
const ins = this._doc._ins[i];
|
||||
if (typeof ins === "string") {
|
||||
const span = $("<span>").text(ins);
|
||||
const span: HTMLSpanElement = document.createElement("span");
|
||||
span.innerText = ins;
|
||||
if (this._curRChp != null) {
|
||||
this._curRChp.apply(this._doc, span);
|
||||
}
|
||||
|
||||
@@ -23,24 +23,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
export class SVGDefs {
|
||||
|
||||
}
|
||||
|
||||
export class SVGFilters {
|
||||
|
||||
public flood(filter: SVGFilterElement, resultId: string, color: string, opacity: number, _settings?:any): void {
|
||||
const floodElement = document.createElementNS('http://www.w3.org/2000/svg', "feFlood");
|
||||
public flood(filter: SVGFilterElement, resultId: string, color: string, opacity: number, _settings?: any): void {
|
||||
const floodElement = document.createElementNS("http://www.w3.org/2000/svg", "feFlood");
|
||||
if (resultId) {
|
||||
floodElement.setAttribute("id", resultId);
|
||||
}
|
||||
floodElement.setAttribute("flood-color", color);
|
||||
floodElement.setAttribute("flood-opacity", opacity.toString());
|
||||
filter.appendChild(floodElement);
|
||||
filter.appendChild(floodElement);
|
||||
}
|
||||
|
||||
public composite(filter: SVGFilterElement, resultId: string, in1: string, in2: string, k1?: number, k2?: number, k3?: number, k4?: number, _settings?: any): void {
|
||||
const compositeElement = document.createElementNS('http://www.w3.org/2000/svg', "feComposite");
|
||||
public composite(filter: SVGFilterElement,
|
||||
resultId: string,
|
||||
in1: string,
|
||||
in2: string,
|
||||
k1?: number,
|
||||
k2?: number,
|
||||
k3?: number,
|
||||
k4?: number,
|
||||
_settings?: any): void {
|
||||
const compositeElement = document.createElementNS("http://www.w3.org/2000/svg", "feComposite");
|
||||
if (resultId) {
|
||||
compositeElement.setAttribute("id", resultId);
|
||||
}
|
||||
@@ -51,27 +56,44 @@ export class SVGFilters {
|
||||
}
|
||||
|
||||
export class SVG {
|
||||
public filters = new SVGFilters();
|
||||
private _svg: SVGElement;
|
||||
private _defs: SVGDefsElement | undefined = undefined;
|
||||
public filters = new SVGFilters();
|
||||
|
||||
constructor(svg: SVGElement) {
|
||||
this._svg = svg;
|
||||
}
|
||||
|
||||
public svg(parent: Element, x: number, y: number, width: number, height: number, settings?: any): SVGElement {
|
||||
const svgElement = document.createElementNS('http://www.w3.org/2000/svg', "svg");
|
||||
public svg(parent: Element,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
settings?: any): SVGElement {
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
svgElement.setAttribute("x", x.toString());
|
||||
svgElement.setAttribute("y", y.toString());
|
||||
svgElement.setAttribute("width", `${width}px`);
|
||||
svgElement.setAttribute("height", `${height}px`);
|
||||
this._appendSettings(settings, svgElement);
|
||||
parent.appendChild(svgElement);
|
||||
|
||||
if (parent != null) {
|
||||
parent.appendChild(svgElement);
|
||||
} else {
|
||||
this._svg.appendChild(svgElement);
|
||||
}
|
||||
|
||||
return svgElement;
|
||||
}
|
||||
|
||||
public image(parent: Element, x: number, y: number, width: number, height: number, url: string, settings?: any): SVGImageElement {
|
||||
const imageElement = document.createElementNS('http://www.w3.org/2000/svg', "image");
|
||||
public image(parent: Element,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
url: string,
|
||||
settings?: any): SVGImageElement {
|
||||
const imageElement = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
||||
imageElement.setAttribute("x", x.toString());
|
||||
imageElement.setAttribute("y", y.toString());
|
||||
imageElement.setAttribute("width", `${width}px`);
|
||||
@@ -82,10 +104,24 @@ export class SVG {
|
||||
return imageElement;
|
||||
}
|
||||
|
||||
public rect(parent: Element, x: number, y: number, width: number, height: number, rx?: number, ry?: number, settings?: any): SVGRectElement;
|
||||
public rect(parent: Element,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
rx?: number,
|
||||
ry?: number,
|
||||
settings?: any): SVGRectElement;
|
||||
public rect(parent: Element, x: number, y: number, width: number, height: number, settings?: any): SVGRectElement;
|
||||
public rect(parent: Element, x: number, y: number, width: number, height: number, rx?: number | any, ry?: number, settings?: any): SVGRectElement {
|
||||
const rectElement = document.createElementNS('http://www.w3.org/2000/svg', "rect");
|
||||
public rect(parent: Element,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
rx?: number | any,
|
||||
ry?: number,
|
||||
settings?: any): SVGRectElement {
|
||||
const rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
rectElement.setAttribute("x", x.toString());
|
||||
rectElement.setAttribute("y", y.toString());
|
||||
rectElement.setAttribute("width", `${width}px`);
|
||||
@@ -106,7 +142,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public line(parent: Element, x1: number, y1: number, x2: number, y2: number, settings?: any): SVGLineElement {
|
||||
const lineElement = document.createElementNS('http://www.w3.org/2000/svg', "line");
|
||||
const lineElement = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
||||
lineElement.setAttribute("x1", x1.toString());
|
||||
lineElement.setAttribute("y1", y1.toString());
|
||||
lineElement.setAttribute("x2", x2.toString());
|
||||
@@ -117,7 +153,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public polygon(parent: Element, points: number[][], settings?: any): SVGPolygonElement {
|
||||
const polygonElement = document.createElementNS('http://www.w3.org/2000/svg', "polygon");
|
||||
const polygonElement = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
||||
polygonElement.setAttribute("points", points.join(","));
|
||||
this._appendSettings(settings, polygonElement);
|
||||
parent.appendChild(polygonElement);
|
||||
@@ -125,7 +161,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public polyline(parent: Element, points: number[][], settings?: any): SVGPolylineElement {
|
||||
const polylineElement = document.createElementNS('http://www.w3.org/2000/svg', "polyline");
|
||||
const polylineElement = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
|
||||
polylineElement.setAttribute("points", points.join(","));
|
||||
this._appendSettings(settings, polylineElement);
|
||||
parent.appendChild(polylineElement);
|
||||
@@ -133,7 +169,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public ellipse(parent: Element, cx: number, cy: number, rx: number, ry: number, settings?: any): SVGEllipseElement {
|
||||
const ellipseElement = document.createElementNS('http://www.w3.org/2000/svg', "ellipse");
|
||||
const ellipseElement = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
|
||||
ellipseElement.setAttribute("cx", cx.toString());
|
||||
ellipseElement.setAttribute("cy", cy.toString());
|
||||
ellipseElement.setAttribute("rx", rx.toString());
|
||||
@@ -144,7 +180,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public text(parent: Element, x: number, y: number, value: string, settings?: any): SVGTextElement {
|
||||
const textElement = document.createElementNS('http://www.w3.org/2000/svg', "text");
|
||||
const textElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
||||
textElement.setAttribute("x", x.toString());
|
||||
textElement.setAttribute("y", y.toString());
|
||||
this._appendSettings(settings, textElement);
|
||||
@@ -154,8 +190,14 @@ export class SVG {
|
||||
return textElement;
|
||||
}
|
||||
|
||||
public filter(parent: Element, id: string, x: number, y: number, width: number, height: number, settings?: any): SVGFilterElement {
|
||||
const filterElement = document.createElementNS('http://www.w3.org/2000/svg', "filter");
|
||||
public filter(parent: Element,
|
||||
id: string,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
settings?: any): SVGFilterElement {
|
||||
const filterElement = document.createElementNS("http://www.w3.org/2000/svg", "filter");
|
||||
filterElement.setAttribute("x", x.toString());
|
||||
filterElement.setAttribute("y", y.toString());
|
||||
filterElement.setAttribute("width", `${width}px`);
|
||||
@@ -165,8 +207,14 @@ export class SVG {
|
||||
return filterElement;
|
||||
}
|
||||
|
||||
public pattern(parent: Element, resultId: string, x: number, y: number, width: number, height: number, settings?: any): SVGPatternElement {
|
||||
const patternElement = document.createElementNS('http://www.w3.org/2000/svg', "pattern");
|
||||
public pattern(parent: Element,
|
||||
resultId: string,
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
settings?: any): SVGPatternElement {
|
||||
const patternElement = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
|
||||
if (resultId) {
|
||||
patternElement.setAttribute("id", resultId);
|
||||
}
|
||||
@@ -181,7 +229,7 @@ export class SVG {
|
||||
|
||||
public defs(): SVGDefsElement {
|
||||
if (this._defs === undefined) {
|
||||
const defsElement = document.createElementNS('http://www.w3.org/2000/svg', "defs");
|
||||
const defsElement = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
||||
this._svg.appendChild(defsElement);
|
||||
this._defs = defsElement;
|
||||
}
|
||||
@@ -189,7 +237,7 @@ export class SVG {
|
||||
}
|
||||
|
||||
public clipPath(parent: Element, resultId: string, units?: string, settings?: any): SVGClipPathElement {
|
||||
const clipElement = document.createElementNS('http://www.w3.org/2000/svg', "clipPath");
|
||||
const clipElement = document.createElementNS("http://www.w3.org/2000/svg", "clipPath");
|
||||
if (resultId) {
|
||||
clipElement.setAttribute("id", resultId);
|
||||
}
|
||||
@@ -204,9 +252,10 @@ export class SVG {
|
||||
|
||||
private _appendSettings(settings: any | undefined, element: Element): void {
|
||||
if (settings !== undefined) {
|
||||
Object.keys(settings).forEach(key => {
|
||||
Object.keys(settings).forEach((key) => {
|
||||
element.setAttribute(key, settings[key]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Tom Zoehner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
export { SVG } from "./SVG";
|
||||
@@ -24,13 +24,13 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import { SVG } from "../util/SVG";
|
||||
import { DIBitmap } from "./Bitmap";
|
||||
import { Blob } from "./Blob";
|
||||
import { Helper, WMFJSError } from "./Helper";
|
||||
import { Obj, PointS, Rect } from "./Primitives";
|
||||
import { CreateSimpleRegion, Region } from "./Region";
|
||||
import { Brush, ColorRef, Font, Palette, Pen } from "./Style";
|
||||
import { SVG } from "./SVG";
|
||||
|
||||
export interface ISelectedStyle {
|
||||
brush?: Brush;
|
||||
@@ -42,9 +42,9 @@ export interface ISelectedStyle {
|
||||
}
|
||||
|
||||
export class GDIContextState {
|
||||
public _svggroup: any;
|
||||
public _svggroup: SVGElement;
|
||||
public _svgclipChanged: boolean;
|
||||
public _svgtextbkfilter: any;
|
||||
public _svgtextbkfilter: SVGFilterElement;
|
||||
public mapmode: number;
|
||||
public stretchmode: number;
|
||||
public textalign: number;
|
||||
@@ -132,7 +132,7 @@ export class GDIContextState {
|
||||
|
||||
export class GDIContext {
|
||||
private _svg: SVG;
|
||||
private _svgdefs: any;
|
||||
private _svgdefs: SVGDefsElement;
|
||||
private _svgPatterns: {[key: string]: Brush};
|
||||
private _svgClipPaths: {[key: string]: Region};
|
||||
private defObjects: ISelectedStyle;
|
||||
@@ -322,7 +322,7 @@ export class GDIContext {
|
||||
this.state._svgtextbkfilter = filter;
|
||||
}
|
||||
|
||||
opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
|
||||
opts.filter = "url(#" + this.state._svgtextbkfilter.id + ")";
|
||||
}
|
||||
this._svg.text(this.state._svggroup, x, y, text, opts);
|
||||
}
|
||||
@@ -349,7 +349,7 @@ export class GDIContext {
|
||||
this.state._svgtextbkfilter = filter;
|
||||
}
|
||||
|
||||
opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
|
||||
opts.filter = "url(#" + this.state._svgtextbkfilter.id + ")";
|
||||
}
|
||||
this._svg.text(this.state._svggroup, x, y, text, opts);
|
||||
}
|
||||
|
||||
+10
-13
@@ -24,11 +24,11 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
import { SVG } from "../util";
|
||||
import { Blob } from "./Blob";
|
||||
import { GDIContext } from "./GDIContext";
|
||||
import { Helper, WMFJSError } from "./Helper";
|
||||
import { WMFRecords } from "./WMFRecords";
|
||||
import { SVG } from "./SVG";
|
||||
|
||||
export interface IRendererSettings {
|
||||
width: string;
|
||||
@@ -46,18 +46,15 @@ export class Renderer {
|
||||
Helper.log("WMFJS.Renderer instantiated");
|
||||
}
|
||||
|
||||
public render(info: IRendererSettings): HTMLDivElement {
|
||||
const divElement = document.createElement("div");
|
||||
const svgElement = document.createElementNS('http://www.w3.org/2000/svg', "svg");
|
||||
divElement.appendChild(svgElement);
|
||||
svgElement.onload = () => this._render(new SVG(svgElement), info.mapMode, info.xExt, info.yExt);
|
||||
(svgElement as any)["settings"] = {
|
||||
viewBox: [0, 0, info.xExt, info.yExt].join(" "),
|
||||
preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
|
||||
};
|
||||
divElement.setAttribute("width", info.width);
|
||||
divElement.setAttribute("height", info.height);
|
||||
return divElement;
|
||||
public render(info: IRendererSettings): SVGElement {
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
|
||||
this._render(new SVG(svgElement), info.mapMode, info.xExt, info.yExt);
|
||||
svgElement.setAttribute("viewBox", [0, 0, info.xExt, info.yExt].join(" "));
|
||||
svgElement.setAttribute("preserveAspectRatio", "none"); // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
|
||||
svgElement.setAttribute("width", info.width);
|
||||
svgElement.setAttribute("height", info.height);
|
||||
return svgElement;
|
||||
}
|
||||
|
||||
private parse(blob: ArrayBuffer) {
|
||||
|
||||
+5
-30
@@ -23,11 +23,6 @@ exports.runRtfjs = function(path, source, callback, errorCallback) {
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var dom = new JSDOM(`
|
||||
<script src="../samples/.common/dep/jquery.min.js"></script>
|
||||
|
||||
<script src="../dist/jquery.svg.min.js"></script>
|
||||
<script src="../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../dist/WMFJS.bundle.js"></script>
|
||||
<script src="../dist/EMFJS.bundle.js"></script>
|
||||
<script src="../dist/RTFJS.bundle.js"></script>
|
||||
@@ -78,7 +73,9 @@ exports.runRtfjs = function(path, source, callback, errorCallback) {
|
||||
|
||||
var meta = doc.metadata();
|
||||
doc.render().then(function(htmlElements) {
|
||||
var html = $("<div>").append(htmlElements).html();
|
||||
var div = document.createElement("div");
|
||||
div.append(...htmlElements);
|
||||
var html = div.innerHTML;
|
||||
|
||||
window.done(meta, html);
|
||||
}).catch(error => window.onerror(error))
|
||||
@@ -99,10 +96,6 @@ exports.runRtfjs = function(path, source, callback, errorCallback) {
|
||||
window.onerror = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
// Catch exceptions from jquery.svg.min.js
|
||||
window.alert = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
window.$_$twiz = $_$twiz;
|
||||
window.__coverage__ = global.__coverage__;
|
||||
}});
|
||||
@@ -113,11 +106,6 @@ exports.runEmfjs = function(source, callback, errorCallback) {
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var dom = new JSDOM(`
|
||||
<script src="../samples/.common/dep/jquery.min.js"></script>
|
||||
|
||||
<script src="../dist/jquery.svg.min.js"></script>
|
||||
<script src="../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../dist/EMFJS.bundle.js"></script>
|
||||
|
||||
<script>
|
||||
@@ -137,7 +125,7 @@ exports.runEmfjs = function(source, callback, errorCallback) {
|
||||
};
|
||||
|
||||
var renderer = new EMFJS.Renderer(emfFile);
|
||||
var svg = renderer.render(settings).html();
|
||||
var svg = renderer.render(settings).innerHTML;
|
||||
|
||||
window.done(svg);
|
||||
} catch (error){
|
||||
@@ -156,10 +144,6 @@ exports.runEmfjs = function(source, callback, errorCallback) {
|
||||
window.onerror = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
// Catch exceptions from jquery.svg.min.js
|
||||
window.alert = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
window.$_$twiz = $_$twiz;
|
||||
window.__coverage__ = global.__coverage__;
|
||||
}});
|
||||
@@ -170,11 +154,6 @@ exports.runWmfjs = function(source, callback, errorCallback) {
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var dom = new JSDOM(`
|
||||
<script src="../samples/.common/dep/jquery.min.js"></script>
|
||||
|
||||
<script src="../dist/jquery.svg.min.js"></script>
|
||||
<script src="../dist/jquery.svgfilter.min.js"></script>
|
||||
|
||||
<script src="../dist/WMFJS.bundle.js"></script>
|
||||
|
||||
<script>
|
||||
@@ -192,7 +171,7 @@ exports.runWmfjs = function(source, callback, errorCallback) {
|
||||
};
|
||||
|
||||
var renderer = new WMFJS.Renderer(wmfFile);
|
||||
var svg = renderer.render(settings).html();
|
||||
var svg = renderer.render(settings).innerHTML;
|
||||
|
||||
window.done(svg);
|
||||
} catch (error){
|
||||
@@ -211,10 +190,6 @@ exports.runWmfjs = function(source, callback, errorCallback) {
|
||||
window.onerror = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
// Catch exceptions from jquery.svg.min.js
|
||||
window.alert = function (error) {
|
||||
errorCallback(error)
|
||||
};
|
||||
window.$_$twiz = $_$twiz;
|
||||
window.__coverage__ = global.__coverage__;
|
||||
}});
|
||||
|
||||
+5
-3
@@ -2,10 +2,12 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/src",
|
||||
"allowJs": false,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "scripthost", "es2015.promise"],
|
||||
"target": "ES5",
|
||||
"lib": [
|
||||
"ES2018", "DOM"
|
||||
],
|
||||
"moduleResolution": "node",
|
||||
"module": "es2015",
|
||||
"module": "ES2015",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"strict": true,
|
||||
|
||||
Vendored
-1379
File diff suppressed because it is too large
Load Diff
Vendored
-8
File diff suppressed because one or more lines are too long
-395
@@ -1,395 +0,0 @@
|
||||
/* http://keith-wood.name/svg.html
|
||||
SVG filters for jQuery v1.5.0.
|
||||
Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
|
||||
Available under the MIT (http://keith-wood.name/licence.html) license.
|
||||
Please attribute the author if you use it. */
|
||||
|
||||
// Follow the UMD template https://github.com/umdjs/umd/blob/master/templates/jqueryPlugin.js
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node/CommonJS
|
||||
module.exports = function( root, jQuery ) {
|
||||
if ( jQuery === undefined ) {
|
||||
// require('jQuery') returns a factory that requires window to
|
||||
// build a jQuery instance, we normalize how we use modules
|
||||
// that require this pattern but the window provided is a noop
|
||||
// if it's defined (how jquery works)
|
||||
if ( typeof window !== 'undefined' ) {
|
||||
jQuery = require('jquery');
|
||||
}
|
||||
else {
|
||||
jQuery = require('jquery')(root);
|
||||
}
|
||||
}
|
||||
factory(jQuery);
|
||||
return jQuery;
|
||||
};
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
$.svg.addExtension('filters', SVGFilter);
|
||||
|
||||
$.extend($.svg._wrapperClass.prototype, {
|
||||
|
||||
/** Add a filter definition.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param id {string} The ID for this filter.
|
||||
@param x {number} The x-coordinate for the left edge of the filter.
|
||||
@param y {number} The y-coordinate for the top edge of the filter.
|
||||
@param width {number} The width of the filter.
|
||||
@param height {number} The height of the filter.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
filter: function(parent, id, x, y, width, height, settings) {
|
||||
var args = this._args(arguments, ['id', 'x', 'y', 'width', 'height']);
|
||||
return this._makeNode(args.parent, 'filter', $.extend(
|
||||
{id: args.id, x: args.x, y: args.y, width: args.width, height: args.height}, args.settings || {}));
|
||||
}
|
||||
});
|
||||
|
||||
/** The SVG filters manager.
|
||||
<p>Use the singleton instance of this class, $.svg.filters,
|
||||
to interact with the SVG filters functionality.</p>
|
||||
@module SVGFilter */
|
||||
function SVGFilter(wrapper) {
|
||||
this._wrapper = wrapper; // The attached SVG wrapper object
|
||||
}
|
||||
|
||||
$.extend(SVGFilter.prototype, {
|
||||
|
||||
/** Add a distant light filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param azimuth {number} The angle (degrees) in the XY plane for the light source.
|
||||
@param elevation {number} The angle (degrees) in the YZ plane for the light source.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
distantLight: function(parent, result, azimuth, elevation, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'azimuth', 'elevation']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDistantLight', $.extend(
|
||||
{result: args.result, azimuth: args.azimuth, elevation: args.elevation}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a point light filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param x {number} The x-coordinate for the light source.
|
||||
@param y {number} The y-coordinate for the light source.
|
||||
@param z {number} The z-coordinate for the light source.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
pointLight: function(parent, result, x, y, z, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z']);
|
||||
return this._wrapper._makeNode(args.parent, 'fePointLight', $.extend(
|
||||
{result: args.result, x: args.x, y: args.y, z: args.z}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a spot light filter.
|
||||
<p>Specify all of <code>toX</code>, <code>toY</code>, <code>toZ</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param x {number} The x-coordinate for the light source.
|
||||
@param y {number} The y-coordinate for the light source.
|
||||
@param z {number} The z-coordinate for the light source.
|
||||
@param [toX] {number} The x-coordinate for where the light is pointing.
|
||||
@param [toY] {number} The y-coordinate for where the light is pointing.
|
||||
@param [toZ] {number} The z-coordinate for where the light is pointing.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
spotLight: function(parent, result, x, y, z, toX, toY, toZ, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'z', 'toX', 'toY', 'toZ'], ['toX']);
|
||||
var sets = $.extend({result: args.result, x: args.x, y: args.y, z: args.z},
|
||||
(args.toX != null ? {pointsAtX: args.toX, pointsAtY: args.toY, pointsAtZ: args.toZ} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feSpotLight', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a blend filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param mode {string} One of 'normal', 'multiply', 'screen', 'darken', 'lighten'.
|
||||
@param in1 {string} The first image to blend.
|
||||
@param in2 {string} The second image to blend.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
blend: function(parent, result, mode, in1, in2, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'mode', 'in1', 'in2']);
|
||||
return this._wrapper._makeNode(args.parent, 'feBlend', $.extend(
|
||||
{result: args.result, mode: args.mode, in_: args.in1, in2: args.in2}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a colour matrix filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source to colour.
|
||||
@param type {string} One of 'matrix', 'saturate', 'hueRotate', 'luminanceToAlpha'.
|
||||
@param values {number[][]|number} For 'matrix' the matrix (5x4) values to apply, for 'saturate' 0.0 to 1.0,
|
||||
for 'hueRotate' degrees, for 'luminanceToAlpha' nothing.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
colorMatrix: function(parent, result, in1, type, values, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'type', 'values']);
|
||||
if ($.isArray(args.values)) {
|
||||
var vs = '';
|
||||
for (var i = 0; i < args.values.length; i++) {
|
||||
vs += (i === 0 ? '' : ' ') + args.values[i].join(' ');
|
||||
}
|
||||
args.values = vs;
|
||||
}
|
||||
else if (typeof args.values === 'object') {
|
||||
args.settings = args.values;
|
||||
args.values = null;
|
||||
}
|
||||
var sets = $.extend({result: args.result, in_: args.in1, type: args.type},
|
||||
(args.values != null ? {values: args.values} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feColorMatrix', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a component transfer filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param functions {object[]} One for each of RGB and A (alpha, optional), for each entry:
|
||||
[0] {string} one of 'identity', 'table', 'discrete', 'linear', 'gamma',
|
||||
[1] {number[]|number} for 'table' or 'discrete' the list of interpolation or step values OR
|
||||
for 'linear' the slope, for 'gamma' the amplitude,
|
||||
[2] {number} for 'linear' the intercept, for 'gamma' the exponent,
|
||||
[3] {number} for 'gamma' the offset.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
componentTransfer: function(parent, result, functions, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'functions']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feComponentTransfer',
|
||||
$.extend({result: args.result}, args.settings || {}));
|
||||
var rgba = ['R', 'G', 'B', 'A'];
|
||||
for (var i = 0; i < Math.min(4, args.functions.length); i++) {
|
||||
var props = args.functions[i];
|
||||
var sets = $.extend({type: props[0]},
|
||||
(props[0] === 'table' || props[0] === 'discrete' ? {tableValues: props[1].join(' ')} :
|
||||
(props[0] === 'linear' ? {slope: props[1], intercept: props[2]} :
|
||||
(props[0] === 'gamma' ? {amplitude: props[1], exponent: props[2], offset: props[3]} : {}))));
|
||||
this._wrapper._makeNode(node, 'feFunc' + rgba[i], sets);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a composite filter.
|
||||
<p>Specify all of <code>k1</code>, <code>k2</code>, <code>k3</code>, <code>k4</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param operator {string} One of 'over', 'in', 'out', 'atop', 'xor', 'arithmetic'.
|
||||
@param in1 {string} The first filter to compose.
|
||||
@param in2 {string} The second filter to compose.
|
||||
@param [k1] {number} For 'arithmetic'.
|
||||
@param [k2] {number} For 'arithmetic'.
|
||||
@param [k3] {number} For 'arithmetic'.
|
||||
@param [k4] {number} For 'arithmetic'.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
composite: function(parent, result, operator, in1, in2, k1, k2, k3, k4, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'operator', 'in1', 'in2', 'k1', 'k2', 'k3', 'k4'], ['k1']);
|
||||
var sets = $.extend({result: args.result, operator: args.operator, 'in': args.in1, in2: args.in2},
|
||||
(args.k1 != null ? {k1: args.k1, k2: args.k2, k3: args.k3, k4: args.k4} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feComposite', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a convolve matrix filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter
|
||||
@param order {number|string} The size(s) of the matrix
|
||||
optionally separated into x- and y-components ('number number').
|
||||
@param matrix {number[][]} The kernel matrix for the convolution.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
convolveMatrix: function(parent, result, order, matrix, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'order', 'matrix']);
|
||||
var mx = '';
|
||||
for (var i = 0; i < args.matrix.length; i++) {
|
||||
mx += (i === 0 ? '' : ' ') + args.matrix[i].join(' ');
|
||||
}
|
||||
args.matrix = mx;
|
||||
return this._wrapper._makeNode(args.parent, 'feConvolveMatrix', $.extend(
|
||||
{result: args.result, order: args.order, kernelMatrix: args.matrix}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a diffuse lighting filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param [colour] {string} The lighting colour.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
diffuseLighting: function(parent, result, colour, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'colour'], ['colour']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDiffuseLighting', $.extend($.extend({result: args.result},
|
||||
(args.colour ? {lightingColor: args.colour} : {})), args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a displacement map filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source image.
|
||||
@param in2 {string} The displacement image.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
displacementMap: function(parent, result, in1, in2, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'in2']);
|
||||
return this._wrapper._makeNode(args.parent, 'feDisplacementMap',
|
||||
$.extend({result: args.result, in_: args.in1, in2: args.in2}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a flood filter.
|
||||
<p>Specify all of <code>x</code>, <code>y</code>, <code>width</code>, <code>height</code> or none of them.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param [x] {number} The left coordinate of the rectangle.
|
||||
@param [y] {number} The top coordinate of the rectangle.
|
||||
@param [width] {number} The width of the rectangle.
|
||||
@param [height] {number} The height of the rectangle.
|
||||
@param colour {string} The colour to fill with.
|
||||
@param opacity {number} The opacity 0.0-1.0.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
flood: function(parent, result, x, y, width, height, colour, opacity, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'x', 'y', 'width', 'height', 'colour', 'opacity']);
|
||||
if (arguments.length < 6) {
|
||||
args.colour = args.x;
|
||||
args.opacity = args.y;
|
||||
args.settings = args.width;
|
||||
args.x = null;
|
||||
}
|
||||
var sets = $.extend({result: args.result, floodColor: args.colour,
|
||||
floodOpacity: args.opacity}, (args.x != null ?
|
||||
{x: args.x, y: args.y, width: args.width, height: args.height} : {}));
|
||||
return this._wrapper._makeNode(args.parent, 'feFlood', $.extend(sets, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a Gaussian blur filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param stdDevX {number} The standard deviation along the x-axis.
|
||||
@param [stdDevY] {number} The standard deviation along the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
gaussianBlur: function(parent, result, in1, stdDevX, stdDevY, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'stdDevX', 'stdDevY'], ['stdDevY']);
|
||||
return this._wrapper._makeNode(args.parent, 'feGaussianBlur', $.extend(
|
||||
{result: args.result, in_: args.in1, stdDeviation: args.stdDevX +
|
||||
(args.stdDevY ? ' ' + args.stdDevY : '')}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add an image filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} the ID of this filter.
|
||||
@param href {string} The URL of the image.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
image: function(parent, result, href, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'href']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feImage', $.extend({result: args.result}, args.settings || {}));
|
||||
node.setAttributeNS($.svg.xlinkNS, 'href', args.href);
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a merge filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param refs {string[])} The IDs of the filters to merge.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
merge: function(parent, result, refs, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'refs']);
|
||||
var node = this._wrapper._makeNode(args.parent, 'feMerge', $.extend({result: args.result}, args.settings || {}));
|
||||
for (var i = 0; i < args.refs.length; i++) {
|
||||
this._wrapper._makeNode(node, 'feMergeNode', {in_: args.refs[i]});
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** Add a morphology filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param operator {string} One of 'erode', 'dilate'.
|
||||
@param radiusX {number} The size of the operation in the x-axis.
|
||||
@param [radiusY] {number} The size of the operation in the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
morphology: function(parent, result, in1, operator, radiusX, radiusY, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'operator', 'radiusX', 'radiusY'], ['radiusY']);
|
||||
return this._wrapper._makeNode(args.parent, 'feMorphology', $.extend(
|
||||
{result: args.result, in_: args.in1, operator: args.operator,
|
||||
radius: args.radiusX + (args.radiusY ? ' ' + args.radiusY : '')}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add an offset filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param dX {number} The offset in the x-axis.
|
||||
@param dY {number} The offset in the y-axis.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
offset: function(parent, result, in1, dx, dy, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'dx', 'dy']);
|
||||
return this._wrapper._makeNode(args.parent, 'feOffset', $.extend(
|
||||
{result: args.result, in_: args.in1, dx: args.dx, dy: args.dy}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a specular lighting filter.
|
||||
<p>Numeric params are only optional if following numeric params are also omitted.</p>
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string}The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param [surfaceScale] {number} The surface height when Ain = 1.
|
||||
@param [specularConstant] {number} The ks in Phong lighting model.
|
||||
@param [specularExponent] {number} The shininess 1.0-128.0.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
specularLighting: function(parent, result, in1, surfaceScale, specularConstant, specularExponent, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'surfaceScale', 'specularConstant', 'specularExponent'],
|
||||
['surfaceScale', 'specularConstant', 'specularExponent']);
|
||||
return this._wrapper._makeNode(args.parent, 'feSpecularLighting', $.extend(
|
||||
{result: args.result, in_: args.in1, surfaceScale: args.surfaceScale,
|
||||
specularConstant: args.specularConstant, specularExponent: args.specularExponent}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a tile filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param in1 {string} The source filter.
|
||||
@param x {number} The left coordinate of the rectangle.
|
||||
@param y {number} The top coordinate of the rectangle.
|
||||
@param width {number} The width of the rectangle.
|
||||
@param height {number} The height of the rectangle.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
tile: function(parent, result, in1, x, y, width, height, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'in1', 'x', 'y', 'width', 'height']);
|
||||
return this._wrapper._makeNode(args.parent, 'feTile', $.extend(
|
||||
{result: args.result, in_: args.in1, x: args.x, y: args.y,
|
||||
width: args.width, height: args.height}, args.settings || {}));
|
||||
},
|
||||
|
||||
/** Add a turbulence filter.
|
||||
@param [parent] {SVGElement|jQuery} The parent node for the new node, or SVG root if not specified.
|
||||
@param result {string} The ID of this filter.
|
||||
@param type {string} One of 'fractalNoise', 'turbulence'.
|
||||
@param [baseFreq] {number|string} The base frequency,
|
||||
optionally separated into x- and y-components ('number number').
|
||||
@param [octaves] {number} The amount of turbulence.
|
||||
@param [settings] {object} Additional settings for this node.
|
||||
@return {SVGElement} The new filter node. */
|
||||
turbulence: function(parent, result, type, baseFreq, octaves, settings) {
|
||||
var args = this._wrapper._args(arguments, ['result', 'type', 'baseFreq', 'octaves'], ['octaves']);
|
||||
return this._wrapper._makeNode(args.parent, 'feTurbulence', $.extend(
|
||||
{result: args.result, type: args.type, baseFrequency: args.baseFreq,
|
||||
numOctaves: args.octaves}, args.settings || {}));
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
-8
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
|
||||
const path = require('path');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'none',
|
||||
@@ -36,29 +35,8 @@ module.exports = {
|
||||
commonjs2: './WMFJS.bundle.js',
|
||||
amd: './WMFJS.bundle.js',
|
||||
root: 'WMFJS'
|
||||
},
|
||||
jquery: {
|
||||
commonjs: 'jquery',
|
||||
commonjs2: 'jquery',
|
||||
amd: 'jquery',
|
||||
root: '$'
|
||||
},
|
||||
"jquery.svg": {
|
||||
commonjs: './jquery.svg',
|
||||
commonjs2: './jquery.svg',
|
||||
amd: './jquery.svg',
|
||||
root: '$'
|
||||
},
|
||||
"jquery.svgfilter": {
|
||||
commonjs: './jquery.svgfilter',
|
||||
commonjs2: './jquery.svgfilter',
|
||||
amd: './jquery.svgfilter',
|
||||
root: '$'
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([{ from: 'vendor/jquery-svg', context: path.join(__dirname, '..'), force: true}])
|
||||
],
|
||||
stats: {
|
||||
modules: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user