@_sh/strapi-plugin-ckeditor 1.1.2 → 1.1.3
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/README.md +47 -6
- package/admin/src/components/CKEditor/build/ckeditor.js +6 -6
- package/admin/src/components/CKEditor/index.js +93 -40
- package/admin/src/components/Initializer/index.js +26 -26
- package/admin/src/index.js +17 -17
- package/admin/src/pages/App/index.js +25 -25
- package/admin/src/pages/HomePage/index.js +20 -20
- package/admin/src/pluginId.js +6 -6
- package/admin/src/utils/axiosInstance.js +40 -40
- package/admin/src/utils/getTrad.js +5 -5
- package/package.json +50 -50
- package/server/controllers/config.js +20 -14
- package/server/controllers/index.js +7 -7
- package/server/index.js +13 -25
- package/server/register.js +5 -5
- package/server/routes/index.js +16 -8
- package/server/services/config.js +12 -0
- package/server/services/index.js +7 -7
- package/strapi-admin.js +3 -3
- package/strapi-server.js +3 -3
- package/server/bootstrap.js +0 -5
- package/server/config/index.js +0 -6
- package/server/content-types/index.js +0 -3
- package/server/destroy.js +0 -5
- package/server/middlewares/index.js +0 -3
- package/server/policies/index.js +0 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import styled, {
|
|
1
|
+
import React, {useEffect, useRef, useState} from "react";
|
|
2
|
+
import {auth, prefixFileUrlWithBackendUrl, request} from "@strapi/helper-plugin";
|
|
3
|
+
import styled, {createGlobalStyle} from "styled-components";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import {Box} from "@strapi/design-system/Box";
|
|
6
|
+
import {CKEditor} from "@ckeditor/ckeditor5-react";
|
|
7
|
+
import {Editor as CustomClassicEditor} from "./build/ckeditor";
|
|
8
8
|
import MediaLib from "../MediaLib";
|
|
9
9
|
import PropTypes from "prop-types";
|
|
10
10
|
import pluginId from "../../pluginId";
|
|
@@ -55,6 +55,9 @@ const Editor = ({ onChange, name, value, disabled }) => {
|
|
|
55
55
|
const imgTag = `<img src="${asset.url}" alt="${asset.alt}"></img>`;
|
|
56
56
|
newValue = `${newValue}${imgTag}`;
|
|
57
57
|
}
|
|
58
|
+
} else if (asset.mime.includes("application/pdf")) {
|
|
59
|
+
const downloadTag = `<a href="${prefixFileUrlWithBackendUrl(asset.url)}" download="${asset.alt}">${asset.alt || 'Download PDF'}</a>`
|
|
60
|
+
newValue = `${newValue}${downloadTag}`
|
|
58
61
|
}
|
|
59
62
|
// Handle videos and other type of files by adding some code
|
|
60
63
|
});
|
|
@@ -66,6 +69,84 @@ const Editor = ({ onChange, name, value, disabled }) => {
|
|
|
66
69
|
toggleMediaLib();
|
|
67
70
|
};
|
|
68
71
|
|
|
72
|
+
const requestConfig = (key) =>
|
|
73
|
+
request(`/${pluginId}/config/${key}`, { method: "GET" });
|
|
74
|
+
|
|
75
|
+
const insertConfigScript = () => {
|
|
76
|
+
const url = strapi.backendURL !== '/'
|
|
77
|
+
? `${strapi.backendURL}/${pluginId}/editor-config-script.js`
|
|
78
|
+
: `/${pluginId}/editor-config-script.js`
|
|
79
|
+
|
|
80
|
+
var script = document.createElement('script');
|
|
81
|
+
script.id = 'editor-config'
|
|
82
|
+
script.src = url;
|
|
83
|
+
document.body.appendChild(script);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const waitForConfigToInitialize = async () => {
|
|
87
|
+
return new Promise((resolve) => {
|
|
88
|
+
(function checkConfigLoaded() {
|
|
89
|
+
if (typeof globalThis.ckEditorConfig !== "undefined") {
|
|
90
|
+
resolve(globalThis.ckEditorConfig)
|
|
91
|
+
} else
|
|
92
|
+
setTimeout(checkConfigLoaded, 5)
|
|
93
|
+
})();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const getEditorConfig = async () => {
|
|
98
|
+
// raw config/ckeditor.[js|ts] file
|
|
99
|
+
// Can be used with non-JSON serializable properties
|
|
100
|
+
insertConfigScript();
|
|
101
|
+
const configFromScript = await waitForConfigToInitialize();
|
|
102
|
+
if(configFromScript) {
|
|
103
|
+
return configFromScript;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ckeditor snippet of config/plugins.[js|ts] serialized as JSON
|
|
107
|
+
// Can't be used with non-JSON serializable properties
|
|
108
|
+
else {
|
|
109
|
+
return requestConfig('editor');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const setLanguage = (config) => {
|
|
114
|
+
|
|
115
|
+
const {
|
|
116
|
+
ui,
|
|
117
|
+
content,
|
|
118
|
+
textPartLanguage,
|
|
119
|
+
ignorei18n
|
|
120
|
+
} = config.language || {};
|
|
121
|
+
|
|
122
|
+
const preferedLanguage = auth.getUserInfo().preferedLanguage;
|
|
123
|
+
|
|
124
|
+
//read i18n locale
|
|
125
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
126
|
+
const params = Object.fromEntries(urlSearchParams.entries());
|
|
127
|
+
const languageContent = params["plugins[i18n][locale]"];
|
|
128
|
+
|
|
129
|
+
// let language = config.language;
|
|
130
|
+
if (languageContent) {
|
|
131
|
+
const locale = languageContent.split("-")[0]
|
|
132
|
+
|
|
133
|
+
config.language = {
|
|
134
|
+
ui: typeof config.language === "string" ? config.language : ui || preferedLanguage,
|
|
135
|
+
content: ignorei18n ? content : locale,
|
|
136
|
+
textPartLanguage: textPartLanguage
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
import(/* webpackMode: "eager" */ `./build/translations/${config.language.ui}.js`).catch(() => null);
|
|
140
|
+
import(/* webpackMode: "eager" */ `./build/translations/${config.language.content}.js`).catch(() => null);
|
|
141
|
+
|
|
142
|
+
} else {
|
|
143
|
+
config.language = preferedLanguage
|
|
144
|
+
import(/* webpackMode: "eager" */ `./build/translations/${preferedLanguage}.js`).catch(() => null);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
69
150
|
//####### config #############################################################################################
|
|
70
151
|
const [config, setConfig] = useState();
|
|
71
152
|
const [pluginCfg, setPluginCfg] = useState({});
|
|
@@ -75,32 +156,18 @@ const Editor = ({ onChange, name, value, disabled }) => {
|
|
|
75
156
|
useEffect(() => {
|
|
76
157
|
// load the editor config
|
|
77
158
|
(async () => {
|
|
78
|
-
const editor = await
|
|
79
|
-
const plugin = await
|
|
80
|
-
const upload = await
|
|
81
|
-
|
|
82
|
-
//read i18n locale
|
|
83
|
-
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
84
|
-
const params = Object.fromEntries(urlSearchParams.entries());
|
|
85
|
-
const languageContent = params["plugins[i18n][locale]"];
|
|
159
|
+
const editor = await getEditorConfig();
|
|
160
|
+
const plugin = await requestConfig('plugin');
|
|
161
|
+
const upload = await requestConfig('uploadcfg');
|
|
86
162
|
|
|
87
163
|
if (editor) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const countryCode = languageContent.split("-")[0]
|
|
92
|
-
if (countryCode && language)
|
|
93
|
-
language = {
|
|
94
|
-
content: language.content || countryCode,
|
|
95
|
-
ui: typeof language === "string" && language || language.ui || auth.getUserInfo().preferedLanguage,
|
|
96
|
-
textPartLanguage: language.textPartLanguage
|
|
97
|
-
}
|
|
98
|
-
}
|
|
164
|
+
|
|
165
|
+
setLanguage(editor);
|
|
166
|
+
|
|
99
167
|
setConfig({
|
|
100
168
|
...config,
|
|
101
169
|
editor: {
|
|
102
170
|
...editor,
|
|
103
|
-
language: language ? language : auth.getUserInfo().preferedLanguage,
|
|
104
171
|
strapiMediaLib: {
|
|
105
172
|
onToggle: toggleMediaLib,
|
|
106
173
|
label: "Media library",
|
|
@@ -112,20 +179,6 @@ const Editor = ({ onChange, name, value, disabled }) => {
|
|
|
112
179
|
},
|
|
113
180
|
});
|
|
114
181
|
|
|
115
|
-
if (editor.language) {
|
|
116
|
-
if (editor.language.ui) {
|
|
117
|
-
import(/* webpackMode: "eager" */ `./build/translations/${editor.language.ui}.js`).catch(() => null);
|
|
118
|
-
}
|
|
119
|
-
if (editor.language.content) {
|
|
120
|
-
import(/* webpackMode: "eager" */ `./build/translations/${editor.language.content}.js`).catch(() => null);
|
|
121
|
-
}
|
|
122
|
-
if (typeof editor.language !== "object") {
|
|
123
|
-
import(/* webpackMode: "eager" */ `./build/translations/${editor.language}.js`).catch(() => null);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (!editor.language) {
|
|
127
|
-
import(/* webpackMode: "eager" */ `./build/translations/${auth.getUserInfo().preferedLanguage}.js`).catch(() => null);
|
|
128
|
-
}
|
|
129
182
|
}
|
|
130
183
|
if (plugin) {
|
|
131
184
|
setPluginCfg({
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Initializer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useEffect, useRef } from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import pluginId from '../../pluginId';
|
|
10
|
-
|
|
11
|
-
const Initializer = ({ setPlugin }) => {
|
|
12
|
-
const ref = useRef();
|
|
13
|
-
ref.current = setPlugin;
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
ref.current(pluginId);
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Initializer.propTypes = {
|
|
23
|
-
setPlugin: PropTypes.func.isRequired,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default Initializer;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Initializer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useEffect, useRef } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import pluginId from '../../pluginId';
|
|
10
|
+
|
|
11
|
+
const Initializer = ({ setPlugin }) => {
|
|
12
|
+
const ref = useRef();
|
|
13
|
+
ref.current = setPlugin;
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
ref.current(pluginId);
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Initializer.propTypes = {
|
|
23
|
+
setPlugin: PropTypes.func.isRequired,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default Initializer;
|
package/admin/src/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import pluginPkg from "../../package.json";
|
|
2
|
-
import Wysiwyg from "./components/Wysiwyg";
|
|
3
|
-
import pluginId from "./pluginId";
|
|
4
|
-
|
|
5
|
-
const name = pluginPkg.strapi.name;
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
register(app) {
|
|
9
|
-
app.addFields({ type: "wysiwyg", Component: Wysiwyg });
|
|
10
|
-
app.registerPlugin({
|
|
11
|
-
id: pluginId,
|
|
12
|
-
isReady: true,
|
|
13
|
-
name,
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
bootstrap(app) {
|
|
17
|
-
},
|
|
1
|
+
import pluginPkg from "../../package.json";
|
|
2
|
+
import Wysiwyg from "./components/Wysiwyg";
|
|
3
|
+
import pluginId from "./pluginId";
|
|
4
|
+
|
|
5
|
+
const name = pluginPkg.strapi.name;
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
register(app) {
|
|
9
|
+
app.addFields({ type: "wysiwyg", Component: Wysiwyg });
|
|
10
|
+
app.registerPlugin({
|
|
11
|
+
id: pluginId,
|
|
12
|
+
isReady: true,
|
|
13
|
+
name,
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
bootstrap(app) {
|
|
17
|
+
},
|
|
18
18
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This component is the skeleton around the actual pages, and should only
|
|
4
|
-
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { Switch, Route } from 'react-router-dom';
|
|
10
|
-
import { NotFound } from '@strapi/helper-plugin';
|
|
11
|
-
import pluginId from '../../pluginId';
|
|
12
|
-
import HomePage from '../HomePage';
|
|
13
|
-
|
|
14
|
-
const App = () => {
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<Switch>
|
|
18
|
-
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
|
|
19
|
-
<Route component={NotFound} />
|
|
20
|
-
</Switch>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default App;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* This component is the skeleton around the actual pages, and should only
|
|
4
|
+
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Switch, Route } from 'react-router-dom';
|
|
10
|
+
import { NotFound } from '@strapi/helper-plugin';
|
|
11
|
+
import pluginId from '../../pluginId';
|
|
12
|
+
import HomePage from '../HomePage';
|
|
13
|
+
|
|
14
|
+
const App = () => {
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<Switch>
|
|
18
|
+
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
|
|
19
|
+
<Route component={NotFound} />
|
|
20
|
+
</Switch>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default App;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* HomePage
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { memo } from 'react';
|
|
8
|
-
// import PropTypes from 'prop-types';
|
|
9
|
-
import pluginId from '../../pluginId';
|
|
10
|
-
|
|
11
|
-
const HomePage = () => {
|
|
12
|
-
return (
|
|
13
|
-
<div>
|
|
14
|
-
<h1>{pluginId}'s HomePage</h1>
|
|
15
|
-
<p>Happy coding</p>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default memo(HomePage);
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* HomePage
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { memo } from 'react';
|
|
8
|
+
// import PropTypes from 'prop-types';
|
|
9
|
+
import pluginId from '../../pluginId';
|
|
10
|
+
|
|
11
|
+
const HomePage = () => {
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<h1>{pluginId}'s HomePage</h1>
|
|
15
|
+
<p>Happy coding</p>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default memo(HomePage);
|
package/admin/src/pluginId.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const pluginPkg = require('../../package.json');
|
|
2
|
-
|
|
3
|
-
const pluginId = pluginPkg.name.replace(/^(@_sh\/strapi-)plugin-/i, '');
|
|
4
|
-
// const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
|
|
5
|
-
|
|
6
|
-
module.exports = pluginId;
|
|
1
|
+
const pluginPkg = require('../../package.json');
|
|
2
|
+
|
|
3
|
+
const pluginId = pluginPkg.name.replace(/^(@_sh\/strapi-)plugin-/i, '');
|
|
4
|
+
// const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
|
|
5
|
+
|
|
6
|
+
module.exports = pluginId;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* axios with a custom config.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import axios from 'axios';
|
|
6
|
-
import { auth } from '@strapi/helper-plugin';
|
|
7
|
-
|
|
8
|
-
const instance = axios.create({
|
|
9
|
-
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
instance.interceptors.request.use(
|
|
13
|
-
async config => {
|
|
14
|
-
config.headers = {
|
|
15
|
-
Authorization: `Bearer ${auth.getToken()}`,
|
|
16
|
-
Accept: 'application/json',
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return config;
|
|
21
|
-
},
|
|
22
|
-
error => {
|
|
23
|
-
Promise.reject(error);
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
instance.interceptors.response.use(
|
|
28
|
-
response => response,
|
|
29
|
-
error => {
|
|
30
|
-
// whatever you want to do with the error
|
|
31
|
-
if (error.response?.status === 401) {
|
|
32
|
-
auth.clearAppStorage();
|
|
33
|
-
window.location.reload();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export default instance;
|
|
1
|
+
/**
|
|
2
|
+
* axios with a custom config.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import { auth } from '@strapi/helper-plugin';
|
|
7
|
+
|
|
8
|
+
const instance = axios.create({
|
|
9
|
+
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
instance.interceptors.request.use(
|
|
13
|
+
async config => {
|
|
14
|
+
config.headers = {
|
|
15
|
+
Authorization: `Bearer ${auth.getToken()}`,
|
|
16
|
+
Accept: 'application/json',
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return config;
|
|
21
|
+
},
|
|
22
|
+
error => {
|
|
23
|
+
Promise.reject(error);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
instance.interceptors.response.use(
|
|
28
|
+
response => response,
|
|
29
|
+
error => {
|
|
30
|
+
// whatever you want to do with the error
|
|
31
|
+
if (error.response?.status === 401) {
|
|
32
|
+
auth.clearAppStorage();
|
|
33
|
+
window.location.reload();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export default instance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import pluginId from '../pluginId';
|
|
2
|
-
|
|
3
|
-
const getTrad = id => `${pluginId}.${id}`;
|
|
4
|
-
|
|
5
|
-
export default getTrad;
|
|
1
|
+
import pluginId from '../pluginId';
|
|
2
|
+
|
|
3
|
+
const getTrad = id => `${pluginId}.${id}`;
|
|
4
|
+
|
|
5
|
+
export default getTrad;
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@_sh/strapi-plugin-ckeditor",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Replaces the default Strapi WYSIWYG editor with a customized buil of CKEditor 5 packed with useful plugins.",
|
|
5
|
-
"private": false,
|
|
6
|
-
"keywords": [
|
|
7
|
-
"strapi",
|
|
8
|
-
"ckeditor",
|
|
9
|
-
"ckeditor5",
|
|
10
|
-
"ckeditor 5",
|
|
11
|
-
"wysiwyg",
|
|
12
|
-
"rich text",
|
|
13
|
-
"editor"
|
|
14
|
-
],
|
|
15
|
-
"strapi": {
|
|
16
|
-
"icon": "edit",
|
|
17
|
-
"name": "ckeditor",
|
|
18
|
-
"displayName": "CKEditor 5",
|
|
19
|
-
"description": "Replaces the default Strapi WYSIWYG editor with a customized buil of CKEditor 5 packed with useful plugins.",
|
|
20
|
-
"kind": "plugin"
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"admin",
|
|
24
|
-
"server",
|
|
25
|
-
"strapi-admin.js",
|
|
26
|
-
"strapi-server.js"
|
|
27
|
-
],
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@ckeditor/ckeditor5-react": "5.0.2"
|
|
30
|
-
},
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@strapi/strapi": "^4.0.0"
|
|
33
|
-
},
|
|
34
|
-
"author": {
|
|
35
|
-
"name": "nshenderov"
|
|
36
|
-
},
|
|
37
|
-
"homepage": "https://market.strapi.io/plugins/@_sh-strapi-plugin-ckeditor",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/nshenderov/strapi-plugin-ckeditor.git"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"test": "echo \"Error: no tests specified\" && exit 1"
|
|
44
|
-
},
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=14.
|
|
47
|
-
"npm": ">=6.0.0"
|
|
48
|
-
},
|
|
49
|
-
"license": "MIT"
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@_sh/strapi-plugin-ckeditor",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Replaces the default Strapi WYSIWYG editor with a customized buil of CKEditor 5 packed with useful plugins.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"keywords": [
|
|
7
|
+
"strapi",
|
|
8
|
+
"ckeditor",
|
|
9
|
+
"ckeditor5",
|
|
10
|
+
"ckeditor 5",
|
|
11
|
+
"wysiwyg",
|
|
12
|
+
"rich text",
|
|
13
|
+
"editor"
|
|
14
|
+
],
|
|
15
|
+
"strapi": {
|
|
16
|
+
"icon": "edit",
|
|
17
|
+
"name": "ckeditor",
|
|
18
|
+
"displayName": "CKEditor 5",
|
|
19
|
+
"description": "Replaces the default Strapi WYSIWYG editor with a customized buil of CKEditor 5 packed with useful plugins.",
|
|
20
|
+
"kind": "plugin"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"admin",
|
|
24
|
+
"server",
|
|
25
|
+
"strapi-admin.js",
|
|
26
|
+
"strapi-server.js"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@ckeditor/ckeditor5-react": "^5.0.2"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@strapi/strapi": "^4.0.0"
|
|
33
|
+
},
|
|
34
|
+
"author": {
|
|
35
|
+
"name": "nshenderov"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://market.strapi.io/plugins/@_sh-strapi-plugin-ckeditor",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/nshenderov/strapi-plugin-ckeditor.git"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "echo \"Error: no tests specified\" && exit 1"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=14.19.1 <=18.x.x",
|
|
47
|
+
"npm": ">=6.0.0"
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT"
|
|
50
|
+
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
getConfig: async (ctx) => {
|
|
5
|
-
const { configKey } = ctx.params;
|
|
6
|
-
if(configKey === 'uploadcfg'){
|
|
7
|
-
const uploadConfig = await strapi.plugin('ckeditor').service('config').getUploadConfig('upload').getSettings();
|
|
8
|
-
ctx.send(uploadConfig);
|
|
9
|
-
}else{
|
|
10
|
-
const config = await strapi.plugin('ckeditor').service('config').getConfig(configKey);
|
|
11
|
-
ctx.send(config);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
},
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
getConfig: async (ctx) => {
|
|
5
|
+
const { configKey } = ctx.params;
|
|
6
|
+
if(configKey === 'uploadcfg'){
|
|
7
|
+
const uploadConfig = await strapi.plugin('ckeditor').service('config').getUploadConfig('upload').getSettings();
|
|
8
|
+
ctx.send(uploadConfig);
|
|
9
|
+
}else{
|
|
10
|
+
const config = await strapi.plugin('ckeditor').service('config').getConfig(configKey);
|
|
11
|
+
ctx.send(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
getEditorConfigScript: async (ctx) => {
|
|
17
|
+
const config = await strapi.plugin('ckeditor').service('config').getEditorConfigScript();
|
|
18
|
+
ctx.type = 'application/javascript';
|
|
19
|
+
ctx.send(config);
|
|
20
|
+
}
|
|
15
21
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const config = require('./config');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
config
|
|
7
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('./config');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
config
|
|
7
|
+
};
|
package/server/index.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const register = require('./register');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
register,
|
|
16
|
-
bootstrap,
|
|
17
|
-
destroy,
|
|
18
|
-
config,
|
|
19
|
-
controllers,
|
|
20
|
-
routes,
|
|
21
|
-
services,
|
|
22
|
-
contentTypes,
|
|
23
|
-
policies,
|
|
24
|
-
middlewares,
|
|
25
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const register = require('./register');
|
|
4
|
+
const controllers = require('./controllers');
|
|
5
|
+
const routes = require('./routes');
|
|
6
|
+
const services = require('./services');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
register,
|
|
10
|
+
controllers,
|
|
11
|
+
routes,
|
|
12
|
+
services,
|
|
13
|
+
};
|
package/server/register.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = ({ strapi }) => {
|
|
4
|
-
// registeration phase
|
|
5
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = ({ strapi }) => {
|
|
4
|
+
// registeration phase
|
|
5
|
+
};
|