@jx3box/jx3box-editor 3.2.5 → 3.2.7
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/.storybook/main.js +70 -0
- package/.storybook/middleware.js +73 -0
- package/.storybook/preview.js +90 -0
- package/package.json +9 -1
- package/src/Article.vue +6 -1
- package/src/ArticleMarkdown.vue +1 -1
- package/src/assets/css/markdown/markdown-article.less +13 -13
- package/src/assets/css/markdown/markdown-editor.less +11 -11
- package/src/components/Author.vue +312 -52
- package/src/components/QRcode.vue +1 -1
- package/src/service/cms.js +13 -1
- package/src/storybook/storybook-vars.less +1 -0
- package/src/storybook/storybook.helpers.js +154 -0
- package/stories/components/Author.stories.js +36 -0
- package/stories/components/Avatar.stories.js +55 -0
- package/stories/components/Combo.stories.js +37 -0
- package/stories/components/Letter.stories.js +30 -0
- package/stories/components/PostAuthor.stories.js +32 -0
- package/stories/components/QRcode.stories.js +37 -0
- package/stories/components/SkillMartial.stories.js +31 -0
- package/stories/exports/Article.stories.js +48 -0
- package/stories/exports/BoxResource.stories.js +31 -0
- package/stories/exports/Buff.stories.js +38 -0
- package/stories/exports/GameText.stories.js +38 -0
- package/stories/exports/Item.stories.js +51 -0
- package/stories/exports/ItemSimple.stories.js +50 -0
- package/stories/exports/Markdown.stories.js +46 -0
- package/stories/exports/Npc.stories.js +35 -0
- package/stories/exports/Resource.stories.js +29 -0
- package/stories/exports/Skill.stories.js +38 -0
- package/stories/exports/Tinymce.stories.js +46 -0
- package/stories/exports/Upload.stories.js +41 -0
- package/stories/exports/UploadAlbum.stories.js +31 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const rootDir = path.resolve(__dirname, "..");
|
|
4
|
+
const srcDir = path.resolve(rootDir, "src");
|
|
5
|
+
const globalLess = path.resolve(srcDir, "assets/css/var.less");
|
|
6
|
+
const csslabBaseLess = path.resolve(rootDir, "node_modules/csslab/base.less");
|
|
7
|
+
const storybookVarsLess = path.resolve(srcDir, "storybook/storybook-vars.less");
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
framework: {
|
|
11
|
+
name: "@storybook/vue3-webpack5",
|
|
12
|
+
options: {},
|
|
13
|
+
},
|
|
14
|
+
stories: ["../stories/components/*.stories.js", "../stories/exports/*.stories.js"],
|
|
15
|
+
staticDirs: ["../public"],
|
|
16
|
+
addons: ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions"],
|
|
17
|
+
docs: {
|
|
18
|
+
autodocs: "tag",
|
|
19
|
+
},
|
|
20
|
+
webpackFinal: async (config) => {
|
|
21
|
+
config.resolve = config.resolve || {};
|
|
22
|
+
config.resolve.alias = {
|
|
23
|
+
...(config.resolve.alias || {}),
|
|
24
|
+
"@": srcDir,
|
|
25
|
+
"@src": srcDir,
|
|
26
|
+
};
|
|
27
|
+
config.resolve.extensions = Array.from(new Set([...(config.resolve.extensions || []), ".vue", ".js", ".json"]));
|
|
28
|
+
|
|
29
|
+
config.module.rules.push(
|
|
30
|
+
{
|
|
31
|
+
test: /\.svg$/i,
|
|
32
|
+
resourceQuery: /inline/,
|
|
33
|
+
use: [
|
|
34
|
+
{
|
|
35
|
+
loader: require.resolve("vue-svg-inline-loader"),
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
test: /\.less$/i,
|
|
41
|
+
use: [
|
|
42
|
+
require.resolve("style-loader"),
|
|
43
|
+
{
|
|
44
|
+
loader: require.resolve("css-loader"),
|
|
45
|
+
options: {
|
|
46
|
+
importLoaders: 2,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
require.resolve("postcss-loader"),
|
|
50
|
+
{
|
|
51
|
+
loader: require.resolve("less-loader"),
|
|
52
|
+
options: {
|
|
53
|
+
lessOptions: {
|
|
54
|
+
javascriptEnabled: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
loader: require.resolve("style-resources-loader"),
|
|
60
|
+
options: {
|
|
61
|
+
patterns: [csslabBaseLess, globalLess, storybookVarsLess],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return config;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
2
|
+
const JX3BOX = require("@jx3box/jx3box-common/data/jx3box.json");
|
|
3
|
+
|
|
4
|
+
const CMS_PROXY_TARGET = (process.env.VUE_APP_CMS || JX3BOX.__cms || "https://cms.jx3box.com").replace(/\/$/, "");
|
|
5
|
+
const { __cms, __node, __team, __next } = JX3BOX;
|
|
6
|
+
|
|
7
|
+
module.exports = function storybookMiddleware(router) {
|
|
8
|
+
router.use(
|
|
9
|
+
"/api/cms",
|
|
10
|
+
createProxyMiddleware({
|
|
11
|
+
target: CMS_PROXY_TARGET,
|
|
12
|
+
changeOrigin: true,
|
|
13
|
+
secure: true,
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
router.use(
|
|
18
|
+
"/api/node",
|
|
19
|
+
createProxyMiddleware({
|
|
20
|
+
target: __node,
|
|
21
|
+
changeOrigin: true,
|
|
22
|
+
secure: true,
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
router.use(
|
|
27
|
+
"/__proxy/cms",
|
|
28
|
+
createProxyMiddleware({
|
|
29
|
+
target: __cms,
|
|
30
|
+
changeOrigin: true,
|
|
31
|
+
secure: true,
|
|
32
|
+
pathRewrite: {
|
|
33
|
+
"^/__proxy/cms": "",
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
router.use(
|
|
39
|
+
"/__proxy/node",
|
|
40
|
+
createProxyMiddleware({
|
|
41
|
+
target: __node,
|
|
42
|
+
changeOrigin: true,
|
|
43
|
+
secure: true,
|
|
44
|
+
pathRewrite: {
|
|
45
|
+
"^/__proxy/node": "",
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
router.use(
|
|
51
|
+
"/__proxy/team",
|
|
52
|
+
createProxyMiddleware({
|
|
53
|
+
target: __team,
|
|
54
|
+
changeOrigin: true,
|
|
55
|
+
secure: true,
|
|
56
|
+
pathRewrite: {
|
|
57
|
+
"^/__proxy/team": "",
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
router.use(
|
|
63
|
+
"/__proxy/next",
|
|
64
|
+
createProxyMiddleware({
|
|
65
|
+
target: __next,
|
|
66
|
+
changeOrigin: true,
|
|
67
|
+
secure: true,
|
|
68
|
+
pathRewrite: {
|
|
69
|
+
"^/__proxy/next": "",
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { setup } from "@storybook/vue3";
|
|
2
|
+
import ElementPlus from "element-plus";
|
|
3
|
+
import "element-plus/dist/index.css";
|
|
4
|
+
import "@imengyu/vue3-context-menu/lib/vue3-context-menu.css";
|
|
5
|
+
import "../src/assets/css/var.less";
|
|
6
|
+
import "../src/assets/css/article.less";
|
|
7
|
+
import "../src/assets/css/markdown.less";
|
|
8
|
+
import "../src/assets/css/resource.less";
|
|
9
|
+
import "../src/assets/css/upload.less";
|
|
10
|
+
import "../src/assets/css/upload_album.less";
|
|
11
|
+
import "../src/assets/css/tinymce.less";
|
|
12
|
+
|
|
13
|
+
setup((app) => {
|
|
14
|
+
app.use(ElementPlus);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const ensureStorage = (key) => {
|
|
18
|
+
if (typeof window === "undefined" || window[key]) return;
|
|
19
|
+
const store = {};
|
|
20
|
+
window[key] = {
|
|
21
|
+
getItem(name) {
|
|
22
|
+
return Object.prototype.hasOwnProperty.call(store, name) ? store[name] : null;
|
|
23
|
+
},
|
|
24
|
+
setItem(name, value) {
|
|
25
|
+
store[name] = String(value);
|
|
26
|
+
},
|
|
27
|
+
removeItem(name) {
|
|
28
|
+
delete store[name];
|
|
29
|
+
},
|
|
30
|
+
clear() {
|
|
31
|
+
Object.keys(store).forEach((name) => delete store[name]);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
ensureStorage("localStorage");
|
|
37
|
+
ensureStorage("sessionStorage");
|
|
38
|
+
|
|
39
|
+
if (typeof window !== "undefined") {
|
|
40
|
+
window.__JX3BOX_STORYBOOK__ = true;
|
|
41
|
+
|
|
42
|
+
const originFetch = window.fetch?.bind(window);
|
|
43
|
+
if (originFetch) {
|
|
44
|
+
window.fetch = (input, init) => {
|
|
45
|
+
const nextInput = rewriteProxyRequest(input);
|
|
46
|
+
return originFetch(nextInput, init);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const parameters = {
|
|
52
|
+
controls: {
|
|
53
|
+
expanded: true,
|
|
54
|
+
sort: "requiredFirst",
|
|
55
|
+
},
|
|
56
|
+
actions: {
|
|
57
|
+
argTypesRegex: "^on[A-Z].*",
|
|
58
|
+
},
|
|
59
|
+
docs: {
|
|
60
|
+
toc: true,
|
|
61
|
+
},
|
|
62
|
+
layout: "centered",
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function rewriteProxyRequest(input) {
|
|
66
|
+
if (typeof input === "string") {
|
|
67
|
+
return rewriteUrlString(input);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (input instanceof Request) {
|
|
71
|
+
return new Request(rewriteUrlString(input.url), input);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return input;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function rewriteUrlString(url) {
|
|
78
|
+
if (!url) return url;
|
|
79
|
+
|
|
80
|
+
if (url.startsWith("/__proxy/") || url.startsWith("/api/")) {
|
|
81
|
+
return url;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (url.startsWith("http://localhost:6006/__proxy/") || url.startsWith("http://127.0.0.1:6006/__proxy/")) {
|
|
85
|
+
const parsed = new URL(url);
|
|
86
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return url;
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-editor",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"description": "JX3BOX Article & Editor",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"dev:tinymce": "serve -l 5120 ./tinymce",
|
|
10
10
|
"serve": "npm run dev",
|
|
11
11
|
"build": "npx lessc -x ./tinymce/skins/content/default/content.less ./tinymce/skins/content/default/content.min.css",
|
|
12
|
+
"storybook": "storybook dev -p 6006",
|
|
13
|
+
"build-storybook": "storybook build",
|
|
12
14
|
"lint": "vue-cli-service lint",
|
|
13
15
|
"update": "npm --registry https://registry.npmjs.org install @jx3box/jx3box-common@latest @jx3box/jx3box-data@latest @jx3box/jx3box-macro@latest @jx3box/jx3box-talent@latest @jx3box/jx3box-emotion@latest"
|
|
14
16
|
},
|
|
@@ -47,6 +49,10 @@
|
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@babel/core": "^7.12.16",
|
|
49
51
|
"@babel/eslint-parser": "^7.12.16",
|
|
52
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
53
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
54
|
+
"@storybook/addon-links": "^8.6.14",
|
|
55
|
+
"@storybook/vue3-webpack5": "^8.6.14",
|
|
50
56
|
"@tailwindcss/postcss": "^4.2.1",
|
|
51
57
|
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
52
58
|
"@typescript-eslint/parser": "^5.31.0",
|
|
@@ -68,9 +74,11 @@
|
|
|
68
74
|
"postcss": "^8.5.6",
|
|
69
75
|
"postcss-safe-parser": "^7.0.1",
|
|
70
76
|
"prettier": "2.7.1",
|
|
77
|
+
"qrcode.vue": "^3.6.0",
|
|
71
78
|
"sass": "^1.97.3",
|
|
72
79
|
"sass-loader": "^16.0.7",
|
|
73
80
|
"serve": "^14.2.0",
|
|
81
|
+
"storybook": "^8.6.14",
|
|
74
82
|
"style-resources-loader": "^1.5.0",
|
|
75
83
|
"tailwindcss": "^4.2.1",
|
|
76
84
|
"typescript": "~4.5.5",
|
package/src/Article.vue
CHANGED
|
@@ -47,7 +47,12 @@
|
|
|
47
47
|
v-show="jx3_element.type == 'skill'"
|
|
48
48
|
/>
|
|
49
49
|
<jx3-npc :client="npc.client" :id="npc.id" v-show="jx3_element.type === 'npc'" />
|
|
50
|
-
<jx3-author
|
|
50
|
+
<jx3-author
|
|
51
|
+
:key="author.id"
|
|
52
|
+
:uid="author.id"
|
|
53
|
+
:visible="jx3_element.type === 'author' && jx3_element.style.display !== 'none'"
|
|
54
|
+
v-show="jx3_element.type === 'author'"
|
|
55
|
+
/>
|
|
51
56
|
<jx3-emotion-author :id="emotion.id" v-show="jx3_element.type === 'emotion'" />
|
|
52
57
|
</div>
|
|
53
58
|
</div>
|
package/src/ArticleMarkdown.vue
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// md文章样式
|
|
2
2
|
|
|
3
|
-
@import "
|
|
4
|
-
@import "
|
|
3
|
+
@import "./macro.less";
|
|
4
|
+
@import "./talent.less";
|
|
5
5
|
|
|
6
|
-
@import "
|
|
7
|
-
@import "
|
|
8
|
-
@import "
|
|
6
|
+
@import "./video.less";
|
|
7
|
+
@import "./macro.less";
|
|
8
|
+
@import "./talent.less";
|
|
9
9
|
|
|
10
|
-
@import 'module/directory.less';
|
|
11
|
-
@import 'module/icon.less';
|
|
12
|
-
@import 'module/resource.less';
|
|
13
|
-
@import 'module/jx3_element.less';
|
|
10
|
+
@import '../module/directory.less';
|
|
11
|
+
@import '../module/icon.less';
|
|
12
|
+
@import '../module/resource.less';
|
|
13
|
+
@import '../module/jx3_element.less';
|
|
14
14
|
|
|
15
|
-
@import 'module/buff.less';
|
|
16
|
-
@import 'module/skill.less';
|
|
17
|
-
@import 'module/item.less';
|
|
18
|
-
@import 'module/npc.less';
|
|
15
|
+
@import '../module/buff.less';
|
|
16
|
+
@import '../module/skill.less';
|
|
17
|
+
@import '../module/item.less';
|
|
18
|
+
@import '../module/npc.less';
|
|
@@ -62,16 +62,16 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
@import "
|
|
66
|
-
@import "
|
|
67
|
-
@import "
|
|
65
|
+
@import "./video.less";
|
|
66
|
+
@import "./macro.less";
|
|
67
|
+
@import "./talent.less";
|
|
68
68
|
|
|
69
|
-
@import 'module/directory.less';
|
|
70
|
-
@import 'module/icon.less';
|
|
71
|
-
@import 'module/resource.less';
|
|
72
|
-
@import 'module/jx3_element.less';
|
|
69
|
+
@import '../module/directory.less';
|
|
70
|
+
@import '../module/icon.less';
|
|
71
|
+
@import '../module/resource.less';
|
|
72
|
+
@import '../module/jx3_element.less';
|
|
73
73
|
|
|
74
|
-
@import 'module/buff.less';
|
|
75
|
-
@import 'module/skill.less';
|
|
76
|
-
@import 'module/item.less';
|
|
77
|
-
@import 'module/npc.less';
|
|
74
|
+
@import '../module/buff.less';
|
|
75
|
+
@import '../module/skill.less';
|
|
76
|
+
@import '../module/item.less';
|
|
77
|
+
@import '../module/npc.less';
|