@_sh/strapi-plugin-ckeditor 5.0.2 → 6.0.1

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 CHANGED
@@ -122,10 +122,25 @@ default to the Strapi admin's preferred language. If no preference is set, Engli
122
122
 
123
123
  > 💡 It is important to use the content styles on the publishing side of your application. Otherwise, the content will look different in the editor and for your end users. [Follow the documentation](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/css.html#styling-the-published-content).
124
124
 
125
+ > To display content from external sources, such as images or videos, in your admin panel,
126
+ > you need to configure your `middlewares.js` file.
127
+ > [**Check the documentation for details.**](https://docs.strapi.io/dev-docs/configurations/middlewares#security)
128
+
125
129
  ## <a id="configuration"></a>⚙️ Configuration
126
130
 
127
- The plugin configuration must be defined on the front-end. The plugin provides a `setPluginConfig`
128
- function, which accepts a plugin configuration (`PluginConfig`) that can include an array of presets
131
+ The plugin configuration must be defined on the front-end.
132
+
133
+ The plugin provides a set of functions that allow you to modify the plugin's configuration:
134
+
135
+ ```ts
136
+ setPluginConfig(config);
137
+ getPluginPresets();
138
+ getPluginTheme();
139
+ ```
140
+
141
+ **setPluginConfig**
142
+
143
+ The function, accepts a plugin configuration (`PluginConfig`) that can include an array of presets
129
144
  and a theme object:
130
145
 
131
146
  ```ts
@@ -219,6 +234,28 @@ type Theme = {
219
234
  export type EditorStyles = string | Interpolation<object>[];
220
235
  ```
221
236
 
237
+ **getPluginPresets**
238
+
239
+ ```ts
240
+ function getPluginPresets(): {
241
+ [key: string]: Preset;
242
+ };
243
+ ```
244
+
245
+ Returns `presets` object.
246
+
247
+ - Each property name must match the corresponding preset's name.
248
+ - To extend or modify the options visible in the admin panel's content manager,
249
+ changes must be made before the admin panel's bootstrap lifecycle function.
250
+
251
+ **getPluginTheme**
252
+
253
+ ```ts
254
+ function getPluginTheme(): Theme;
255
+ ```
256
+
257
+ Returns `theme` object.
258
+
222
259
  **Default presets and theme**
223
260
 
224
261
  To simplify the process of defining a new preset, the plugin exports default presets and
@@ -351,7 +388,7 @@ export type EditorStyles = string | Interpolation<object>[];
351
388
  ### Configuration examples:
352
389
 
353
390
  <details>
354
- <summary>Adding a new preset [JS]</summary>
391
+ <summary>Setting a new set of presets [JS]</summary>
355
392
 
356
393
  ```js
357
394
  // src/admin/app.js
@@ -429,7 +466,7 @@ export default {
429
466
  </details>
430
467
 
431
468
  <details>
432
- <summary>Adding a new preset [TS]</summary>
469
+ <summary>Setting a new set of presets [TS]</summary>
433
470
 
434
471
  ```ts
435
472
  // src/admin/app.tsx
@@ -513,7 +550,7 @@ export default {
513
550
  </details>
514
551
 
515
552
  <details>
516
- <summary>Default presets modification [TS]</summary>
553
+ <summary>Default presets modification using setPluginConfig [TS]</summary>
517
554
 
518
555
  ```ts
519
556
  // src/admin/app.tsx
@@ -587,7 +624,67 @@ export default {
587
624
  </details>
588
625
 
589
626
  <details>
590
- <summary>Modifying theme [TS]</summary>
627
+ <summary>Default presets modification using getPluginPresets [TS]</summary>
628
+
629
+ ```ts
630
+ // src/admin/app.tsx
631
+
632
+ import { css } from 'styled-components';
633
+ import { getPluginPresets } from '@_sh/strapi-plugin-ckeditor';
634
+
635
+ export default {
636
+ register() {
637
+ const presets = getPluginPresets();
638
+
639
+ presets.defaultHtml.styles = css`
640
+ .ck {
641
+ color: red;
642
+ }
643
+ `;
644
+
645
+ presets.defaultHtml.editorConfig = {
646
+ ...presets.defaultHtml.editorConfig,
647
+ placeholder: 'Modified default HTML editor',
648
+ toolbar: [
649
+ 'heading',
650
+ '|',
651
+ 'bold',
652
+ 'italic',
653
+ 'link',
654
+ 'bulletedList',
655
+ 'numberedList',
656
+ '|',
657
+ 'strapiMediaLib',
658
+ 'insertTable',
659
+ '|',
660
+ 'undo',
661
+ 'redo',
662
+ ],
663
+ };
664
+
665
+ presets.defaultMarkdown = {
666
+ ...presets.defaultMarkdown,
667
+ description: 'Modified default Markdown editor',
668
+ styles: css`
669
+ .ck {
670
+ --ck-editor-max-width: 1500px;
671
+ --ck-editor-min-height: 700px;
672
+ --ck-editor-max-height: 700px;
673
+ }
674
+
675
+ .ck.ck-editor__main {
676
+ border: 3px dashed ${({ theme }) => theme.colors.warning500};
677
+ }
678
+ `,
679
+ };
680
+ },
681
+ };
682
+ ```
683
+
684
+ </details>
685
+
686
+ <details>
687
+ <summary>Modifying theme using setPluginConfig [TS]</summary>
591
688
 
592
689
  ```ts
593
690
  // src/admin/app.tsx
@@ -622,6 +719,36 @@ export default {
622
719
 
623
720
  </details>
624
721
 
722
+ <details>
723
+ <summary>Modifying theme using getPluginTheme [TS]</summary>
724
+
725
+ ```ts
726
+ // src/admin/app.tsx
727
+
728
+ import { css } from 'styled-components';
729
+ import { getPluginTheme } from '@_sh/strapi-plugin-ckeditor';
730
+
731
+ export default {
732
+ register() {
733
+ const theme = getPluginTheme();
734
+
735
+ theme.additional = css`
736
+ .ck {
737
+ --ck-editor-max-width: 1500px;
738
+ --ck-editor-min-height: 700px;
739
+ --ck-editor-max-height: 700px;
740
+ }
741
+
742
+ .ck.ck-editor__main {
743
+ border: 3px dashed ${({ theme }) => theme.colors.warning500};
744
+ }
745
+ `;
746
+ },
747
+ };
748
+ ```
749
+
750
+ </details>
751
+
625
752
  <details>
626
753
  <summary>Adding Timestamp plugin [JS]</summary>
627
754
 
@@ -673,10 +800,6 @@ export default {
673
800
 
674
801
  > 📌 It is highly recommended to explore [**the official CKEditor5 documentation**](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html).
675
802
 
676
- > 💡 To display content from external sources, such as images or videos, in your admin panel,
677
- > you need to configure your `middlewares.js` file.
678
- > [**Check the documentation for details.**](https://docs.strapi.io/dev-docs/configurations/middlewares#security)
679
-
680
803
  ## <a id="contributing"></a>🛠 Contributing
681
804
 
682
805
  Feel free to [fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)
@@ -30,7 +30,8 @@ const admin = require("@strapi/strapi/admin");
30
30
  const ckeditor5 = require("ckeditor5");
31
31
  const ckeditor5React = require("@ckeditor/ckeditor5-react");
32
32
  require("ckeditor5/ckeditor5.css");
33
- const index = require("./index-CsSYDZ4y.js");
33
+ const index = require("./index-DUYTlr_2.js");
34
+ require("sanitize-html");
34
35
  const icons = require("@strapi/icons");
35
36
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
36
37
  const React__default = /* @__PURE__ */ _interopDefault(React);
@@ -39,12 +40,24 @@ const STORAGE_KEYS = {
39
40
  PREFERED_LANGUAGE: "strapi-admin-language",
40
41
  PROFILE_THEME: "STRAPI_THEME"
41
42
  };
43
+ function getCookieValue(name) {
44
+ let result = null;
45
+ const cookieArray = document.cookie.split(";");
46
+ cookieArray.forEach((cookie) => {
47
+ const [key, value] = cookie.split("=").map((item) => item.trim());
48
+ if (key === name) {
49
+ result = decodeURIComponent(value);
50
+ }
51
+ });
52
+ return result;
53
+ }
42
54
  function getStoredToken() {
43
- const token = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
44
- if (typeof token === "string") {
45
- return JSON.parse(token);
55
+ const tokenFromStorage = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
56
+ if (tokenFromStorage) {
57
+ return JSON.parse(tokenFromStorage);
46
58
  }
47
- return null;
59
+ const tokenFromCookie = getCookieValue(STORAGE_KEYS.TOKEN);
60
+ return tokenFromCookie;
48
61
  }
49
62
  function getPreferedLanguage() {
50
63
  const language = localStorage.getItem(STORAGE_KEYS.PREFERED_LANGUAGE)?.replace(/^"|"$/g, "") || "en";
@@ -421,9 +434,7 @@ const WordCounter = styledComponents.styled(designSystem.Flex)`
421
434
  `;
422
435
  function EditorLayout({ children }) {
423
436
  const { error, preset } = useEditorContext();
424
- const [isExpandedMode, setIsExpandedMode] = React.useState(false);
425
- const handleToggleExpand = () => setIsExpandedMode(true);
426
- const handleOnCollapse = () => setIsExpandedMode(false);
437
+ const [isExpandedMode, handleToggleExpand] = React.useReducer((prev) => !prev, false);
427
438
  React.useEffect(() => {
428
439
  if (isExpandedMode) {
429
440
  document.body.classList.add("lock-body-scroll");
@@ -433,45 +444,19 @@ function EditorLayout({ children }) {
433
444
  };
434
445
  }, [isExpandedMode]);
435
446
  if (isExpandedMode) {
436
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.FocusTrap, { onEscape: handleOnCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(
437
- Backdrop,
447
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isExpandedMode, onOpenChange: handleToggleExpand, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Content, { style: { maxWidth: "unset", width: "unset" }, children: /* @__PURE__ */ jsxRuntime.jsx(FullScreenBox, { height: "90vh", width: "90vw", background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsxs(
448
+ EditorWrapper,
438
449
  {
439
- position: "fixed",
440
- top: 0,
441
- left: 0,
442
- right: 0,
443
- bottom: 0,
444
- zIndex: 4,
445
- justifyContent: "center",
446
- onClick: handleOnCollapse,
447
- children: /* @__PURE__ */ jsxRuntime.jsx(
448
- FullScreenBox,
449
- {
450
- background: "neutral100",
451
- hasRadius: true,
452
- shadow: "popupShadow",
453
- overflow: "hidden",
454
- width: "90%",
455
- height: "90%",
456
- onClick: (e) => e.stopPropagation(),
457
- position: "relative",
458
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { height: "100%", alignItems: "flex-start", direction: "column", children: /* @__PURE__ */ jsxRuntime.jsxs(
459
- EditorWrapper,
460
- {
461
- $presetStyles: preset?.styles,
462
- $isExpanded: isExpandedMode,
463
- $hasError: Boolean(error),
464
- className: "ck-editor__expanded",
465
- children: [
466
- children,
467
- /* @__PURE__ */ jsxRuntime.jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Collapse, {}) })
468
- ]
469
- }
470
- ) })
471
- }
472
- )
450
+ $presetStyles: preset?.styles,
451
+ $isExpanded: isExpandedMode,
452
+ $hasError: Boolean(error),
453
+ className: "ck-editor__expanded",
454
+ children: [
455
+ children,
456
+ /* @__PURE__ */ jsxRuntime.jsx(CollapseButton, { label: "Collapse", onClick: handleToggleExpand, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Collapse, {}) })
457
+ ]
473
458
  }
474
- ) }) });
459
+ ) }) }) });
475
460
  }
476
461
  return /* @__PURE__ */ jsxRuntime.jsxs(
477
462
  EditorWrapper,
@@ -509,22 +494,21 @@ const EditorWrapper = styledComponents.styled("div")`
509
494
  ${$presetStyles}
510
495
  `}
511
496
  `;
512
- const Backdrop = styledComponents.styled(designSystem.Flex)`
513
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
514
- `;
515
497
  const ExpandButton = styledComponents.styled(designSystem.IconButton)`
516
498
  position: absolute;
517
499
  bottom: 1.4rem;
518
500
  right: 1.2rem;
519
501
  z-index: 2;
502
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
520
503
  `;
521
504
  const CollapseButton = styledComponents.styled(designSystem.IconButton)`
522
505
  position: absolute;
523
506
  bottom: 2.5rem;
524
507
  right: 1.2rem;
525
508
  z-index: 2;
509
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
526
510
  `;
527
- const FullScreenBox = styledComponents.styled(designSystem.Box)`
511
+ const FullScreenBox = styledComponents.styled(designSystem.Flex)`
528
512
  max-width: var(--ck-editor-full-screen-box-max-width);
529
513
  `;
530
514
  const GlobalStyle = styledComponents.createGlobalStyle`
@@ -1,24 +1,37 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback } from "react";
3
- import { Flex, IconButton, Box, Portal, FocusTrap, Field as Field$1, Loader } from "@strapi/design-system";
2
+ import React, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback, useReducer } from "react";
3
+ import { Flex, IconButton, Modal, Box, Field as Field$1, Loader } from "@strapi/design-system";
4
4
  import { styled, css, createGlobalStyle } from "styled-components";
5
5
  import { useStrapiApp, useField } from "@strapi/strapi/admin";
6
6
  import { ClassicEditor } from "ckeditor5";
7
7
  import { CKEditor } from "@ckeditor/ckeditor5-react";
8
8
  import "ckeditor5/ckeditor5.css";
9
- import { g as getPluginConfig, p as prefixFileUrlWithBackendUrl, i as isImageResponsive } from "./index-D3a4OadF.mjs";
9
+ import { g as getPluginConfig, p as prefixFileUrlWithBackendUrl, i as isImageResponsive } from "./index-Q6to6uwX.mjs";
10
+ import "sanitize-html";
10
11
  import { Collapse, Expand } from "@strapi/icons";
11
12
  const STORAGE_KEYS = {
12
13
  TOKEN: "jwtToken",
13
14
  PREFERED_LANGUAGE: "strapi-admin-language",
14
15
  PROFILE_THEME: "STRAPI_THEME"
15
16
  };
17
+ function getCookieValue(name) {
18
+ let result = null;
19
+ const cookieArray = document.cookie.split(";");
20
+ cookieArray.forEach((cookie) => {
21
+ const [key, value] = cookie.split("=").map((item) => item.trim());
22
+ if (key === name) {
23
+ result = decodeURIComponent(value);
24
+ }
25
+ });
26
+ return result;
27
+ }
16
28
  function getStoredToken() {
17
- const token = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
18
- if (typeof token === "string") {
19
- return JSON.parse(token);
29
+ const tokenFromStorage = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
30
+ if (tokenFromStorage) {
31
+ return JSON.parse(tokenFromStorage);
20
32
  }
21
- return null;
33
+ const tokenFromCookie = getCookieValue(STORAGE_KEYS.TOKEN);
34
+ return tokenFromCookie;
22
35
  }
23
36
  function getPreferedLanguage() {
24
37
  const language = localStorage.getItem(STORAGE_KEYS.PREFERED_LANGUAGE)?.replace(/^"|"$/g, "") || "en";
@@ -395,9 +408,7 @@ const WordCounter = styled(Flex)`
395
408
  `;
396
409
  function EditorLayout({ children }) {
397
410
  const { error, preset } = useEditorContext();
398
- const [isExpandedMode, setIsExpandedMode] = useState(false);
399
- const handleToggleExpand = () => setIsExpandedMode(true);
400
- const handleOnCollapse = () => setIsExpandedMode(false);
411
+ const [isExpandedMode, handleToggleExpand] = useReducer((prev) => !prev, false);
401
412
  useEffect(() => {
402
413
  if (isExpandedMode) {
403
414
  document.body.classList.add("lock-body-scroll");
@@ -407,45 +418,19 @@ function EditorLayout({ children }) {
407
418
  };
408
419
  }, [isExpandedMode]);
409
420
  if (isExpandedMode) {
410
- return /* @__PURE__ */ jsx(Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsx(FocusTrap, { onEscape: handleOnCollapse, children: /* @__PURE__ */ jsx(
411
- Backdrop,
421
+ return /* @__PURE__ */ jsx(Modal.Root, { open: isExpandedMode, onOpenChange: handleToggleExpand, children: /* @__PURE__ */ jsx(Modal.Content, { style: { maxWidth: "unset", width: "unset" }, children: /* @__PURE__ */ jsx(FullScreenBox, { height: "90vh", width: "90vw", background: "neutral100", children: /* @__PURE__ */ jsxs(
422
+ EditorWrapper,
412
423
  {
413
- position: "fixed",
414
- top: 0,
415
- left: 0,
416
- right: 0,
417
- bottom: 0,
418
- zIndex: 4,
419
- justifyContent: "center",
420
- onClick: handleOnCollapse,
421
- children: /* @__PURE__ */ jsx(
422
- FullScreenBox,
423
- {
424
- background: "neutral100",
425
- hasRadius: true,
426
- shadow: "popupShadow",
427
- overflow: "hidden",
428
- width: "90%",
429
- height: "90%",
430
- onClick: (e) => e.stopPropagation(),
431
- position: "relative",
432
- children: /* @__PURE__ */ jsx(Flex, { height: "100%", alignItems: "flex-start", direction: "column", children: /* @__PURE__ */ jsxs(
433
- EditorWrapper,
434
- {
435
- $presetStyles: preset?.styles,
436
- $isExpanded: isExpandedMode,
437
- $hasError: Boolean(error),
438
- className: "ck-editor__expanded",
439
- children: [
440
- children,
441
- /* @__PURE__ */ jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsx(Collapse, {}) })
442
- ]
443
- }
444
- ) })
445
- }
446
- )
424
+ $presetStyles: preset?.styles,
425
+ $isExpanded: isExpandedMode,
426
+ $hasError: Boolean(error),
427
+ className: "ck-editor__expanded",
428
+ children: [
429
+ children,
430
+ /* @__PURE__ */ jsx(CollapseButton, { label: "Collapse", onClick: handleToggleExpand, children: /* @__PURE__ */ jsx(Collapse, {}) })
431
+ ]
447
432
  }
448
- ) }) });
433
+ ) }) }) });
449
434
  }
450
435
  return /* @__PURE__ */ jsxs(
451
436
  EditorWrapper,
@@ -483,22 +468,21 @@ const EditorWrapper = styled("div")`
483
468
  ${$presetStyles}
484
469
  `}
485
470
  `;
486
- const Backdrop = styled(Flex)`
487
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
488
- `;
489
471
  const ExpandButton = styled(IconButton)`
490
472
  position: absolute;
491
473
  bottom: 1.4rem;
492
474
  right: 1.2rem;
493
475
  z-index: 2;
476
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
494
477
  `;
495
478
  const CollapseButton = styled(IconButton)`
496
479
  position: absolute;
497
480
  bottom: 2.5rem;
498
481
  right: 1.2rem;
499
482
  z-index: 2;
483
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
500
484
  `;
501
- const FullScreenBox = styled(Box)`
485
+ const FullScreenBox = styled(Flex)`
502
486
  max-width: var(--ck-editor-full-screen-box-max-width);
503
487
  `;
504
488
  const GlobalStyle = createGlobalStyle`
@@ -28,7 +28,7 @@ const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
28
28
  const sanitizeHtml__namespace = /* @__PURE__ */ _interopNamespace(sanitizeHtml);
29
29
  const cloneDeep__default = /* @__PURE__ */ _interopDefault(cloneDeep);
30
30
  const name = "@_sh/strapi-plugin-ckeditor";
31
- const version = "5.0.2";
31
+ const version = "6.0.1";
32
32
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
33
33
  const keywords = [
34
34
  "strapi",
@@ -95,7 +95,7 @@ const dependencies = {
95
95
  "@ckeditor/ckeditor5-react": "~9.5.0",
96
96
  "@strapi/design-system": "2.0.0-rc.18",
97
97
  "@strapi/icons": "2.0.0-rc.18",
98
- ckeditor5: "~44.3.0",
98
+ ckeditor5: "~45.0.0",
99
99
  lodash: "4.17.21",
100
100
  "sanitize-html": "2.13.0",
101
101
  yup: "0.32.9"
@@ -845,7 +845,7 @@ const editorConfig$1 = {
845
845
  "alignment",
846
846
  {
847
847
  label: "Indentation",
848
- icon: ckeditor5.icons.indent,
848
+ icon: ckeditor5.IconIndent,
849
849
  items: ["outdent", "indent"]
850
850
  },
851
851
  "bulletedList",
@@ -1191,20 +1191,16 @@ function setPluginConfig(userPluginConfig) {
1191
1191
  if (userTheme) {
1192
1192
  PLUGIN_CONFIG.theme = userTheme;
1193
1193
  }
1194
- deepFreeze(PLUGIN_CONFIG);
1194
+ }
1195
+ function getPluginPresets() {
1196
+ return PLUGIN_CONFIG.presets;
1197
+ }
1198
+ function getPluginTheme() {
1199
+ return PLUGIN_CONFIG.presets;
1195
1200
  }
1196
1201
  function getPluginConfig() {
1197
- if (!Object.isFrozen(PLUGIN_CONFIG)) deepFreeze(PLUGIN_CONFIG);
1198
1202
  return PLUGIN_CONFIG;
1199
1203
  }
1200
- function deepFreeze(obj) {
1201
- Object.keys(obj).forEach((p) => {
1202
- if (typeof obj[p] === "object" && obj[p] !== null && !Object.isFrozen(obj[p])) {
1203
- deepFreeze(obj[p]);
1204
- }
1205
- });
1206
- return Object.freeze(obj);
1207
- }
1208
1204
  function CKEditorIcon() {
1209
1205
  return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(SvgIcon, {}) });
1210
1206
  }
@@ -1269,7 +1265,7 @@ const index = {
1269
1265
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1270
1266
  },
1271
1267
  components: {
1272
- Input: async () => Promise.resolve().then(() => require("./Field-DplOWQLX.js")).then((module2) => ({
1268
+ Input: async () => Promise.resolve().then(() => require("./Field-CJHYTedG.js")).then((module2) => ({
1273
1269
  default: module2.Field
1274
1270
  }))
1275
1271
  },
@@ -1343,6 +1339,8 @@ exports.clonedDefaultHtmlPreset = clonedDefaultHtmlPreset;
1343
1339
  exports.clonedDefaultMarkdownPreset = clonedDefaultMarkdownPreset;
1344
1340
  exports.clonedDefaultTheme = clonedDefaultTheme;
1345
1341
  exports.getPluginConfig = getPluginConfig;
1342
+ exports.getPluginPresets = getPluginPresets;
1343
+ exports.getPluginTheme = getPluginTheme;
1346
1344
  exports.index = index;
1347
1345
  exports.isImageResponsive = isImageResponsive;
1348
1346
  exports.prefixFileUrlWithBackendUrl = prefixFileUrlWithBackendUrl;
@@ -1,12 +1,12 @@
1
1
  import * as yup from "yup";
2
2
  import { css, styled } from "styled-components";
3
- import { Plugin, ButtonView, FileRepository, logWarning, Alignment, Autoformat, AutoImage, BalloonToolbar, BlockQuote, Bold, Code, CodeBlock, Essentials, FontBackgroundColor, FontColor, FontFamily, FontSize, GeneralHtmlSupport, Heading, HorizontalLine, HtmlEmbed, Image, ImageCaption, ImageInsert, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Indent, IndentBlock, Italic, List, ListProperties, Link, LinkImage, MediaEmbed, Paragraph, PageBreak, PasteFromOffice, PictureEditing, RemoveFormat, SourceEditing, SpecialCharacters, SpecialCharactersEssentials, Strikethrough, Style, Subscript, Superscript, ShowBlocks, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableToolbar, TodoList, Underline, WordCount, icons, Markdown, TextTransformation } from "ckeditor5";
3
+ import { Plugin, ButtonView, FileRepository, logWarning, Alignment, Autoformat, AutoImage, BalloonToolbar, BlockQuote, Bold, Code, CodeBlock, Essentials, FontBackgroundColor, FontColor, FontFamily, FontSize, GeneralHtmlSupport, Heading, HorizontalLine, HtmlEmbed, Image, ImageCaption, ImageInsert, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Indent, IndentBlock, Italic, List, ListProperties, Link, LinkImage, MediaEmbed, Paragraph, PageBreak, PasteFromOffice, PictureEditing, RemoveFormat, SourceEditing, SpecialCharacters, SpecialCharactersEssentials, Strikethrough, Style, Subscript, Superscript, ShowBlocks, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableToolbar, TodoList, Underline, WordCount, IconIndent, Markdown, TextTransformation } from "ckeditor5";
4
4
  import * as sanitizeHtml from "sanitize-html";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Flex, lightTheme } from "@strapi/design-system";
7
7
  import cloneDeep from "lodash/cloneDeep";
8
8
  const name = "@_sh/strapi-plugin-ckeditor";
9
- const version = "5.0.2";
9
+ const version = "6.0.1";
10
10
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
11
11
  const keywords = [
12
12
  "strapi",
@@ -73,7 +73,7 @@ const dependencies = {
73
73
  "@ckeditor/ckeditor5-react": "~9.5.0",
74
74
  "@strapi/design-system": "2.0.0-rc.18",
75
75
  "@strapi/icons": "2.0.0-rc.18",
76
- ckeditor5: "~44.3.0",
76
+ ckeditor5: "~45.0.0",
77
77
  lodash: "4.17.21",
78
78
  "sanitize-html": "2.13.0",
79
79
  yup: "0.32.9"
@@ -823,7 +823,7 @@ const editorConfig$1 = {
823
823
  "alignment",
824
824
  {
825
825
  label: "Indentation",
826
- icon: icons.indent,
826
+ icon: IconIndent,
827
827
  items: ["outdent", "indent"]
828
828
  },
829
829
  "bulletedList",
@@ -1169,20 +1169,16 @@ function setPluginConfig(userPluginConfig) {
1169
1169
  if (userTheme) {
1170
1170
  PLUGIN_CONFIG.theme = userTheme;
1171
1171
  }
1172
- deepFreeze(PLUGIN_CONFIG);
1172
+ }
1173
+ function getPluginPresets() {
1174
+ return PLUGIN_CONFIG.presets;
1175
+ }
1176
+ function getPluginTheme() {
1177
+ return PLUGIN_CONFIG.presets;
1173
1178
  }
1174
1179
  function getPluginConfig() {
1175
- if (!Object.isFrozen(PLUGIN_CONFIG)) deepFreeze(PLUGIN_CONFIG);
1176
1180
  return PLUGIN_CONFIG;
1177
1181
  }
1178
- function deepFreeze(obj) {
1179
- Object.keys(obj).forEach((p) => {
1180
- if (typeof obj[p] === "object" && obj[p] !== null && !Object.isFrozen(obj[p])) {
1181
- deepFreeze(obj[p]);
1182
- }
1183
- });
1184
- return Object.freeze(obj);
1185
- }
1186
1182
  function CKEditorIcon() {
1187
1183
  return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(SvgIcon, {}) });
1188
1184
  }
@@ -1247,7 +1243,7 @@ const index = {
1247
1243
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1248
1244
  },
1249
1245
  components: {
1250
- Input: async () => import("./Field-D_JHCz5O.mjs").then((module) => ({
1246
+ Input: async () => import("./Field-Dh4Ympog.mjs").then((module) => ({
1251
1247
  default: module.Field
1252
1248
  }))
1253
1249
  },
@@ -1321,8 +1317,10 @@ export {
1321
1317
  clonedDefaultHtmlPreset as b,
1322
1318
  clonedDefaultTheme as c,
1323
1319
  clonedDefaultMarkdownPreset as d,
1324
- StrapiUploadAdapter as e,
1320
+ getPluginPresets as e,
1321
+ getPluginTheme as f,
1325
1322
  getPluginConfig as g,
1323
+ StrapiUploadAdapter as h,
1326
1324
  isImageResponsive as i,
1327
1325
  prefixFileUrlWithBackendUrl as p,
1328
1326
  setPluginConfig as s
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  require("yup");
4
- const index = require("../_chunks/index-CsSYDZ4y.js");
4
+ const index = require("../_chunks/index-DUYTlr_2.js");
5
5
  require("ckeditor5");
6
+ require("sanitize-html");
6
7
  exports.StrapiMediaLib = index.StrapiMediaLib;
7
8
  exports.StrapiUploadAdapter = index.StrapiUploadAdapter;
8
9
  exports.default = index.index;
9
10
  exports.defaultHtmlPreset = index.clonedDefaultHtmlPreset;
10
11
  exports.defaultMarkdownPreset = index.clonedDefaultMarkdownPreset;
11
12
  exports.defaultTheme = index.clonedDefaultTheme;
13
+ exports.getPluginPresets = index.getPluginPresets;
14
+ exports.getPluginTheme = index.getPluginTheme;
12
15
  exports.setPluginConfig = index.setPluginConfig;
@@ -1,12 +1,15 @@
1
1
  import "yup";
2
- import { S, e, a, b, d, c, s } from "../_chunks/index-D3a4OadF.mjs";
2
+ import { S, h, a, b, d, c, e, f, s } from "../_chunks/index-Q6to6uwX.mjs";
3
3
  import "ckeditor5";
4
+ import "sanitize-html";
4
5
  export {
5
6
  S as StrapiMediaLib,
6
- e as StrapiUploadAdapter,
7
+ h as StrapiUploadAdapter,
7
8
  a as default,
8
9
  b as defaultHtmlPreset,
9
10
  d as defaultMarkdownPreset,
10
11
  c as defaultTheme,
12
+ e as getPluginPresets,
13
+ f as getPluginTheme,
11
14
  s as setPluginConfig
12
15
  };
@@ -1,22 +1,36 @@
1
- import type { PluginConfig, UserPluginConfig } from './types';
1
+ import type { PluginConfig, UserPluginConfig, Preset, Theme } from './types';
2
2
  /**
3
3
  * Sets a configuration for the plugin.
4
4
  *
5
5
  * @remarks
6
6
  *
7
- * - The function must be invoked before the admin panel's bootstrap lifecycle function.
8
- * The general recommendation is to call it inside the admin panel's register lifecycle function.
7
+ * - Function must be invoked before the admin panel's bootstrap lifecycle function.
8
+ * The recommended way is to invoke it within the admin panel's register lifecycle function.
9
9
  *
10
10
  * - Provided properties will overwrite the default configuration values.
11
11
  *
12
- * - The configuration becomes immutable after the first invocation, preventing further
13
- * modifications.
14
- *
15
- * @param userConfig - The plugin configuration object.
12
+ * @param userConfig - Plugin configuration object.
16
13
  */
17
14
  export declare function setPluginConfig(userPluginConfig: UserPluginConfig): void;
18
15
  /**
19
- * Retrieves the current plugin configuration, ensuring it is immutable.
16
+ * Returns the presets object.
17
+ *
18
+ * @remarks
19
+ *
20
+ * - Each property name must match the corresponding preset's name.
21
+ *
22
+ * - To extend or modify the options visible in the admin panel's content manager,
23
+ * changes must be made before the admin panel's bootstrap lifecycle function.
24
+ *
25
+ */
26
+ export declare function getPluginPresets(): Record<string, Preset>;
27
+ /**
28
+ * Returns the theme object.
29
+ *
30
+ */
31
+ export declare function getPluginTheme(): Theme;
32
+ /**
33
+ * Retrieves current plugin configuration.
20
34
  *
21
35
  * @internal
22
36
  */
@@ -120,4 +120,5 @@ export type Preset = {
120
120
  *
121
121
  * @see {@link https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html | CKEditor documentation}
122
122
  */
123
- export type EditorConfig = CKE5EditorConfig;
123
+ export interface EditorConfig extends CKE5EditorConfig {
124
+ }
@@ -5,5 +5,5 @@ export { clonedDefaultTheme as defaultTheme };
5
5
  export { clonedDefaultHtmlPreset as defaultHtmlPreset };
6
6
  export { clonedDefaultMarkdownPreset as defaultMarkdownPreset };
7
7
  export type { UserPluginConfig as PluginConfig, EditorConfig, Preset, Theme, EditorStyles, } from './config/types';
8
- export { setPluginConfig } from './config';
8
+ export { setPluginConfig, getPluginPresets, getPluginTheme } from './config';
9
9
  export { StrapiMediaLib, StrapiUploadAdapter } from './plugins';
@@ -1,3 +1,4 @@
1
+ export declare function getCookieValue(name: string): string | null;
1
2
  export declare function getStoredToken(): string | null;
2
3
  export declare function getPreferedLanguage(): string | 'en';
3
4
  export declare function getProfileTheme(): 'light' | 'dark' | 'system' | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const name = "@_sh/strapi-plugin-ckeditor";
3
- const version = "5.0.2";
3
+ const version = "6.0.1";
4
4
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
5
5
  const keywords = [
6
6
  "strapi",
@@ -67,7 +67,7 @@ const dependencies = {
67
67
  "@ckeditor/ckeditor5-react": "~9.5.0",
68
68
  "@strapi/design-system": "2.0.0-rc.18",
69
69
  "@strapi/icons": "2.0.0-rc.18",
70
- ckeditor5: "~44.3.0",
70
+ ckeditor5: "~45.0.0",
71
71
  lodash: "4.17.21",
72
72
  "sanitize-html": "2.13.0",
73
73
  yup: "0.32.9"
@@ -1,5 +1,5 @@
1
1
  const name = "@_sh/strapi-plugin-ckeditor";
2
- const version = "5.0.2";
2
+ const version = "6.0.1";
3
3
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
4
4
  const keywords = [
5
5
  "strapi",
@@ -66,7 +66,7 @@ const dependencies = {
66
66
  "@ckeditor/ckeditor5-react": "~9.5.0",
67
67
  "@strapi/design-system": "2.0.0-rc.18",
68
68
  "@strapi/icons": "2.0.0-rc.18",
69
- ckeditor5: "~44.3.0",
69
+ ckeditor5: "~45.0.0",
70
70
  lodash: "4.17.21",
71
71
  "sanitize-html": "2.13.0",
72
72
  yup: "0.32.9"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_sh/strapi-plugin-ckeditor",
3
- "version": "5.0.2",
3
+ "version": "6.0.1",
4
4
  "description": "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)",
5
5
  "keywords": [
6
6
  "strapi",
@@ -67,7 +67,7 @@
67
67
  "@ckeditor/ckeditor5-react": "~9.5.0",
68
68
  "@strapi/design-system": "2.0.0-rc.18",
69
69
  "@strapi/icons": "2.0.0-rc.18",
70
- "ckeditor5": "~44.3.0",
70
+ "ckeditor5": "~45.0.0",
71
71
  "lodash": "4.17.21",
72
72
  "sanitize-html": "2.13.0",
73
73
  "yup": "0.32.9"