- 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. // Configuration of the MathJax extention.
// This will be added to the head tag before MathJax is loaded. // This will be added to the head tag before MathJax is loaded.
/* mathjaxConfiguration = '<script type="text/x-mathjax-config">\ /* mathjaxConfiguration = `<script type="text/x-mathjax-config">
MathJax.Hub.Config({\ MathJax.Hub.Config({
extensions: ["tex2jax.js"],\ extensions: ['tex2jax.js'],
jax: ["input/TeX","output/SVG"],\ jax: ['input/TeX', 'output/SVG'],
showProcessingMessages: true,\ showProcessingMessages: true,
showMathMenu: false,\ showMathMenu: false,
showMathMenuMSIE: false,\ showMathMenuMSIE: false,
errorSettings: {\ errorSettings: {
message: ["[Math Processing Error]"],\ message: ['[Math Processing Error]'],
style: {color: "#CC0000", "font-style":"italic"}\ style: {color: '#CC0000', 'font-style': 'italic'}
},\ },
elements: [],\ elements: [],
tex2jax: {\ tex2jax: {
ignoreClass: "tex2jax_ignore2", processClass: "tex2jax_process2",\ ignoreClass: 'tex2jax_ignore2', processClass: 'tex2jax_process2',
},\ },
TeX: {\ TeX: {
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]\ extensions: ['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js']
},\ },
"SVG": {\ SVG: {
}\ }
});\ });
</script>', */ </script>`, */
// mathjaxSrc = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js', // 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 // 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 // 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']; 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 * Convert a path to one with only absolute or relative values
* @param {Object} path - the path to convert * @param {Object} path - the path to convert
* @param {boolean} toRel - true of convert to relative * @param {boolean} toRel - true of convert to relative
@ -6680,7 +6680,7 @@ var walkTreePost = function walkTreePost(elem, cbFn) {
*/ */
var getUrlFromAttr = function getUrlFromAttr(attrVal) { var getUrlFromAttr = function getUrlFromAttr(attrVal) {
if (attrVal) { if (attrVal) {
// url("#somegrad") // url('#somegrad')
if (attrVal.startsWith('url("')) { if (attrVal.startsWith('url("')) {
return attrVal.substring(5, attrVal.indexOf('"', 6)); return attrVal.substring(5, attrVal.indexOf('"', 6));
} }
@ -15012,6 +15012,7 @@ var SvgCanvas = function SvgCanvas(container, config) {
// TODO: Correct this: // TODO: Correct this:
pathActions$$1.canDeleteNodes = true; pathActions$$1.canDeleteNodes = true;
pathActions$$1.closed_subpath = closedSubpath; pathActions$$1.closed_subpath = closedSubpath;
call('pointsAdded', { closedSubpath: closedSubpath, grips: grips });
call('selected', grips); call('selected', grips);
}, },
endChanges: function endChanges(_ref2) { endChanges: function endChanges(_ref2) {
@ -21540,8 +21541,8 @@ jGraduate(options, okCallback, cancelCallback)
where options is an object literal: where options is an object literal:
{ {
window: { title: "Pick the start color and opacity for the gradient" }, window: { title: 'Pick the start color and opacity for the gradient' },
images: { clientPath: "images/" }, images: { clientPath: 'images/' },
paint: a Paint object, paint: a Paint object,
newstop: String of value "same", "inverse", "black" or "white" newstop: String of value "same", "inverse", "black" or "white"
OR object with one or both values {color: #Hex color, opac: number 0-1} 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() -> constructs a 'none' color
$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o $.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({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({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: - 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) }; return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
}, },
validateHex: function validateHex(hex) { validateHex: function validateHex(hex) {
// if (typeof hex === "object") return ""; // if (typeof hex === 'object') return '';
hex = hex.toLowerCase().replace(/[^a-f0-9]/g, ''); hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
if (hex.length > 8) hex = hex.substring(0, 8); if (hex.length > 8) hex = hex.substring(0, 8);
return hex; return hex;
@ -27442,8 +27443,8 @@ editor.init = function () {
break; break;
// TODO: Update values that change on move/resize, etc // TODO: Update values that change on move/resize, etc
// case "select": // case 'select':
// case "resize": // case 'resize':
// break; // break;
} }
} }
@ -30486,16 +30487,10 @@ editor.init = function () {
updateCanvas(true); updateCanvas(true);
// }); // });
// const revnums = "svg-editor.js ($Rev$) "; // const revnums = 'svg-editor.js ($Rev$) ';
// revnums += svgCanvas.getVersion(); // revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums); // $('#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) { var setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); $$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']; 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 * Convert a path to one with only absolute or relative values
* @param {Object} path - the path to convert * @param {Object} path - the path to convert
* @param {boolean} toRel - true of convert to relative * @param {boolean} toRel - true of convert to relative
@ -6686,7 +6686,7 @@
*/ */
var getUrlFromAttr = function getUrlFromAttr(attrVal) { var getUrlFromAttr = function getUrlFromAttr(attrVal) {
if (attrVal) { if (attrVal) {
// url("#somegrad") // url('#somegrad')
if (attrVal.startsWith('url("')) { if (attrVal.startsWith('url("')) {
return attrVal.substring(5, attrVal.indexOf('"', 6)); return attrVal.substring(5, attrVal.indexOf('"', 6));
} }
@ -15018,6 +15018,7 @@
// TODO: Correct this: // TODO: Correct this:
pathActions$$1.canDeleteNodes = true; pathActions$$1.canDeleteNodes = true;
pathActions$$1.closed_subpath = closedSubpath; pathActions$$1.closed_subpath = closedSubpath;
call('pointsAdded', { closedSubpath: closedSubpath, grips: grips });
call('selected', grips); call('selected', grips);
}, },
endChanges: function endChanges(_ref2) { endChanges: function endChanges(_ref2) {
@ -21546,8 +21547,8 @@
where options is an object literal: where options is an object literal:
{ {
window: { title: "Pick the start color and opacity for the gradient" }, window: { title: 'Pick the start color and opacity for the gradient' },
images: { clientPath: "images/" }, images: { clientPath: 'images/' },
paint: a Paint object, paint: a Paint object,
newstop: String of value "same", "inverse", "black" or "white" newstop: String of value "same", "inverse", "black" or "white"
OR object with one or both values {color: #Hex color, opac: number 0-1} 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() -> constructs a 'none' color
$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o $.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({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({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: - 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) }; return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) };
}, },
validateHex: function validateHex(hex) { validateHex: function validateHex(hex) {
// if (typeof hex === "object") return ""; // if (typeof hex === 'object') return '';
hex = hex.toLowerCase().replace(/[^a-f0-9]/g, ''); hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
if (hex.length > 8) hex = hex.substring(0, 8); if (hex.length > 8) hex = hex.substring(0, 8);
return hex; return hex;
@ -27448,8 +27449,8 @@
break; break;
// TODO: Update values that change on move/resize, etc // TODO: Update values that change on move/resize, etc
// case "select": // case 'select':
// case "resize": // case 'resize':
// break; // break;
} }
} }
@ -30492,16 +30493,10 @@
updateCanvas(true); updateCanvas(true);
// }); // });
// const revnums = "svg-editor.js ($Rev$) "; // const revnums = 'svg-editor.js ($Rev$) ';
// revnums += svgCanvas.getVersion(); // revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums); // $('#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) { var setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true; editor.langChanged = true;
$$b.pref('lang', lang); $$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(); // revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute('title', revnums); // $('#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) { const setLang = editor.setLang = function (lang, allStrings) {
editor.langChanged = true; editor.langChanged = true;
$.pref('lang', lang); $.pref('lang', lang);

View File

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