- Refactoring: Switch from `$.param.querystring` to `URL`
parent
37424278d1
commit
56197a493c
|
@ -22,7 +22,8 @@
|
|||
- Fix: Redirect paths for imagelib redirect checks
|
||||
- Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file
|
||||
- Localization: Add 'SVG-Edit Home Page' to locale files
|
||||
- Refactoring: Ensure file-global tags are at beginning of file
|
||||
- Refactoring: Switch from `$.param.querystring` to `URL`
|
||||
- Refactoring: Ensure file-global jsdoc tags are at beginning of file
|
||||
- Linting (ESLint): Simplify regexes
|
||||
- Linting (ESLint): Replace `innerHTML` with `textContent` from old demo
|
||||
- Linting (ESLint): Update as per latest ash-nazg
|
||||
|
|
|
@ -28,8 +28,8 @@ export default {
|
|||
svgEditor.setCustomHandlers({
|
||||
async save (win, data) {
|
||||
const svg = '<?xml version="1.0"?>\n' + data;
|
||||
const qstr = $.param.querystring();
|
||||
const [, name] = qstr.substr(9).split('/+get/');
|
||||
const {pathname} = new URL(location);
|
||||
const name = pathname.replace(/\/+get\//, '');
|
||||
const svgData = encode64(svg);
|
||||
if (!$('#export_canvas').length) {
|
||||
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
|
||||
|
|
|
@ -726,7 +726,6 @@ editor.init = function () {
|
|||
}
|
||||
(() => {
|
||||
// Load config/data from URL if given
|
||||
let src, qstr;
|
||||
urldata = $.deparam.querystring(true);
|
||||
if (!$.isEmptyObject(urldata)) {
|
||||
if (urldata.dimensions) {
|
||||
|
@ -759,19 +758,19 @@ editor.init = function () {
|
|||
setupCurConfig();
|
||||
|
||||
if (!curConfig.preventURLContentLoading) {
|
||||
src = urldata.source;
|
||||
qstr = $.param.querystring();
|
||||
if (!src) { // urldata.source may have been null if it ended with '='
|
||||
if (qstr.includes('source=data:')) {
|
||||
src = qstr.match(/source=(data:[^&]*)/)[1];
|
||||
// ({src} = qstr.match(/source=(?<src>data:[^&]*)/).groups);
|
||||
let {source} = urldata;
|
||||
if (!source) { // urldata.source may have been null if it ended with '='
|
||||
const {searchParams} = new URL(location);
|
||||
const src = searchParams.get('source');
|
||||
if (src.startsWith('data:')) {
|
||||
source = src;
|
||||
}
|
||||
}
|
||||
if (src) {
|
||||
if (src.startsWith('data:')) {
|
||||
editor.loadFromDataURI(src);
|
||||
if (source) {
|
||||
if (source.startsWith('data:')) {
|
||||
editor.loadFromDataURI(source);
|
||||
} else {
|
||||
editor.loadFromString(src);
|
||||
editor.loadFromString(source);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue