|
@ -14,3 +14,6 @@ trim_trailing_whitespace = true
|
|||
; [app/public/css/**.styl]
|
||||
; indent_style = tab
|
||||
; indent_size = 2
|
||||
|
||||
[*.md]
|
||||
indent_size = 4
|
||||
|
|
|
@ -15,9 +15,6 @@ editor/xdomain-svgedit-config-iife.js
|
|||
editor/jquery.min.js
|
||||
editor/jquery-ui
|
||||
|
||||
# Previously minified though exporting
|
||||
editor/jquerybbq
|
||||
|
||||
# Previously minified though exporting
|
||||
editor/js-hotkeys
|
||||
|
||||
|
@ -26,8 +23,14 @@ editor/jspdf/underscore-min.js
|
|||
|
||||
editor/extensions/mathjax
|
||||
|
||||
# Todo: We should at least check `compat/compat` in our other files, however
|
||||
editor/external/*
|
||||
!editor/external/dom-polyfill
|
||||
editor/external/dom-polyfill/*
|
||||
!editor/external/dom-polyfill/dom-polyfill.js
|
||||
!editor/external/dynamic-import-polyfill
|
||||
|
||||
mochawesome-report
|
||||
releases
|
||||
!.eslintrc.js
|
||||
!.ncurc.js
|
||||
|
|
420
.eslintrc.js
|
@ -1,57 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: ["ash-nazg/sauron-node"],
|
||||
extends: ['ash-nazg/sauron-node'],
|
||||
parserOptions: {
|
||||
sourceType: "module"
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
browser: true
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
"Array.isArray",
|
||||
"Blob",
|
||||
"console",
|
||||
"Date.now",
|
||||
"document.body",
|
||||
"document.evaluate",
|
||||
"document.head",
|
||||
"document.importNode",
|
||||
"document.querySelector", "document.querySelectorAll",
|
||||
"DOMParser",
|
||||
"Error",
|
||||
"fetch",
|
||||
"FileReader",
|
||||
"history.pushState",
|
||||
"history.replaceState",
|
||||
"JSON",
|
||||
"location.href",
|
||||
"location.origin",
|
||||
"MutationObserver",
|
||||
"Object.assign", "Object.defineProperty", "Object.defineProperties",
|
||||
"Object.getOwnPropertyDescriptor",
|
||||
"Object.entries", "Object.keys", "Object.values",
|
||||
"Promise",
|
||||
"Set",
|
||||
"Uint8Array",
|
||||
"URL",
|
||||
"window.getComputedStyle",
|
||||
"window.postMessage",
|
||||
"window.scrollX", "window.scrollY",
|
||||
"XMLHttpRequest",
|
||||
"XMLSerializer"
|
||||
],
|
||||
jsdoc: {
|
||||
additionalTagNames: {
|
||||
// In case we need to extend
|
||||
customTags: []
|
||||
},
|
||||
augmentsExtendsReplacesDocs: true,
|
||||
augmentsExtendsReplacesDocs: true
|
||||
// Todo: Figure out why this is not working and why seem to have to
|
||||
// disable for all Markdown:
|
||||
/*
|
||||
baseConfig: {
|
||||
rules: {
|
||||
"no-multi-spaces": "off"
|
||||
'no-multi-spaces': 'off'
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -61,87 +32,182 @@ module.exports = {
|
|||
// Locales have no need for importing outside of SVG-Edit
|
||||
{
|
||||
files: [
|
||||
"editor/locale/lang.*.js", "editor/extensions/ext-locale/**",
|
||||
"docs/tutorials/ExtensionDocs.md"
|
||||
'editor/locale/lang.*.js', 'editor/extensions/ext-locale/**',
|
||||
'docs/tutorials/ExtensionDocs.md'
|
||||
],
|
||||
rules: {
|
||||
"import/no-anonymous-default-export": ["off"]
|
||||
'import/no-anonymous-default-export': ['off']
|
||||
}
|
||||
},
|
||||
// These browser files don't do importing or requiring
|
||||
{
|
||||
files: [
|
||||
'editor/svgpathseg.js', 'editor/touch.js', 'editor/typedefs.js',
|
||||
'editor/redirect-on-no-module-support.js',
|
||||
'editor/extensions/imagelib/index.js',
|
||||
'editor/external/dom-polyfill/dom-polyfill.js',
|
||||
'screencasts/svgopen2010/script.js'
|
||||
],
|
||||
rules: {
|
||||
'import/unambiguous': ['off']
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.html', 'screencasts/**'],
|
||||
globals: {
|
||||
root: 'off'
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
'document.querySelector',
|
||||
'history',
|
||||
'history.pushState',
|
||||
'history.replaceState',
|
||||
'Number.parseFloat',
|
||||
'Number.parseInt',
|
||||
'Number.isNaN'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
'import/unambiguous': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['.eslintrc.js', '.ncurc.js', 'tools/mochawesome-cli.js'],
|
||||
extends: [
|
||||
'ash-nazg/sauron-node-script'
|
||||
]
|
||||
},
|
||||
// Our Markdown rules (and used for JSDoc examples as well, by way of
|
||||
// our use of `jsdoc/check-examples` within `ash-nazg`)
|
||||
{
|
||||
files: ['**/*.md'],
|
||||
settings: {
|
||||
polyfills: [
|
||||
// Tutorials
|
||||
'console',
|
||||
'location.href'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
// Todo: Figure out why this is not enough to disable warning
|
||||
// for examples in my environment (but it is in others')
|
||||
// Used in examples of assert-close.js plugin
|
||||
'mocha-cleanup/no-assertions-outside-it': 'off',
|
||||
'eslint-comments/no-unused-disable': 'warn',
|
||||
|
||||
'eol-last': ['off'],
|
||||
'no-console': ['off'],
|
||||
'no-undef': ['off'],
|
||||
'no-unused-vars': ['warn'],
|
||||
'padded-blocks': ['off'],
|
||||
'import/unambiguous': ['off'],
|
||||
'import/no-unresolved': ['off'],
|
||||
'node/no-missing-import': ['off'],
|
||||
'no-multi-spaces': 'off',
|
||||
'sonarjs/no-all-duplicated-branches': 'off',
|
||||
'node/no-unpublished-import': ['error', {
|
||||
allowModules: ['@cypress/fiddle']
|
||||
}],
|
||||
'no-alert': 'off',
|
||||
// Disable until may fix https://github.com/gajus/eslint-plugin-jsdoc/issues/211
|
||||
indent: 'off'
|
||||
}
|
||||
},
|
||||
// Dis-apply Node rules mistakenly giving errors with browser files,
|
||||
// and treating Node global `root` as being present for shadowing
|
||||
{
|
||||
files: ['editor/**'],
|
||||
globals: {
|
||||
root: 'off'
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
// These are the primary polyfills needed by regular users if
|
||||
// not present, e.g., with core-js-bundle; also those under
|
||||
// extensions
|
||||
'Array.isArray',
|
||||
'Blob',
|
||||
'console',
|
||||
'CustomEvent',
|
||||
'document.body',
|
||||
'document.createElementNS',
|
||||
'document.evaluate',
|
||||
'document.head',
|
||||
'document.importNode',
|
||||
'document.querySelectorAll',
|
||||
'DOMParser',
|
||||
'Error',
|
||||
'FileReader',
|
||||
'JSON',
|
||||
'KeyboardEvent',
|
||||
'location.href',
|
||||
'MouseEvent',
|
||||
'MutationObserver',
|
||||
'Number.isNaN',
|
||||
'Number.parseFloat',
|
||||
'Number.parseInt',
|
||||
'Object.assign',
|
||||
'Object.defineProperty',
|
||||
'Object.defineProperties',
|
||||
'Object.entries',
|
||||
'Object.getOwnPropertyDescriptor',
|
||||
'Object.keys',
|
||||
'Object.values',
|
||||
'Promise',
|
||||
'Promise.all',
|
||||
'Set',
|
||||
'Uint8Array',
|
||||
'URL',
|
||||
'URL.createObjectURL',
|
||||
'XMLSerializer',
|
||||
'XMLHttpRequest',
|
||||
'window.getComputedStyle',
|
||||
'window.parent',
|
||||
'window.scrollX',
|
||||
'window.scrollY'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
'node/no-unsupported-features/node-builtins': 'off'
|
||||
}
|
||||
},
|
||||
// For extensions, `this` is generally assigned to be the more
|
||||
// descriptive `svgEditor`; they also have no need for importing outside
|
||||
// of SVG-Edit
|
||||
{
|
||||
files: ["editor/extensions/**/ext-*.js"],
|
||||
rules: {
|
||||
"consistent-this": ["error", "svgEditor"],
|
||||
"import/no-anonymous-default-export": ["off"]
|
||||
}
|
||||
},
|
||||
// These browser files don't do importing or requiring
|
||||
{
|
||||
files: [
|
||||
"editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js",
|
||||
"editor/redirect-on-no-module-support.js",
|
||||
"editor/extensions/imagelib/index.js",
|
||||
"editor/external/dom-polyfill/dom-polyfill.js",
|
||||
"screencasts/svgopen2010/script.js",
|
||||
"opera-widget/handlers.js",
|
||||
"firefox-extension/handlers.js",
|
||||
"firefox-extension/content/svg-edit-overlay.js"
|
||||
],
|
||||
rules: {
|
||||
"import/unambiguous": ["off"]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.html'],
|
||||
rules: {
|
||||
'import/unambiguous': 'off'
|
||||
}
|
||||
},
|
||||
// Our Markdown rules (and used for JSDoc examples as well, by way of
|
||||
// our use of `matchingFileName` in conjunction with
|
||||
// `jsdoc/check-examples` within `ash-nazg`)
|
||||
{
|
||||
files: ["**/*.md"],
|
||||
rules: {
|
||||
"eol-last": ["off"],
|
||||
"no-console": ["off"],
|
||||
"no-undef": ["off"],
|
||||
"no-unused-vars": ["warn"],
|
||||
"padded-blocks": ["off"],
|
||||
"import/unambiguous": ["off"],
|
||||
"import/no-unresolved": ["off"],
|
||||
"node/no-missing-import": ["off"],
|
||||
"no-multi-spaces": "off",
|
||||
"sonarjs/no-all-duplicated-branches": "off",
|
||||
'node/no-unpublished-import': ['error', {allowModules: ['@cypress/fiddle']}],
|
||||
"no-alert": "off",
|
||||
// Disable until may fix https://github.com/gajus/eslint-plugin-jsdoc/issues/211
|
||||
"indent": "off"
|
||||
}
|
||||
},
|
||||
// Dis-apply Node rules mistakenly giving errors with browser files,
|
||||
// and treating Node global `root` as being present for shadowing
|
||||
{
|
||||
files: ["editor/**", "screencasts/**"],
|
||||
globals: {
|
||||
root: "off"
|
||||
files: ['editor/extensions/**'],
|
||||
settings: {
|
||||
polyfills: [
|
||||
'console',
|
||||
'fetch',
|
||||
'location.origin',
|
||||
'Number.isNaN',
|
||||
'Number.parseFloat',
|
||||
'Number.parseInt',
|
||||
'window.postMessage'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
"node/no-unsupported-features/node-builtins": "off"
|
||||
'consistent-this': ['error', 'svgEditor'],
|
||||
'import/no-anonymous-default-export': ['off']
|
||||
}
|
||||
},
|
||||
{
|
||||
// Node files
|
||||
files: [
|
||||
"docs/jsdoc-config.js",
|
||||
"build-html.js",
|
||||
"rollup.config.js", "rollup-config.config.js"
|
||||
'docs/jsdoc-config.js',
|
||||
'build/build-html.js',
|
||||
'rollup.config.js', 'rollup-config.config.js'
|
||||
],
|
||||
env: {
|
||||
node: true,
|
||||
node: true
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
'console',
|
||||
'Promise.resolve'
|
||||
]
|
||||
},
|
||||
globals: {
|
||||
require: true
|
||||
|
@ -151,55 +217,169 @@ module.exports = {
|
|||
// and we have too many modules to add to `peerDependencies`
|
||||
// so this rule can know them to be available, so we instead
|
||||
// disable
|
||||
"node/no-unpublished-import": "off"
|
||||
'node/no-unpublished-import': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
// As consumed by jsdoc, cannot be expressed as ESM
|
||||
files: ["docs/jsdoc-config.js"],
|
||||
files: ['docs/jsdoc-config.js'],
|
||||
parserOptions: {
|
||||
sourceType: "script"
|
||||
sourceType: 'script'
|
||||
},
|
||||
globals: {
|
||||
"module": false
|
||||
module: false
|
||||
},
|
||||
rules: {
|
||||
"import/no-commonjs": "off",
|
||||
"strict": "off"
|
||||
'import/no-commonjs': 'off',
|
||||
strict: 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
extends: ['plugin:node/recommended-script'],
|
||||
files: ['cypress/support/build-coverage-badge.js']
|
||||
// Should probably have as external, but should still check
|
||||
files: ['canvg/rgbcolor.js'],
|
||||
settings: {
|
||||
polyfills: [
|
||||
'Number.isNaN',
|
||||
'Number.parseInt',
|
||||
'Object.assign',
|
||||
'Object.keys'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["cypress/**"],
|
||||
extends: ["plugin:cypress/recommended"],
|
||||
files: ['cypress/plugins/index.js'],
|
||||
extends: [
|
||||
'ash-nazg/sauron-node-script'
|
||||
]
|
||||
},
|
||||
{
|
||||
files: ['cypress/**'],
|
||||
extends: [
|
||||
'plugin:cypress/recommended',
|
||||
'plugin:mocha/recommended',
|
||||
'plugin:mocha-cleanup/recommended-no-limits',
|
||||
'plugin:@fintechstudios/chai-as-promised/recommended',
|
||||
'plugin:chai-expect-keywords/recommended',
|
||||
'plugin:chai-expect/recommended',
|
||||
'plugin:chai-friendly/recommended'
|
||||
],
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
'console',
|
||||
'Date.now',
|
||||
'document.body',
|
||||
'document.createElementNS',
|
||||
'document.head',
|
||||
'DOMParser',
|
||||
'Number.isNaN',
|
||||
'Object.keys',
|
||||
'Object.entries',
|
||||
'Promise'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
// These errors are caused in Cypress files if user has not
|
||||
// yet instrumented code; need to reinvestigate why we had to
|
||||
// instrument separately from nyc mocha
|
||||
'import/no-unresolved': 'warn',
|
||||
'node/no-missing-import': 'warn',
|
||||
|
||||
'chai-expect-keywords/no-unsupported-keywords': [
|
||||
'error', {
|
||||
allowChaiDOM: true
|
||||
}
|
||||
],
|
||||
// Would be good but seems necessary due to some bugs in Cypress
|
||||
// in detecting visibility
|
||||
// 'cypress/no-force': 0,
|
||||
// Good but would be difficult to enforce (and data-* may not be less
|
||||
// brittle than IDs/classes anyways)
|
||||
// 'cypress/require-data-selectors': 0,
|
||||
'cypress/assertion-before-screenshot': 2,
|
||||
|
||||
// Conflicts with Cypress `should`
|
||||
'mocha-cleanup/invalid-assertions': 0,
|
||||
|
||||
// Might see about working around to avoid the option limitation,
|
||||
// but convenient
|
||||
'mocha-cleanup/no-expressions-in-assertions': ['error', {
|
||||
replacementsOnly: true
|
||||
}],
|
||||
|
||||
// Too oppressive when planning to extend a section
|
||||
'mocha/no-hooks-for-single-case': 0,
|
||||
|
||||
// Would be good to enable but needs some refactoring
|
||||
'mocha/no-setup-in-describe': 0,
|
||||
'mocha-cleanup/no-outside-declaration': 0,
|
||||
|
||||
// Useful to ensure allowing `this.timeout()`, etc., but a
|
||||
// little oppressive
|
||||
'mocha/no-mocha-arrows': 0,
|
||||
// Useful if enabling the regular `prefer-arrow-callback`
|
||||
// 'mocha/prefer-arrow-callback': 2
|
||||
|
||||
'jsdoc/require-jsdoc': 0,
|
||||
'no-console': 0,
|
||||
'import/unambiguous': 0,
|
||||
'import/unambiguous': 0
|
||||
}
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
// check-examples is not picking up eslint config properly in some
|
||||
// environments; see also discussion above
|
||||
// `mocha-cleanup/no-assertions-outside-it`
|
||||
'jsdoc/check-examples': ['warn', {
|
||||
rejectExampleCodeRegex: '^`'
|
||||
}],
|
||||
|
||||
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453
|
||||
"unicorn/regex-shorthand": 0,
|
||||
'unicorn/regex-shorthand': 0,
|
||||
// The Babel transform seems to have a problem converting these
|
||||
"prefer-named-capture-group": "off",
|
||||
'prefer-named-capture-group': 'off',
|
||||
// Override these `ash-nazg/sauron` rules which are difficult for us
|
||||
// to apply at this time
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"default-case": "off",
|
||||
"require-unicode-regexp": "off",
|
||||
"max-len": ["off", {
|
||||
'unicorn/prefer-string-slice': 'off',
|
||||
'default-case': 'off',
|
||||
'require-unicode-regexp': 'off',
|
||||
'max-len': 'off', /* , {
|
||||
ignoreUrls: true,
|
||||
ignoreRegExpLiterals: true
|
||||
}],
|
||||
"unicorn/prefer-query-selector": "off",
|
||||
"unicorn/prefer-node-append": "off",
|
||||
"unicorn/no-zero-fractions": "off"
|
||||
} */
|
||||
'unicorn/prefer-query-selector': 'off',
|
||||
'unicorn/prefer-node-append': 'off',
|
||||
'unicorn/no-zero-fractions': 'off',
|
||||
'unicorn/prefer-number-properties': 'off',
|
||||
'jsdoc/require-file-overview': ['error', {
|
||||
tags: {
|
||||
file: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
},
|
||||
license: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
},
|
||||
copyright: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
},
|
||||
author: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
},
|
||||
module: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
},
|
||||
exports: {
|
||||
initialCommentsOnly: true,
|
||||
preventDuplicates: true
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
github: [brettz9] # May have up to 4 comma-separated user names
|
|
@ -3,6 +3,7 @@ name: Bug report
|
|||
about: Create a report in case we may be able to help
|
||||
|
||||
---
|
||||
**PLEASE NOTE: This project is not currently being actively developed due to the core developers having moved on, and the only remaining maintainer merely applying occasional minor PRs or tweaks to keep the project alive. While you can file an issue, you should not expect any action, even if we label the issue.**
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
@ -36,5 +37,9 @@ A clear and concise description of what you expected to happen.
|
|||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Log**
|
||||
If applicable, copy any error logs in your browser console. This can be very
|
||||
helpful in identifying the problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
ignore
|
||||
node_modules
|
||||
|
||||
build/
|
||||
|
||||
svgedit-custom.css
|
||||
|
||||
docs/jsdoc
|
||||
|
||||
cypress/results
|
||||
cypress/screenshots
|
||||
cypress/videos
|
||||
cypress.env.json
|
||||
|
||||
coverage/**
|
||||
instrumented/**
|
||||
coverage
|
||||
instrumented
|
||||
.nyc_output
|
||||
mochawesome-report
|
||||
mochawesome.json
|
||||
|
||||
.vscode
|
||||
.eslintcache
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
reject: [
|
||||
// Todo: Old copy with jspdf which needs updating: https://github.com/SVG-Edit/svgedit/issues/51
|
||||
'underscore'
|
||||
]
|
||||
};
|
|
@ -2,8 +2,10 @@ ignore
|
|||
screencasts
|
||||
|
||||
.github/ISSUE_TEMPLATE/bug_report.md
|
||||
gh-disabled-workflows
|
||||
build
|
||||
lgtm.yml
|
||||
.travis.yml
|
||||
|
||||
cypress/**
|
||||
cypress.env.json
|
||||
|
@ -11,3 +13,10 @@ cypress.env.json
|
|||
coverage/**
|
||||
.nyc_output
|
||||
instrumented/**
|
||||
mochawesome-report/**
|
||||
mochawesome.json
|
||||
|
||||
releases
|
||||
|
||||
tools
|
||||
.eslintcache
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
language: ruby
|
||||
rvm:
|
||||
- 2.3
|
||||
script: "bundle exec jekyll build"
|
4
AUTHORS
|
@ -1,5 +1,5 @@
|
|||
Narendra Sisodiya <narendra@narendrasisodiya.com>
|
||||
Pavol Rusnak <stick@gk2.sk>
|
||||
Pavol Rusnak <pavol@rusnak.io>
|
||||
Jeff Schiller <codedread@gmail.com>
|
||||
Vidar Hokstad <vidar.hokstad@gmail.com>
|
||||
Alexis Deveria <adeveria@gmail.com>
|
||||
|
@ -19,5 +19,5 @@ ja: Dong <iwadon@yarhalla.jpn.org> (日本語)
|
|||
nl: Jaap Blom <jaap.blom@gmail.com> (Nederlands)
|
||||
ro: Christian Tzurcanu <christian.tzurcanu@gmail.com> (Româneşte)
|
||||
ru: Laurent Dufloux <laurent.dufloux@etu.upmc.fr> (Русский)
|
||||
sk: Pavol Rusnak <stick@gk2.sk> (Slovenčina)
|
||||
sk: Pavol Rusnak <pavol@rusnak.io> (Slovenčina)
|
||||
zh-TW: 黃瀚生 (Han Sheng Huang) <zenixls2@gmail.com> (台灣正體)
|
||||
|
|
89
CHANGES.md
|
@ -1,22 +1,109 @@
|
|||
# SVG-Edit CHANGES
|
||||
|
||||
## ?
|
||||
## 6.0.0 (unreleased)
|
||||
|
||||
- Project: Add `FUNDING.yml` to accept contributions
|
||||
- License: Reflect actual license of library in `package.json` based
|
||||
not only on licenses of repository as a whole (i.e., "MIT") but
|
||||
individual component files; see `filesByLicense` in `licenseInfo.json`
|
||||
for a map of license to these files within the repo with their own
|
||||
licenses. See the new license badges on the README for a summary of
|
||||
the licenses including either bundled devDependencies or all
|
||||
`devDependencies` (we have no direct npm `dependencies` currently).
|
||||
- License: Add note about unclear provenance of some images
|
||||
- License: Relicense ext-mathjax from Apache-2.0 to MIT per
|
||||
<https://github.com/josegaert/ext-mathjax/issues/6>
|
||||
- License: Clarify in `@license` that `ext-server_moinsave.js` is
|
||||
"(MIT OR GPL-2.0-or-later)" per subsequent text
|
||||
- License: Reorder license listing in `jquery.contextMenu.js` so
|
||||
that more permissive is noticeable first
|
||||
- License: Replace CC-BY-SA-2.0 polygon image (thanks, @mowijo !)
|
||||
- BREAKING CHANGE: Remove `$.pref` in favor of new `svgEditor.pref`
|
||||
(avoiding polluting jQuery). (Might be moved to own module in
|
||||
future.)
|
||||
- BREAKING CHANGE: `putLocale` (a function called automatically by
|
||||
`svg-editor.js`) no longer checks `pref`. Should not impact
|
||||
average consumers.
|
||||
- BREAKING CHANGE: Move clipboard from `localStorage` to `sessionStorage`
|
||||
(@NeilFraser)
|
||||
- Fix: main menu style and text #371
|
||||
- Fix (Accessibility): Avoid duplicate IDs
|
||||
- Fix (openclipart browser): Redirect on lacking browser support
|
||||
- Fix: Misspelling for `dropXMLInternalSubset` method (also fixes
|
||||
use in imagelib when defaulting to image's title)
|
||||
- Fix: Redirect paths for imagelib redirect checks
|
||||
- Fix: Ensure `setupCurPrefs` is run (including when `source` or
|
||||
`url` is set within the URL)
|
||||
- Fix: Pressing 'Ctrl+A' causes js error when canvas is empty (@cuixiping)
|
||||
- Fix: Path element cannot be exported to PDF; export path with
|
||||
holes to PDF; export path element to PDF, support more path
|
||||
commands; #269 (@cuixiping)
|
||||
- Fix: remove "null" attributes in svg source #76 (@cuixiping)
|
||||
- Fix: A bug of `convertPath` function when converting H and V to
|
||||
relative (@cuixiping)
|
||||
- Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file
|
||||
- Optimization: Remove old build/tools closure/yuicompressor code
|
||||
- Optimization: Remove unmaintained chrome-app, firefox-extension,
|
||||
opera-widget (an updated WebExtensions replacement (or such)
|
||||
would be welcome.)
|
||||
- Localization: Add 'SVG-Edit Home Page' to locale files
|
||||
- Docs: Remove outdated info on jsdoc linting (now just part of eslint config)
|
||||
- Docs: Add testing badge
|
||||
- Docs: Update coverage badge per latest coveradge
|
||||
- Docs: Add license badges and `licenseInfo.json` (has a
|
||||
`filesByLicense` map of files to licenses (not yet used programmatically)
|
||||
and `bundledRootPackages` which is used by `license-badger` to know which
|
||||
dev. packages are being bundled (added by `npm run copy`) for determining
|
||||
summary of all licenses including bundled).
|
||||
- Docs: Reprioritize `docs` in commit lists (prioritize user-facing)
|
||||
- Docs: Update Pavol's email address (@prusnak)
|
||||
- Docs: Update license badges to reflect lack of (known) CC-BY-SA-2.0 usage
|
||||
- Docs: Update Contributing, Testing (renamed to Development),
|
||||
Linting and ReleaseInstructions
|
||||
- Update: Cypress code coverage plugin
|
||||
- Refactoring: Switch from `$.param.querystring` to `URL`
|
||||
- Refactoring: Ensure file-global jsdoc tags are at beginning of file
|
||||
- Refactoring: Move `build-html` to `build` directory
|
||||
- Refactoring: Add favicon no-op to suppress favicon 404s until
|
||||
loaded dynamically (might make configurable in future)
|
||||
- Linting (ESLint): Simplify regexes
|
||||
- Linting (ESLint): Replace `innerHTML` with `textContent` from old demo
|
||||
- Linting (ESLint): Update as per latest ash-nazg
|
||||
- Linting (ESLint): Add rules to check for file-level tags
|
||||
- Linting (ESLint): Check hidden rc files
|
||||
- Linting (ESLint): Add linting plugins (mocha, chai-expect, chai-friendly,
|
||||
cypress)
|
||||
- Linting (ESLint): Add `@fintechstudieos/eslint-plugin-chai-as-promised`,
|
||||
`eslint-plugin-chai-expect-keywords`, and `eslint-plugin-mocha-cleanup`
|
||||
plugins
|
||||
- Testing: Switch to Cypress with code coverage for UI testing;
|
||||
use ESM version for faster debugging
|
||||
- Testing: Add map file for underscore
|
||||
- Testing: Separate tests into unit/ui; split UI tests by specific domain;
|
||||
setup browser-bug folder and ui issues folder
|
||||
- Testing: Create test utilities for selecting English and visiting and
|
||||
approving storage
|
||||
- Testing: Produce mochawesome report
|
||||
- Testing: Cypress with multiple reporters in case we need
|
||||
- Build: Update underscore and core-js-bundle copies
|
||||
- npm: Add `underscore` to copy script
|
||||
- npm: Make `copy`, `compress-images`, `start-embedded`, `build-docs-remove`
|
||||
scripts cross-platform; add `start-allow-origin` script
|
||||
- npm: Rename open script to open-tests, and add `open` script for opening
|
||||
instance of svgedit
|
||||
- npm: Ensure starting server for open scripts
|
||||
- npm/Linting: Add `--cache` to speed up subsequent linting
|
||||
- npm: Fix scripts for Windows development (needed for
|
||||
building docs and instrumenting)
|
||||
- npm: Update scripts to reflect removal of `all_tests.html`;
|
||||
remove `browser-test` script
|
||||
- npm: Add `add-release` script
|
||||
- npm: Add reporting scripts (tests and coverage)
|
||||
- npm: Add `license-badges`, `build-docs`, and `copy` scripts to `prepublishOnly` script
|
||||
- npm: Rename `test-prep` to `prep` and other misc. script naming changes
|
||||
- npm: Update `package-lock.json`
|
||||
- npm: Update from deprecated `rollup-plugin-babel` to `@rollup/plugin-babel`
|
||||
(and make `babelHelpers` explicit)
|
||||
- npm: Update devDeps, peerDeps
|
||||
|
||||
## 5.1.0
|
||||
|
|
41
README.md
|
@ -1,4 +1,4 @@
|
|||
# ![alt text](https://svg-edit.github.io/svgedit/images/logo48x48.svg "svg-edit logo of a pencil") SVG-edit
|
||||
# ![LOGO](editor/images/logo.png) SVG-edit
|
||||
|
||||
[![npm](https://img.shields.io/npm/v/svgedit.svg)](https://www.npmjs.com/package/svgedit)
|
||||
[![Dependencies](https://img.shields.io/david/SVG-Edit/svgedit.svg)](https://david-dm.org/SVG-Edit/svgedit)
|
||||
|
@ -7,19 +7,33 @@
|
|||
<!-- [![Actions Status](https://github.com/SVG-Edit/svgedit/workflows/Node%20CI/badge.svg)](https://github.com/SVG-Edit/svgedit/actions)
|
||||
[![Actions Status](https://github.com/SVG-Edit/svgedit/workflows/Coverage/badge.svg)](https://github.com/SVG-Edit/svgedit/actions)
|
||||
-->
|
||||
[![coverage badge](coverage-badge.svg)](coverage-badge.svg)
|
||||
[![Tests badge](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/badges/tests-badge.svg?sanitize=true)](badges/tests-badge.svg)
|
||||
[![Coverage badge](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/badges/coverage-badge.svg?sanitize=true)](badges/coverage-badge.svg)
|
||||
|
||||
[![Known Vulnerabilities](https://snyk.io/test/github/SVG-Edit/svgedit/badge.svg)](https://snyk.io/test/github/SVG-Edit/svgedit)
|
||||
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/SVG-Edit/svgedit.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/SVG-Edit/svgedit/alerts)
|
||||
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/SVG-Edit/svgedit.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/SVG-Edit/svgedit/context:javascript)
|
||||
|
||||
[![License](https://img.shields.io/npm/l/svgedit.svg)](LICENSE-MIT)
|
||||
[![Licenses badge](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/badges/licenses-badge.svg?sanitize=true)](badges/licenses-badge.svg)
|
||||
|
||||
(see also [licenses for dev. deps.](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/badges/licenses-badge-dev.svg?sanitize=true))
|
||||
|
||||
(Note: The license provenance of the images in `/editor/images` may not be
|
||||
fully clear, even with the origin of some of the images listed as being from <http://tango.freedesktop.org/static/cvs/tango-art-libre/22x22/>. We would like to
|
||||
replace these images if their provenance cannot be determined or is found to
|
||||
be under a protective license. If you know of the original terms, or can help
|
||||
create SVG replacement images, please let us know at:
|
||||
[#377](https://github.com/SVG-Edit/svgedit/issues/377).)
|
||||
<!-- [![License](https://img.shields.io/npm/l/svgedit.svg)](LICENSE-MIT) -->
|
||||
|
||||
[![issuehunt-to-marktext](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/r/SVG-Edit/svgedit)
|
||||
|
||||
SVG-edit is a fast, web-based, JavaScript-driven SVG drawing editor that
|
||||
works in any modern browser.
|
||||
|
||||
![screenshot](docs/screenshot.png)
|
||||
[SVG](https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg)
|
||||
|
||||
## Help wanted
|
||||
|
||||
While we have made some recent releases to SVG-edit for bug fixes,
|
||||
|
@ -30,29 +44,40 @@ to join the project.
|
|||
|
||||
## Demo
|
||||
|
||||
### [Try SVG-edit here](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor.html)
|
||||
### [Try SVG-edit here](https://svg-edit.github.io/svgedit/editor/svg-editor.html)
|
||||
|
||||
See the [latest release](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor.html)
|
||||
<!-- See the [latest release](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor.html)
|
||||
(or its [ES6-Module](https://svg-edit.github.io/svgedit/releases/latest/editor/svg-editor-es.html)
|
||||
version, which requires a modern browser).
|
||||
-->
|
||||
See a working editor on [`master`](https://svg-edit.github.io/svgedit/editor/svg-editor.html) (or its [ES6-Module](https://svg-edit.github.io/svgedit/editor/svg-editor-es.html)
|
||||
version, which requires a modern browser).
|
||||
|
||||
You may also try it at <https://unpkg.com/svgedit/editor/svg-editor.html>
|
||||
(which redirects to a versioned URL).
|
||||
|
||||
You may also obtain URLs for specific [releases](https://github.com/SVG-Edit/svgedit/releases).
|
||||
|
||||
For testing the latest version in `master`, you may use
|
||||
<https://raw.githack.com/SVG-Edit/svgedit/master/editor/svg-editor.html>.
|
||||
You may test the [latest version in `master`](https://svg-edit.github.io/svgedit/editor/svg-editor-es.html)
|
||||
which is the ESM version. (The [non-ESM version](https://svg-edit.github.io/svgedit/editor/svg-editor.html)
|
||||
on `master` may be updated less frequently.)
|
||||
|
||||
## Installation
|
||||
|
||||
### Quick install
|
||||
|
||||
1. Clone or copy the repository contents (at least the `editor` directory).
|
||||
Please note that you should not do a recursive Git clone (i.e., with the
|
||||
`--recursive` or `--recurse-submodules` flags), as you will get assorted
|
||||
past versions (which are available on the parent as branches anyways).
|
||||
(The reason these past versions are available as submodules is merely
|
||||
for convenience in hosting these versions, along with `master`, online
|
||||
on Github Pages.)
|
||||
1. If you need programmatic customization, see its section below.
|
||||
1. Otherwise, just add an iframe to your site, adding any extensions or
|
||||
configuration (see `docs/tutorials/ConfigOptions.md`
|
||||
([ConfigOptions]{@tutorial ConfigOptions})) within the URL:
|
||||
|
||||
```html
|
||||
<iframe src="svgedit/editor/svg-editor.html?extensions="
|
||||
width="100%" height="100%"></iframe>
|
||||
|
@ -134,6 +159,8 @@ incorporating SVGEdit. You will need to have Node.js/npm installed.
|
|||
|
||||
## Recent news
|
||||
|
||||
- 2020-02-22 Published 6.0.0 License clarifications/updates, PDF export
|
||||
improvements, clipboard `sessionStorage`, and other changes.
|
||||
- 2019-11-16 Published 5.1.0 Misc. fixes and refactoring
|
||||
- 2019-05-07 Published 5.0.0 Change from `@babel/polyfill`
|
||||
- 2019-04-03 Published 4.3.0 Fix for double click on gradient
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="421" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h113v20H0zM113 0h109v20H113zM222 0h87v20h-87zM309 0h112v20H309z"/><path fill="url(#smooth)" d="M0 0h421v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 42.5%</text><text class="high" x="5" y="14">Statements 42.5%</text><text class="shadow" x="118.5" y="15">Branches 31.25%</text><text class="high" x="118" y="14">Branches 31.25%</text><text class="shadow" x="227.5" y="15">Lines 43.61%</text><text class="high" x="227" y="14">Lines 43.61%</text><text class="shadow" x="314.5" y="15">Functions 48.57%</text><text class="high" x="314" y="14">Functions 48.57%</text></g></svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="839" height="224"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h88v224H0z"/><path fill="#006400" d="M88 0h131v224H88z"/><path fill="green" d="M219 0h266v224H219z"/><path fill="#cc0" d="M485 0h79v224h-79z"/><path fill="#a9a9a9" d="M564 0h106v224H564z"/><path fill="#d3d3d3" d="M670 0h169v224H670z"/><path fill="url(#smooth)" d="M0 0h839v224H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(all devDeps)</text><text class="high" x="5" y="26">(all devDeps)</text><text class="shadow" x="93.5" y="15">Public</text><text class="high" x="93" y="14">Public</text><text class="shadow" x="93.5" y="27">domain</text><text class="high" x="93" y="26">domain</text><text class="shadow" x="93.5" y="51">1. (MIT OR CC0-1.0)</text><text class="high" x="93" y="50">1. (MIT OR CC0-1.0)</text><text class="shadow" x="93.5" y="63">2. CC0-1.0</text><text class="high" x="93" y="62">2. CC0-1.0</text><text class="shadow" x="93.5" y="75">3. Unlicense</text><text class="high" x="93" y="74">3. Unlicense</text><text class="shadow" x="224.5" y="15">Permissive</text><text class="high" x="224" y="14">Permissive</text><text class="shadow" x="224.5" y="39">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="high" x="224" y="38">1. (AFL-2.1 OR BSD-3-Clause)</text><text class="shadow" x="224.5" y="51">2. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="high" x="224" y="50">2. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="shadow" x="224.5" y="63">3. (GPL-3.0-or-later OR MIT)</text><text class="high" x="224" y="62">3. (GPL-3.0-or-later OR MIT)</text><text class="shadow" x="224.5" y="75">4. (MIT OR Apache-2.0)</text><text class="high" x="224" y="74">4. (MIT OR Apache-2.0)</text><text class="shadow" x="224.5" y="87">5. (MPL-2.0 OR Apache-2.0)</text><text class="high" x="224" y="86">5. (MPL-2.0 OR Apache-2.0)</text><text class="shadow" x="224.5" y="99">6. (WTFPL OR MIT)</text><text class="high" x="224" y="98">6. (WTFPL OR MIT)</text><text class="shadow" x="224.5" y="111">7. Apache</text><text class="high" x="224" y="110">7. Apache</text><text class="shadow" x="224.5" y="123">8. Apache-2.0</text><text class="high" x="224" y="122">8. Apache-2.0</text><text class="shadow" x="224.5" y="135">9. Artistic-2.0</text><text class="high" x="224" y="134">9. Artistic-2.0</text><text class="shadow" x="224.5" y="147">10. BSD-2-Clause</text><text class="high" x="224" y="146">10. BSD-2-Clause</text><text class="shadow" x="224.5" y="159">11. BSD-3-Clause</text><text class="high" x="224" y="158">11. BSD-3-Clause</text><text class="shadow" x="224.5" y="171">12. CC-BY-3.0</text><text class="high" x="224" y="170">12. CC-BY-3.0</text><text class="shadow" x="224.5" y="183">13. CC-BY-4.0</text><text class="high" x="224" y="182">13. CC-BY-4.0</text><text class="shadow" x="224.5" y="195">14. ISC</text><text class="high" x="224" y="194">14. ISC</text><text class="shadow" x="224.5" y="207">15. MIT</text><text class="high" x="224" y="206">15. MIT</text><text class="shadow" x="224.5" y="219">16. Zlib</text><text class="high" x="224" y="218">16. Zlib</text><text class="shadow" x="490.5" y="15">Weakly</text><text class="high" x="490" y="14">Weakly</text><text class="shadow" x="490.5" y="27">protective</text><text class="high" x="490" y="26">protective</text><text class="shadow" x="490.5" y="51">1. LGPL-3.0</text><text class="high" x="490" y="50">1. LGPL-3.0</text><text class="shadow" x="490.5" y="63">2. MPL-2.0</text><text class="high" x="490" y="62">2. MPL-2.0</text><text class="shadow" x="569.5" y="15">Uncategorized</text><text class="high" x="569" y="14">Uncategorized</text><text class="shadow" x="569.5" y="39">1. jsonify (0.0.0)</text><text class="high" x="569" y="38">1. jsonify (0.0.0)</text><text class="shadow" x="675.5" y="15">Missing</text><text class="high" x="675" y="14">Missing</text><text class="shadow" x="675.5" y="39">1. boundary (1.0.1)</text><text class="high" x="675" y="38">1. boundary (1.0.1)</text><text class="shadow" x="675.5" y="51">2. structured-source (3.0.2)</text><text class="high" x="675" y="50">2. structured-source (3.0.2)</text><text class="shadow" x="675.5" y="63">3. taffydb (2.6.2)</text><text class="high" x="675" y="62">3. taffydb (2.6.2)</text></g></svg>
|
After Width: | Height: | Size: 4.6 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="445" height="80"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h227v80H0z"/><path fill="green" d="M227 0h90v80h-90z"/><path fill="#cc0" d="M317 0h128v80H317z"/><path fill="url(#smooth)" d="M0 0h445v80H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(project, deps, and bundled devDeps)</text><text class="high" x="5" y="26">(project, deps, and bundled devDeps)</text><text class="shadow" x="232.5" y="15">Permissive</text><text class="high" x="232" y="14">Permissive</text><text class="shadow" x="232.5" y="39">1. Apache-2.0</text><text class="high" x="232" y="38">1. Apache-2.0</text><text class="shadow" x="232.5" y="51">2. ISC</text><text class="high" x="232" y="50">2. ISC</text><text class="shadow" x="232.5" y="63">3. MIT</text><text class="high" x="232" y="62">3. MIT</text><text class="shadow" x="232.5" y="75">4. X11</text><text class="high" x="232" y="74">4. X11</text><text class="shadow" x="322.5" y="15">Weakly</text><text class="high" x="322" y="14">Weakly</text><text class="shadow" x="322.5" y="27">protective</text><text class="high" x="322" y="26">protective</text><text class="shadow" x="322.5" y="51">1. LGPL-3.0-or-later</text><text class="high" x="322" y="50">1. LGPL-3.0-or-later</text></g></svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">127/128</text><text class="high" x="46" y="14">127/128</text></g></svg>
|
After Width: | Height: | Size: 823 B |
|
@ -19,7 +19,7 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM xdomain-svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
<!-- AUTO-GENERATED FROM xdomain-svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
|
||||
],
|
||||
[
|
||||
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
||||
|
@ -47,7 +47,7 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
|
||||
]
|
||||
]
|
||||
},
|
||||
|
@ -58,7 +58,7 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build/build-html.js to build -->`
|
||||
],
|
||||
[
|
||||
'<script type="module" src="redirect-on-lacking-support.js"></script>',
|
||||
|
@ -85,7 +85,7 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM imagelib/openclipart-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
<!-- AUTO-GENERATED FROM imagelib/openclipart-es.html; DO NOT EDIT; use build/build-html.js to build -->`
|
||||
],
|
||||
[
|
||||
'<script src="../../external/dom-polyfill/dom-polyfill.js"></script>',
|
||||
|
@ -108,7 +108,7 @@ const filesAndReplacements = [
|
|||
[
|
||||
'<!DOCTYPE html>',
|
||||
`<!DOCTYPE html>
|
||||
<!-- AUTO-GENERATED FROM imagelib/index-es.html; DO NOT EDIT; use build-html.js to build -->`
|
||||
<!-- AUTO-GENERATED FROM imagelib/index-es.html; DO NOT EDIT; use build/build-html.js to build -->`
|
||||
],
|
||||
[
|
||||
'<script type="module" src="index.js"></script>',
|
|
@ -1,202 +0,0 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -1,289 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Contents
|
||||
//
|
||||
|
||||
The Closure Compiler performs checking, instrumentation, and
|
||||
optimizations on JavaScript code. The purpose of this README is to
|
||||
explain how to build and run the Closure Compiler.
|
||||
|
||||
The Closure Compiler requires Java 6 or higher.
|
||||
http://www.java.com/
|
||||
|
||||
|
||||
//
|
||||
// Building The Closure Compiler
|
||||
//
|
||||
|
||||
There are three ways to get a Closure Compiler executable.
|
||||
|
||||
1) Use one we built for you.
|
||||
|
||||
Pre-built Closure binaries can be found at
|
||||
http://code.google.com/p/closure-compiler/downloads/list
|
||||
|
||||
|
||||
2) Check out the source and build it with Apache Ant.
|
||||
|
||||
First, check out the full source tree of the Closure Compiler. There
|
||||
are instructions on how to do this at the project site.
|
||||
http://code.google.com/p/closure-compiler/source/checkout
|
||||
|
||||
Apache Ant is a cross-platform build tool.
|
||||
http://ant.apache.org/
|
||||
|
||||
At the root of the source tree, there is an Ant file named
|
||||
build.xml. To use it, navigate to the same directory and type the
|
||||
command
|
||||
|
||||
ant jar
|
||||
|
||||
This will produce a jar file called "build/compiler.jar".
|
||||
|
||||
|
||||
3) Check out the source and build it with Eclipse.
|
||||
|
||||
Eclipse is a cross-platform IDE.
|
||||
http://www.eclipse.org/
|
||||
|
||||
Under Eclipse's File menu, click "New > Project ..." and create a
|
||||
"Java Project." You will see an options screen. Give the project a
|
||||
name, select "Create project from existing source," and choose the
|
||||
root of the checked-out source tree as the existing directory. Verify
|
||||
that you are using JRE version 6 or higher.
|
||||
|
||||
Eclipse can use the build.xml file to discover rules. When you
|
||||
navigate to the build.xml file, you will see all the build rules in
|
||||
the "Outline" pane. Run the "jar" rule to build the compiler in
|
||||
build/compiler.jar.
|
||||
|
||||
|
||||
//
|
||||
// Running The Closure Compiler
|
||||
//
|
||||
|
||||
Once you have the jar binary, running the Closure Compiler is straightforward.
|
||||
|
||||
On the command line, type
|
||||
|
||||
java -jar compiler.jar
|
||||
|
||||
This starts the compiler in interactive mode. Type
|
||||
|
||||
var x = 17 + 25;
|
||||
|
||||
then hit "Enter", then hit "Ctrl-Z" (on Windows) or "Ctrl-D" (on Mac or Linux)
|
||||
and "Enter" again. The Compiler will respond:
|
||||
|
||||
var x=42;
|
||||
|
||||
The Closure Compiler has many options for reading input from a file,
|
||||
writing output to a file, checking your code, and running
|
||||
optimizations. To learn more, type
|
||||
|
||||
java -jar compiler.jar --help
|
||||
|
||||
You can read more detailed documentation about the many flags at
|
||||
http://code.google.com/closure/compiler/docs/gettingstarted_app.html
|
||||
|
||||
|
||||
//
|
||||
// Compiling Multiple Scripts
|
||||
//
|
||||
|
||||
If you have multiple scripts, you should compile them all together with
|
||||
one compile command.
|
||||
|
||||
java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
|
||||
|
||||
The Closure Compiler will concatenate the files in the order they're
|
||||
passed at the command line.
|
||||
|
||||
If you need to compile many, many scripts together, you may start to
|
||||
run into problems with managing dependencies between scripts. You
|
||||
should check out the Closure Library. It contains functions for
|
||||
enforcing dependencies between scripts, and a tool called calcdeps.py
|
||||
that knows how to give scripts to the Closure Compiler in the right
|
||||
order.
|
||||
|
||||
http://code.google.com/p/closure-library/
|
||||
|
||||
//
|
||||
// Licensing
|
||||
//
|
||||
|
||||
Unless otherwise stated, all source files are licensed under
|
||||
the Apache License, Version 2.0.
|
||||
|
||||
|
||||
-----
|
||||
Code under:
|
||||
src/com/google/javascript/rhino
|
||||
test/com/google/javascript/rhino
|
||||
|
||||
URL: http://www.mozilla.org/rhino
|
||||
Version: 1.5R3, with heavy modifications
|
||||
License: Netscape Public License and MPL / GPL dual license
|
||||
|
||||
Description: A partial copy of Mozilla Rhino. Mozilla Rhino is an
|
||||
implementation of JavaScript for the JVM. The JavaScript parser and
|
||||
the parse tree data structures were extracted and modified
|
||||
significantly for use by Google's JavaScript compiler.
|
||||
|
||||
Local Modifications: The packages have been renamespaced. All code not
|
||||
relavant to parsing has been removed. A JSDoc parser and static typing
|
||||
system have been added.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/libtrunk_rhino_parser_jarjared.jar
|
||||
|
||||
Rhino
|
||||
URL: http://www.mozilla.org/rhino
|
||||
Version: Trunk
|
||||
License: Netscape Public License and MPL / GPL dual license
|
||||
|
||||
Description: Mozilla Rhino is an implementation of JavaScript for the JVM.
|
||||
|
||||
Local Modifications: None. We've used JarJar to renamespace the code
|
||||
post-compilation. See:
|
||||
http://code.google.com/p/jarjar/
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/args4j_deploy.jar
|
||||
|
||||
Args4j
|
||||
URL: https://args4j.dev.java.net/
|
||||
Version: 2.0.9
|
||||
License: MIT
|
||||
|
||||
Description:
|
||||
args4j is a small Java class library that makes it easy to parse command line
|
||||
options/arguments in your CUI application.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/guava-r06.jar
|
||||
|
||||
Guava Libraries
|
||||
URL: http://code.google.com/p/guava-libraries/
|
||||
Version: R6
|
||||
License: Apache License 2.0
|
||||
|
||||
Description: Google's core Java libraries.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/hamcrest-core-1.1.jar
|
||||
|
||||
Hamcrest
|
||||
URL: http://code.google.com/p/hamcrest
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
Description:
|
||||
Provides a library of matcher objects (also known as constraints or
|
||||
predicates) allowing 'match' rules to be defined declaratively, to be used in
|
||||
other frameworks. Typical scenarios include testing frameworks, mocking
|
||||
libraries and UI validation rules.
|
||||
|
||||
Local modifications:
|
||||
The original jars contained both source code and compiled classes.
|
||||
|
||||
hamcrest-core-1.1.jar just contains the compiled classes.
|
||||
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/jsr305.jar
|
||||
|
||||
Annotations for software defect detection
|
||||
URL: http://code.google.com/p/jsr-305/
|
||||
Version: svn revision 47
|
||||
License: BSD License
|
||||
|
||||
Description: Annotations for software defect detection.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
----
|
||||
Code in:
|
||||
lib/junit.jar
|
||||
|
||||
JUnit
|
||||
URL: http://sourceforge.net/projects/junit/
|
||||
Version: 4.5
|
||||
License: Common Public License 1.0
|
||||
|
||||
Description: A framework for writing and running automated tests in Java.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/protobuf-java-2.3.0.jar
|
||||
|
||||
Protocol Buffers
|
||||
URL: http://code.google.com/p/protobuf/
|
||||
Version: 2.3.0
|
||||
License: New BSD License
|
||||
|
||||
Description: Supporting libraries for protocol buffers,
|
||||
an encoding of structured data.
|
||||
|
||||
Local Modifications: None
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/ant_deploy.jar
|
||||
|
||||
URL: http://ant.apache.org/bindownload.cgi
|
||||
Version: 1.6.5
|
||||
License: Apache License 2.0
|
||||
Description:
|
||||
Ant is a Java based build tool. In theory it is kind of like "make"
|
||||
without make's wrinkles and with the full portability of pure java code.
|
||||
|
||||
Local Modifications:
|
||||
Modified apache-ant-1.6.5/bin/ant to look in the ant.runfiles directory
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/json.jar
|
||||
URL: http://json.org/java/index.html
|
||||
Version: JSON version 2
|
||||
License: MIT license
|
||||
Description:
|
||||
JSON is a set of java files for use in transmitting data in JSON format.
|
||||
|
||||
Local Modifications: None
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ship.py
|
||||
#
|
||||
# Licensed under the Apache 2 License as is the rest of the project
|
||||
# Copyright (c) 2011 Jeff Schiller
|
||||
#
|
||||
# This script has very little real-world application. It is only used in our pure-client web app
|
||||
# served on GoogleCode so we can have one HTML file, run a build script and generate a 'release'
|
||||
# version without having to maintain two separate HTML files. It does this by evaluating
|
||||
# 'processing comments' that are suspicously similar to IE conditional comments and then outputting
|
||||
# a new HTML file after evaluating particular variables.
|
||||
#
|
||||
# This script takes the following inputs:
|
||||
#
|
||||
# * a HTML file (--i=in.html)
|
||||
# * a series of flag names (--on=Foo --on=Bar)
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# in.html:
|
||||
# <!--{if foo}>
|
||||
# FOO!
|
||||
# <!{else}-->
|
||||
# BAR!
|
||||
# <!--{endif}-->
|
||||
#
|
||||
# $ ship.py --i in.html --on foo
|
||||
#
|
||||
# out.html:
|
||||
# <!--{if foo}-->
|
||||
# FOO!
|
||||
# <!--{else}>
|
||||
# BAR!
|
||||
# <!{endif}-->
|
||||
#
|
||||
# It has the following limitations:
|
||||
#
|
||||
# 1) Only if-else-endif are currently supported.
|
||||
# 2) All processing comments must be on one line with no other non-whitespace characters.
|
||||
# 3) Comments cannot be nested.
|
||||
|
||||
import optparse
|
||||
import os
|
||||
|
||||
inside_if = False
|
||||
last_if_true = False
|
||||
|
||||
_options_parser = optparse.OptionParser(
|
||||
usage='%prog --i input.html [--on flag1]',
|
||||
description=('Rewrites an HTML file based on conditional comments and flags'))
|
||||
_options_parser.add_option('--i',
|
||||
action='store', dest='input_html_file', help='Input HTML filename')
|
||||
_options_parser.add_option('--on',
|
||||
action='append', type='string', dest='enabled_flags',
|
||||
help='name of flag to enable')
|
||||
|
||||
def parse_args(args=None):
|
||||
options, rargs = _options_parser.parse_args(args)
|
||||
return options, (None, None)
|
||||
|
||||
def parseComment(line, line_num, enabled_flags):
|
||||
global inside_if
|
||||
global last_if_true
|
||||
|
||||
start = line.find('{')
|
||||
end = line.find('}')
|
||||
statement = line[start+1:end].strip()
|
||||
if statement.startswith('if '):
|
||||
if inside_if == True:
|
||||
print 'Fatal Error: Nested {if} found on line ' + str(line_num)
|
||||
print line
|
||||
quit()
|
||||
|
||||
# Evaluate whether the expression is true/false.
|
||||
# only one variable name allowed for now
|
||||
variable_name = statement[3:].strip()
|
||||
if variable_name in enabled_flags:
|
||||
last_if_true = True
|
||||
line = '<!--{if ' + variable_name + '}-->'
|
||||
else:
|
||||
last_if_true = False
|
||||
line = '<!--{if ' + variable_name + '}>'
|
||||
|
||||
inside_if = True
|
||||
|
||||
elif statement == 'else':
|
||||
if inside_if == False:
|
||||
print 'Fatal Error: {else} found without {if} on line ' + str(line_num)
|
||||
print line
|
||||
quit()
|
||||
if inside_if == 'else':
|
||||
print 'Fatal Error: Multiple {else} clauses found in the same if on line ' + str(line_num)
|
||||
print line
|
||||
quit()
|
||||
|
||||
if last_if_true:
|
||||
line = '<!--{else}>'
|
||||
else:
|
||||
line = '<!{else}-->'
|
||||
|
||||
# invert the logic so the endif clause is closed properly
|
||||
last_if_true = not last_if_true
|
||||
|
||||
# ensure we don't have two else statements in the same if
|
||||
inside_if = 'else'
|
||||
|
||||
elif statement == 'endif':
|
||||
if inside_if == False:
|
||||
print 'Fatal Error: {endif} found without {if} on line ' + str(line_num)
|
||||
print line
|
||||
quit()
|
||||
|
||||
if last_if_true:
|
||||
line = '<!--{endif}-->'
|
||||
else:
|
||||
line = '<!{endif}-->'
|
||||
|
||||
inside_if = False
|
||||
|
||||
return line
|
||||
|
||||
def ship(inFileName, enabled_flags):
|
||||
# read in HTML file
|
||||
lines = file(inFileName, 'r').readlines()
|
||||
out_lines = []
|
||||
i = 0
|
||||
|
||||
# loop for each line of markup
|
||||
for line in lines:
|
||||
strline = line.strip()
|
||||
# if we find a comment, process it and print out
|
||||
if strline.startswith('<!--{') or strline.startswith('<!{'):
|
||||
# using the same indentation as the previous line
|
||||
start = line.find('<')
|
||||
out_lines.append(line[:start] \
|
||||
+ parseComment(strline, i, enabled_flags) \
|
||||
+ os.linesep)
|
||||
else: # else append line to the output list
|
||||
out_lines.append(line)
|
||||
i += 1
|
||||
|
||||
return ''.join(out_lines)
|
||||
|
||||
if __name__ == '__main__':
|
||||
options, (input, output) = parse_args()
|
||||
|
||||
if options.input_html_file != None:
|
||||
enabled_flags = []
|
||||
if options.enabled_flags != None:
|
||||
enabled_flags.extend(options.enabled_flags)
|
||||
out_file = ship(options.input_html_file, enabled_flags)
|
||||
print out_file
|
Before Width: | Height: | Size: 6.2 KiB |
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"name": "SVG-edit",
|
||||
"description": "A fast, web-based, Javascript-driven SVG editor that works in any modern browser",
|
||||
"version": "2.6",
|
||||
"app": {
|
||||
"urls": [
|
||||
"*://svg-edit.googlecode.com/svn/tags/stable/"
|
||||
],
|
||||
"launch": {
|
||||
"web_url": "http://svg-edit.googlecode.com/svn/tags/stable/editor/svg-editor.html"
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"128": "icon_128.png"
|
||||
},
|
||||
"permissions": [
|
||||
"unlimitedStorage",
|
||||
"notifications"
|
||||
]
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
{
|
||||
"name": "Pavol Rusnak",
|
||||
"email": "stick@gk2.sk"
|
||||
"email": "pavol@rusnak.io"
|
||||
},
|
||||
{
|
||||
"name": "Jeff Schiller",
|
||||
|
|
Before Width: | Height: | Size: 2.7 KiB |
|
@ -1,29 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20">
|
||||
<linearGradient id="smooth" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
|
||||
<clipPath id="round">
|
||||
<rect width="116" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
|
||||
<g clip-path="url(#round)">
|
||||
<rect width="63" height="20" fill="#555"/>
|
||||
<rect x="63" width="53" height="20" fill="#fe7d37"/>
|
||||
<rect width="116" height="20" fill="url(#smooth)"/>
|
||||
</g>
|
||||
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
|
||||
|
||||
<text x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
|
||||
<text x="325" y="140" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
|
||||
|
||||
<text x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">40.89%</text>
|
||||
<text x="885" y="140" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">40.89%</text>
|
||||
</g>
|
||||
|
||||
|
||||
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB |
|
@ -1,3 +1,7 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:8000"
|
||||
"baseUrl": "http://localhost:8000",
|
||||
"reporter": "cypress-multi-reporters",
|
||||
"reporterOptions": {
|
||||
"configFile": "mocha-multi-reporters.json"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe('Accessibility', function () {
|
||||
describe('UI - Accessibility', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/instrumented/svg-editor-es.html');
|
||||
cy.injectAxe();
|
|
@ -0,0 +1,63 @@
|
|||
import {
|
||||
visitAndApproveStorage
|
||||
} from '../../support/ui-test-helper.js';
|
||||
|
||||
describe('UI - Clipboard', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('Editor - Copy and paste', () => {
|
||||
cy.get('#tool_source').click();
|
||||
|
||||
cy.get('#svg_source_textarea')
|
||||
.type('{selectall}')
|
||||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
|
||||
<g class="layer">
|
||||
<title>Layer 1</title>
|
||||
<circle cx="100" cy="100" r="50" fill="#FF0000" id="testCircle" stroke="#000000" stroke-width="5"/>
|
||||
</g>
|
||||
</svg>`, {parseSpecialCharSequences: false});
|
||||
cy.get('#tool_source_save').click();
|
||||
cy.get('#testCircle').should('exist');
|
||||
cy.get('#svg_1').should('not.exist');
|
||||
cy.get('#svg_2').should('not.exist');
|
||||
|
||||
// Copy.
|
||||
cy.get('#testCircle').click().rightclick();
|
||||
cy.get('#cmenu_canvas a[href="#copy"]').click();
|
||||
|
||||
// Paste.
|
||||
// Scrollbars fail to recenter in Cypress test. Works fine in reality.
|
||||
// Thus forcing click is needed since workspace is mostly offscreen.
|
||||
cy.get('#svgroot').rightclick({force: true});
|
||||
cy.get('#cmenu_canvas a[href="#paste"]').click();
|
||||
cy.get('#testCircle').should('exist');
|
||||
cy.get('#svg_1').should('exist');
|
||||
cy.get('#svg_2').should('not.exist');
|
||||
|
||||
// Cut.
|
||||
cy.get('#testCircle').click().rightclick();
|
||||
cy.get('#cmenu_canvas a[href="#cut"]').click();
|
||||
cy.get('#testCircle').should('not.exist');
|
||||
cy.get('#svg_1').should('exist');
|
||||
cy.get('#svg_2').should('not.exist');
|
||||
|
||||
// Paste.
|
||||
// Scrollbars fail to recenter in Cypress test. Works fine in reality.
|
||||
// Thus forcing click is needed since workspace is mostly offscreen.
|
||||
cy.get('#svgroot').rightclick({force: true});
|
||||
cy.get('#cmenu_canvas a[href="#paste"]').click();
|
||||
cy.get('#testCircle').should('not.exist');
|
||||
cy.get('#svg_1').should('exist');
|
||||
cy.get('#svg_2').should('exist');
|
||||
|
||||
// Delete.
|
||||
cy.get('#svg_2').click().rightclick();
|
||||
cy.get('#cmenu_canvas a[href="#delete"]').click();
|
||||
cy.get('#svg_1').click().rightclick();
|
||||
cy.get('#cmenu_canvas a[href="#delete"]').click();
|
||||
cy.get('#svg_1').should('not.exist');
|
||||
cy.get('#svg_2').should('not.exist');
|
||||
});
|
||||
});
|
|
@ -1,27 +1,10 @@
|
|||
import {
|
||||
approveStorage, openMainMenu,
|
||||
openEditorPreferences
|
||||
} from '../support/ui-test-helper.js';
|
||||
visitAndApproveStorage
|
||||
} from '../../support/ui-test-helper.js';
|
||||
|
||||
describe('UI tests', function () {
|
||||
describe('UI - Control Points', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/instrumented/svg-editor-es.html');
|
||||
// Ensure we test against English regardless of the original locale
|
||||
approveStorage();
|
||||
openEditorPreferences();
|
||||
cy.get('#lang_select').select('en');
|
||||
cy.get('#tool_prefs_save').click();
|
||||
});
|
||||
|
||||
it('Editor - No parameters: Has export button', () => {
|
||||
openMainMenu();
|
||||
cy.get('#tool_export');
|
||||
});
|
||||
|
||||
it('Editor - No parameters: Export button clicking; dialog opens', () => {
|
||||
openMainMenu();
|
||||
cy.get('#tool_export').click();
|
||||
cy.get('#dialog_content select');
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('Editor - No parameters: Drag control point of arc path', () => {
|
||||
|
@ -35,7 +18,7 @@ describe('UI tests', function () {
|
|||
<title>Layer 1</title>
|
||||
<path d="m187,194a114,62 0 1 0 219,2" fill="#FF0000" stroke="#000000" stroke-width="5"/>
|
||||
</g>
|
||||
</svg>`, {parseSpecialCharSequences: false});
|
||||
</svg>`, {force: true, parseSpecialCharSequences: false});
|
||||
cy.get('#tool_source_save').click();
|
||||
cy.get('#svg_1').click().click();
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import {
|
||||
visitAndApproveStorage, openMainMenu
|
||||
} from '../../support/ui-test-helper.js';
|
||||
|
||||
describe('UI - Export tests', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('Editor - No parameters: Has export button', () => {
|
||||
openMainMenu();
|
||||
cy.get('#tool_export');
|
||||
});
|
||||
|
||||
it('Editor - No parameters: Export button clicking; dialog opens', () => {
|
||||
openMainMenu();
|
||||
cy.get('#tool_export').click();
|
||||
cy.get('#dialog_content select');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
import {
|
||||
visitAndApproveStorage
|
||||
} from '../../../support/ui-test-helper.js';
|
||||
|
||||
// See https://github.com/SVG-Edit/svgedit/issues/364
|
||||
describe('Issue 364; IE errorwith rectangle selection by click', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('should set rectangle selection after click', function () {
|
||||
cy.get('#tools_rect_show')
|
||||
.trigger('mousedown', {force: true})
|
||||
.trigger('mouseup', {force: true})
|
||||
.should((button) => {
|
||||
expect(button).to.have.class('tool_button_current');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
import {
|
||||
visitAndApproveStorage
|
||||
} from '../../support/ui-test-helper.js';
|
||||
|
||||
// See https://github.com/SVG-Edit/svgedit/issues/364
|
||||
describe('Key commands', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('cmd-A on empty canvas should not cause an error', function () {
|
||||
cy.get('body').type('{cmd}a');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
import {
|
||||
visitAndApproveStorage
|
||||
} from '../../support/ui-test-helper.js';
|
||||
|
||||
describe('UI - Tool selection', function () {
|
||||
beforeEach(() => {
|
||||
visitAndApproveStorage();
|
||||
});
|
||||
|
||||
it('should set rectangle selection by click', function () {
|
||||
cy.get('#tools_rect_show')
|
||||
.trigger('mousedown', {force: true})
|
||||
.trigger('mouseup', {force: true, timeout: 10000})
|
||||
.should((button) => {
|
||||
expect(button).to.have.class('tool_button_current');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import * as contextmenu from '../../instrumented/contextmenu.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
import * as contextmenu from '../../../instrumented/contextmenu.js';
|
||||
|
||||
describe('contextmenu', function () {
|
||||
/**
|
|
@ -1,8 +1,8 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as coords from '../../instrumented/coords.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as coords from '../../../instrumented/coords.js';
|
||||
|
||||
describe('coords', function () {
|
||||
let elemId = 1;
|
|
@ -1,8 +1,8 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as draw from '../../instrumented/draw.js';
|
||||
import * as units from '../../instrumented/units.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as draw from '../../../instrumented/draw.js';
|
||||
import * as units from '../../../instrumented/units.js';
|
||||
|
||||
describe('draw.Drawing', function () {
|
||||
const addOwnSpies = (obj) => {
|
||||
|
@ -69,19 +69,19 @@ describe('draw.Drawing', function () {
|
|||
const setupSVGWith3Layers = function (svgElem) {
|
||||
const layer1 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer1Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer1Title.append(document.createTextNode(LAYER1));
|
||||
layer1Title.append(LAYER1);
|
||||
layer1.append(layer1Title);
|
||||
svgElem.append(layer1);
|
||||
|
||||
const layer2 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer2Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer2Title.append(document.createTextNode(LAYER2));
|
||||
layer2Title.append(LAYER2);
|
||||
layer2.append(layer2Title);
|
||||
svgElem.append(layer2);
|
||||
|
||||
const layer3 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer3Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer3Title.append(document.createTextNode(LAYER3));
|
||||
layer3Title.append(LAYER3);
|
||||
layer3.append(layer3Title);
|
||||
svgElem.append(layer3);
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as transformlist from '../../instrumented/svgtransformlist.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as hstory from '../../instrumented/history.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as hstory from '../../../instrumented/history.js';
|
||||
|
||||
describe('history', function () {
|
||||
// TODO(codedread): Write tests for handling history events.
|
|
@ -1,7 +1,7 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as math from '../../instrumented/math.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as math from '../../../instrumented/math.js';
|
||||
|
||||
describe('math', function () {
|
||||
const svg = document.createElementNS(NS.SVG, 'svg');
|
|
@ -1,10 +1,11 @@
|
|||
/* globals SVGPathSeg */
|
||||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import '../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as pathModule from '../../instrumented/path.js';
|
||||
import '../../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as pathModule from '../../../instrumented/path.js';
|
||||
import {init as unitsInit} from '../../../instrumented/units.js';
|
||||
|
||||
describe('path', function () {
|
||||
/**
|
||||
|
@ -164,4 +165,19 @@ describe('path', function () {
|
|||
assert.equal(path.pathSegList.getItem(1).x, 15);
|
||||
assert.equal(path.pathSegList.getItem(1).y, 16);
|
||||
});
|
||||
|
||||
it('Test svgedit.path.convertPath', function () {
|
||||
unitsInit({
|
||||
getRoundDigits () { return 5; }
|
||||
});
|
||||
|
||||
const path = document.createElementNS(NS.SVG, 'path');
|
||||
path.setAttribute('d', 'M40,55h20v20');
|
||||
|
||||
const abs = pathModule.convertPath(path);
|
||||
assert.equal(abs, 'M40,55L60,55L60,75');
|
||||
|
||||
const rel = pathModule.convertPath(path, true);
|
||||
assert.equal(rel, 'm40,55l20,0l0,20');
|
||||
});
|
||||
});
|
|
@ -1,9 +1,9 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as coords from '../../instrumented/coords.js';
|
||||
import * as recalculate from '../../instrumented/recalculate.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as coords from '../../../instrumented/coords.js';
|
||||
import * as recalculate from '../../../instrumented/recalculate.js';
|
||||
|
||||
describe('recalculate', function () {
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
@ -89,7 +89,7 @@ describe('recalculate', function () {
|
|||
tspan.setAttribute('x', '200');
|
||||
tspan.setAttribute('y', '150');
|
||||
|
||||
const theText = document.createTextNode('Foo bar');
|
||||
const theText = 'Foo bar';
|
||||
tspan.append(theText);
|
||||
elem.append(tspan);
|
||||
svg.append(elem);
|
|
@ -1,7 +1,7 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as sanitize from '../../instrumented/sanitize.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as sanitize from '../../../instrumented/sanitize.js';
|
||||
|
||||
describe('sanitize', function () {
|
||||
const svg = document.createElementNS(NS.SVG, 'svg');
|
|
@ -1,7 +1,7 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import * as select from '../../instrumented/select.js';
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as select from '../../../instrumented/select.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
|
||||
describe('select', function () {
|
||||
const sandbox = document.createElement('div');
|
|
@ -1,11 +1,11 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as transformlist from '../../instrumented/svgtransformlist.js';
|
||||
import {disableSupportsNativeTransformLists} from '../../instrumented/browser.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
||||
import {disableSupportsNativeTransformLists} from '../../../instrumented/browser.js';
|
||||
|
||||
import almostEqualsPlugin from '../support/assert-almostEquals.js';
|
||||
import expectOutOfBoundsExceptionPlugin from '../support/assert-expectOutOfBoundsException.js';
|
||||
import almostEqualsPlugin from '../../support/assert-almostEquals.js';
|
||||
import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js';
|
||||
|
||||
chai.use(almostEqualsPlugin);
|
||||
chai.use(expectOutOfBoundsExceptionPlugin);
|
|
@ -1,8 +1,8 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js';
|
||||
|
||||
import '../../instrumented/svgpathseg.js';
|
||||
import SvgCanvas from '../../instrumented/svgcanvas.js';
|
||||
import '../../../instrumented/svgpathseg.js';
|
||||
import SvgCanvas from '../../../instrumented/svgcanvas.js';
|
||||
|
||||
describe('Basic Module', function () {
|
||||
// helper functions
|
||||
|
@ -129,7 +129,7 @@ describe('Basic Module', function () {
|
|||
fu = document.getElementById('foreign-use'),
|
||||
nfu = document.getElementById('no-use');
|
||||
|
||||
assert.equal((u && u.nodeName === 'use'), true, 'Did not import <use> element');
|
||||
assert.equal((u && u.nodeName), 'use', 'Did not import <use> element');
|
||||
assert.equal(fu, null, 'Removed <use> element that had a foreign href');
|
||||
assert.equal(nfu, null, 'Removed <use> element that had no href');
|
||||
});
|
||||
|
@ -145,7 +145,7 @@ describe('Basic Module', function () {
|
|||
|
||||
const t = document.getElementById('the-text');
|
||||
|
||||
assert.equal((t && t.nodeName === 'text'), true, 'Did not import <text> element');
|
||||
assert.equal((t && t.nodeName), 'text', 'Did not import <text> element');
|
||||
assert.equal(t.getAttribute('d'), null, 'Imported a <text> with a d attribute');
|
||||
});
|
||||
|
||||
|
@ -159,7 +159,7 @@ describe('Basic Module', function () {
|
|||
);
|
||||
const attrVal = document.getElementById('se_test_elem').getAttributeNS('http://svg-edit.googlecode.com', 'foo');
|
||||
|
||||
assert.equal(attrVal === 'bar', true, 'Preserved namespaced attribute on import');
|
||||
assert.strictEqual(attrVal, 'bar', true, 'Preserved namespaced attribute on import');
|
||||
|
||||
const output = svgCanvas.getSvgString();
|
||||
// } catch(e) {console.log(e)}
|
|
@ -1,6 +1,6 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import * as units from '../../instrumented/units.js';
|
||||
import * as units from '../../../instrumented/units.js';
|
||||
|
||||
describe('units', function () {
|
||||
/**
|
|
@ -1,12 +1,12 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import '../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as transformlist from '../../instrumented/svgtransformlist.js';
|
||||
import * as math from '../../instrumented/math.js';
|
||||
import * as path from '../../instrumented/path.js';
|
||||
import setAssertionMethods from '../support/assert-close.js';
|
||||
import '../../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
||||
import * as math from '../../../instrumented/math.js';
|
||||
import * as path from '../../../instrumented/path.js';
|
||||
import setAssertionMethods from '../../support/assert-close.js';
|
||||
|
||||
chai.use(setAssertionMethods);
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import '../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import * as transformlist from '../../instrumented/svgtransformlist.js';
|
||||
import * as math from '../../instrumented/math.js';
|
||||
import '../../../instrumented/svgpathseg.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import * as transformlist from '../../../instrumented/svgtransformlist.js';
|
||||
import * as math from '../../../instrumented/math.js';
|
||||
|
||||
describe('utilities performance', function () {
|
||||
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;
|
||||
|
@ -207,7 +207,7 @@ describe('utilities performance', function () {
|
|||
}
|
||||
total = lastTime - start;
|
||||
const ave = total / count;
|
||||
assert.ok(ave < 20, 'svgedit.utilities.getStrokedBBox average execution time is less than 20 ms');
|
||||
assert.isBelow(ave, 20, 'svgedit.utilities.getStrokedBBox average execution time is less than 20 ms');
|
||||
console.log('Pass1 svgCanvas.getStrokedBBox total ms ' + total + ', ave ms ' + ave.toFixed(1) + ',\t min/max ' + min + ' ' + max);
|
||||
|
||||
// eslint-disable-next-line promise/avoid-new
|
||||
|
@ -229,7 +229,7 @@ describe('utilities performance', function () {
|
|||
|
||||
total = lastTime - strt;
|
||||
const avg = total / ct;
|
||||
assert.ok(avg < 2, 'svgedit.utilities.getStrokedBBox average execution time is less than 1 ms');
|
||||
assert.isBelow(avg, 2, 'svgedit.utilities.getStrokedBBox average execution time is less than 1 ms');
|
||||
console.log('Pass2 svgCanvas.getStrokedBBox total ms ' + total + ', ave ms ' + avg.toFixed(1) + ',\t min/max ' + min + ' ' + max);
|
||||
|
||||
resolve();
|
|
@ -1,8 +1,8 @@
|
|||
import '../../instrumented/jquery.min.js';
|
||||
import '../../../instrumented/jquery.min.js';
|
||||
|
||||
import * as browser from '../../instrumented/browser.js';
|
||||
import * as utilities from '../../instrumented/utilities.js';
|
||||
import {NS} from '../../instrumented/namespaces.js';
|
||||
import * as browser from '../../../instrumented/browser.js';
|
||||
import * as utilities from '../../../instrumented/utilities.js';
|
||||
import {NS} from '../../../instrumented/namespaces.js';
|
||||
|
||||
describe('utilities', function () {
|
||||
/**
|
|
@ -1,5 +1,4 @@
|
|||
/* globals module, require */
|
||||
/* eslint-disable import/no-commonjs */
|
||||
'use strict';
|
||||
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
|
@ -11,18 +10,7 @@
|
|||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
const codeCoverageTask = require('@cypress/code-coverage/task.js');
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
// https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
|
||||
on('task', codeCoverageTask);
|
||||
};
|
||||
require('@babel/register')({
|
||||
plugins: ['@babel/plugin-transform-modules-commonjs']
|
||||
});
|
||||
module.exports = require('./main.js').default;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
import codeCoverageTask from '@cypress/code-coverage/task.js';
|
||||
|
||||
// eslint-disable-next-line import/no-anonymous-default-export
|
||||
export default (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
// https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
|
||||
codeCoverageTask(on, config);
|
||||
return config;
|
||||
};
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable jsdoc/check-examples */
|
||||
import assertionWrapper from './assertion-wrapper.js';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const {
|
||||
writeFile: writeFileOriginal /* unlink: unlinkOriginal, openSync */
|
||||
} = require('fs');
|
||||
// const {join} = require('path');
|
||||
// const {spawn} = require('child_process');
|
||||
const {promisify} = require('util');
|
||||
|
||||
// const {convertFile} = require('convert-svg-to-png');
|
||||
const {BadgeFactory} = require('gh-badges');
|
||||
|
||||
const coverageSummary = require('../../coverage/coverage-summary.json');
|
||||
|
||||
const writeFile = promisify(writeFileOriginal);
|
||||
// const unlink = promisify(unlinkOriginal);
|
||||
const {pct} = coverageSummary.total.statements;
|
||||
|
||||
/*
|
||||
const format = 'png';
|
||||
const out = openSync('coverage-badge.' + format, 'a');
|
||||
spawn('./node_modules/.bin/badge', [
|
||||
`Coverage ${pct}%`,
|
||||
':orange',
|
||||
'.' + format
|
||||
], {
|
||||
stdio: [process.stdin, out, process.stderr]
|
||||
});
|
||||
*/
|
||||
|
||||
// Only CLI handles image conversion
|
||||
const bf = new BadgeFactory();
|
||||
const format = {
|
||||
text: ['Coverage', `${pct}%`],
|
||||
color: 'orange',
|
||||
format: 'svg', // svg|json|png|jpg|gif
|
||||
// labelColor: 'black',
|
||||
template: 'flat' // 'flat'|'flat-square'|'for-the-badge'|'plastic'|'social'
|
||||
};
|
||||
const badge = bf.create(format);
|
||||
|
||||
(async () => {
|
||||
const svgFilePath = 'coverage-badge.svg';
|
||||
await writeFile(svgFilePath, badge);
|
||||
console.log('Finished writing temporary SVG file...');
|
||||
|
||||
// Works too
|
||||
// const outputFile = await convertFile(join(process.cwd(), svgFilePath));
|
||||
// console.log('Wrote file', outputFile);
|
||||
|
||||
// await unlink(svgFilePath);
|
||||
// console.log('Cleaned up temporary SVG file');
|
||||
console.log('Done!');
|
||||
})();
|
|
@ -32,13 +32,13 @@ import './commands.js';
|
|||
import '@cypress/fiddle';
|
||||
|
||||
/**
|
||||
* COVERAGE
|
||||
* COVERAGE.
|
||||
* @see https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
|
||||
*/
|
||||
import '@cypress/code-coverage/support.js';
|
||||
|
||||
/**
|
||||
* ACCESSIBILITY
|
||||
* ACCESSIBILITY.
|
||||
* @see https://www.npmjs.com/package/cypress-axe
|
||||
*/
|
||||
import 'cypress-axe';
|
||||
|
|
|
@ -3,11 +3,22 @@ export const approveStorage = () => {
|
|||
.click();
|
||||
};
|
||||
|
||||
export const visitAndApproveStorage = () => {
|
||||
cy.visit('/instrumented/svg-editor-es.html');
|
||||
approveStorage();
|
||||
};
|
||||
|
||||
export const openMainMenu = () => {
|
||||
return cy.get('#main_icon').click();
|
||||
};
|
||||
|
||||
export const openEditorPreferences = () => {
|
||||
openMainMenu();
|
||||
return cy.get('#tool_prefs_option').click();
|
||||
return cy.get('#tool_editor_prefs').click();
|
||||
};
|
||||
|
||||
export const selectEnglish = () => {
|
||||
openEditorPreferences();
|
||||
cy.get('#lang_select').select('en');
|
||||
cy.get('#tool_prefs_save').click();
|
||||
};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
'use strict';
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
|
@ -120,7 +122,8 @@
|
|||
viableNextSibling = viableNextSibling.nextSibling;
|
||||
}
|
||||
|
||||
var node = convertNodesIntoANode(nodes);
|
||||
var node = convertNodesIntoANode(nodes); // eslint-disable-next-line unicorn/prefer-modern-dom-apis
|
||||
|
||||
parent.insertBefore(node, viableNextSibling);
|
||||
},
|
||||
replaceWith: function replaceWith() {
|
||||
|
@ -141,6 +144,7 @@
|
|||
if (this.parentNode === parent) {
|
||||
parent.replaceChild(node, this);
|
||||
} else {
|
||||
// eslint-disable-next-line unicorn/prefer-modern-dom-apis
|
||||
parent.insertBefore(node, viableNextSibling);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_arrows = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-arrows.js
|
||||
* @file ext-arrows.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -47,16 +47,16 @@ var svgEditorExtension_arrows = (function () {
|
|||
*/
|
||||
var extArrows = {
|
||||
name: 'arrows',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
||||
var strings, svgEditor, svgCanvas, addElem, nonce, $, prefix, selElems, arrowprefix, randomizeIds, setArrowNonce, unsetArrowNonce, pathdata, getLinked, showPanel, resetMarker, addMarker, setArrow, colorChanged, contextTools;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
colorChanged = function _ref10(elem) {
|
||||
colorChanged = function _colorChanged(elem) {
|
||||
var color = elem.getAttribute('stroke');
|
||||
var mtypes = ['start', 'mid', 'end'];
|
||||
var defs = svgCanvas.findDefs();
|
||||
|
@ -122,7 +122,7 @@ var svgEditorExtension_arrows = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
setArrow = function _ref9() {
|
||||
setArrow = function _setArrow() {
|
||||
resetMarker();
|
||||
var type = this.value;
|
||||
|
||||
|
@ -150,7 +150,7 @@ var svgEditorExtension_arrows = (function () {
|
|||
svgCanvas.call('changed', selElems);
|
||||
};
|
||||
|
||||
addMarker = function _ref8(dir, type, id) {
|
||||
addMarker = function _addMarker(dir, type, id) {
|
||||
// TODO: Make marker (or use?) per arrow type, since refX can be different
|
||||
id = id || arrowprefix + dir;
|
||||
var data = pathdata[dir];
|
||||
|
@ -191,14 +191,14 @@ var svgEditorExtension_arrows = (function () {
|
|||
return marker;
|
||||
};
|
||||
|
||||
resetMarker = function _ref7() {
|
||||
resetMarker = function _resetMarker() {
|
||||
var el = selElems[0];
|
||||
el.removeAttribute('marker-start');
|
||||
el.removeAttribute('marker-mid');
|
||||
el.removeAttribute('marker-end');
|
||||
};
|
||||
|
||||
showPanel = function _ref6(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
$('#arrow_panel').toggle(on);
|
||||
|
||||
if (on) {
|
||||
|
@ -230,7 +230,7 @@ var svgEditorExtension_arrows = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
getLinked = function _ref5(elem, attr) {
|
||||
getLinked = function _getLinked(elem, attr) {
|
||||
var str = elem.getAttribute(attr);
|
||||
|
||||
if (!str) {
|
||||
|
@ -247,14 +247,14 @@ var svgEditorExtension_arrows = (function () {
|
|||
return svgCanvas.getElem(m[1]); // return svgCanvas.getElem(m.groups.id);
|
||||
};
|
||||
|
||||
unsetArrowNonce = function _ref4(win) {
|
||||
unsetArrowNonce = function _unsetArrowNonce(win) {
|
||||
randomizeIds = false;
|
||||
arrowprefix = prefix;
|
||||
pathdata.fw.id = arrowprefix + 'fw';
|
||||
pathdata.bk.id = arrowprefix + 'bk';
|
||||
};
|
||||
|
||||
setArrowNonce = function _ref3(win, n) {
|
||||
setArrowNonce = function _setArrowNonce(win, n) {
|
||||
randomizeIds = true;
|
||||
arrowprefix = prefix + n + '_';
|
||||
pathdata.fw.id = arrowprefix + 'fw';
|
||||
|
@ -266,7 +266,7 @@ var svgEditorExtension_arrows = (function () {
|
|||
|
||||
case 10:
|
||||
strings = _context2.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
// {svgcontent} = S,
|
||||
addElem = svgCanvas.addSVGElementFromJson, nonce = S.nonce, $ = S.$, prefix = 'se_arrow_';
|
||||
|
@ -324,11 +324,9 @@ var svgEditorExtension_arrows = (function () {
|
|||
|
||||
$('#arrow_list option')[0].id = 'connector_no_arrow';
|
||||
},
|
||||
addLangData: function () {
|
||||
var _addLangData = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
var lang, importLocale, _ref2, langList;
|
||||
addLangData: function addLangData(_ref) {
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var lang, importLocale, _yield$importLocale, langList;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -339,8 +337,8 @@ var svgEditorExtension_arrows = (function () {
|
|||
return importLocale();
|
||||
|
||||
case 3:
|
||||
_ref2 = _context.sent;
|
||||
langList = _ref2.langList;
|
||||
_yield$importLocale = _context.sent;
|
||||
langList = _yield$importLocale.langList;
|
||||
return _context.abrupt("return", {
|
||||
data: langList
|
||||
});
|
||||
|
@ -351,14 +349,8 @@ var svgEditorExtension_arrows = (function () {
|
|||
}
|
||||
}
|
||||
}, _callee);
|
||||
}));
|
||||
|
||||
function addLangData(_x2) {
|
||||
return _addLangData.apply(this, arguments);
|
||||
}
|
||||
|
||||
return addLangData;
|
||||
}(),
|
||||
}))();
|
||||
},
|
||||
selectedChanged: function selectedChanged(opts) {
|
||||
// Use this to update the current selected elements
|
||||
selElems = opts.elems;
|
||||
|
@ -397,15 +389,9 @@ var svgEditorExtension_arrows = (function () {
|
|||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee2);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extArrows;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_closepath = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-closepath.js
|
||||
* @file ext-closepath.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -49,10 +49,10 @@ var svgEditorExtension_closepath = (function () {
|
|||
// The button toggles whether the path is open or closed
|
||||
var extClosepath = {
|
||||
name: 'closepath',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var importLocale, $, strings, svgEditor, selElems, updateButton, showPanel, toggleClosed, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -64,7 +64,7 @@ var svgEditorExtension_closepath = (function () {
|
|||
|
||||
case 3:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
|
||||
updateButton = function updateButton(path) {
|
||||
var seglist = path.pathSegList,
|
||||
|
@ -159,15 +159,9 @@ var svgEditorExtension_closepath = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extClosepath;
|
||||
|
|
|
@ -40,7 +40,7 @@ var svgEditorExtension_connector = (function () {
|
|||
/* eslint-disable unicorn/no-fn-reference-in-iterator */
|
||||
|
||||
/**
|
||||
* ext-connector.js
|
||||
* @file ext-connector.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -49,16 +49,16 @@ var svgEditorExtension_connector = (function () {
|
|||
*/
|
||||
var extConnector = {
|
||||
name: 'connector',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var svgEditor, svgCanvas, getElem, $, svgroot, importLocale, addElem, selManager, connSel, elData, strings, startX, startY, curLine, startElem, endElem, seNs, svgcontent, started, connections, selElems, getBBintersect, getOffset, showPanel, setPoint, updateLine, findConnectors, updateConnectors, init, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
init = function _ref9() {
|
||||
init = function _init() {
|
||||
// Make sure all connectors have data set
|
||||
$(svgcontent).find('*').each(function () {
|
||||
var conn = this.getAttributeNS(seNs, 'connector');
|
||||
|
@ -74,7 +74,7 @@ var svgEditorExtension_connector = (function () {
|
|||
}); // updateConnectors();
|
||||
};
|
||||
|
||||
updateConnectors = function _ref8(elems) {
|
||||
updateConnectors = function _updateConnectors(elems) {
|
||||
// Updates connector lines based on selected elements
|
||||
// Is not used on mousemove, as it runs getStrokedBBox every time,
|
||||
// which isn't necessary there.
|
||||
|
@ -126,7 +126,7 @@ var svgEditorExtension_connector = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
findConnectors = function _ref7() {
|
||||
findConnectors = function _findConnectors() {
|
||||
var elems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selElems;
|
||||
var connectors = $(svgcontent).find(connSel);
|
||||
connections = []; // Loop through connectors to see if one is connected to the element
|
||||
|
@ -186,7 +186,7 @@ var svgEditorExtension_connector = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
updateLine = function _ref6(diffX, diffY) {
|
||||
updateLine = function _updateLine(diffX, diffY) {
|
||||
// Update line with element
|
||||
var i = connections.length;
|
||||
|
||||
|
@ -216,7 +216,7 @@ var svgEditorExtension_connector = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
setPoint = function _ref5(elem, pos, x, y, setMid) {
|
||||
setPoint = function _setPoint(elem, pos, x, y, setMid) {
|
||||
var pts = elem.points;
|
||||
var pt = svgroot.createSVGPoint();
|
||||
pt.x = x;
|
||||
|
@ -250,7 +250,7 @@ var svgEditorExtension_connector = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
showPanel = function _ref4(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
var connRules = $('#connector_rules');
|
||||
|
||||
if (!connRules.length) {
|
||||
|
@ -261,7 +261,7 @@ var svgEditorExtension_connector = (function () {
|
|||
$('#connector_panel').toggle(on);
|
||||
};
|
||||
|
||||
getOffset = function _ref3(side, line) {
|
||||
getOffset = function _getOffset(side, line) {
|
||||
var giveOffset = line.getAttribute('marker-' + side); // const giveOffset = $(line).data(side+'_off');
|
||||
// TODO: Make this number (5) be based on marker width/height
|
||||
|
||||
|
@ -269,7 +269,7 @@ var svgEditorExtension_connector = (function () {
|
|||
return giveOffset ? size : 0;
|
||||
};
|
||||
|
||||
getBBintersect = function _ref2(x, y, bb, offset) {
|
||||
getBBintersect = function _getBBintersect(x, y, bb, offset) {
|
||||
if (offset) {
|
||||
offset -= 0;
|
||||
bb = $.extend({}, bb);
|
||||
|
@ -298,7 +298,7 @@ var svgEditorExtension_connector = (function () {
|
|||
};
|
||||
};
|
||||
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
getElem = svgCanvas.getElem;
|
||||
$ = S.$, svgroot = S.svgroot, importLocale = S.importLocale, addElem = svgCanvas.addSVGElementFromJson, selManager = S.selectorManager, connSel = '.se_connector', elData = $.data;
|
||||
|
@ -683,15 +683,9 @@ var svgEditorExtension_connector = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extConnector;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_eyedropper = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-eyedropper.js
|
||||
* @file ext-eyedropper.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -47,16 +47,16 @@ var svgEditorExtension_eyedropper = (function () {
|
|||
*/
|
||||
var extEyedropper = {
|
||||
name: 'eyedropper',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var strings, svgEditor, $, ChangeElementCommand, svgCanvas, addToHistory, currentStyle, getStyle, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
getStyle = function _ref(opts) {
|
||||
getStyle = function _getStyle(opts) {
|
||||
// if we are in eyedropper mode, we don't want to disable the eye-dropper tool
|
||||
var mode = svgCanvas.getMode();
|
||||
|
||||
|
@ -91,7 +91,7 @@ var svgEditorExtension_eyedropper = (function () {
|
|||
|
||||
case 3:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
$ = S.$, ChangeElementCommand = S.ChangeElementCommand, svgCanvas = svgEditor.canvas, addToHistory = function addToHistory(cmd) {
|
||||
svgCanvas.undoMgr.addCommandToHistory(cmd);
|
||||
}, currentStyle = {
|
||||
|
@ -192,15 +192,9 @@ var svgEditorExtension_eyedropper = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extEyedropper;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-foreignobject.js
|
||||
* @file ext-foreignobject.js
|
||||
*
|
||||
* @license Apache-2.0
|
||||
*
|
||||
|
@ -47,21 +47,21 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
*/
|
||||
var extForeignobject = {
|
||||
name: 'foreignobject',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
||||
var svgEditor, $, text2xml, NS, importLocale, svgCanvas, svgdoc, strings, properlySourceSizeTextArea, showPanel, toggleSourceButtons, selElems, started, newFO, editingforeign, setForeignString, showForeignEditor, setAttr, buttons, contextTools;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
setAttr = function _ref6(attr, val) {
|
||||
setAttr = function _setAttr(attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
svgCanvas.call('changed', selElems);
|
||||
};
|
||||
|
||||
showForeignEditor = function _ref5() {
|
||||
showForeignEditor = function _showForeignEditor() {
|
||||
var elt = selElems[0];
|
||||
|
||||
if (!elt || editingforeign) {
|
||||
|
@ -78,7 +78,7 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
$('#svg_source_textarea').focus();
|
||||
};
|
||||
|
||||
setForeignString = function _ref4(xmlString) {
|
||||
setForeignString = function _setForeignString(xmlString) {
|
||||
var elt = selElems[0]; // The parent `Element` to append to
|
||||
|
||||
try {
|
||||
|
@ -99,12 +99,12 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
return true;
|
||||
};
|
||||
|
||||
toggleSourceButtons = function _ref3(on) {
|
||||
toggleSourceButtons = function _toggleSourceButtons(on) {
|
||||
$('#tool_source_save, #tool_source_cancel').toggle(!on);
|
||||
$('#foreign_save, #foreign_cancel').toggle(on);
|
||||
};
|
||||
|
||||
showPanel = function _ref2(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
var fcRules = $('#fc_rules');
|
||||
|
||||
if (!fcRules.length) {
|
||||
|
@ -115,7 +115,7 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
$('#foreignObject_panel').toggle(on);
|
||||
};
|
||||
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
$ = S.$, text2xml = S.text2xml, NS = S.NS, importLocale = S.importLocale;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
svgdoc = S.svgroot.parentNode.ownerDocument;
|
||||
|
@ -218,11 +218,7 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
// Create source save/cancel buttons
|
||||
|
||||
/* const save = */
|
||||
$('#tool_source_save').clone().hide().attr('id', 'foreign_save').unbind().appendTo('#tool_source_back').click(
|
||||
/*#__PURE__*/
|
||||
_asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee() {
|
||||
$('#tool_source_save').clone().hide().attr('id', 'foreign_save').unbind().appendTo('#tool_source_back').click( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var ok;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -357,15 +353,9 @@ var svgEditorExtension_foreignobject = (function () {
|
|||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee2);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extForeignobject;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_grid = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-grid.js
|
||||
* @file ext-grid.js
|
||||
*
|
||||
* @license Apache-2.0
|
||||
*
|
||||
|
@ -47,16 +47,16 @@ var svgEditorExtension_grid = (function () {
|
|||
*/
|
||||
var extGrid = {
|
||||
name: 'grid',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var $, NS, getTypeMap, importLocale, strings, svgEditor, svgCanvas, svgdoc, assignAttributes, hcanvas, canvBG, units, intervals, showGrid, canvasGrid, gridDefs, gridPattern, gridimg, gridBox, updateGrid, gridUpdate, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
gridUpdate = function _ref3() {
|
||||
gridUpdate = function _gridUpdate() {
|
||||
if (showGrid) {
|
||||
updateGrid(svgCanvas.getZoom());
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ var svgEditorExtension_grid = (function () {
|
|||
$('#view_grid').toggleClass('push_button_pressed tool_button');
|
||||
};
|
||||
|
||||
updateGrid = function _ref2(zoom) {
|
||||
updateGrid = function _updateGrid(zoom) {
|
||||
// TODO: Try this with <line> elements, then compare performance difference
|
||||
var unit = units[svgEditor.curConfig.baseUnit]; // 1 = 1px
|
||||
|
||||
|
@ -119,7 +119,7 @@ var svgEditorExtension_grid = (function () {
|
|||
|
||||
case 5:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
svgdoc = document.getElementById('svgcanvas').ownerDocument, assignAttributes = svgCanvas.assignAttributes, hcanvas = document.createElement('canvas'), canvBG = $('#canvasBackground'), units = getTypeMap(), intervals = [0.01, 0.1, 1, 10, 100, 1000];
|
||||
showGrid = svgEditor.curConfig.showGrid || false;
|
||||
|
@ -212,15 +212,9 @@ var svgEditorExtension_grid = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extGrid;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_helloworld = (function () {
|
|||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
|
@ -46,10 +46,7 @@ var svgEditorExtension_helloworld = (function () {
|
|||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
|
@ -75,12 +72,29 @@ var svgEditorExtension_helloworld = (function () {
|
|||
return _arr;
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-helloworld.js
|
||||
* @file ext-helloworld.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -95,10 +109,10 @@ var svgEditorExtension_helloworld = (function () {
|
|||
*/
|
||||
var extHelloworld = {
|
||||
name: 'helloworld',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var $, importLocale, strings, svgEditor, svgCanvas;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -110,7 +124,7 @@ var svgEditorExtension_helloworld = (function () {
|
|||
|
||||
case 3:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
return _context.abrupt("return", {
|
||||
name: strings.name,
|
||||
|
@ -181,15 +195,9 @@ var svgEditorExtension_helloworld = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extHelloworld;
|
||||
|
|
|
@ -2,6 +2,8 @@ var svgEditorExtension_imagelib = (function () {
|
|||
'use strict';
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
|
@ -52,7 +54,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-imagelib.js
|
||||
* @file ext-imagelib.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -61,16 +63,17 @@ var svgEditorExtension_imagelib = (function () {
|
|||
*/
|
||||
var extImagelib = {
|
||||
name: 'imagelib',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(_ref) {
|
||||
var $, decode64, importLocale, dropXMLInternalSubset, imagelibStrings, modularVersion, svgEditor, uiStrings, svgCanvas, extIconsPath, allowedImageLibOrigins, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, toggleMulti, showBrowser, buttons;
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
||||
var $, decode64, importLocale, dropXMLInternalSubset, imagelibStrings, modularVersion, svgEditor, uiStrings, svgCanvas, extIconsPath, allowedImageLibOrigins, closeBrowser, importImage, pending, mode, multiArr, transferStopped, preview, submit, onMessage, _onMessage, toggleMulti, showBrowser, buttons;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
showBrowser = function _ref10() {
|
||||
showBrowser = function _showBrowser() {
|
||||
var browser = $('#imgbrowse');
|
||||
|
||||
if (!browser.length) {
|
||||
|
@ -78,7 +81,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||
browser = $('#imgbrowse');
|
||||
var allLibs = imagelibStrings.select_lib;
|
||||
var libOpts = $('<ul id=imglib_opts>').appendTo(browser);
|
||||
var frame = $('<iframe/>').prependTo(browser).hide().wrap('<div id=lib_framewrap>');
|
||||
var frame = $('<iframe src="javascript:0"/>').prependTo(browser).hide().wrap('<div id=lib_framewrap>');
|
||||
var header = $('<h1>').prependTo(browser).text(allLibs).css({
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
|
@ -126,10 +129,10 @@ var svgEditorExtension_imagelib = (function () {
|
|||
});
|
||||
cancel.prepend($.getSvgIcon('cancel', true));
|
||||
back.prepend($.getSvgIcon('tool_imagelib', true));
|
||||
imagelibStrings.imgLibs.forEach(function (_ref6) {
|
||||
var name = _ref6.name,
|
||||
url = _ref6.url,
|
||||
description = _ref6.description;
|
||||
imagelibStrings.imgLibs.forEach(function (_ref5) {
|
||||
var name = _ref5.name,
|
||||
url = _ref5.url,
|
||||
description = _ref5.description;
|
||||
$('<li>').appendTo(libOpts).text(name).on('click touchend', function () {
|
||||
frame.attr('src', url).show();
|
||||
header.text(name);
|
||||
|
@ -142,7 +145,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
toggleMulti = function _ref9(show) {
|
||||
toggleMulti = function _toggleMulti(show) {
|
||||
$('#lib_framewrap, #imglib_opts').css({
|
||||
right: show ? 200 : 10
|
||||
});
|
||||
|
@ -184,73 +187,8 @@ var svgEditorExtension_imagelib = (function () {
|
|||
submit.toggle(show);
|
||||
};
|
||||
|
||||
importImage = function _ref8(url) {
|
||||
var newImage = svgCanvas.addSVGElementFromJson({
|
||||
element: 'image',
|
||||
attr: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
id: svgCanvas.getNextId(),
|
||||
style: 'pointer-events:inherit'
|
||||
}
|
||||
});
|
||||
svgCanvas.clearSelection();
|
||||
svgCanvas.addToSelection([newImage]);
|
||||
svgCanvas.setImageURL(url);
|
||||
};
|
||||
|
||||
closeBrowser = function _ref7() {
|
||||
$('#imgbrowse_holder').hide();
|
||||
};
|
||||
|
||||
$ = _ref.$, decode64 = _ref.decode64, importLocale = _ref.importLocale, dropXMLInternalSubset = _ref.dropXMLInternalSubset;
|
||||
_context2.next = 7;
|
||||
return importLocale();
|
||||
|
||||
case 7:
|
||||
imagelibStrings = _context2.sent;
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false;
|
||||
svgEditor = this;
|
||||
uiStrings = svgEditor.uiStrings, svgCanvas = svgEditor.canvas, extIconsPath = svgEditor.curConfig.extIconsPath;
|
||||
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(function (_ref2) {
|
||||
var name = _ref2.name,
|
||||
url = _ref2.url,
|
||||
description = _ref2.description;
|
||||
// Todo: Adopt some standard formatting library like `fluent.js` instead
|
||||
url = url.replace(/\{path\}/g, extIconsPath).replace(/\{modularVersion\}/g, modularVersion ? imagelibStrings.moduleEnding || '-es' : '');
|
||||
return {
|
||||
name: name,
|
||||
url: url,
|
||||
description: description
|
||||
};
|
||||
});
|
||||
allowedImageLibOrigins = imagelibStrings.imgLibs.map(function (_ref3) {
|
||||
var url = _ref3.url;
|
||||
|
||||
try {
|
||||
return new URL(url).origin;
|
||||
} catch (err) {
|
||||
return location.origin;
|
||||
}
|
||||
});
|
||||
/**
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
pending = {};
|
||||
mode = 's';
|
||||
multiArr = [];
|
||||
transferStopped = false;
|
||||
// Receive `postMessage` data
|
||||
window.addEventListener('message',
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var _ref5 = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref4) {
|
||||
_onMessage = function _onMessage3() {
|
||||
_onMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref4) {
|
||||
var origin, response, id, type, hasName, hasHref, char1, secondpos, entry, curMeta, svgStr, imgStr, name, message, pre, src, title, xml, ok;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -365,7 +303,6 @@ var svgEditorExtension_imagelib = (function () {
|
|||
return $.process_cancel(message);
|
||||
|
||||
case 39:
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
transferStopped = true; // Should a message be sent back to the frame?
|
||||
|
||||
$('#dialog_box').hide();
|
||||
|
@ -462,7 +399,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||
preview.children().each(function () {
|
||||
if ($(this).data('id') === id) {
|
||||
if (curMeta.preview_url) {
|
||||
$(this).html($('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title)));
|
||||
$(this).html($('<span>').append($('<img>').attr('src', curMeta.preview_url), title));
|
||||
} else {
|
||||
$(this).text(title);
|
||||
}
|
||||
|
@ -477,10 +414,7 @@ var svgEditorExtension_imagelib = (function () {
|
|||
} else {
|
||||
if (curMeta && curMeta.preview_url) {
|
||||
title = curMeta.name || '';
|
||||
}
|
||||
|
||||
if (curMeta && curMeta.preview_url) {
|
||||
entry = $('<span>').append($('<img>').attr('src', curMeta.preview_url), document.createTextNode(title));
|
||||
entry = $('<span>').append($('<img>').attr('src', curMeta.preview_url), title);
|
||||
} else {
|
||||
entry = $('<img>').attr('src', response);
|
||||
}
|
||||
|
@ -536,11 +470,79 @@ var svgEditorExtension_imagelib = (function () {
|
|||
}
|
||||
}, _callee, null, [[3, 20]]);
|
||||
}));
|
||||
return _onMessage.apply(this, arguments);
|
||||
};
|
||||
|
||||
return function (_x2) {
|
||||
return _ref5.apply(this, arguments);
|
||||
onMessage = function _onMessage2(_x) {
|
||||
return _onMessage.apply(this, arguments);
|
||||
};
|
||||
|
||||
importImage = function _importImage(url) {
|
||||
var newImage = svgCanvas.addSVGElementFromJson({
|
||||
element: 'image',
|
||||
attr: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
id: svgCanvas.getNextId(),
|
||||
style: 'pointer-events:inherit'
|
||||
}
|
||||
});
|
||||
svgCanvas.clearSelection();
|
||||
svgCanvas.addToSelection([newImage]);
|
||||
svgCanvas.setImageURL(url);
|
||||
};
|
||||
|
||||
closeBrowser = function _closeBrowser() {
|
||||
$('#imgbrowse_holder').hide();
|
||||
};
|
||||
|
||||
$ = _ref.$, decode64 = _ref.decode64, importLocale = _ref.importLocale, dropXMLInternalSubset = _ref.dropXMLInternalSubset;
|
||||
_context2.next = 9;
|
||||
return importLocale();
|
||||
|
||||
case 9:
|
||||
imagelibStrings = _context2.sent;
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false;
|
||||
svgEditor = _this;
|
||||
uiStrings = svgEditor.uiStrings, svgCanvas = svgEditor.canvas, extIconsPath = svgEditor.curConfig.extIconsPath;
|
||||
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(function (_ref2) {
|
||||
var name = _ref2.name,
|
||||
url = _ref2.url,
|
||||
description = _ref2.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
|
||||
// eslint-disable-next-line unicorn/better-regex
|
||||
.replace(/\{path\}/g, extIconsPath).replace( // eslint-disable-next-line unicorn/better-regex
|
||||
/\{modularVersion\}/g, modularVersion ? imagelibStrings.moduleEnding || '-es' : '');
|
||||
return {
|
||||
name: name,
|
||||
url: url,
|
||||
description: description
|
||||
};
|
||||
}(), true);
|
||||
});
|
||||
allowedImageLibOrigins = imagelibStrings.imgLibs.map(function (_ref3) {
|
||||
var url = _ref3.url;
|
||||
|
||||
try {
|
||||
return new URL(url).origin;
|
||||
} catch (err) {
|
||||
return location.origin;
|
||||
}
|
||||
});
|
||||
/**
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
pending = {};
|
||||
mode = 's';
|
||||
multiArr = [];
|
||||
transferStopped = false;
|
||||
// Receive `postMessage` data
|
||||
window.addEventListener('message', onMessage, true);
|
||||
/**
|
||||
* @param {boolean} show
|
||||
* @returns {void}
|
||||
|
@ -566,20 +568,14 @@ var svgEditorExtension_imagelib = (function () {
|
|||
}
|
||||
});
|
||||
|
||||
case 20:
|
||||
case 22:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee2);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extImagelib;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_markers = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-markers.js
|
||||
* @file ext-markers.js
|
||||
*
|
||||
* @license Apache-2.0
|
||||
*
|
||||
|
@ -69,17 +69,17 @@ var svgEditorExtension_markers = (function () {
|
|||
*/
|
||||
var extMarkers = {
|
||||
name: 'markers',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee3(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
||||
var strings, svgEditor, $, svgCanvas, addElem, mtypes, markerPrefix, idPrefix, markerTypes, getLinked, setIcon, selElems, showPanel, addMarker, convertline, setMarker, colorChanged, updateReferences, triggerTextEntry, showTextPrompt, _showTextPrompt, setArrowFromButton, _setArrowFromButton, getTitle, buildButtonList, contextTools;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
buildButtonList = function _ref16() {
|
||||
buildButtonList = function _buildButtonList() {
|
||||
var buttons = []; // const i = 0;
|
||||
|
||||
/*
|
||||
|
@ -130,7 +130,7 @@ var svgEditorExtension_markers = (function () {
|
|||
return buttons;
|
||||
};
|
||||
|
||||
getTitle = function _ref15(id) {
|
||||
getTitle = function _getTitle(id) {
|
||||
var langList = strings.langList;
|
||||
var item = langList.find(function (itm) {
|
||||
return itm.id === id;
|
||||
|
@ -138,10 +138,8 @@ var svgEditorExtension_markers = (function () {
|
|||
return item ? item.title : id;
|
||||
};
|
||||
|
||||
_setArrowFromButton = function _ref14() {
|
||||
_setArrowFromButton = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(ev) {
|
||||
_setArrowFromButton = function _setArrowFromButton3() {
|
||||
_setArrowFromButton = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ev) {
|
||||
var parts, pos, val;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
|
@ -178,14 +176,12 @@ var svgEditorExtension_markers = (function () {
|
|||
return _setArrowFromButton.apply(this, arguments);
|
||||
};
|
||||
|
||||
setArrowFromButton = function _ref13(_x3) {
|
||||
setArrowFromButton = function _setArrowFromButton2(_x2) {
|
||||
return _setArrowFromButton.apply(this, arguments);
|
||||
};
|
||||
|
||||
_showTextPrompt = function _ref12() {
|
||||
_showTextPrompt = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(pos) {
|
||||
_showTextPrompt = function _showTextPrompt3() {
|
||||
_showTextPrompt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(pos) {
|
||||
var def, txt;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -217,18 +213,18 @@ var svgEditorExtension_markers = (function () {
|
|||
return _showTextPrompt.apply(this, arguments);
|
||||
};
|
||||
|
||||
showTextPrompt = function _ref11(_x2) {
|
||||
showTextPrompt = function _showTextPrompt2(_x) {
|
||||
return _showTextPrompt.apply(this, arguments);
|
||||
};
|
||||
|
||||
triggerTextEntry = function _ref10(pos, val) {
|
||||
triggerTextEntry = function _triggerTextEntry(pos, val) {
|
||||
$('#' + pos + '_marker').val(val);
|
||||
$('#' + pos + '_marker').change(); // const txtbox = $('#'+pos+'_marker');
|
||||
// if (val.substr(0,1)=='\\') {txtbox.hide();}
|
||||
// else {txtbox.show();}
|
||||
};
|
||||
|
||||
updateReferences = function _ref9(el) {
|
||||
updateReferences = function _updateReferences(el) {
|
||||
$.each(mtypes, function (i, pos) {
|
||||
var id = markerPrefix + pos + '_' + el.id;
|
||||
var markerName = 'marker-' + pos;
|
||||
|
@ -260,7 +256,7 @@ var svgEditorExtension_markers = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
colorChanged = function _ref8(elem) {
|
||||
colorChanged = function _colorChanged(elem) {
|
||||
var color = elem.getAttribute('stroke');
|
||||
$.each(mtypes, function (i, pos) {
|
||||
var marker = getLinked(elem, 'marker-' + pos);
|
||||
|
@ -293,7 +289,7 @@ var svgEditorExtension_markers = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
setMarker = function _ref7() {
|
||||
setMarker = function _setMarker() {
|
||||
var poslist = {
|
||||
start_marker: 'start',
|
||||
mid_marker: 'mid',
|
||||
|
@ -334,7 +330,7 @@ var svgEditorExtension_markers = (function () {
|
|||
setIcon(pos, val);
|
||||
};
|
||||
|
||||
convertline = function _ref6(elem) {
|
||||
convertline = function _convertline(elem) {
|
||||
// this routine came from the connectors extension
|
||||
// it is needed because midpoint markers don't work with line elements
|
||||
if (elem.tagName !== 'line') {
|
||||
|
@ -378,7 +374,7 @@ var svgEditorExtension_markers = (function () {
|
|||
return pline;
|
||||
};
|
||||
|
||||
addMarker = function _ref5(id, val) {
|
||||
addMarker = function _addMarker(id, val) {
|
||||
var txtBoxBg = '#ffffff';
|
||||
var txtBoxBorder = 'none';
|
||||
var txtBoxStrokeWidth = 0;
|
||||
|
@ -482,7 +478,7 @@ var svgEditorExtension_markers = (function () {
|
|||
return marker;
|
||||
};
|
||||
|
||||
showPanel = function _ref4(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
$('#marker_panel').toggle(on);
|
||||
|
||||
if (on) {
|
||||
|
@ -518,7 +514,7 @@ var svgEditorExtension_markers = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
setIcon = function _ref3(pos, id) {
|
||||
setIcon = function _setIcon(pos, id) {
|
||||
if (id.substr(0, 1) !== '\\') {
|
||||
id = '\\textmarker';
|
||||
}
|
||||
|
@ -528,7 +524,7 @@ var svgEditorExtension_markers = (function () {
|
|||
$(ci).addClass('current').siblings().removeClass('current');
|
||||
};
|
||||
|
||||
getLinked = function _ref2(elem, attr) {
|
||||
getLinked = function _getLinked(elem, attr) {
|
||||
var str = elem.getAttribute(attr);
|
||||
|
||||
if (!str) {
|
||||
|
@ -550,7 +546,7 @@ var svgEditorExtension_markers = (function () {
|
|||
|
||||
case 17:
|
||||
strings = _context3.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
$ = S.$;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
addElem = svgCanvas.addSVGElementFromJson;
|
||||
|
@ -757,15 +753,9 @@ var svgEditorExtension_markers = (function () {
|
|||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee3);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extMarkers;
|
||||
|
|
|
@ -103,16 +103,16 @@ var svgEditorExtension_mathjax = (function () {
|
|||
|
||||
var extMathjax = {
|
||||
name: 'mathjax',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
||||
var $, importLocale, strings, svgEditor, svgCanvas, mathjaxSrcSecure, uiStrings, math, locationX, locationY, mathjaxLoaded, saveMath, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
saveMath = function _ref2() {
|
||||
saveMath = function _saveMath() {
|
||||
var code = $('#mathjax_code_textarea').val(); // displaystyle to force MathJax NOT to use the inline style. Because it is
|
||||
// less fancy!
|
||||
|
||||
|
@ -170,7 +170,7 @@ var svgEditorExtension_mathjax = (function () {
|
|||
|
||||
case 4:
|
||||
strings = _context2.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas; // Configuration of the MathJax extention.
|
||||
// This will be added to the head tag before MathJax is loaded.
|
||||
|
||||
|
@ -222,10 +222,8 @@ var svgEditorExtension_mathjax = (function () {
|
|||
type: 'mode',
|
||||
icon: svgEditor.curConfig.extIconsPath + 'mathjax.png',
|
||||
events: {
|
||||
click: function () {
|
||||
var _click = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee() {
|
||||
click: function click() {
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
|
@ -307,14 +305,8 @@ var svgEditorExtension_mathjax = (function () {
|
|||
}
|
||||
}
|
||||
}, _callee, null, [[7, 13]]);
|
||||
}));
|
||||
|
||||
function click() {
|
||||
return _click.apply(this, arguments);
|
||||
}
|
||||
|
||||
return click;
|
||||
}()
|
||||
}))();
|
||||
}
|
||||
}
|
||||
}];
|
||||
return _context2.abrupt("return", {
|
||||
|
@ -358,15 +350,9 @@ var svgEditorExtension_mathjax = (function () {
|
|||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee2);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extMathjax;
|
||||
|
|
|
@ -2,7 +2,7 @@ var svgEditorExtension_overview_window = (function () {
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* ext-overview_window.js
|
||||
* @file ext-overview_window.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -20,7 +20,7 @@ var svgEditorExtension_overview_window = (function () {
|
|||
|
||||
if (isChrome()) {
|
||||
var verIndex = navigator.userAgent.indexOf('Chrome/') + 7;
|
||||
var chromeVersion = parseInt(navigator.userAgent.substring(verIndex));
|
||||
var chromeVersion = Number.parseInt(navigator.userAgent.substring(verIndex));
|
||||
|
||||
if (chromeVersion < 49) {
|
||||
return undefined;
|
||||
|
@ -32,12 +32,12 @@ var svgEditorExtension_overview_window = (function () {
|
|||
$('#sidepanels').append(propsWindowHtml); // Define dynamic animation of the view box.
|
||||
|
||||
var updateViewBox = function updateViewBox() {
|
||||
var portHeight = parseFloat($('#workarea').css('height'));
|
||||
var portWidth = parseFloat($('#workarea').css('width'));
|
||||
var portHeight = Number.parseFloat($('#workarea').css('height'));
|
||||
var portWidth = Number.parseFloat($('#workarea').css('width'));
|
||||
var portX = $('#workarea').scrollLeft();
|
||||
var portY = $('#workarea').scrollTop();
|
||||
var windowWidth = parseFloat($('#svgcanvas').css('width'));
|
||||
var windowHeight = parseFloat($('#svgcanvas').css('height'));
|
||||
var windowWidth = Number.parseFloat($('#svgcanvas').css('width'));
|
||||
var windowHeight = Number.parseFloat($('#svgcanvas').css('height'));
|
||||
var overviewWidth = $('#overviewMiniView').attr('width');
|
||||
var overviewHeight = $('#overviewMiniView').attr('height');
|
||||
var viewBoxX = portX / windowWidth * overviewWidth;
|
||||
|
@ -87,12 +87,12 @@ var svgEditorExtension_overview_window = (function () {
|
|||
overviewWindowGlobals.viewBoxDragging = false;
|
||||
|
||||
var updateViewPortFromViewBox = function updateViewPortFromViewBox() {
|
||||
var windowWidth = parseFloat($('#svgcanvas').css('width'));
|
||||
var windowHeight = parseFloat($('#svgcanvas').css('height'));
|
||||
var windowWidth = Number.parseFloat($('#svgcanvas').css('width'));
|
||||
var windowHeight = Number.parseFloat($('#svgcanvas').css('height'));
|
||||
var overviewWidth = $('#overviewMiniView').attr('width');
|
||||
var overviewHeight = $('#overviewMiniView').attr('height');
|
||||
var viewBoxX = parseFloat($('#overview_window_view_box').css('left'));
|
||||
var viewBoxY = parseFloat($('#overview_window_view_box').css('top'));
|
||||
var viewBoxX = Number.parseFloat($('#overview_window_view_box').css('left'));
|
||||
var viewBoxY = Number.parseFloat($('#overview_window_view_box').css('top'));
|
||||
var portX = viewBoxX / overviewWidth * windowWidth;
|
||||
var portY = viewBoxY / overviewHeight * windowHeight;
|
||||
$('#workarea').scrollLeft(portX);
|
||||
|
@ -115,8 +115,8 @@ var svgEditorExtension_overview_window = (function () {
|
|||
var mouseY = evt.offsetY || evt.originalEvent.layerY;
|
||||
var overviewWidth = $('#overviewMiniView').attr('width');
|
||||
var overviewHeight = $('#overviewMiniView').attr('height');
|
||||
var viewBoxWidth = parseFloat($('#overview_window_view_box').css('min-width'));
|
||||
var viewBoxHeight = parseFloat($('#overview_window_view_box').css('min-height'));
|
||||
var viewBoxWidth = Number.parseFloat($('#overview_window_view_box').css('min-width'));
|
||||
var viewBoxHeight = Number.parseFloat($('#overview_window_view_box').css('min-height'));
|
||||
var viewBoxX = mouseX - 0.5 * viewBoxWidth;
|
||||
var viewBoxY = mouseY - 0.5 * viewBoxHeight; // deal with constraints
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_panning = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-panning.js
|
||||
* @file ext-panning.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -51,10 +51,10 @@ var svgEditorExtension_panning = (function () {
|
|||
*/
|
||||
var extPanning = {
|
||||
name: 'panning',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var importLocale, strings, svgEditor, svgCanvas, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -66,7 +66,7 @@ var svgEditorExtension_panning = (function () {
|
|||
|
||||
case 3:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
buttons = [{
|
||||
id: 'ext-panning',
|
||||
|
@ -112,15 +112,9 @@ var svgEditorExtension_panning = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extPanning;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
|
@ -46,10 +46,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
|
@ -75,12 +72,29 @@ var svgEditorExtension_placemark = (function () {
|
|||
return _arr;
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-placemark.js
|
||||
* @file ext-placemark.js
|
||||
*
|
||||
*
|
||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||
|
@ -88,16 +102,16 @@ var svgEditorExtension_placemark = (function () {
|
|||
*/
|
||||
var extPlacemark = {
|
||||
name: 'placemark',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var svgEditor, svgCanvas, addElem, $, importLocale, selElems, started, newPM, strings, markerTypes, showPanel, getLinked, updateText, updateFont, addMarker, setMarker, colorChanged, updateReferences, setArrowFromButton, getTitle, addMarkerButtons, buttons, contextTools;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
addMarkerButtons = function _ref11(buttons) {
|
||||
addMarkerButtons = function _addMarkerButtons(buttons) {
|
||||
Object.keys(markerTypes).forEach(function (id) {
|
||||
var title = getTitle(String(id));
|
||||
buttons.push({
|
||||
|
@ -117,7 +131,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
return buttons;
|
||||
};
|
||||
|
||||
getTitle = function _ref10(id) {
|
||||
getTitle = function _getTitle(id) {
|
||||
var langList = strings.langList;
|
||||
var item = langList.find(function (itm) {
|
||||
return itm.id === id;
|
||||
|
@ -125,7 +139,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
return item ? item.title : id;
|
||||
};
|
||||
|
||||
setArrowFromButton = function _ref9(ev) {
|
||||
setArrowFromButton = function _setArrowFromButton(ev) {
|
||||
var parts = this.id.split('_');
|
||||
var val = parts[2];
|
||||
|
||||
|
@ -136,7 +150,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
$('#placemark_marker').attr('value', val);
|
||||
};
|
||||
|
||||
updateReferences = function _ref8(el) {
|
||||
updateReferences = function _updateReferences(el) {
|
||||
var id = 'placemark_marker_' + el.id;
|
||||
var markerName = 'marker-start';
|
||||
var marker = getLinked(el, markerName);
|
||||
|
@ -161,7 +175,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
colorChanged = function _ref7(el) {
|
||||
colorChanged = function _colorChanged(el) {
|
||||
var color = el.getAttribute('stroke');
|
||||
var marker = getLinked(el, 'marker-start'); // console.log(marker);
|
||||
|
||||
|
@ -192,7 +206,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
}
|
||||
};
|
||||
|
||||
setMarker = function _ref6(el, val) {
|
||||
setMarker = function _setMarker(el, val) {
|
||||
var markerName = 'marker-start';
|
||||
var marker = getLinked(el, markerName);
|
||||
|
||||
|
@ -214,7 +228,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
svgCanvas.call('changed', [el]);
|
||||
};
|
||||
|
||||
addMarker = function _ref5(id, val) {
|
||||
addMarker = function _addMarker(id, val) {
|
||||
var marker = svgCanvas.getElem(id);
|
||||
|
||||
if (marker) {
|
||||
|
@ -274,9 +288,9 @@ var svgEditorExtension_placemark = (function () {
|
|||
return marker;
|
||||
};
|
||||
|
||||
updateFont = function _ref4(font) {
|
||||
updateFont = function _updateFont(font) {
|
||||
font = font.split(' ');
|
||||
var fontSize = parseInt(font.pop());
|
||||
var fontSize = Number.parseInt(font.pop());
|
||||
font = font.join(' ');
|
||||
selElems.forEach(function (elem) {
|
||||
if (elem && elem.getAttribute('class').includes('placemark')) {
|
||||
|
@ -296,7 +310,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
updateText = function _ref3(txt) {
|
||||
updateText = function _updateText(txt) {
|
||||
var items = txt.split(';');
|
||||
selElems.forEach(function (elem) {
|
||||
if (elem && elem.getAttribute('class').includes('placemark')) {
|
||||
|
@ -314,7 +328,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
getLinked = function _ref2(elem, attr) {
|
||||
getLinked = function _getLinked(elem, attr) {
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
|
@ -336,11 +350,11 @@ var svgEditorExtension_placemark = (function () {
|
|||
return svgCanvas.getElem(m[1]); // return svgCanvas.getElem(m.groups.id);
|
||||
};
|
||||
|
||||
showPanel = function _ref(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
$('#placemark_panel').toggle(on);
|
||||
};
|
||||
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
addElem = svgCanvas.addSVGElementFromJson;
|
||||
$ = S.$, importLocale = S.importLocale; // {svgcontent},
|
||||
|
@ -490,7 +504,7 @@ var svgEditorExtension_placemark = (function () {
|
|||
var id = svgCanvas.getNextId();
|
||||
var items = $('#placemarkText').val().split(';');
|
||||
var font = $('#placemarkFont').val().split(' ');
|
||||
var fontSize = parseInt(font.pop());
|
||||
var fontSize = Number.parseInt(font.pop());
|
||||
font = font.join(' ');
|
||||
var x0 = opts.start_x + 10,
|
||||
y0 = opts.start_y + 10;
|
||||
|
@ -700,15 +714,9 @@ var svgEditorExtension_placemark = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extPlacemark;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_polygon = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-polygon.js
|
||||
* @file ext-polygon.js
|
||||
*
|
||||
*
|
||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||
|
@ -46,29 +46,29 @@ var svgEditorExtension_polygon = (function () {
|
|||
*/
|
||||
var extPolygon = {
|
||||
name: 'polygon',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var svgEditor, svgCanvas, $, importLocale, editingitex, strings, selElems, started, newFO, showPanel, setAttr, cot, sec, buttons, contextTools;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
sec = function _ref4(n) {
|
||||
sec = function _sec(n) {
|
||||
return 1 / Math.cos(n);
|
||||
};
|
||||
|
||||
cot = function _ref3(n) {
|
||||
cot = function _cot(n) {
|
||||
return 1 / Math.tan(n);
|
||||
};
|
||||
|
||||
setAttr = function _ref2(attr, val) {
|
||||
setAttr = function _setAttr(attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
svgCanvas.call('changed', selElems);
|
||||
};
|
||||
|
||||
showPanel = function _ref(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
var fcRules = $('#fc_rules');
|
||||
|
||||
if (!fcRules.length) {
|
||||
|
@ -79,7 +79,7 @@ var svgEditorExtension_polygon = (function () {
|
|||
$('#polygon_panel').toggle(on);
|
||||
};
|
||||
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
$ = S.$, importLocale = S.importLocale, editingitex = false;
|
||||
_context.next = 9;
|
||||
|
@ -299,15 +299,9 @@ var svgEditorExtension_polygon = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extPolygon;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_shapes = (function () {
|
|||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
|
@ -46,10 +46,7 @@ var svgEditorExtension_shapes = (function () {
|
|||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
|
@ -75,12 +72,29 @@ var svgEditorExtension_shapes = (function () {
|
|||
return _arr;
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-shapes.js
|
||||
* @file ext-shapes.js
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
|
@ -89,16 +103,16 @@ var svgEditorExtension_shapes = (function () {
|
|||
*/
|
||||
var extShapes = {
|
||||
name: 'shapes',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var $, importLocale, strings, svgEditor, canv, svgroot, lastBBox, categories, library, modeId, startClientPos, currentD, curShapeId, curShape, startX, startY, curLib, loadIcons, makeButtons, loadLibrary, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
loadLibrary = function _ref8(catId) {
|
||||
loadLibrary = function _loadLibrary(catId) {
|
||||
var lib = library[catId];
|
||||
|
||||
if (!lib) {
|
||||
|
@ -124,7 +138,7 @@ var svgEditorExtension_shapes = (function () {
|
|||
loadIcons();
|
||||
};
|
||||
|
||||
makeButtons = function _ref7(cat, shapes) {
|
||||
makeButtons = function _makeButtons(cat, shapes) {
|
||||
var size = curLib.size || 300;
|
||||
var fill = curLib.fill || false;
|
||||
var off = size * 0.05;
|
||||
|
@ -153,7 +167,7 @@ var svgEditorExtension_shapes = (function () {
|
|||
});
|
||||
};
|
||||
|
||||
loadIcons = function _ref6() {
|
||||
loadIcons = function _loadIcons() {
|
||||
$('#shape_buttons').empty().append(curLib.buttons);
|
||||
};
|
||||
|
||||
|
@ -163,7 +177,7 @@ var svgEditorExtension_shapes = (function () {
|
|||
|
||||
case 6:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
canv = svgEditor.canvas;
|
||||
svgroot = canv.getRootElem();
|
||||
lastBBox = {}; // This populates the category list
|
||||
|
@ -413,15 +427,9 @@ var svgEditorExtension_shapes = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extShapes;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_star = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* ext-star.js
|
||||
* @file ext-star.js
|
||||
*
|
||||
*
|
||||
* @copyright 2010 CloudCanvas, Inc. All rights reserved
|
||||
|
@ -46,21 +46,21 @@ var svgEditorExtension_star = (function () {
|
|||
*/
|
||||
var extStar = {
|
||||
name: 'star',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(S) {
|
||||
init: function init(S) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var svgEditor, svgCanvas, $, importLocale, selElems, started, newFO, strings, showPanel, setAttr, buttons, contextTools;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
setAttr = function _ref2(attr, val) {
|
||||
setAttr = function _setAttr(attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
svgCanvas.call('changed', selElems);
|
||||
};
|
||||
|
||||
showPanel = function _ref(on) {
|
||||
showPanel = function _showPanel(on) {
|
||||
var fcRules = $('#fc_rules');
|
||||
|
||||
if (!fcRules.length) {
|
||||
|
@ -71,7 +71,7 @@ var svgEditorExtension_star = (function () {
|
|||
$('#star_panel').toggle(on);
|
||||
};
|
||||
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
svgCanvas = svgEditor.canvas;
|
||||
$ = S.$, importLocale = S.importLocale; // {svgcontent},
|
||||
|
||||
|
@ -284,15 +284,9 @@ var svgEditorExtension_star = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extStar;
|
||||
|
|
|
@ -38,7 +38,7 @@ var svgEditorExtension_storage = (function () {
|
|||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
|
@ -46,10 +46,7 @@ var svgEditorExtension_storage = (function () {
|
|||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
|
@ -75,12 +72,29 @@ var svgEditorExtension_storage = (function () {
|
|||
return _arr;
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* ext-storage.js
|
||||
* @file ext-storage.js
|
||||
*
|
||||
* This extension allows automatic saving of the SVG canvas contents upon
|
||||
* page unload (which can later be automatically retrieved upon future
|
||||
|
@ -89,15 +103,13 @@ var svgEditorExtension_storage = (function () {
|
|||
* The functionality was originally part of the SVG Editor, but moved to a
|
||||
* separate extension to make the setting behavior optional, and adapted
|
||||
* to inform the user of its setting of local data.
|
||||
* Dependencies:
|
||||
*
|
||||
* 1. jQuery BBQ (for deparam)
|
||||
* @license MIT
|
||||
*
|
||||
* @copyright 2010 Brett Zamir
|
||||
* @todo Revisit on whether to use $.pref over directly setting curConfig in all
|
||||
* extensions for a more public API (not only for extPath and imagePath,
|
||||
* but other currently used config in the extensions)
|
||||
* @todo Revisit on whether to use `svgEditor.pref` over directly setting
|
||||
* `curConfig` in all extensions for a more public API (not only for `extPath`
|
||||
* and `imagePath`, but other currently used config in the extensions)
|
||||
* @todo We might provide control of storage settings through the UI besides the
|
||||
* initial (or URL-forced) dialog. *
|
||||
*/
|
||||
|
@ -122,6 +134,7 @@ var svgEditorExtension_storage = (function () {
|
|||
* Replace `storagePrompt` parameter within URL.
|
||||
* @param {string} val
|
||||
* @returns {void}
|
||||
* @todo Replace the string manipulation with `searchParams.set`
|
||||
*/
|
||||
|
||||
function replaceStoragePrompt(val) {
|
||||
|
@ -253,18 +266,16 @@ var svgEditorExtension_storage = (function () {
|
|||
var loaded = false;
|
||||
return {
|
||||
name: 'storage',
|
||||
langReady: function () {
|
||||
var _langReady = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref4) {
|
||||
var importLocale, _$$deparam$querystrin, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight, _ref5, pref, checked;
|
||||
langReady: function langReady(_ref4) {
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var importLocale, storagePrompt, confirmSetStorage, message, storagePrefsAndContent, storagePrefsOnly, storagePrefs, storageNoPrefsOrContent, storageNoPrefs, rememberLabel, rememberTooltip, options, oldContainerWidth, oldContainerMarginLeft, oldContentHeight, oldContainerHeight, _yield$$$select, pref, checked;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
importLocale = _ref4.importLocale;
|
||||
_$$deparam$querystrin = $.deparam.querystring(true), storagePrompt = _$$deparam$querystrin.storagePrompt;
|
||||
storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
||||
_context.next = 4;
|
||||
return importLocale();
|
||||
|
||||
|
@ -289,11 +300,11 @@ var svgEditorExtension_storage = (function () {
|
|||
if (!(!forceStorage && ( // If the URL has been explicitly set to always prompt the
|
||||
// user (e.g., so one can be pointed to a URL where one
|
||||
// can alter one's settings, say to prevent future storage)...
|
||||
storagePrompt === true || // ...or...if the URL at least doesn't explicitly prevent a
|
||||
storagePrompt === 'true' || // ...or...if the URL at least doesn't explicitly prevent a
|
||||
// storage prompt (as we use for users who
|
||||
// don't want to set cookies at all but who don't want
|
||||
// continual prompts about it)...
|
||||
storagePrompt !== false && // ...and this user hasn't previously indicated a desire for storage
|
||||
storagePrompt !== 'false' && // ...and this user hasn't previously indicated a desire for storage
|
||||
!document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/) // ...then show the storage prompt.
|
||||
))) {
|
||||
_context.next = 44;
|
||||
|
@ -340,9 +351,9 @@ var svgEditorExtension_storage = (function () {
|
|||
});
|
||||
|
||||
case 20:
|
||||
_ref5 = _context.sent;
|
||||
pref = _ref5.response;
|
||||
checked = _ref5.checked;
|
||||
_yield$$$select = _context.sent;
|
||||
pref = _yield$$$select.response;
|
||||
checked = _yield$$$select.checked;
|
||||
|
||||
if (!(pref && pref !== 'noPrefsOrContent')) {
|
||||
_context.next = 30;
|
||||
|
@ -355,14 +366,13 @@ var svgEditorExtension_storage = (function () {
|
|||
// doesn't even want to remember their not wanting
|
||||
// storage, so we don't set the cookie or continue on with
|
||||
// setting storage on beforeunload
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
document.cookie = 'svgeditstore=' + encodeURIComponent(pref) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; // 'prefsAndContent' | 'prefsOnly'
|
||||
// If the URL was configured to always insist on a prompt, if
|
||||
// the user does indicate a wish to store their info, we
|
||||
// don't want ask them again upon page refresh so move
|
||||
// them instead to a URL which does not always prompt
|
||||
|
||||
if (!(storagePrompt === true && checked)) {
|
||||
if (!(storagePrompt === 'true' && checked)) {
|
||||
_context.next = 28;
|
||||
break;
|
||||
}
|
||||
|
@ -423,14 +433,8 @@ var svgEditorExtension_storage = (function () {
|
|||
}
|
||||
}
|
||||
}, _callee);
|
||||
}));
|
||||
|
||||
function langReady(_x) {
|
||||
return _langReady.apply(this, arguments);
|
||||
}
|
||||
|
||||
return langReady;
|
||||
}()
|
||||
}))();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -38,17 +38,18 @@ var svgEditorExtension_webappfind = (function () {
|
|||
}
|
||||
|
||||
/**
|
||||
* Depends on Firefox add-on and executables from {@link https://github.com/brettz9/webappfind}
|
||||
* Depends on Firefox add-on and executables from
|
||||
* {@link https://github.com/brettz9/webappfind}.
|
||||
* @author Brett Zamir
|
||||
* @license MIT
|
||||
* @todo See WebAppFind Readme for SVG-related todos
|
||||
*/
|
||||
var extWebappfind = {
|
||||
name: 'webappfind',
|
||||
init: function () {
|
||||
var _init = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee(_ref) {
|
||||
init: function init(_ref) {
|
||||
var _this = this;
|
||||
|
||||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
||||
var importLocale, $, strings, svgEditor, saveMessage, readMessage, excludedMessages, pathID, buttons;
|
||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -60,12 +61,15 @@ var svgEditorExtension_webappfind = (function () {
|
|||
|
||||
case 3:
|
||||
strings = _context.sent;
|
||||
svgEditor = this;
|
||||
svgEditor = _this;
|
||||
saveMessage = 'save', readMessage = 'read', excludedMessages = [readMessage, saveMessage];
|
||||
this.canvas.bind('message',
|
||||
|
||||
_this.canvas.bind('message',
|
||||
/**
|
||||
* @param {external:Window} win
|
||||
* @param {module:svgcanvas.SvgCanvas#event:message} data
|
||||
* @param {PlainObject} info
|
||||
* @param {module:svgcanvas.SvgCanvas#event:message} info.data
|
||||
* @param {string} info.origin
|
||||
* @listens module:svgcanvas.SvgCanvas#event:message
|
||||
* @throws {Error} Unexpected event type
|
||||
* @returns {void}
|
||||
|
@ -124,6 +128,7 @@ var svgEditorExtension_webappfind = (function () {
|
|||
);
|
||||
*/
|
||||
|
||||
|
||||
buttons = [{
|
||||
id: 'webappfind_save',
|
||||
//
|
||||
|
@ -163,15 +168,9 @@ var svgEditorExtension_webappfind = (function () {
|
|||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}));
|
||||
|
||||
function init(_x) {
|
||||
return _init.apply(this, arguments);
|
||||
}
|
||||
|
||||
return init;
|
||||
}()
|
||||
}, _callee);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
|
||||
return extWebappfind;
|
||||
|
|
|
@ -2,6 +2,8 @@ var svgEditorExtension_xdomain_messaging = (function () {
|
|||
'use strict';
|
||||
|
||||
function _typeof(obj) {
|
||||
"@babel/helpers - typeof";
|
||||
|
||||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||||
_typeof = function (obj) {
|
||||
return typeof obj;
|
||||
|
@ -16,29 +18,42 @@ var svgEditorExtension_xdomain_messaging = (function () {
|
|||
}
|
||||
|
||||
function _toConsumableArray(arr) {
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
||||
}
|
||||
|
||||
function _arrayWithoutHoles(arr) {
|
||||
if (Array.isArray(arr)) {
|
||||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
||||
}
|
||||
|
||||
function _iterableToArray(iter) {
|
||||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableSpread() {
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Should not be needed for same domain control (just call via child frame),
|
||||
* but an API common for cross-domain and same domain use can be found
|
||||
* in embedapi.js with a demo at embedapi.html
|
||||
* in embedapi.js with a demo at embedapi.html.
|
||||
*/
|
||||
var extXdomainMessaging = {
|
||||
name: 'xdomain-messaging',
|
||||
|
|
|
@ -24,19 +24,15 @@
|
|||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _toConsumableArray(arr) {
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
||||
}
|
||||
|
||||
function _arrayWithoutHoles(arr) {
|
||||
if (Array.isArray(arr)) {
|
||||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
|
@ -44,14 +40,11 @@
|
|||
}
|
||||
|
||||
function _iterableToArray(iter) {
|
||||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
||||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
|
@ -77,16 +70,33 @@
|
|||
return _arr;
|
||||
}
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) {
|
||||
if (!o) return;
|
||||
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
||||
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||||
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||||
if (n === "Map" || n === "Set") return Array.from(o);
|
||||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
||||
}
|
||||
|
||||
function _arrayLikeToArray(arr, len) {
|
||||
if (len == null || len > arr.length) len = arr.length;
|
||||
|
||||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
}
|
||||
|
||||
function _nonIterableSpread() {
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* For parsing color values
|
||||
* For parsing color values.
|
||||
* @module RGBColor
|
||||
* @author Stoyan Stefanov <sstoo@gmail.com>
|
||||
* @see https://www.phpied.com/rgb-color-parser-in-javascript/
|
||||
|
@ -248,7 +258,7 @@
|
|||
}
|
||||
|
||||
return bits.map(function (b) {
|
||||
return parseInt(b);
|
||||
return Number.parseInt(b);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
|
@ -261,7 +271,7 @@
|
|||
}
|
||||
|
||||
return bits.map(function (b) {
|
||||
return parseInt(b, 16);
|
||||
return Number.parseInt(b, 16);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
|
@ -274,7 +284,7 @@
|
|||
}
|
||||
|
||||
return bits.map(function (b) {
|
||||
return parseInt(b + b, 16);
|
||||
return Number.parseInt(b + b, 16);
|
||||
});
|
||||
}
|
||||
}];
|
||||
|
@ -282,9 +292,7 @@
|
|||
* A class to parse color values.
|
||||
*/
|
||||
|
||||
var RGBColor =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var RGBColor = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {string} colorString
|
||||
*/
|
||||
|
@ -416,12 +424,13 @@
|
|||
circle: ['cx', 'cy', 'r', 'stroke', 'fill', 'stroke-width'],
|
||||
polygon: ['points', 'stroke', 'fill', 'stroke-width'],
|
||||
// polyline attributes are the same as those of polygon
|
||||
path: ['d', 'stroke', 'fill', 'stroke-width'],
|
||||
text: ['x', 'y', 'font-size', 'font-family', 'text-anchor', 'font-weight', 'font-style', 'fill']
|
||||
};
|
||||
|
||||
var attributeIsNotEmpty = function attributeIsNotEmpty(node, attr) {
|
||||
var attVal = attr ? node.getAttribute(attr) : node;
|
||||
return attVal !== '' && attVal !== null;
|
||||
return attVal !== '' && attVal !== null && attVal !== 'null';
|
||||
};
|
||||
|
||||
var nodeIs = function nodeIs(node, possible) {
|
||||
|
@ -479,6 +488,226 @@
|
|||
};
|
||||
};
|
||||
|
||||
var getLinesOptionsOfPath = function getLinesOptionsOfPath(node) {
|
||||
var segList = node.pathSegList,
|
||||
n = segList.numberOfItems,
|
||||
opsList = [];
|
||||
var ops = {
|
||||
lines: []
|
||||
};
|
||||
var curr = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
var reflectControl = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
var toRelative = function toRelative(nums, relativeTo) {
|
||||
var re = [];
|
||||
|
||||
for (var i = 0; i < nums.length - 1; i += 2) {
|
||||
re[i] = nums[i] - relativeTo.x;
|
||||
re[i + 1] = nums[i + 1] - relativeTo.y;
|
||||
}
|
||||
|
||||
return re;
|
||||
};
|
||||
|
||||
var curveQToC = function curveQToC(nums) {
|
||||
var a = 2 / 3;
|
||||
var re = [nums[0] * a, nums[1] * a, nums[2] + (nums[0] - nums[2]) * a, nums[3] + (nums[1] - nums[3]) * a, nums[2], nums[3]];
|
||||
return re;
|
||||
};
|
||||
|
||||
for (var i = 0, letterPrev; i < n; i++) {
|
||||
var seg = segList.getItem(i);
|
||||
var x1 = seg.x1,
|
||||
y1 = seg.y1,
|
||||
x2 = seg.x2,
|
||||
y2 = seg.y2,
|
||||
x = seg.x,
|
||||
y = seg.y,
|
||||
letter = seg.pathSegTypeAsLetter;
|
||||
var isRelative = letter >= 'a'; // lowercase letter
|
||||
|
||||
switch (letter) {
|
||||
case 'M':
|
||||
case 'm':
|
||||
{
|
||||
if (ops.lines.length && Object.prototype.hasOwnProperty.call(ops, 'x')) {
|
||||
opsList.push(ops);
|
||||
}
|
||||
|
||||
ops = {
|
||||
lines: [],
|
||||
x: isRelative ? x + curr.x : x,
|
||||
y: isRelative ? y + curr.y : y,
|
||||
closed: false
|
||||
};
|
||||
ops.closed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'L':
|
||||
{
|
||||
ops.lines.push(toRelative([x, y], curr));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'l':
|
||||
{
|
||||
ops.lines.push([x, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'H':
|
||||
{
|
||||
ops.lines.push([x - curr.x, 0]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'h':
|
||||
{
|
||||
ops.lines.push([x, 0]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'V':
|
||||
{
|
||||
ops.lines.push([0, y - curr.y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v':
|
||||
{
|
||||
ops.lines.push([0, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Q':
|
||||
{
|
||||
ops.lines.push(curveQToC(toRelative([x1, y1, x, y], curr)));
|
||||
reflectControl.x = x - x1;
|
||||
reflectControl.y = y - y1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'q':
|
||||
{
|
||||
ops.lines.push(curveQToC([x1, y1, x, y]));
|
||||
reflectControl.x = x - x1;
|
||||
reflectControl.y = y - y1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'T':
|
||||
{
|
||||
var p1 = letterPrev && 'QqTt'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
ops.lines.push(curveQToC([p1.x, p1.y, x - curr.x, y - curr.y]));
|
||||
reflectControl.x = x - curr.x - p1.x;
|
||||
reflectControl.y = y - curr.y - p1.y;
|
||||
break;
|
||||
}
|
||||
|
||||
case 't':
|
||||
{
|
||||
var _p = letterPrev && 'QqTt'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
ops.lines.push([_p.x, _p.y, x, y]);
|
||||
reflectControl.x = x - _p.x;
|
||||
reflectControl.y = y - _p.y;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'C':
|
||||
{
|
||||
ops.lines.push(toRelative([x1, y1, x2, y2, x, y], curr));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c':
|
||||
{
|
||||
ops.lines.push([x1, y1, x2, y2, x, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'S':
|
||||
case 's':
|
||||
{
|
||||
var _p2 = letterPrev && 'CcSs'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isRelative) {
|
||||
ops.lines.push([_p2.x, _p2.y, x2, y2, x, y]);
|
||||
} else {
|
||||
ops.lines.push([_p2.x, _p2.y].concat(toRelative([x2, y2, x, y], curr)));
|
||||
}
|
||||
|
||||
reflectControl.x = x - x2;
|
||||
reflectControl.y = y - y2;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'A':
|
||||
case 'a':
|
||||
{
|
||||
// Not support command 'A' and 'a' yet. Treat it as straight line instead.
|
||||
if (isRelative) {
|
||||
ops.lines.push([x, y]);
|
||||
} else {
|
||||
ops.lines.push(toRelative([x, y], curr));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'z':
|
||||
case 'Z':
|
||||
{
|
||||
ops.closed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// throw new Error('Unknown path command ' + letter);
|
||||
return opsList;
|
||||
}
|
||||
}
|
||||
|
||||
if (letter === 'Z' || letter === 'z') {
|
||||
curr.x = ops.x;
|
||||
curr.y = ops.y;
|
||||
} else {
|
||||
if (letter !== 'V' && letter !== 'v') {
|
||||
curr.x = isRelative ? x + curr.x : x;
|
||||
}
|
||||
|
||||
if (letter !== 'H' && letter !== 'h') {
|
||||
curr.y = isRelative ? y + curr.y : y;
|
||||
}
|
||||
}
|
||||
|
||||
letterPrev = letter;
|
||||
}
|
||||
|
||||
if (ops.lines.length && Object.prototype.hasOwnProperty.call(ops, 'x')) {
|
||||
opsList.push(ops);
|
||||
}
|
||||
|
||||
return opsList;
|
||||
};
|
||||
|
||||
var svgElementToPdf = function svgElementToPdf(element, pdf, options) {
|
||||
// pdf is a jsPDF object
|
||||
// console.log('options =', options);
|
||||
|
@ -490,11 +719,12 @@
|
|||
// let hasStrokeColor = false;
|
||||
var hasFillColor = false;
|
||||
var fillRGB;
|
||||
colorMode = null;
|
||||
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'text'])) {
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'path', 'text'])) {
|
||||
var fillColor = node.getAttribute('fill');
|
||||
|
||||
if (attributeIsNotEmpty(fillColor)) {
|
||||
if (attributeIsNotEmpty(fillColor) && node.getAttribute('fill-opacity') !== '0') {
|
||||
fillRGB = new RGBColor(fillColor);
|
||||
|
||||
if (fillRGB.ok) {
|
||||
|
@ -506,25 +736,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline'])) {
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'path'])) {
|
||||
if (hasFillColor) {
|
||||
pdf.setFillColor(fillRGB.r, fillRGB.g, fillRGB.b);
|
||||
}
|
||||
|
||||
if (attributeIsNotEmpty(node, 'stroke-width')) {
|
||||
pdf.setLineWidth(k * parseInt(node.getAttribute('stroke-width')));
|
||||
pdf.setLineWidth(k * Number.parseInt(node.getAttribute('stroke-width')));
|
||||
}
|
||||
|
||||
var strokeColor = node.getAttribute('stroke');
|
||||
|
||||
if (attributeIsNotEmpty(strokeColor)) {
|
||||
if (attributeIsNotEmpty(strokeColor) && node.getAttribute('stroke-width') !== '0' && node.getAttribute('stroke-opacity') !== '0') {
|
||||
var strokeRGB = new RGBColor(strokeColor);
|
||||
|
||||
if (strokeRGB.ok) {
|
||||
// hasStrokeColor = true;
|
||||
pdf.setDrawColor(strokeRGB.r, strokeRGB.g, strokeRGB.b);
|
||||
|
||||
if (colorMode === 'F') {
|
||||
if (hasFillColor) {
|
||||
colorMode = 'FD';
|
||||
} else {
|
||||
colorMode = 'S';
|
||||
|
@ -546,22 +776,22 @@
|
|||
break;
|
||||
|
||||
case 'line':
|
||||
pdf.line(k * parseInt(node.getAttribute('x1')), k * parseInt(node.getAttribute('y1')), k * parseInt(node.getAttribute('x2')), k * parseInt(node.getAttribute('y2')));
|
||||
pdf.line(k * Number.parseInt(node.getAttribute('x1')), k * Number.parseInt(node.getAttribute('y1')), k * Number.parseInt(node.getAttribute('x2')), k * Number.parseInt(node.getAttribute('y2')));
|
||||
removeAttributes(node, pdfSvgAttr.line);
|
||||
break;
|
||||
|
||||
case 'rect':
|
||||
pdf.rect(k * parseInt(node.getAttribute('x')), k * parseInt(node.getAttribute('y')), k * parseInt(node.getAttribute('width')), k * parseInt(node.getAttribute('height')), colorMode);
|
||||
pdf.rect(k * Number.parseInt(node.getAttribute('x')), k * Number.parseInt(node.getAttribute('y')), k * Number.parseInt(node.getAttribute('width')), k * Number.parseInt(node.getAttribute('height')), colorMode);
|
||||
removeAttributes(node, pdfSvgAttr.rect);
|
||||
break;
|
||||
|
||||
case 'ellipse':
|
||||
pdf.ellipse(k * parseInt(node.getAttribute('cx')), k * parseInt(node.getAttribute('cy')), k * parseInt(node.getAttribute('rx')), k * parseInt(node.getAttribute('ry')), colorMode);
|
||||
pdf.ellipse(k * Number.parseInt(node.getAttribute('cx')), k * Number.parseInt(node.getAttribute('cy')), k * Number.parseInt(node.getAttribute('rx')), k * Number.parseInt(node.getAttribute('ry')), colorMode);
|
||||
removeAttributes(node, pdfSvgAttr.ellipse);
|
||||
break;
|
||||
|
||||
case 'circle':
|
||||
pdf.circle(k * parseInt(node.getAttribute('cx')), k * parseInt(node.getAttribute('cy')), k * parseInt(node.getAttribute('r')), colorMode);
|
||||
pdf.circle(k * Number.parseInt(node.getAttribute('cx')), k * Number.parseInt(node.getAttribute('cy')), k * Number.parseInt(node.getAttribute('r')), colorMode);
|
||||
removeAttributes(node, pdfSvgAttr.circle);
|
||||
break;
|
||||
|
||||
|
@ -576,7 +806,37 @@
|
|||
}
|
||||
|
||||
removeAttributes(node, pdfSvgAttr.polygon);
|
||||
break; // TODO: path
|
||||
break;
|
||||
}
|
||||
|
||||
case 'path':
|
||||
{
|
||||
if (colorMode) {
|
||||
var linesOptionsList = getLinesOptionsOfPath(node);
|
||||
|
||||
if (linesOptionsList.length > 0) {
|
||||
linesOptionsList.forEach(function (linesOptions) {
|
||||
pdf.lines(linesOptions.lines, k * linesOptions.x, k * linesOptions.y, [k, k], null, linesOptions.closed);
|
||||
}); // svg fill rule default is nonzero
|
||||
|
||||
var fillRule = node.getAttribute('fill-rule');
|
||||
|
||||
if (fillRule === 'evenodd') {
|
||||
// f* : fill using even-odd rule
|
||||
// B* : stroke and fill using even-odd rule
|
||||
if (colorMode === 'F') {
|
||||
colorMode = 'f*';
|
||||
} else if (colorMode === 'FD') {
|
||||
colorMode = 'B*';
|
||||
}
|
||||
}
|
||||
|
||||
pdf.internal.write(pdf.internal.getStyle(colorMode));
|
||||
}
|
||||
}
|
||||
|
||||
removeAttributes(node, pdfSvgAttr.path);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'text':
|
||||
|
@ -591,6 +851,18 @@
|
|||
pdf.setFont('courier');
|
||||
break;
|
||||
|
||||
case 'times':
|
||||
pdf.setFont('times');
|
||||
break;
|
||||
|
||||
case 'courier':
|
||||
pdf.setFont('courier');
|
||||
break;
|
||||
|
||||
case 'helvetica':
|
||||
pdf.setFont('helvetica');
|
||||
break;
|
||||
|
||||
default:
|
||||
node.setAttribute('font-family', 'sans-serif');
|
||||
pdf.setFont('helvetica');
|
||||
|
@ -620,7 +892,7 @@
|
|||
}
|
||||
|
||||
pdf.setFontType(fontType);
|
||||
var pdfFontSize = node.hasAttribute('font-size') ? parseInt(node.getAttribute('font-size')) : 16;
|
||||
var pdfFontSize = node.hasAttribute('font-size') ? Number.parseInt(node.getAttribute('font-size')) : 16;
|
||||
/**
|
||||
*
|
||||
* @param {Element} elem
|
||||
|
@ -647,7 +919,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
document.body.removeChild(svg);
|
||||
svg.remove();
|
||||
}
|
||||
|
||||
return box.width;
|
||||
|
@ -676,8 +948,8 @@
|
|||
break;
|
||||
}
|
||||
|
||||
x = parseInt(node.getAttribute('x')) - xOffset;
|
||||
y = parseInt(node.getAttribute('y'));
|
||||
x = Number.parseInt(node.getAttribute('x')) - xOffset;
|
||||
y = Number.parseInt(node.getAttribute('y'));
|
||||
} // console.log('fontSize:', pdfFontSize, 'text:', node.textContent);
|
||||
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_af = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Ungroup Elemente',
|
||||
docprops: 'Document Properties',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Skuif na Bottom',
|
||||
move_top: 'Skuif na bo',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_ar = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'فك تجميع عناصر',
|
||||
docprops: 'خصائص المستند',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'الانتقال إلى أسفل',
|
||||
move_top: 'الانتقال إلى أعلى',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_az = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Ungroup Elements',
|
||||
docprops: 'Document Properties',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Move to Bottom',
|
||||
move_top: 'Move to Top',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_be = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Элементы Разгруппировать',
|
||||
docprops: 'Уласцівасці дакумента',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Перамясціць уніз',
|
||||
move_top: 'Перамясціць угару',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_bg = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Разгрупирай Елементи',
|
||||
docprops: 'Document Properties',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Премести надолу',
|
||||
move_top: 'Премести в началото',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_ca = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Desagrupar elements',
|
||||
docprops: 'Propietats del document',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Mou al final',
|
||||
move_top: 'Mou al principi',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_cs = (function () {
|
|||
reorient_path: 'Změna orientace křivky',
|
||||
ungroup: 'Zrušit seskupení',
|
||||
docprops: 'Vlastnosti dokumentu',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Vrstvu úplně dospodu',
|
||||
move_top: 'Vrstvu úplně nahoru',
|
||||
node_clone: 'Vložit nový uzel',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_cy = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Elfennau Ungroup',
|
||||
docprops: 'Document Eiddo',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Symud i'r Gwaelod',
|
||||
move_top: 'Symud i'r Top',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_da = (function () {
|
|||
reorient_path: 'Reorient path',
|
||||
ungroup: 'Opdel Elements',
|
||||
docprops: 'Document Properties',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Flyt til bund',
|
||||
move_top: 'Flyt til toppen',
|
||||
node_clone: 'Clone Node',
|
||||
|
|
|
@ -129,6 +129,7 @@ var svgEditorLang_de = (function () {
|
|||
reorient_path: 'Neuausrichtung des Pfades',
|
||||
ungroup: 'Gruppierung aufheben',
|
||||
docprops: 'Dokument-Eigenschaften',
|
||||
editor_homepage: 'SVG-Edit Home Page',
|
||||
move_bottom: 'Die gewählten Objekte nach ganz unten verschieben',
|
||||
move_top: 'Die gewählten Objekte nach ganz oben verschieben',
|
||||
node_clone: 'Klone den Knoten',
|
||||
|
|