@_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.
@@ -1,8 +1,16 @@
1
- module.exports = [
2
- {
3
- method: 'GET',
4
- path: '/config/:configKey',
5
- handler: 'config.getConfig',
6
- config: { policies: [] },
7
- }
8
- ];
1
+ module.exports = [
2
+ {
3
+ method: 'GET',
4
+ path: '/config/:configKey',
5
+ handler: 'config.getConfig',
6
+ config: {policies: []},
7
+ },
8
+ {
9
+ method: 'GET',
10
+ path: '/editor-config-script.js',
11
+ handler: 'config.getEditorConfigScript',
12
+ config: {
13
+ auth: false // Assume CKEditor config is not sensitive. We can't send a JWT token in a static script tag.
14
+ },
15
+ }
16
+ ];
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const fs = require("fs");
4
+
3
5
  /**
4
6
  * config.js configuration service
5
7
  */
@@ -9,6 +11,16 @@ module.exports = ({ strapi }) => {
9
11
  getConfig(key = 'editor') {
10
12
  return strapi.plugin('ckeditor').config(key) ?? {};
11
13
  },
14
+ getEditorConfigScript() {
15
+ const appDir = process.cwd();
16
+ const isTSProject = fs.existsSync(`${appDir}/dist`);
17
+ const jsDir = isTSProject ? `${appDir}/dist` : appDir;
18
+
19
+ const filename = `${jsDir}/config/ckeditor.js`;
20
+ return fs.existsSync(filename)
21
+ ? fs.readFileSync(filename)
22
+ : 'globalThis.ckEditorConfig = null' // empty script tag causes no problems
23
+ },
12
24
  getUploadConfig(name) {
13
25
  return strapi.plugin('upload').service(name) ?? {};
14
26
  },
@@ -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/strapi-admin.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';
2
-
3
- module.exports = require('./admin/src').default;
1
+ 'use strict';
2
+
3
+ module.exports = require('./admin/src').default;
package/strapi-server.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';
2
-
3
- module.exports = require('./server');
1
+ 'use strict';
2
+
3
+ module.exports = require('./server');
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- // bootstrap phase
5
- };
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- default: {},
5
- validator() {},
6
- };
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};
package/server/destroy.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- // destroy phase
5
- };
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {};