- Fix: Add images (and references) for fallback (#135)

- Fix (canvg): blur export fix
- i18n (Chinese): A few fixes (#135)
- Optimize: Further image optimizing
- Refactoring: Avoid custom JS substitution syntax
- Refactoring: Reorder default extension list
This commit is contained in:
Brett Zamir
2018-05-28 22:00:20 +08:00
parent 5ad6e6ba48
commit acb57c1609
111 changed files with 372 additions and 155 deletions

View File

@@ -2691,7 +2691,7 @@ function build (opts) {
ctx.canvas.id = svg.UniqueId();
ctx.canvas.style.display = 'none';
document.body.append(ctx.canvas);
canvasRGBA_(ctx.canvas.id, x, y, width, height, this.blurRadius);
canvasRGBA_(ctx.canvas, x, y, width, height, this.blurRadius);
ctx.canvas.remove();
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@@ -51,6 +51,7 @@ export default {
const buttons = [
{
id: 'tool_openpath',
icon: svgEditor.curConfig.extIconsPath + 'openpath.png',
type: 'context',
panel: 'closepath_panel',
events: {
@@ -61,6 +62,7 @@ export default {
},
{
id: 'tool_closepath',
icon: svgEditor.curConfig.extIconsPath + 'closepath.png',
type: 'context',
panel: 'closepath_panel',
events: {

View File

@@ -59,6 +59,7 @@ export default {
const buttons = [
{
id: 'tool_eyedropper',
icon: svgEditor.curConfig.extIconsPath + 'eyedropper.png',
type: 'mode',
events: {
click () {

View File

@@ -91,6 +91,7 @@ export default {
const buttons = [{
id: 'tool_foreign',
icon: svgEditor.curConfig.extIconsPath + 'foreignobject-tool.png',
type: 'mode',
events: {
click () {
@@ -99,6 +100,7 @@ export default {
}
}, {
id: 'edit_foreign',
icon: svgEditor.curConfig.extIconsPath + 'foreignobject-edit.png',
type: 'context',
panel: 'foreignObject_panel',
events: {

View File

@@ -133,6 +133,7 @@ export default {
}
const buttons = [{
id: 'view_grid',
icon: svgEditor.curConfig.extIconsPath + 'grid.png',
type: 'context',
panel: 'editor_panel',
events: {

View File

@@ -32,6 +32,9 @@ export default {
// Must match the icon ID in helloworld-icon.xml
id: 'hello_world',
// Fallback, e.g., for `file://` access
icon: svgEditor.curConfig.extIconsPath + 'helloworld.png',
// This indicates that the button will be added to the "mode"
// button panel on the left side
type: 'mode',

View File

@@ -364,6 +364,7 @@ export default {
const buttons = [{
id: 'tool_imagelib',
type: 'app_menu', // _flyout
icon: svgEditor.curConfig.extIconsPath + 'imagelib.png',
position: 4,
events: {
mouseup: showBrowser

View File

@@ -75,7 +75,7 @@ export default {
};
// duplicate shapes to support unfilled (open) marker types with an _o suffix
$.each(['leftarrow', 'rightarrow', 'box', 'star', 'mcircle', 'triangle'], function (i, v) {
['leftarrow', 'rightarrow', 'box', 'star', 'mcircle', 'triangle'].forEach((v) => {
markerTypes[v + '_o'] = markerTypes[v];
});
@@ -432,11 +432,12 @@ export default {
$.each(mtypes, function (k, pos) {
const listname = pos + '_marker_list';
let def = true;
$.each(markerTypes, function (id, v) {
Object.keys(markerTypes).forEach(function (id) {
const title = getTitle(String(id));
buttons.push({
id: idPrefix + pos + '_' + id,
svgicon: id,
icon: svgEditor.curConfig.extIconsPath + 'markers-' + id + '.png',
title,
type: 'context',
events: {click: setArrowFromButton},

View File

@@ -120,6 +120,7 @@ export default {
const buttons = [{
id: 'tool_mathjax',
type: 'mode',
icon: svgEditor.curConfig.extIconsPath + 'mathjax.png',
events: {
click () {
// Only load Mathjax when needed, we don't want to strain Svg-Edit any more.

View File

@@ -17,6 +17,7 @@ export default {
const svgCanvas = svgEditor.canvas;
const buttons = [{
id: 'ext-panning',
icon: svgEditor.curConfig.extIconsPath + 'panning.png',
type: 'mode',
events: {
click () {

View File

@@ -112,6 +112,7 @@ export default {
*/
const buttons = [{
id: 'tool_polygon',
icon: svgEditor.curConfig.extIconsPath + 'polygon.png',
type: 'mode',
position: 11,
events: {

View File

@@ -125,6 +125,7 @@ export default {
}
const buttons = [{
id: 'tool_shapelib',
icon: svgEditor.curConfig.extIconsPath + 'shapes.png',
type: 'mode_flyout', // _flyout
position: 6,
events: {

View File

@@ -56,6 +56,7 @@ export default {
*/
const buttons = [{
id: 'tool_star',
icon: svgEditor.curConfig.extIconsPath + 'star.png',
type: 'mode',
position: 12,
events: {

View File

@@ -70,6 +70,7 @@ export default {
*/
const buttons = [{
id: 'webappfind_save', //
icon: svgEditor.curConfig.extIconsPath + 'webappfind.png',
type: 'app_menu',
position: 4, // Before 0-based index position 4 (after the regular "Save Image (S)")
events: {

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
editor/extensions/grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
editor/extensions/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
editor/images/align.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

BIN
editor/images/angle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
editor/images/blur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
editor/images/c_radius.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

BIN
editor/images/closepath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

BIN
editor/images/export.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

BIN
editor/images/fill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

BIN
editor/images/fontsize.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

BIN
editor/images/height.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

BIN
editor/images/import.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
editor/images/no_color.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

BIN
editor/images/opacity.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

BIN
editor/images/openpath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
editor/images/stroke.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
editor/images/warning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

BIN
editor/images/width.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 265 B

View File

@@ -2,19 +2,19 @@ export default {
lang: 'zh-CN',
dir: 'ltr',
common: {
ok: 'OK',
cancel: 'Cancel',
key_backspace: 'Backspace',
key_del: 'Del',
key_down: 'Down',
key_up: 'Up',
more_opts: 'more_opts',
url: 'url',
width: 'width',
height: 'height'
ok: '确定',
cancel: '取消',
key_backspace: '退格',
key_del: '删除',
key_down: '',
key_up: '',
more_opts: '更多选项',
url: 'URL',
width: '宽度',
height: '高度'
},
misc: {
powered_by: 'powered_by'
powered_by: 'Powered by'
},
ui: {
toggle_stroke_tools: 'toggle_stroke_tools',

View File

@@ -2,7 +2,7 @@ export default {
lang: 'zh-HK',
dir: 'ltr',
common: {
ok: 'OK',
ok: '确定',
cancel: 'Cancel',
key_backspace: 'Backspace',
key_del: 'Del',

View File

@@ -2,9 +2,9 @@ export default {
lang: 'zh-TW',
dir: 'ltr',
common: {
ok: 'OK',
ok: '确定',
cancel: 'Cancel',
key_backspace: 'Backspace',
key_backspace: 'backspace',
key_del: 'Del',
key_down: 'Down',
key_up: 'Up',

View File

@@ -138,16 +138,16 @@ const callbacks = [],
* @type {string[]}
*/
defaultExtensions = [
'ext-overview_window.js',
'ext-markers.js',
'ext-connector.js',
'ext-eyedropper.js',
'ext-shapes.js',
'ext-imagelib.js',
'ext-grid.js',
'ext-polygon.js',
'ext-star.js',
'ext-imagelib.js',
'ext-markers.js',
'ext-overview_window.js',
'ext-panning.js',
'ext-polygon.js',
'ext-shapes.js',
'ext-star.js',
'ext-storage.js'
],
/**
@@ -1113,42 +1113,68 @@ editor.init = function () {
no_img: !isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
new_image: 'clear.png',
save: 'save.png',
open: 'open.png',
source: 'source.png',
docprops: 'document-properties.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
pencil: 'fhpath.png',
pen: 'line.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
path: 'path.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
node_clone: 'node_clone.png',
delete: 'delete.png',
node_delete: 'node_delete.png',
group: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
move_top: 'move_top.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
@@ -1157,14 +1183,23 @@ editor.init = function () {
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
arrow_right: 'flyouth.png',
arrow_down: 'dropdown.gif'
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',

View File

@@ -2,6 +2,3 @@ import svgEditor from './svg-editor.js';
svgEditor.setConfig({
allowedOrigins: ['*']
});
// <CONDITIONAL-ADD>: window.svgEditor = svgEditor; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT
// <CONDITIONAL-ADD>: window.svgEditor.modules = false; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT

View File

@@ -25017,7 +25017,7 @@
* @name module:SVGEditor~defaultExtensions
* @type {string[]}
*/
defaultExtensions = ['ext-overview_window.js', 'ext-markers.js', 'ext-connector.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js', 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js', 'ext-storage.js'],
defaultExtensions = ['ext-connector.js', 'ext-eyedropper.js', 'ext-grid.js', 'ext-imagelib.js', 'ext-markers.js', 'ext-overview_window.js', 'ext-panning.js', 'ext-polygon.js', 'ext-shapes.js', 'ext-star.js', 'ext-storage.js'],
/**
* @typedef {"@default"|string} module:SVGEditor.Stylesheet `@default` will automatically load all of the default CSS paths for SVGEditor
@@ -26079,42 +26079,68 @@
no_img: !isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
new_image: 'clear.png',
save: 'save.png',
open: 'open.png',
source: 'source.png',
docprops: 'document-properties.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
pencil: 'fhpath.png',
pen: 'line.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
path: 'path.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
node_clone: 'node_clone.png',
delete: 'delete.png',
node_delete: 'node_delete.png',
group: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
move_top: 'move_top.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
@@ -26123,14 +26149,23 @@
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
arrow_right: 'flyouth.png',
arrow_down: 'dropdown.gif'
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
@@ -31020,11 +31055,11 @@
editor.init();
});
window.svgEditor = editor;
window.svgEditor.modules = false;
editor.setConfig({
allowedOrigins: ['*']
});
window.svgEditor = editor; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT
window.svgEditor.modules = false; // DO NOT DELETE THIS LINE: USED BY AUTOMATED SCRIPT
}());