group each plugin in its own folder

This commit is contained in:
jfh
2020-09-06 08:32:10 +02:00
parent caa4fe38cc
commit cfb3620d3a
322 changed files with 519 additions and 956 deletions

View File

@@ -10,10 +10,11 @@
export default {
name: 'arrows',
async init (S) {
const strings = await S.importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
const // {svgcontent} = S,
const
addElem = svgCanvas.addSVGElementFromJson,
{nonce, $} = S,
prefix = 'se_arrow_';
@@ -73,7 +74,6 @@ export default {
return null;
}
return svgCanvas.getElem(m[1]);
// return svgCanvas.getElem(m.groups.id);
}
/**

View File

@@ -6,7 +6,7 @@
* @copyright 2010 Jeff Schiller
*
*/
import '../../common/svgpathseg.js';
import '../../../common/svgpathseg.js';
// This extension adds a simple button to the contextual panel for paths
// The button toggles whether the path is open or closed

View File

@@ -13,13 +13,12 @@ export default {
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const {getElem} = svgCanvas;
const {$, svgroot, importLocale} = S,
const {$, svgroot} = S,
addElem = svgCanvas.addSVGElementFromJson,
selManager = S.selectorManager,
connSel = '.se_connector',
// connect_str = '-SE_CONNECT-',
elData = $.data;
const strings = await importLocale();
let startX,
startY,
@@ -334,20 +333,8 @@ export default {
svgCanvas.getEditorNS(true);
}
});
// updateConnectors();
}
// $(svgroot).parent().mousemove(function (e) {
// // if (started
// // || svgCanvas.getMode() !== 'connector'
// // || e.target.parentNode.parentNode !== svgcontent) return;
//
// console.log('y')
// // if (e.target.parentNode.parentNode === svgcontent) {
// //
// // }
// });
const buttons = [{
id: 'mode_connect',
type: 'mode',
@@ -363,7 +350,8 @@ export default {
}
}
}];
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
return {
name: strings.name,
svgicons: 'conn.svg',

View File

@@ -5,7 +5,7 @@ export default {
],
buttons: [
{
title: 'Connect two objects'
title: 'Connecter deux objets'
}
]
};

View File

@@ -10,8 +10,9 @@
export default {
name: 'eyedropper',
async init (S) {
const strings = await S.importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const {$, ChangeElementCommand} = S, // , svgcontent,
// svgdoc = S.svgroot.parentNode.ownerDocument,
svgCanvas = svgEditor.canvas,

View File

@@ -11,13 +11,14 @@ export default {
name: 'foreignobject',
async init (S) {
const svgEditor = this;
const {$, text2xml, NS, importLocale} = S;
const {$, text2xml, NS} = S;
const svgCanvas = svgEditor.canvas;
const
// {svgcontent} = S,
// addElem = svgCanvas.addSVGElementFromJson,
svgdoc = S.svgroot.parentNode.ownerDocument;
const strings = await importLocale();
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const properlySourceSizeTextArea = function () {
// TODO: remove magic numbers here and get values from CSS

View File

@@ -9,9 +9,10 @@
export default {
name: 'grid',
async init ({$, NS, getTypeMap, importLocale}) {
const strings = await importLocale();
async init ({$, NS, getTypeMap}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
const svgdoc = document.getElementById('svgcanvas').ownerDocument,
{assignAttributes} = svgCanvas,

View File

@@ -15,9 +15,9 @@
export default {
name: 'helloworld',
async init ({$, importLocale}) {
// See `/editor/extensions/ext-locale/helloworld/`
const strings = await importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
return {
name: strings.name,

View File

@@ -9,31 +9,13 @@
export default {
name: 'imagelib',
async init ({$, decode64, importLocale, dropXMLInternalSubset}) {
const imagelibStrings = await importLocale();
const modularVersion = !('svgEditor' in window) ||
!window.svgEditor ||
window.svgEditor.modules !== false;
async init ({$, decode64, dropXMLInternalSubset}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: imagelibStrings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const {uiStrings, canvas: svgCanvas} = svgEditor;
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
// Todo: Adopt some standard formatting library like `fluent.js` instead
url = url
// Keep these regexes as is in prep. for switching to `u` flag
// which will require escaping
.replace(
// eslint-disable-next-line unicorn/better-regex
/\{modularVersion\}/g,
modularVersion
? (imagelibStrings.moduleEnding || '-es')
: ''
);
return {name, url, description};
});
const allowedImageLibOrigins = imagelibStrings.imgLibs.map(({url}) => {
try {
return new URL(url).origin;

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{
@@ -30,7 +30,7 @@ export default {
/*
{
name: 'Openclipart',
url: '{path}imagelib/openclipart{modularVersion}.html',
url: '{path}imagelib/openclipart.html',
description: 'Share and Use Images. Over 100,000 Public Domain SVG Images and Growing.'
}
*/

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

@@ -12,7 +12,7 @@ export default {
imgLibs: [
{
name: 'Demo library (local)',
url: '{path}imagelib/index{modularVersion}.html',
url: '{path}imagelib/index.html',
description: 'Demonstration library for SVG-edit on this server'
},
{

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -32,8 +32,9 @@
export default {
name: 'markers',
async init (S) {
const strings = await S.importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const {$} = S;
const svgCanvas = svgEditor.canvas;
const // {svgcontent} = S,

View File

@@ -10,9 +10,10 @@
export default {
name: 'mathjax',
async init ({$, importLocale}) {
const strings = await importLocale();
async init ({$}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
// Configuration of the MathJax extention.
@@ -180,27 +181,6 @@ export default {
// MathJax preprocessing has to ignore most of the page.
$('body').addClass('tex2jax_ignore');
// Now get (and run) the MathJax Library.
// Todo: insert script with modules once widely supported
// and if MathJax (and its `TeX-AMS-MML_SVG.js` dependency) ends up
// providing an ES6 module export: https://github.com/mathjax/MathJax/issues/1998
/*
const modularVersion = !('svgEditor' in window) ||
!window.svgEditor ||
window.svgEditor.modules !== false;
// Add as second argument to `importScript`
{
type: modularVersion
? 'module' // Make this the default when widely supported
: 'text/javascript'
}
// If only using modules, just use this:
const {default: MathJax} = await importModule( // or `import()` when widely supported
svgEditor.curConfig.extIconsPath + mathjaxSrcSecure
);
*/
// We use `extIconsPath` here for now as it does not vary with
// the modular type as does `extPath`
try {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
await import(mathjaxSrcSecure);

View File

@@ -13,8 +13,9 @@
export default {
name: 'panning',
async init ({importLocale}) {
const strings = await importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
const buttons = [{
id: 'ext-panning',

View File

@@ -11,7 +11,7 @@ export default {
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const addElem = svgCanvas.addSVGElementFromJson;
const {$, importLocale} = S; // {svgcontent},
const {$} = S; // {svgcontent},
let
selElems,
// editingitex = false,
@@ -22,7 +22,8 @@ export default {
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
// undoCommand = 'Not image',
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
const strings = await importLocale();
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const markerTypes = {
nomarker: {},
forwardslash:

View File

@@ -11,10 +11,11 @@ export default {
async init (S) {
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const {$, importLocale} = S, // {svgcontent}
const {$} = S, // {svgcontent}
// addElem = svgCanvas.addSVGElementFromJson,
editingitex = false;
const strings = await importLocale();
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
let selElems,
// svgdoc = S.svgroot.parentNode.ownerDocument,
// newFOG, newFOGParent, newDef, newImageName, newMaskID, modeChangeG,

View File

@@ -7,13 +7,14 @@
* adopted for moinmoins item storage. It sends in one post png and svg data
* (I agree to dual license my work to additional GPLv2 or later)
*/
import {canvg} from '../../external/canvg/canvg.js';
import {canvg} from '../../../external/canvg/canvg.js';
export default {
name: 'server_moinsave',
async init ({$, encode64, importLocale}) {
const strings = await importLocale();
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const svgCanvas = svgEditor.canvas;
const saveSvgAction = '/+modify';

View File

@@ -6,13 +6,14 @@
* @copyright 2010 Alexis Deveria
*
*/
import {canvg} from '../../external/canvg/canvg.js';
import {canvg} from '../../../external/canvg/canvg.js';
export default {
name: 'server_opensave',
async init ({$, decode64, encode64, importLocale}) {
const strings = await importLocale();
async init ({$, decode64, encode64}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const {
curConfig: {
extPath,

View File

@@ -9,9 +9,10 @@
export default {
name: 'shapes',
async init ({$, importLocale}) {
const strings = await importLocale();
async init ({$}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const canv = svgEditor.canvas;
const svgroot = canv.getRootElem();
let lastBBox = {};

View File

@@ -12,7 +12,7 @@ export default {
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const {$, importLocale} = S; // {svgcontent},
const {$} = S; // {svgcontent},
let
selElems,
// editingitex = false,
@@ -23,7 +23,8 @@ export default {
// newFOG, newFOGParent, newDef, newImageName, newMaskID,
// undoCommand = 'Not image',
// modeChangeG, ccZoom, wEl, hEl, wOffset, hOffset, ccRgbEl, brushW, brushH;
const strings = await importLocale();
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
/**
*

View File

@@ -8,9 +8,10 @@
export default {
name: 'webappfind',
async init ({importLocale, $}) {
const strings = await importLocale();
async init ({$}) {
const svgEditor = this;
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);
const saveMessage = 'save',
readMessage = 'read',
excludedMessages = [readMessage, saveMessage];

View File

@@ -1,29 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>-</title>
<link rel="icon" type="image/png" href="../../images/logo.png" />
<!-- Lacking browser support -->
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
<script type="module" src="../../redirect-on-lacking-support.js"></script>
<!-- As yet no ES6 -->
<script src="../../jquery.min.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="../../external/core-js-bundle/minified.js"></script>
<script src="../../external/regenerator-runtime/runtime.js"></script>
<script type="module" src="index.js"></script>
</head>
<body>
<h1>Select an image:</h1>
<a href="smiley.svg">smiley.svg</a>
<br/>
<a href="../../images/logo.png">logo.png</a>
</body>
</html>

View File

@@ -1,30 +0,0 @@
<!DOCTYPE html>
<!-- AUTO-GENERATED FROM imagelib/index-es.html; DO NOT EDIT; use build/build-html.js to build -->
<html>
<head>
<meta charset="utf-8" />
<title>-</title>
<link rel="icon" type="image/png" href="../../images/logo.png" />
<!-- Lacking browser support -->
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
<script type="module" src="../../redirect-on-lacking-support.js"></script>
<!-- As yet no ES6 -->
<script src="../../jquery.min.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="../../external/core-js-bundle/minified.js"></script>
<script src="../../external/regenerator-runtime/runtime.js"></script>
<script defer="defer" src="../../../../dist/extensions/imagelib/index.js"></script>
</head>
<body>
<h1>Select an image:</h1>
<a href="smiley.svg">smiley.svg</a>
<br/>
<a href="../../images/logo.png">logo.png</a>
</body>
</html>

View File

@@ -1,25 +0,0 @@
<!DOCTYPE html>
<!-- AUTO-GENERATED FROM imagelib/openclipart-es.html; DO NOT EDIT; use build/build-html.js to build -->
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>-</title>
<link rel="icon" type="image/png" href="../../images/logo.png" />
<!-- Lacking browser support -->
<script nomodule="" src="../../redirect-on-no-module-support.js"></script>
<script type="module" src="../../redirect-on-lacking-support.js"></script>
<!-- Browser polyfills -->
<script src="../../../../dist/dom-polyfill.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="../../external/core-js-bundle/minified.js"></script>
<script src="../../external/regenerator-runtime/runtime.js"></script>
<script defer="defer" src="../../../../dist/extensions/imagelib/openclipart.js"></script>
</head>
<body>
</body>
</html>