diff --git a/.eslintrc.js b/.eslintrc.js
index 2558a110..93a3cbb5 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -144,6 +144,7 @@ module.exports = {
complexity: ["off"],
"default-case": ["off"],
"require-unicode-regexp": ["off"],
+ "no-console": ["off"],
"no-magic-numbers": ["off"],
"no-warning-comments": ["off"],
"max-len": ["off", {
diff --git a/CHANGES.md b/CHANGES.md
index 9b2591e7..92ba234e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,12 @@
# SVG-Edit CHANGES
-# 4.1.0
+# ?
+
+- l10n: Add Chinese (simplified) extension locales (Thanks, @enlove!)
+- Linting (ESLint): Avoid reporting `no-console`
+- Refactoring: Avoid Firefox console errors with hidden iframe
+
+## 4.1.0
- Fix: Avoid cross-frame unsafe `instanceof`
- Enhancement: Add svgcanvas distributions
@@ -10,12 +16,12 @@
`startsWith`/`endsWith`, no fn ref in iterator
- npm: Update devDeps
-# 4.0.1
+## 4.0.1
- Fix: Adjust side panel width checking based on device zoom (fixes #298)
- Fix (regression): RGBColor
-# 4.0.0
+## 4.0.0
- Breaking change (storage preference cookies): Namespace the cookie as
"svgeditstore" instead of just "store"
diff --git a/editor/extensions/ext-locale/arrows/zh-CN.js b/editor/extensions/ext-locale/arrows/zh-CN.js
new file mode 100755
index 00000000..bbe2e860
--- /dev/null
+++ b/editor/extensions/ext-locale/arrows/zh-CN.js
@@ -0,0 +1,19 @@
+export default {
+ name: '箭头',
+ langList: [
+ {id: 'arrow_none', textContent: '无箭头'}
+ ],
+ contextTools: [
+ {
+ title: '选择箭头类型',
+ options: {
+ none: '无箭头',
+ end: '---->',
+ start: '<----',
+ both: '<--->',
+ mid: '-->--',
+ mid_bk: '--<--'
+ }
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/closepath/zh-CN.js b/editor/extensions/ext-locale/closepath/zh-CN.js
new file mode 100755
index 00000000..20f0c42d
--- /dev/null
+++ b/editor/extensions/ext-locale/closepath/zh-CN.js
@@ -0,0 +1,11 @@
+export default {
+ name: '闭合路径',
+ buttons: [
+ {
+ title: '打开路径'
+ },
+ {
+ title: '关闭路径'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/connector/zh-CN.js b/editor/extensions/ext-locale/connector/zh-CN.js
new file mode 100755
index 00000000..e5749d17
--- /dev/null
+++ b/editor/extensions/ext-locale/connector/zh-CN.js
@@ -0,0 +1,11 @@
+export default {
+ name: '连接器',
+ langList: [
+ {id: 'mode_connect', title: '连接两个对象'}
+ ],
+ buttons: [
+ {
+ title: '连接两个对象'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/eyedropper/zh-CN.js b/editor/extensions/ext-locale/eyedropper/zh-CN.js
new file mode 100755
index 00000000..3f31a971
--- /dev/null
+++ b/editor/extensions/ext-locale/eyedropper/zh-CN.js
@@ -0,0 +1,9 @@
+export default {
+ name: '滴管',
+ buttons: [
+ {
+ title: '滴管工具',
+ key: 'I'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/foreignobject/zh-CN.js b/editor/extensions/ext-locale/foreignobject/zh-CN.js
new file mode 100755
index 00000000..9b221b8a
--- /dev/null
+++ b/editor/extensions/ext-locale/foreignobject/zh-CN.js
@@ -0,0 +1,25 @@
+export default {
+ name: '外部对象',
+ buttons: [
+ {
+ title: '外部对象工具'
+ },
+ {
+ title: '编辑外部对象内容'
+ }
+ ],
+ contextTools: [
+ {
+ title: '改变外部对象宽度',
+ label: 'w'
+ },
+ {
+ title: '改变外部对象高度',
+ label: 'h'
+ },
+ {
+ title: '改变外部对象文字大小',
+ label: '文字大小'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/grid/zh-CN.js b/editor/extensions/ext-locale/grid/zh-CN.js
new file mode 100755
index 00000000..4c264d8a
--- /dev/null
+++ b/editor/extensions/ext-locale/grid/zh-CN.js
@@ -0,0 +1,8 @@
+export default {
+ name: '网格视图',
+ buttons: [
+ {
+ title: '显示/隐藏网格'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/helloworld/zh-CN.js b/editor/extensions/ext-locale/helloworld/zh-CN.js
new file mode 100755
index 00000000..87912014
--- /dev/null
+++ b/editor/extensions/ext-locale/helloworld/zh-CN.js
@@ -0,0 +1,9 @@
+export default {
+ name: 'Hello World',
+ text: 'Hello World!\n\n 请点击: {x}, {y}',
+ buttons: [
+ {
+ title: "输出 'Hello World'"
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/markers/zh-CN.js b/editor/extensions/ext-locale/markers/zh-CN.js
new file mode 100755
index 00000000..1efe8a0a
--- /dev/null
+++ b/editor/extensions/ext-locale/markers/zh-CN.js
@@ -0,0 +1,46 @@
+export default {
+ name: '标记',
+ langList: [
+ {id: 'nomarker', title: '无标记'},
+ {id: 'leftarrow', title: '左箭头'},
+ {id: 'rightarrow', title: '右箭头'},
+ {id: 'textmarker', title: '文本'},
+ {id: 'forwardslash', title: '斜杠'},
+ {id: 'reverseslash', title: '反斜杠'},
+ {id: 'verticalslash', title: '垂直线'},
+ {id: 'box', title: '方块'},
+ {id: 'star', title: '星形'},
+ {id: 'xmark', title: 'X'},
+ {id: 'triangle', title: '三角形'},
+ {id: 'mcircle', title: '圆形'},
+ {id: 'leftarrow_o', title: '左箭头(空心)'},
+ {id: 'rightarrow_o', title: '右箭头(空心)'},
+ {id: 'box_o', title: '方块(空心)'},
+ {id: 'star_o', title: '星形(空心)'},
+ {id: 'triangle_o', title: '三角形(空心)'},
+ {id: 'mcircle_o', title: '圆形(空心)'}
+ ],
+ contextTools: [
+ {
+ title: '起始标记',
+ label: 's'
+ },
+ {
+ title: '选择起始标记类型'
+ },
+ {
+ title: '中段标记',
+ label: 'm'
+ },
+ {
+ title: '选择中段标记类型'
+ },
+ {
+ title: '末端标记',
+ label: 'e'
+ },
+ {
+ title: '选择末端标记类型'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/mathjax/zh-CN.js b/editor/extensions/ext-locale/mathjax/zh-CN.js
new file mode 100755
index 00000000..0abe8529
--- /dev/null
+++ b/editor/extensions/ext-locale/mathjax/zh-CN.js
@@ -0,0 +1,8 @@
+export default {
+ name: '数学',
+ buttons: [
+ {
+ title: '添加数学计算'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/panning/zh-CN.js b/editor/extensions/ext-locale/panning/zh-CN.js
new file mode 100755
index 00000000..a6264077
--- /dev/null
+++ b/editor/extensions/ext-locale/panning/zh-CN.js
@@ -0,0 +1,8 @@
+export default {
+ name: '移动',
+ buttons: [
+ {
+ title: '移动'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/polygon/zh-CN.js b/editor/extensions/ext-locale/polygon/zh-CN.js
new file mode 100755
index 00000000..6bfcc476
--- /dev/null
+++ b/editor/extensions/ext-locale/polygon/zh-CN.js
@@ -0,0 +1,14 @@
+export default {
+ name: '多边形',
+ buttons: [
+ {
+ title: '多边形工具'
+ }
+ ],
+ contextTools: [
+ {
+ title: '边数',
+ label: '边数'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/server_moinsave/zh-CN.js b/editor/extensions/ext-locale/server_moinsave/zh-CN.js
new file mode 100755
index 00000000..ce1b27ff
--- /dev/null
+++ b/editor/extensions/ext-locale/server_moinsave/zh-CN.js
@@ -0,0 +1,3 @@
+export default {
+ saved: '已保存! 返回视图!'
+};
diff --git a/editor/extensions/ext-locale/server_opensave/zh-CN.js b/editor/extensions/ext-locale/server_opensave/zh-CN.js
new file mode 100755
index 00000000..ab8a5967
--- /dev/null
+++ b/editor/extensions/ext-locale/server_opensave/zh-CN.js
@@ -0,0 +1,3 @@
+export default {
+ uploading: '正在上传...'
+};
diff --git a/editor/extensions/ext-locale/shapes/zh-CN.js b/editor/extensions/ext-locale/shapes/zh-CN.js
new file mode 100755
index 00000000..4b76d7a4
--- /dev/null
+++ b/editor/extensions/ext-locale/shapes/zh-CN.js
@@ -0,0 +1,24 @@
+export default {
+ loading: '正在加载...',
+ categories: {
+ basic: '基本',
+ object: '对象',
+ symbol: '符号',
+ arrow: '箭头',
+ flowchart: '工作流',
+ animal: '动物',
+ game: '棋牌',
+ dialog_balloon: '会话框',
+ electronics: '电子',
+ math: '数学',
+ music: '音乐',
+ misc: '其他',
+ raphael_1: 'raphaeljs.com 集合 1',
+ raphael_2: 'raphaeljs.com 集合 2'
+ },
+ buttons: [
+ {
+ title: '图元库'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/star/zh-CN.js b/editor/extensions/ext-locale/star/zh-CN.js
new file mode 100755
index 00000000..d9ee06da
--- /dev/null
+++ b/editor/extensions/ext-locale/star/zh-CN.js
@@ -0,0 +1,22 @@
+export default {
+ name: '星形',
+ buttons: [
+ {
+ title: '星形工具'
+ }
+ ],
+ contextTools: [
+ {
+ title: '顶点',
+ label: '顶点'
+ },
+ {
+ title: '钝度',
+ label: '钝度'
+ },
+ {
+ title: '径向',
+ label: '径向'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-locale/storage/zh-CN.js b/editor/extensions/ext-locale/storage/zh-CN.js
new file mode 100755
index 00000000..1de1f9dc
--- /dev/null
+++ b/editor/extensions/ext-locale/storage/zh-CN.js
@@ -0,0 +1,11 @@
+export default {
+ message: '默认情况下, SVG-Edit 在本地保存配置参数和画布内容. 如果基于隐私考虑, ' +
+ '您可以勾选以下选项修改配置.',
+ storagePrefsAndContent: '本地存储配置参数和SVG图',
+ storagePrefsOnly: '本地只存储配置参数',
+ storagePrefs: '本地存储配置参数',
+ storageNoPrefsOrContent: '本地不保存配置参数和SVG图',
+ storageNoPrefs: '本地不保存配置参数',
+ rememberLabel: '记住选择?',
+ rememberTooltip: '如果您勾选记住选择,将不再弹出本窗口.'
+};
diff --git a/editor/extensions/ext-locale/webappfind/zh-CN.js b/editor/extensions/ext-locale/webappfind/zh-CN.js
new file mode 100755
index 00000000..0831c4b0
--- /dev/null
+++ b/editor/extensions/ext-locale/webappfind/zh-CN.js
@@ -0,0 +1,8 @@
+export default {
+ name: 'WebAppFind',
+ buttons: [
+ {
+ title: '保存图片到磁盘'
+ }
+ ]
+};
diff --git a/editor/extensions/ext-server_moinsave.js b/editor/extensions/ext-server_moinsave.js
index 63842dd0..f0e550ac 100644
--- a/editor/extensions/ext-server_moinsave.js
+++ b/editor/extensions/ext-server_moinsave.js
@@ -18,7 +18,9 @@ export default {
const saveSvgAction = '/+modify';
// Create upload target (hidden iframe)
- /* const target = */ $('').hide().appendTo('body');
+ // Hiding by size instead of display to avoid FF console errors
+ // with `getBBox` in browser.js `supportsPathBBox_`)
+ /* const target = */ $('').appendTo('body');
svgEditor.setCustomHandlers({
async save (win, data) {
diff --git a/editor/extensions/ext-server_opensave.js b/editor/extensions/ext-server_opensave.js
index 637c26a7..14d28413 100644
--- a/editor/extensions/ext-server_opensave.js
+++ b/editor/extensions/ext-server_opensave.js
@@ -59,7 +59,9 @@ export default {
let cancelled = false;
- $('').hide().appendTo('body');
+ // Hiding by size instead of display to avoid FF console errors
+ // with `getBBox` in browser.js `supportsPathBBox_`)
+ $('').appendTo('body');
svgEditor.setCustomHandlers({
save (win, data) {
const svg = '\n' + data, // Firefox doesn't seem to know it is UTF-8 (no matter whether we use or skip the clientDownload code) despite the Content-Disposition header containing UTF-8, but adding the encoding works