@_sh/strapi-plugin-ckeditor 6.0.0 → 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.
@@ -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-DUYTlr_2.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,45 +444,19 @@ 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(
438
- 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,
439
449
  {
440
- position: "fixed",
441
- top: 0,
442
- left: 0,
443
- right: 0,
444
- bottom: 0,
445
- zIndex: 4,
446
- justifyContent: "center",
447
- onClick: handleOnCollapse,
448
- children: /* @__PURE__ */ jsxRuntime.jsx(
449
- FullScreenBox,
450
- {
451
- background: "neutral100",
452
- hasRadius: true,
453
- shadow: "popupShadow",
454
- overflow: "hidden",
455
- width: "90%",
456
- height: "90%",
457
- onClick: (e) => e.stopPropagation(),
458
- position: "relative",
459
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { height: "100%", alignItems: "flex-start", direction: "column", children: /* @__PURE__ */ jsxRuntime.jsxs(
460
- EditorWrapper,
461
- {
462
- $presetStyles: preset?.styles,
463
- $isExpanded: isExpandedMode,
464
- $hasError: Boolean(error),
465
- className: "ck-editor__expanded",
466
- children: [
467
- children,
468
- /* @__PURE__ */ jsxRuntime.jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Collapse, {}) })
469
- ]
470
- }
471
- ) })
472
- }
473
- )
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
+ ]
474
458
  }
475
- ) }) });
459
+ ) }) }) });
476
460
  }
477
461
  return /* @__PURE__ */ jsxRuntime.jsxs(
478
462
  EditorWrapper,
@@ -510,22 +494,21 @@ const EditorWrapper = styledComponents.styled("div")`
510
494
  ${$presetStyles}
511
495
  `}
512
496
  `;
513
- const Backdrop = styledComponents.styled(designSystem.Flex)`
514
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
515
- `;
516
497
  const ExpandButton = styledComponents.styled(designSystem.IconButton)`
517
498
  position: absolute;
518
499
  bottom: 1.4rem;
519
500
  right: 1.2rem;
520
501
  z-index: 2;
502
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
521
503
  `;
522
504
  const CollapseButton = styledComponents.styled(designSystem.IconButton)`
523
505
  position: absolute;
524
506
  bottom: 2.5rem;
525
507
  right: 1.2rem;
526
508
  z-index: 2;
509
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
527
510
  `;
528
- const FullScreenBox = styledComponents.styled(designSystem.Box)`
511
+ const FullScreenBox = styledComponents.styled(designSystem.Flex)`
529
512
  max-width: var(--ck-editor-full-screen-box-max-width);
530
513
  `;
531
514
  const GlobalStyle = styledComponents.createGlobalStyle`
@@ -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";
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-re_mQliQ.mjs";
9
+ import { g as getPluginConfig, p as prefixFileUrlWithBackendUrl, i as isImageResponsive } from "./index-Q6to6uwX.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,45 +418,19 @@ 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(
412
- 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,
413
423
  {
414
- position: "fixed",
415
- top: 0,
416
- left: 0,
417
- right: 0,
418
- bottom: 0,
419
- zIndex: 4,
420
- justifyContent: "center",
421
- onClick: handleOnCollapse,
422
- children: /* @__PURE__ */ jsx(
423
- FullScreenBox,
424
- {
425
- background: "neutral100",
426
- hasRadius: true,
427
- shadow: "popupShadow",
428
- overflow: "hidden",
429
- width: "90%",
430
- height: "90%",
431
- onClick: (e) => e.stopPropagation(),
432
- position: "relative",
433
- children: /* @__PURE__ */ jsx(Flex, { height: "100%", alignItems: "flex-start", direction: "column", children: /* @__PURE__ */ jsxs(
434
- EditorWrapper,
435
- {
436
- $presetStyles: preset?.styles,
437
- $isExpanded: isExpandedMode,
438
- $hasError: Boolean(error),
439
- className: "ck-editor__expanded",
440
- children: [
441
- children,
442
- /* @__PURE__ */ jsx(CollapseButton, { label: "Collapse", onClick: handleOnCollapse, children: /* @__PURE__ */ jsx(Collapse, {}) })
443
- ]
444
- }
445
- ) })
446
- }
447
- )
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
+ ]
448
432
  }
449
- ) }) });
433
+ ) }) }) });
450
434
  }
451
435
  return /* @__PURE__ */ jsxs(
452
436
  EditorWrapper,
@@ -484,22 +468,21 @@ const EditorWrapper = styled("div")`
484
468
  ${$presetStyles}
485
469
  `}
486
470
  `;
487
- const Backdrop = styled(Flex)`
488
- background: ${({ theme }) => `${theme.colors.neutral800}1F`};
489
- `;
490
471
  const ExpandButton = styled(IconButton)`
491
472
  position: absolute;
492
473
  bottom: 1.4rem;
493
474
  right: 1.2rem;
494
475
  z-index: 2;
476
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
495
477
  `;
496
478
  const CollapseButton = styled(IconButton)`
497
479
  position: absolute;
498
480
  bottom: 2.5rem;
499
481
  right: 1.2rem;
500
482
  z-index: 2;
483
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
501
484
  `;
502
- const FullScreenBox = styled(Box)`
485
+ const FullScreenBox = styled(Flex)`
503
486
  max-width: var(--ck-editor-full-screen-box-max-width);
504
487
  `;
505
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 = "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",
@@ -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-CJHYTedG.js")).then((module2) => ({
1269
1269
  default: module2.Field
1270
1270
  }))
1271
1271
  },
@@ -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",
@@ -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-Dh4Ympog.mjs").then((module) => ({
1247
1247
  default: module.Field
1248
1248
  }))
1249
1249
  },
@@ -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-DUYTlr_2.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-Q6to6uwX.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",
@@ -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",
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.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",