- Openclipart API work (waiting on possibility of their adding a missing CORS header)
parent
ae7d0d1331
commit
9f7f7b9732
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_de = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -18,16 +18,20 @@ var svgEditorExtensionLocale_imagelib_en = (function () {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/* ,
|
// The site is no longer using our API, and they have added an
|
||||||
// Disabling until X-Frame-Options may be removed again (or allow cross-origin):
|
// `X-Frame-Options` header which prevents our usage cross-origin:
|
||||||
// Getting messages like this in console:
|
// Getting messages like this in console:
|
||||||
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
||||||
// because it set 'X-Frame-Options' to 'sameorigin'.
|
// because it set 'X-Frame-Options' to 'sameorigin'.
|
||||||
|
// url: 'https://openclipart.org/svgedit',
|
||||||
|
// However, they do have a custom API which we are using here:
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: '{path}imagelib/openclipart{modularVersion}.html',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
} */
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_fr = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_pl = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_pt_BR = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_ro = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_sk = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_sl = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -19,12 +19,12 @@ var svgEditorExtensionLocale_imagelib_zh_CN = (function () {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -42,6 +42,20 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _extends = Object.assign || function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
|
||||||
var inherits = function (subClass, superClass) {
|
var inherits = function (subClass, superClass) {
|
||||||
if (typeof superClass !== "function" && superClass !== null) {
|
if (typeof superClass !== "function" && superClass !== null) {
|
||||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||||
|
@ -2182,7 +2196,7 @@
|
||||||
return ['div', [['button', { style: 'margin-right: 8px; border: 2px solid black;', dataset: { id: id, value: svgURL }, $on: {
|
return ['div', [['button', { style: 'margin-right: 8px; border: 2px solid black;', dataset: { id: id, value: svgURL }, $on: {
|
||||||
click: function () {
|
click: function () {
|
||||||
var _ref3 = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
|
var _ref3 = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
|
||||||
var _dataset, svgURL, id;
|
var _dataset, svgURL, id, post, result, svg;
|
||||||
|
|
||||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -2192,14 +2206,39 @@
|
||||||
_dataset = this.dataset, svgURL = _dataset.value, id = _dataset.id;
|
_dataset = this.dataset, svgURL = _dataset.value, id = _dataset.id;
|
||||||
|
|
||||||
console.log('this', id, svgURL);
|
console.log('this', id, svgURL);
|
||||||
/*
|
|
||||||
const result = await fetch(svgURL);
|
|
||||||
const svg = await result.text();
|
|
||||||
console.log('svg', svg);
|
|
||||||
*/
|
|
||||||
// Todo: Pass to our API
|
|
||||||
|
|
||||||
case 3:
|
post = function post(message) {
|
||||||
|
// Todo: Make origin customizable as set by opening window
|
||||||
|
// Todo: If dropping IE9, avoid stringifying
|
||||||
|
window.parent.postMessage(JSON.stringify(_extends({
|
||||||
|
namespace: 'imagelib'
|
||||||
|
}, message)), '*');
|
||||||
|
};
|
||||||
|
// Send metadata (also indicates file is about to be sent)
|
||||||
|
|
||||||
|
|
||||||
|
post({
|
||||||
|
name: title,
|
||||||
|
id: svgURL
|
||||||
|
});
|
||||||
|
_context.next = 7;
|
||||||
|
return fetch(svgURL);
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
result = _context.sent;
|
||||||
|
_context.next = 10;
|
||||||
|
return result.text();
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
svg = _context.sent;
|
||||||
|
|
||||||
|
console.log('h', svgURL, svg);
|
||||||
|
post({
|
||||||
|
href: svgURL,
|
||||||
|
data: svg
|
||||||
|
});
|
||||||
|
|
||||||
|
case 13:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
|
@ -2213,7 +2252,10 @@
|
||||||
|
|
||||||
return click;
|
return click;
|
||||||
}()
|
}()
|
||||||
} }, [['img', { src: svgURL, style: 'width: ' + imgHW + '; height: ' + imgHW + ';' }]]], ['b', [title]], ' ', ['i', [description]], ' ', ['span', ['(ID: ', ['a', {
|
} }, [
|
||||||
|
// If we wanted interactive versions despite security risk:
|
||||||
|
// ['object', {data: svgURL, type: 'image/svg+xml'}]
|
||||||
|
['img', { src: svgURL, style: 'width: ' + imgHW + '; height: ' + imgHW + ';' }]]], ['b', [title]], ' ', ['i', [description]], ' ', ['span', ['(ID: ', ['a', {
|
||||||
href: 'javascript: void(0);',
|
href: 'javascript: void(0);',
|
||||||
dataset: { value: id },
|
dataset: { value: id },
|
||||||
$on: {
|
$on: {
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,15 +20,19 @@ export default {
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/* ,
|
// The site is no longer using our API, and they have added an
|
||||||
// Disabling until X-Frame-Options may be removed again (or allow cross-origin):
|
// `X-Frame-Options` header which prevents our usage cross-origin:
|
||||||
// Getting messages like this in console:
|
// Getting messages like this in console:
|
||||||
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
||||||
// because it set 'X-Frame-Options' to 'sameorigin'.
|
// because it set 'X-Frame-Options' to 'sameorigin'.
|
||||||
|
// url: 'https://openclipart.org/svgedit',
|
||||||
|
// However, they do have a custom API which we are using here:
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: '{path}imagelib/openclipart{modularVersion}.html',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
} */
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// See message in "en" locale as to why disabling
|
// See message in "en" locale for further details
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
]
|
]
|
||||||
|
|
|
@ -75,12 +75,26 @@ async function processResults (url) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const {value: svgURL, id} = this.dataset;
|
const {value: svgURL, id} = this.dataset;
|
||||||
console.log('this', id, svgURL);
|
console.log('this', id, svgURL);
|
||||||
/*
|
const post = (message) => {
|
||||||
|
// Todo: Make origin customizable as set by opening window
|
||||||
|
// Todo: If dropping IE9, avoid stringifying
|
||||||
|
window.parent.postMessage(JSON.stringify({
|
||||||
|
namespace: 'imagelib',
|
||||||
|
...message
|
||||||
|
}), '*');
|
||||||
|
};
|
||||||
|
// Send metadata (also indicates file is about to be sent)
|
||||||
|
post({
|
||||||
|
name: title,
|
||||||
|
id: svgURL
|
||||||
|
});
|
||||||
const result = await fetch(svgURL);
|
const result = await fetch(svgURL);
|
||||||
const svg = await result.text();
|
const svg = await result.text();
|
||||||
console.log('svg', svg);
|
console.log('h', svgURL, svg);
|
||||||
*/
|
post({
|
||||||
// Todo: Pass to our API
|
href: svgURL,
|
||||||
|
data: svg
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}}, [
|
}}, [
|
||||||
// If we wanted interactive versions despite security risk:
|
// If we wanted interactive versions despite security risk:
|
||||||
|
|
Loading…
Reference in New Issue