@_sh/strapi-plugin-ckeditor 6.0.0 → 6.0.2

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,12 +1,12 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback } from "react";
2
+ import React, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback, useReducer } from "react";
3
3
  import { Flex, IconButton, Box, Portal, FocusTrap, 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-re_mQliQ.mjs";
9
+ import { g as getPluginConfig, p as prefixFileUrlWithBackendUrl, i as isImageResponsive } from "./index-CM-eZqTL.mjs";
10
10
  import "sanitize-html";
11
11
  import { Collapse, Expand } from "@strapi/icons";
12
12
  const STORAGE_KEYS = {
@@ -14,12 +14,24 @@ const STORAGE_KEYS = {
14
14
  PREFERED_LANGUAGE: "strapi-admin-language",
15
15
  PROFILE_THEME: "STRAPI_THEME"
16
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
+ }
17
28
  function getStoredToken() {
18
- const token = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
19
- if (typeof token === "string") {
20
- 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);
21
32
  }
22
- return null;
33
+ const tokenFromCookie = getCookieValue(STORAGE_KEYS.TOKEN);
34
+ return tokenFromCookie;
23
35
  }
24
36
  function getPreferedLanguage() {
25
37
  const language = localStorage.getItem(STORAGE_KEYS.PREFERED_LANGUAGE)?.replace(/^"|"$/g, "") || "en";
@@ -396,9 +408,7 @@ const WordCounter = styled(Flex)`
396
408
  `;
397
409
  function EditorLayout({ children }) {
398
410
  const { error, preset } = useEditorContext();
399
- const [isExpandedMode, setIsExpandedMode] = useState(false);
400
- const handleToggleExpand = () => setIsExpandedMode(true);
401
- const handleOnCollapse = () => setIsExpandedMode(false);
411
+ const [isExpandedMode, handleToggleExpand] = useReducer((prev) => !prev, false);
402
412
  useEffect(() => {
403
413
  if (isExpandedMode) {
404
414
  document.body.classList.add("lock-body-scroll");
@@ -408,7 +418,7 @@ function EditorLayout({ children }) {
408
418
  };
409
419
  }, [isExpandedMode]);
410
420
  if (isExpandedMode) {
411
- return /* @__PURE__ */ jsx(Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsx(FocusTrap, { onEscape: handleOnCollapse, children: /* @__PURE__ */ jsx(
421
+ return /* @__PURE__ */ jsx(Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsx(FocusTrap, { onEscape: handleToggleExpand, children: /* @__PURE__ */ jsx(
412
422
  Backdrop,
413
423
  {
414
424
  position: "fixed",
@@ -418,7 +428,7 @@ function EditorLayout({ children }) {
418
428
  bottom: 0,
419
429
  zIndex: 4,
420
430
  justifyContent: "center",
421
- onClick: handleOnCollapse,
431
+ onClick: handleToggleExpand,
422
432
  children: /* @__PURE__ */ jsx(
423
433
  FullScreenBox,
424
434
  {
@@ -439,7 +449,7 @@ function EditorLayout({ children }) {
439
449
  className: "ck-editor__expanded",
440
450
  children: [
441
451
  children,
442
- /* @__PURE__ */ jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsx(Collapse, {}) })
452
+ /* @__PURE__ */ jsx(CollapseButton, { label: "Collapse", onClick: handleToggleExpand, children: /* @__PURE__ */ jsx(Collapse, {}) })
443
453
  ]
444
454
  }
445
455
  ) })
@@ -484,24 +494,26 @@ const EditorWrapper = styled("div")`
484
494
  ${$presetStyles}
485
495
  `}
486
496
  `;
487
- const Backdrop = styled(Flex)`
488
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
489
- `;
490
497
  const ExpandButton = styled(IconButton)`
491
498
  position: absolute;
492
499
  bottom: 1.4rem;
493
500
  right: 1.2rem;
494
501
  z-index: 2;
502
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
495
503
  `;
496
504
  const CollapseButton = styled(IconButton)`
497
505
  position: absolute;
498
506
  bottom: 2.5rem;
499
507
  right: 1.2rem;
500
508
  z-index: 2;
509
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
501
510
  `;
502
511
  const FullScreenBox = styled(Box)`
503
512
  max-width: var(--ck-editor-full-screen-box-max-width);
504
513
  `;
514
+ const Backdrop = styled(Flex)`
515
+ background: ${({ theme }) => `${theme.colors.neutral800}1F`};
516
+ `;
505
517
  const GlobalStyle = createGlobalStyle`
506
518
  ${({ $editortTheme, $variant }) => $editortTheme && css`
507
519
  ${$editortTheme.common}
@@ -30,7 +30,7 @@ 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-lgM3BQrm.js");
33
+ const index = require("./index-CgWKes-C.js");
34
34
  require("sanitize-html");
35
35
  const icons = require("@strapi/icons");
36
36
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -40,12 +40,24 @@ const STORAGE_KEYS = {
40
40
  PREFERED_LANGUAGE: "strapi-admin-language",
41
41
  PROFILE_THEME: "STRAPI_THEME"
42
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
+ }
43
54
  function getStoredToken() {
44
- const token = localStorage.getItem(STORAGE_KEYS.TOKEN) ?? sessionStorage.getItem(STORAGE_KEYS.TOKEN);
45
- if (typeof token === "string") {
46
- 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);
47
58
  }
48
- return null;
59
+ const tokenFromCookie = getCookieValue(STORAGE_KEYS.TOKEN);
60
+ return tokenFromCookie;
49
61
  }
50
62
  function getPreferedLanguage() {
51
63
  const language = localStorage.getItem(STORAGE_KEYS.PREFERED_LANGUAGE)?.replace(/^"|"$/g, "") || "en";
@@ -422,9 +434,7 @@ const WordCounter = styledComponents.styled(designSystem.Flex)`
422
434
  `;
423
435
  function EditorLayout({ children }) {
424
436
  const { error, preset } = useEditorContext();
425
- const [isExpandedMode, setIsExpandedMode] = React.useState(false);
426
- const handleToggleExpand = () => setIsExpandedMode(true);
427
- const handleOnCollapse = () => setIsExpandedMode(false);
437
+ const [isExpandedMode, handleToggleExpand] = React.useReducer((prev) => !prev, false);
428
438
  React.useEffect(() => {
429
439
  if (isExpandedMode) {
430
440
  document.body.classList.add("lock-body-scroll");
@@ -434,7 +444,7 @@ function EditorLayout({ children }) {
434
444
  };
435
445
  }, [isExpandedMode]);
436
446
  if (isExpandedMode) {
437
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.FocusTrap, { onEscape: handleOnCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(
447
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Portal, { role: "dialog", "aria-modal": false, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.FocusTrap, { onEscape: handleToggleExpand, children: /* @__PURE__ */ jsxRuntime.jsx(
438
448
  Backdrop,
439
449
  {
440
450
  position: "fixed",
@@ -444,7 +454,7 @@ function EditorLayout({ children }) {
444
454
  bottom: 0,
445
455
  zIndex: 4,
446
456
  justifyContent: "center",
447
- onClick: handleOnCollapse,
457
+ onClick: handleToggleExpand,
448
458
  children: /* @__PURE__ */ jsxRuntime.jsx(
449
459
  FullScreenBox,
450
460
  {
@@ -465,7 +475,7 @@ function EditorLayout({ children }) {
465
475
  className: "ck-editor__expanded",
466
476
  children: [
467
477
  children,
468
- /* @__PURE__ */ jsxRuntime.jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Collapse, {}) })
478
+ /* @__PURE__ */ jsxRuntime.jsx(CollapseButton, { label: "Collapse", onClick: handleToggleExpand, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Collapse, {}) })
469
479
  ]
470
480
  }
471
481
  ) })
@@ -510,24 +520,26 @@ const EditorWrapper = styledComponents.styled("div")`
510
520
  ${$presetStyles}
511
521
  `}
512
522
  `;
513
- const Backdrop = styledComponents.styled(designSystem.Flex)`
514
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
515
- `;
516
523
  const ExpandButton = styledComponents.styled(designSystem.IconButton)`
517
524
  position: absolute;
518
525
  bottom: 1.4rem;
519
526
  right: 1.2rem;
520
527
  z-index: 2;
528
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
521
529
  `;
522
530
  const CollapseButton = styledComponents.styled(designSystem.IconButton)`
523
531
  position: absolute;
524
532
  bottom: 2.5rem;
525
533
  right: 1.2rem;
526
534
  z-index: 2;
535
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
527
536
  `;
528
537
  const FullScreenBox = styledComponents.styled(designSystem.Box)`
529
538
  max-width: var(--ck-editor-full-screen-box-max-width);
530
539
  `;
540
+ const Backdrop = styledComponents.styled(designSystem.Flex)`
541
+ background: ${({ theme }) => `${theme.colors.neutral800}1F`};
542
+ `;
531
543
  const GlobalStyle = styledComponents.createGlobalStyle`
532
544
  ${({ $editortTheme, $variant }) => $editortTheme && styledComponents.css`
533
545
  ${$editortTheme.common}
@@ -6,7 +6,7 @@ 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 = "6.0.0";
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: "~45.0.0",
76
+ ckeditor5: "~45.2.0",
77
77
  lodash: "4.17.21",
78
78
  "sanitize-html": "2.13.0",
79
79
  yup: "0.32.9"
@@ -1243,7 +1243,7 @@ const index = {
1243
1243
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1244
1244
  },
1245
1245
  components: {
1246
- Input: async () => import("./Field-g8gLpd2N.mjs").then((module) => ({
1246
+ Input: async () => import("./Field-DwEixuI8.mjs").then((module) => ({
1247
1247
  default: module.Field
1248
1248
  }))
1249
1249
  },
@@ -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 = "6.0.0";
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: "~45.0.0",
98
+ ckeditor5: "~45.2.0",
99
99
  lodash: "4.17.21",
100
100
  "sanitize-html": "2.13.0",
101
101
  yup: "0.32.9"
@@ -1265,7 +1265,7 @@ const index = {
1265
1265
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1266
1266
  },
1267
1267
  components: {
1268
- Input: async () => Promise.resolve().then(() => require("./Field-kyiYSdM-.js")).then((module2) => ({
1268
+ Input: async () => Promise.resolve().then(() => require("./Field-bpNZPEcR.js")).then((module2) => ({
1269
1269
  default: module2.Field
1270
1270
  }))
1271
1271
  },
@@ -1,7 +1,7 @@
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-lgM3BQrm.js");
4
+ const index = require("../_chunks/index-CgWKes-C.js");
5
5
  require("ckeditor5");
6
6
  require("sanitize-html");
7
7
  exports.StrapiMediaLib = index.StrapiMediaLib;
@@ -1,5 +1,5 @@
1
1
  import "yup";
2
- import { S, h, a, b, d, c, e, f, s } from "../_chunks/index-re_mQliQ.mjs";
2
+ import { S, h, a, b, d, c, e, f, s } from "../_chunks/index-CM-eZqTL.mjs";
3
3
  import "ckeditor5";
4
4
  import "sanitize-html";
5
5
  export {
@@ -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 = "6.0.0";
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: "~45.0.0",
70
+ ckeditor5: "~45.2.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 = "6.0.0";
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: "~45.0.0",
69
+ ckeditor5: "~45.2.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": "6.0.0",
3
+ "version": "6.0.2",
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": "~45.0.0",
70
+ "ckeditor5": "~45.2.0",
71
71
  "lodash": "4.17.21",
72
72
  "sanitize-html": "2.13.0",
73
73
  "yup": "0.32.9"