@_sh/strapi-plugin-ckeditor 7.1.0 → 7.1.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.
@@ -1,12 +1,12 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { createContext, useContext, useState, useEffect, useMemo, useRef, useCallback, useImperativeHandle } from "react";
3
3
  import { Flex, IconButton, Modal, Field as Field$1, Loader, Box } from "@strapi/design-system";
4
- import { styled, css, createGlobalStyle } from "styled-components";
4
+ import { styled, css, useTheme } 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-Be7yVVtW.mjs";
9
+ import { g as getPluginConfig, p as prefixFileUrlWithBackendUrl, i as isImageResponsive } from "./index-Hsx0G4L9.mjs";
10
10
  import "sanitize-html";
11
11
  import { Collapse, Expand } from "@strapi/icons";
12
12
  const STORAGE_KEYS = {
@@ -549,29 +549,57 @@ const Content = styled(Modal.Content)`
549
549
  width: unset;
550
550
  overflow: visible;
551
551
  `;
552
- const GlobalStyle = createGlobalStyle`
553
- ${({ $editortTheme, $variant }) => $editortTheme && css`
554
- ${$editortTheme.common}
555
- ${$editortTheme[$variant]}
556
- ${$editortTheme.additional}
557
- `}
558
- `;
552
+ let styleElement = null;
559
553
  const getSystemColorScheme = () => window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
560
- function GlobalStyling() {
561
- const { theme } = getPluginConfig();
554
+ function flattenCSS(styles, theme) {
555
+ if (styles == null || styles === false) return "";
556
+ if (typeof styles === "string") {
557
+ return styles;
558
+ }
559
+ if (typeof styles === "number") {
560
+ return String(styles);
561
+ }
562
+ if (typeof styles === "function") {
563
+ return flattenCSS(styles({ theme }), theme);
564
+ }
565
+ if (Array.isArray(styles)) {
566
+ return styles.map((part) => flattenCSS(part, theme)).join("");
567
+ }
568
+ return "";
569
+ }
570
+ function buildCSS(pluginTheme, strapiTheme) {
562
571
  const profileTheme = getProfileTheme();
563
572
  const variant = profileTheme && profileTheme !== "system" ? profileTheme : getSystemColorScheme();
564
- return /* @__PURE__ */ jsx(GlobalStyle, { $editortTheme: theme, $variant: variant });
573
+ return [
574
+ flattenCSS(pluginTheme.common, strapiTheme),
575
+ flattenCSS(pluginTheme[variant], strapiTheme),
576
+ flattenCSS(pluginTheme.additional, strapiTheme)
577
+ ].join("\n");
578
+ }
579
+ function injectStyles(strapiTheme) {
580
+ const { theme } = getPluginConfig();
581
+ const cssText = buildCSS(theme, strapiTheme);
582
+ if (!styleElement) {
583
+ styleElement = document.createElement("style");
584
+ styleElement.id = "ck-editor-global-styles";
585
+ document.head.appendChild(styleElement);
586
+ }
587
+ if (styleElement.textContent !== cssText) {
588
+ styleElement.textContent = cssText;
589
+ }
590
+ }
591
+ function useGlobalStyles() {
592
+ const strapiTheme = useTheme();
593
+ useEffect(() => {
594
+ injectStyles(strapiTheme);
595
+ }, [strapiTheme]);
565
596
  }
566
- const MemoizedGlobalStyling = React.memo(GlobalStyling);
567
597
  const Editor = React.forwardRef((_, forwardedRef) => {
568
598
  const { name, hint, required, labelAction, label, error, preset } = useEditorContext();
599
+ useGlobalStyles();
569
600
  return /* @__PURE__ */ jsx(Field$1.Root, { id: name, name, error, hint, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
570
601
  /* @__PURE__ */ jsx(Field$1.Label, { action: labelAction, children: label }),
571
- preset ? /* @__PURE__ */ jsxs(Fragment, { children: [
572
- /* @__PURE__ */ jsx(MemoizedGlobalStyling, {}),
573
- /* @__PURE__ */ jsx(EditorLayout, { children: /* @__PURE__ */ jsx(CKEReact, { ref: forwardedRef }) })
574
- ] }) : /* @__PURE__ */ jsx(LoaderBox, { hasRadius: true, background: "neutral100", children: /* @__PURE__ */ jsx(Loader, { children: "Loading..." }) }),
602
+ preset ? /* @__PURE__ */ jsx(EditorLayout, { children: /* @__PURE__ */ jsx(CKEReact, { ref: forwardedRef }) }) : /* @__PURE__ */ jsx(LoaderBox, { hasRadius: true, background: "neutral100", children: /* @__PURE__ */ jsx(Loader, { children: "Loading..." }) }),
575
603
  /* @__PURE__ */ jsx(Field$1.Hint, {}),
576
604
  /* @__PURE__ */ jsx(Field$1.Error, {})
577
605
  ] }) });
@@ -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-BmYyqc_l.js");
33
+ const index = require("./index-Db6yDUsF.js");
34
34
  require("sanitize-html");
35
35
  const icons = require("@strapi/icons");
36
36
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -575,29 +575,57 @@ const Content = styledComponents.styled(designSystem.Modal.Content)`
575
575
  width: unset;
576
576
  overflow: visible;
577
577
  `;
578
- const GlobalStyle = styledComponents.createGlobalStyle`
579
- ${({ $editortTheme, $variant }) => $editortTheme && styledComponents.css`
580
- ${$editortTheme.common}
581
- ${$editortTheme[$variant]}
582
- ${$editortTheme.additional}
583
- `}
584
- `;
578
+ let styleElement = null;
585
579
  const getSystemColorScheme = () => window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
586
- function GlobalStyling() {
587
- const { theme } = index.getPluginConfig();
580
+ function flattenCSS(styles, theme) {
581
+ if (styles == null || styles === false) return "";
582
+ if (typeof styles === "string") {
583
+ return styles;
584
+ }
585
+ if (typeof styles === "number") {
586
+ return String(styles);
587
+ }
588
+ if (typeof styles === "function") {
589
+ return flattenCSS(styles({ theme }), theme);
590
+ }
591
+ if (Array.isArray(styles)) {
592
+ return styles.map((part) => flattenCSS(part, theme)).join("");
593
+ }
594
+ return "";
595
+ }
596
+ function buildCSS(pluginTheme, strapiTheme) {
588
597
  const profileTheme = getProfileTheme();
589
598
  const variant = profileTheme && profileTheme !== "system" ? profileTheme : getSystemColorScheme();
590
- return /* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, { $editortTheme: theme, $variant: variant });
599
+ return [
600
+ flattenCSS(pluginTheme.common, strapiTheme),
601
+ flattenCSS(pluginTheme[variant], strapiTheme),
602
+ flattenCSS(pluginTheme.additional, strapiTheme)
603
+ ].join("\n");
604
+ }
605
+ function injectStyles(strapiTheme) {
606
+ const { theme } = index.getPluginConfig();
607
+ const cssText = buildCSS(theme, strapiTheme);
608
+ if (!styleElement) {
609
+ styleElement = document.createElement("style");
610
+ styleElement.id = "ck-editor-global-styles";
611
+ document.head.appendChild(styleElement);
612
+ }
613
+ if (styleElement.textContent !== cssText) {
614
+ styleElement.textContent = cssText;
615
+ }
616
+ }
617
+ function useGlobalStyles() {
618
+ const strapiTheme = styledComponents.useTheme();
619
+ React.useEffect(() => {
620
+ injectStyles(strapiTheme);
621
+ }, [strapiTheme]);
591
622
  }
592
- const MemoizedGlobalStyling = React__default.default.memo(GlobalStyling);
593
623
  const Editor = React__default.default.forwardRef((_, forwardedRef) => {
594
624
  const { name, hint, required, labelAction, label, error, preset } = useEditorContext();
625
+ useGlobalStyles();
595
626
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { id: name, name, error, hint, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
596
627
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
597
- preset ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
598
- /* @__PURE__ */ jsxRuntime.jsx(MemoizedGlobalStyling, {}),
599
- /* @__PURE__ */ jsxRuntime.jsx(EditorLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(CKEReact, { ref: forwardedRef }) })
600
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(LoaderBox, { hasRadius: true, background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) }),
628
+ preset ? /* @__PURE__ */ jsxRuntime.jsx(EditorLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(CKEReact, { ref: forwardedRef }) }) : /* @__PURE__ */ jsxRuntime.jsx(LoaderBox, { hasRadius: true, background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) }),
601
629
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
602
630
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
603
631
  ] }) });
@@ -200,8 +200,8 @@ const reset = styledComponents.css`
200
200
  }
201
201
 
202
202
  .ck-editor__main {
203
- --ck-font-face: 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial,
204
- sans-serif;
203
+ --ck-font-face:
204
+ 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
205
205
 
206
206
  font-family: var(--ck-font-face);
207
207
 
@@ -304,6 +304,15 @@ const plugin = styledComponents.css`
304
304
  border: none !important;
305
305
  }
306
306
 
307
+ [role='dialog'] .ck.ck-sticky-panel .ck-sticky-panel__content_sticky {
308
+ position: static !important;
309
+ width: auto !important;
310
+ }
311
+
312
+ [role='dialog'] .ck.ck-sticky-panel .ck-sticky-panel__placeholder {
313
+ display: none !important;
314
+ }
315
+
307
316
  .ck.ck-editor__main {
308
317
  min-height: var(--ck-editor-min-height) !important;
309
318
  max-height: var(--ck-editor-max-height) !important;
@@ -491,7 +500,7 @@ class StrapiMediaLib extends ckeditor5.Plugin {
491
500
  }
492
501
  }
493
502
  const name = "@_sh/strapi-plugin-ckeditor";
494
- const version = "7.0.0";
503
+ const version = "7.1.1";
495
504
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
496
505
  const keywords = [
497
506
  "strapi",
@@ -558,9 +567,7 @@ const scripts = {
558
567
  };
559
568
  const dependencies = {
560
569
  "@ckeditor/ckeditor5-react": "~11.0.1",
561
- "@strapi/design-system": "2.1.2",
562
- "@strapi/icons": "2.1.2",
563
- ckeditor5: "~47.4.0",
570
+ ckeditor5: "~47.6.1",
564
571
  lodash: "4.17.21",
565
572
  "sanitize-html": "2.13.0",
566
573
  yup: "0.32.9"
@@ -593,6 +600,8 @@ const devDependencies = {
593
600
  "styled-components": "^6.0.0"
594
601
  };
595
602
  const peerDependencies = {
603
+ "@strapi/design-system": "^2.0.0",
604
+ "@strapi/icons": "^2.0.0",
596
605
  "@strapi/strapi": "^5.0.0",
597
606
  react: "^18.0.0",
598
607
  "react-dom": "^18.0.0",
@@ -1178,7 +1187,7 @@ function getPluginPresets() {
1178
1187
  return PLUGIN_CONFIG.presets;
1179
1188
  }
1180
1189
  function getPluginTheme() {
1181
- return PLUGIN_CONFIG.presets;
1190
+ return PLUGIN_CONFIG.theme;
1182
1191
  }
1183
1192
  function getPluginConfig() {
1184
1193
  return PLUGIN_CONFIG;
@@ -1264,7 +1273,7 @@ const index = {
1264
1273
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1265
1274
  },
1266
1275
  components: {
1267
- Input: async () => Promise.resolve().then(() => require("./Field-LK0YigdM.js")).then((module2) => ({
1276
+ Input: async () => Promise.resolve().then(() => require("./Field-DXPrjUnm.js")).then((module2) => ({
1268
1277
  default: module2.Field
1269
1278
  }))
1270
1279
  },
@@ -178,8 +178,8 @@ const reset = css`
178
178
  }
179
179
 
180
180
  .ck-editor__main {
181
- --ck-font-face: 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial,
182
- sans-serif;
181
+ --ck-font-face:
182
+ 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
183
183
 
184
184
  font-family: var(--ck-font-face);
185
185
 
@@ -282,6 +282,15 @@ const plugin = css`
282
282
  border: none !important;
283
283
  }
284
284
 
285
+ [role='dialog'] .ck.ck-sticky-panel .ck-sticky-panel__content_sticky {
286
+ position: static !important;
287
+ width: auto !important;
288
+ }
289
+
290
+ [role='dialog'] .ck.ck-sticky-panel .ck-sticky-panel__placeholder {
291
+ display: none !important;
292
+ }
293
+
285
294
  .ck.ck-editor__main {
286
295
  min-height: var(--ck-editor-min-height) !important;
287
296
  max-height: var(--ck-editor-max-height) !important;
@@ -469,7 +478,7 @@ class StrapiMediaLib extends Plugin {
469
478
  }
470
479
  }
471
480
  const name = "@_sh/strapi-plugin-ckeditor";
472
- const version = "7.0.0";
481
+ const version = "7.1.1";
473
482
  const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
474
483
  const keywords = [
475
484
  "strapi",
@@ -536,9 +545,7 @@ const scripts = {
536
545
  };
537
546
  const dependencies = {
538
547
  "@ckeditor/ckeditor5-react": "~11.0.1",
539
- "@strapi/design-system": "2.1.2",
540
- "@strapi/icons": "2.1.2",
541
- ckeditor5: "~47.4.0",
548
+ ckeditor5: "~47.6.1",
542
549
  lodash: "4.17.21",
543
550
  "sanitize-html": "2.13.0",
544
551
  yup: "0.32.9"
@@ -571,6 +578,8 @@ const devDependencies = {
571
578
  "styled-components": "^6.0.0"
572
579
  };
573
580
  const peerDependencies = {
581
+ "@strapi/design-system": "^2.0.0",
582
+ "@strapi/icons": "^2.0.0",
574
583
  "@strapi/strapi": "^5.0.0",
575
584
  react: "^18.0.0",
576
585
  "react-dom": "^18.0.0",
@@ -1156,7 +1165,7 @@ function getPluginPresets() {
1156
1165
  return PLUGIN_CONFIG.presets;
1157
1166
  }
1158
1167
  function getPluginTheme() {
1159
- return PLUGIN_CONFIG.presets;
1168
+ return PLUGIN_CONFIG.theme;
1160
1169
  }
1161
1170
  function getPluginConfig() {
1162
1171
  return PLUGIN_CONFIG;
@@ -1242,7 +1251,7 @@ const index = {
1242
1251
  defaultMessage: "The advanced rich text editor. (Community Edition)"
1243
1252
  },
1244
1253
  components: {
1245
- Input: async () => import("./Field-C2N3FIDl.mjs").then((module) => ({
1254
+ Input: async () => import("./Field-CmFipUw8.mjs").then((module) => ({
1246
1255
  default: module.Field
1247
1256
  }))
1248
1257
  },
@@ -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-BmYyqc_l.js");
4
+ const index = require("../_chunks/index-Db6yDUsF.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-Be7yVVtW.mjs";
2
+ import { S, h, a, b, d, c, e, f, s } from "../_chunks/index-Hsx0G4L9.mjs";
3
3
  import "ckeditor5";
4
4
  import "sanitize-html";
5
5
  export {
@@ -0,0 +1 @@
1
+ export declare function useGlobalStyles(): void;
@@ -1,3 +1,4 @@
1
+ import './styled';
1
2
  export * from './exports';
2
3
  declare const _default: {
3
4
  bootstrap(): void;
@@ -0,0 +1,5 @@
1
+ import type { StrapiTheme } from '@strapi/design-system';
2
+ declare module 'styled-components' {
3
+ interface DefaultTheme extends StrapiTheme {
4
+ }
5
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const name = "@_sh/strapi-plugin-ckeditor";
3
- const version = "7.0.0";
3
+ const version = "7.1.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,9 +67,7 @@ const scripts = {
67
67
  };
68
68
  const dependencies = {
69
69
  "@ckeditor/ckeditor5-react": "~11.0.1",
70
- "@strapi/design-system": "2.1.2",
71
- "@strapi/icons": "2.1.2",
72
- ckeditor5: "~47.4.0",
70
+ ckeditor5: "~47.6.1",
73
71
  lodash: "4.17.21",
74
72
  "sanitize-html": "2.13.0",
75
73
  yup: "0.32.9"
@@ -102,6 +100,8 @@ const devDependencies = {
102
100
  "styled-components": "^6.0.0"
103
101
  };
104
102
  const peerDependencies = {
103
+ "@strapi/design-system": "^2.0.0",
104
+ "@strapi/icons": "^2.0.0",
105
105
  "@strapi/strapi": "^5.0.0",
106
106
  react: "^18.0.0",
107
107
  "react-dom": "^18.0.0",
@@ -1,5 +1,5 @@
1
1
  const name = "@_sh/strapi-plugin-ckeditor";
2
- const version = "7.0.0";
2
+ const version = "7.1.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,9 +66,7 @@ const scripts = {
66
66
  };
67
67
  const dependencies = {
68
68
  "@ckeditor/ckeditor5-react": "~11.0.1",
69
- "@strapi/design-system": "2.1.2",
70
- "@strapi/icons": "2.1.2",
71
- ckeditor5: "~47.4.0",
69
+ ckeditor5: "~47.6.1",
72
70
  lodash: "4.17.21",
73
71
  "sanitize-html": "2.13.0",
74
72
  yup: "0.32.9"
@@ -101,6 +99,8 @@ const devDependencies = {
101
99
  "styled-components": "^6.0.0"
102
100
  };
103
101
  const peerDependencies = {
102
+ "@strapi/design-system": "^2.0.0",
103
+ "@strapi/icons": "^2.0.0",
104
104
  "@strapi/strapi": "^5.0.0",
105
105
  react: "^18.0.0",
106
106
  "react-dom": "^18.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_sh/strapi-plugin-ckeditor",
3
- "version": "7.1.0",
3
+ "version": "7.1.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,9 +67,7 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@ckeditor/ckeditor5-react": "~11.0.1",
70
- "@strapi/design-system": "2.1.2",
71
- "@strapi/icons": "2.1.2",
72
- "ckeditor5": "~47.4.0",
70
+ "ckeditor5": "~47.6.1",
73
71
  "lodash": "4.17.21",
74
72
  "sanitize-html": "2.13.0",
75
73
  "yup": "0.32.9"
@@ -102,6 +100,8 @@
102
100
  "styled-components": "^6.0.0"
103
101
  },
104
102
  "peerDependencies": {
103
+ "@strapi/design-system": "^2.0.0",
104
+ "@strapi/icons": "^2.0.0",
105
105
  "@strapi/strapi": "^5.0.0",
106
106
  "react": "^18.0.0",
107
107
  "react-dom": "^18.0.0",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- declare function GlobalStyling(): import("react/jsx-runtime").JSX.Element;
3
- declare const MemoizedGlobalStyling: React.MemoExoticComponent<typeof GlobalStyling>;
4
- export { MemoizedGlobalStyling as GlobalStyling };