@mce/svg 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { definePlugin } from "mce";
|
|
1
|
+
import { definePlugin, matchSource } from "mce";
|
|
2
2
|
//#region src/plugin.ts
|
|
3
3
|
function plugin() {
|
|
4
4
|
return definePlugin((editor) => {
|
|
5
5
|
const { to, fonts } = editor;
|
|
6
|
-
const RE = /\.svg$/i;
|
|
7
6
|
return {
|
|
8
7
|
name: "mce:svg",
|
|
9
8
|
messages: {
|
|
@@ -13,15 +12,10 @@ function plugin() {
|
|
|
13
12
|
loaders: [{
|
|
14
13
|
name: "svg",
|
|
15
14
|
accept: ".svg",
|
|
16
|
-
test: (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (source instanceof File) {
|
|
21
|
-
if (RE.test(source.name)) return true;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
},
|
|
15
|
+
test: matchSource({
|
|
16
|
+
ext: /\.svg$/i,
|
|
17
|
+
mime: "image/svg+xml"
|
|
18
|
+
}),
|
|
25
19
|
load: async (source) => {
|
|
26
20
|
const { svgToPath2DSet } = await import("modern-path2d");
|
|
27
21
|
const set = svgToPath2DSet(await source.text());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/svg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.29.0",
|
|
5
5
|
"description": "SVG plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"modern-path2d": "^1.8.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"mce": "0.
|
|
53
|
+
"mce": "0.29.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"mce": "^0"
|