- Breaking change: In interests of modularity/removing globals, remove `window.svgCanvas`

and `svgCanvas.ready` as used by older extensions; use `svgEditor.canvas` and
    `svgEditor.ready` instead
- npm: Add `prepare` script to ensure building/testing before publish
master
Brett Zamir 2018-05-31 09:53:47 +08:00
parent 77999a31ce
commit 96e089f930
9 changed files with 49 additions and 64 deletions

View File

@ -18,28 +18,28 @@
// Configuration of the MathJax extention.
// This will be added to the head tag before MathJax is loaded.
/* mathjaxConfiguration = '<script type="text/x-mathjax-config">\
MathJax.Hub.Config({\
extensions: ["tex2jax.js"],\
jax: ["input/TeX","output/SVG"],\
showProcessingMessages: true,\
showMathMenu: false,\
showMathMenuMSIE: false,\
errorSettings: {\
message: ["[Math Processing Error]"],\
style: {color: "#CC0000", "font-style":"italic"}\
},\
elements: [],\
tex2jax: {\
ignoreClass: "tex2jax_ignore2", processClass: "tex2jax_process2",\
},\
TeX: {\
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]\
},\
"SVG": {\
}\
});\
</script>', */
/* mathjaxConfiguration = `<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ['tex2jax.js'],
jax: ['input/TeX', 'output/SVG'],
showProcessingMessages: true,
showMathMenu: false,
showMathMenuMSIE: false,
errorSettings: {
message: ['[Math Processing Error]'],
style: {color: '#CC0000', 'font-style': 'italic'}
},
elements: [],
tex2jax: {
ignoreClass: 'tex2jax_ignore2', processClass: 'tex2jax_process2',
},
TeX: {
extensions: ['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js']
},
SVG: {
}
});
</script>`, */
// mathjaxSrc = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
// Had been on https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG.js
// Obtained Text-AMS-MML_SVG.js from https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/config/TeX-AMS-MML_SVG.js

27
dist/index-es.js vendored
View File

@ -5303,7 +5303,7 @@ var reorientGrads = function reorientGrads(elem, m) {
var pathMap = [0, 'z', 'M', 'm', 'L', 'l', 'C', 'c', 'Q', 'q', 'A', 'a', 'H', 'h', 'V', 'v', 'S', 's', 'T', 't'];
/**
* TODO: move to pathActions.js when migrating rest of pathActions out of svgcanvas.js
* TODO: move to pathActions.js
* Convert a path to one with only absolute or relative values
* @param {Object} path - the path to convert
* @param {boolean} toRel - true of convert to relative
@ -6680,7 +6680,7 @@ var walkTreePost = function walkTreePost(elem, cbFn) {
*/
var getUrlFromAttr = function getUrlFromAttr(attrVal) {
if (attrVal) {
// url("#somegrad")
// url('#somegrad')
if (attrVal.startsWith('url("')) {
return attrVal.substring(5, attrVal.indexOf('"', 6));
}
@ -15012,6 +15012,7 @@ var SvgCanvas = function SvgCanvas(container, config) {
// TODO: Correct this:
pathActions$$1.canDeleteNodes = true;
pathActions$$1.closed_subpath = closedSubpath;
call('pointsAdded', { closedSubpath: closedSubpath, grips: grips });
call('selected', grips);
},
endChanges: function endChanges(_ref2) {
@ -21540,8 +21541,8 @@ jGraduate(options, okCallback, cancelCallback)
where options is an object literal:
{
window: { title: "Pick the start color and opacity for the gradient" },
images: { clientPath: "images/" },
window: { title: 'Pick the start color and opacity for the gradient' },
images: { clientPath: 'images/' },
paint: a Paint object,
newstop: String of value "same", "inverse", "black" or "white"
OR object with one or both values {color: #Hex color, opac: number 0-1}
@ -21558,10 +21559,10 @@ where options is an object literal:
$.jGraduate.Paint() -> constructs a 'none' color
$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o
$.jGraduate.Paint({hex: "#rrggbb"}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({hex: '#rrggbb'}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({linearGradient: o, a: 50}) -> creates a linear gradient paint with opacity=0.5
$.jGraduate.Paint({radialGradient: o, a: 7}) -> creates a radial gradient paint with opacity=0.07
$.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception?
$.jGraduate.Paint({hex: '#rrggbb', linearGradient: o}) -> throws an exception?
- picker accepts the following object as input:
{
@ -23898,7 +23899,7 @@ var jPicker = function jPicker($) {
return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
},
validateHex: function validateHex(hex) {
// if (typeof hex === "object") return "";
// if (typeof hex === 'object') return '';
hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
if (hex.length > 8) hex = hex.substring(0, 8);
return hex;
@ -27442,8 +27443,8 @@ editor.init = function () {
break;
// TODO: Update values that change on move/resize, etc
// case "select":
// case "resize":
// case 'select':
// case 'resize':
// break;
}
}
@ -30486,16 +30487,10 @@ editor.init = function () {
updateCanvas(true);
// });
// const revnums = "svg-editor.js ($Rev$) ";
// const revnums = 'svg-editor.js ($Rev$) ';
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums);
// For Compatibility with older extensions
// $(function () {
window.svgCanvas = svgCanvas;
svgCanvas.ready = editor.ready;
// });
var setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true;
$$b.pref('lang', lang);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

27
dist/index-umd.js vendored
View File

@ -5309,7 +5309,7 @@
var pathMap = [0, 'z', 'M', 'm', 'L', 'l', 'C', 'c', 'Q', 'q', 'A', 'a', 'H', 'h', 'V', 'v', 'S', 's', 'T', 't'];
/**
* TODO: move to pathActions.js when migrating rest of pathActions out of svgcanvas.js
* TODO: move to pathActions.js
* Convert a path to one with only absolute or relative values
* @param {Object} path - the path to convert
* @param {boolean} toRel - true of convert to relative
@ -6686,7 +6686,7 @@
*/
var getUrlFromAttr = function getUrlFromAttr(attrVal) {
if (attrVal) {
// url("#somegrad")
// url('#somegrad')
if (attrVal.startsWith('url("')) {
return attrVal.substring(5, attrVal.indexOf('"', 6));
}
@ -15018,6 +15018,7 @@
// TODO: Correct this:
pathActions$$1.canDeleteNodes = true;
pathActions$$1.closed_subpath = closedSubpath;
call('pointsAdded', { closedSubpath: closedSubpath, grips: grips });
call('selected', grips);
},
endChanges: function endChanges(_ref2) {
@ -21546,8 +21547,8 @@
where options is an object literal:
{
window: { title: "Pick the start color and opacity for the gradient" },
images: { clientPath: "images/" },
window: { title: 'Pick the start color and opacity for the gradient' },
images: { clientPath: 'images/' },
paint: a Paint object,
newstop: String of value "same", "inverse", "black" or "white"
OR object with one or both values {color: #Hex color, opac: number 0-1}
@ -21564,10 +21565,10 @@
$.jGraduate.Paint() -> constructs a 'none' color
$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o
$.jGraduate.Paint({hex: "#rrggbb"}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({hex: '#rrggbb'}) -> creates a solid color paint with hex = "#rrggbb"
$.jGraduate.Paint({linearGradient: o, a: 50}) -> creates a linear gradient paint with opacity=0.5
$.jGraduate.Paint({radialGradient: o, a: 7}) -> creates a radial gradient paint with opacity=0.07
$.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception?
$.jGraduate.Paint({hex: '#rrggbb', linearGradient: o}) -> throws an exception?
- picker accepts the following object as input:
{
@ -23904,7 +23905,7 @@
return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
},
validateHex: function validateHex(hex) {
// if (typeof hex === "object") return "";
// if (typeof hex === 'object') return '';
hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
if (hex.length > 8) hex = hex.substring(0, 8);
return hex;
@ -27448,8 +27449,8 @@
break;
// TODO: Update values that change on move/resize, etc
// case "select":
// case "resize":
// case 'select':
// case 'resize':
// break;
}
}
@ -30492,16 +30493,10 @@
updateCanvas(true);
// });
// const revnums = "svg-editor.js ($Rev$) ";
// const revnums = 'svg-editor.js ($Rev$) ';
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums);
// For Compatibility with older extensions
// $(function () {
window.svgCanvas = svgCanvas;
svgCanvas.ready = editor.ready;
// });
var setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true;
$$b.pref('lang', lang);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5125,12 +5125,6 @@ editor.init = function () {
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums);
// For Compatibility with older extensions
// $(function () {
window.svgCanvas = svgCanvas;
svgCanvas.ready = editor.ready;
// });
const setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true;
$.pref('lang', lang);

View File

@ -11,6 +11,7 @@
},
"engines": {},
"scripts": {
"prepare": "npm test",
"build-config": "rollup -c rollup-config.config.js",
"build-doc": "rm -rf docs/jsdoc/*;jsdoc -d docs/jsdoc -c docs/jsdoc-config.json .",
"build-html": "node build-html.js",