@_sh/strapi-plugin-ckeditor 3.0.4 → 3.0.5

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.
@@ -20,6 +20,7 @@ export const Editor = ({
20
20
  disabled = false,
21
21
  presetName,
22
22
  maxLength,
23
+ placeholder
23
24
  }) => {
24
25
  const [editorInstance, setEditorInstance] = useState(false);
25
26
 
@@ -42,7 +43,20 @@ export const Editor = ({
42
43
  presetName,
43
44
  handleToggleMediaLib
44
45
  );
45
- setPreset(currentPreset);
46
+
47
+ if (placeholder) {
48
+ const clonedPreset = {
49
+ ...currentPreset,
50
+ editorConfig: {
51
+ ...currentPreset.editorConfig,
52
+ placeholder: placeholder.defaultMessage,
53
+ },
54
+ };
55
+
56
+ setPreset(clonedPreset);
57
+ } else {
58
+ setPreset(currentPreset);
59
+ }
46
60
  })();
47
61
  }, []);
48
62
 
@@ -17,29 +17,26 @@ const detecti18n = () => {
17
17
 
18
18
  export const setLanguage = async (config) => {
19
19
  const i18nLang = detecti18n();
20
+
20
21
  const preferedLanguage = auth.getUserInfo().preferedLanguage || 'en';
21
22
 
22
23
  const {
23
- ui = preferedLanguage,
24
- content,
24
+ ui = config.language && typeof config.language === 'string' ?
25
+ config.language
26
+ : preferedLanguage,
25
27
  textPartLanguage,
26
28
  ignorei18n,
27
29
  } = config.language || {};
28
30
 
29
- if (i18nLang) {
31
+ if (i18nLang && !ignorei18n) {
30
32
  config.language = {
31
- ui: typeof config.language === 'string' ? config.language : ui,
32
- content: ignorei18n ? content : i18nLang,
33
+ ui: ui,
34
+ content: i18nLang,
33
35
  textPartLanguage: textPartLanguage,
34
36
  };
35
37
  }
36
38
 
37
- if (!config.language) {
38
- config.language = preferedLanguage;
39
+ if (ui !== 'en') {
40
+ await importLang(config, ui);
39
41
  }
40
-
41
- await importLang(
42
- config,
43
- typeof config.language === 'string' ? config.language : ui
44
- );
45
42
  };
@@ -14,7 +14,7 @@ const getSystemColorScheme = () =>
14
14
  ? 'dark'
15
15
  : 'light';
16
16
 
17
- export const GlobalStyling = () => {
17
+ const GlobalStyling = () => {
18
18
  const { theme: userTheme, dontMergeTheme } = globalThis.SH_CKE_CONFIG || {};
19
19
 
20
20
  const profileTheme = localStorage.getItem('STRAPI_THEME');
@@ -28,3 +28,7 @@ export const GlobalStyling = () => {
28
28
 
29
29
  return <GlobalStyle theme={theme} variant={variant} />;
30
30
  };
31
+
32
+ const MemoizedGlobalStyling = React.memo(GlobalStyling);
33
+
34
+ export { MemoizedGlobalStyling as GlobalStyling };
@@ -11,19 +11,19 @@ import { Stack } from '@strapi/design-system';
11
11
 
12
12
  import { Editor } from './components/Editor';
13
13
 
14
- const Wysiwyg = React.forwardRef((props, ref) => {
15
- const {
16
- name,
17
- attribute,
18
- onChange,
19
- value,
20
- intlLabel,
21
- labelAction,
22
- disabled,
23
- error,
24
- description,
25
- required,
26
- } = props;
14
+ const Wysiwyg = ({
15
+ name,
16
+ attribute,
17
+ onChange,
18
+ value,
19
+ intlLabel,
20
+ labelAction,
21
+ disabled,
22
+ error,
23
+ description,
24
+ required,
25
+ placeholder,
26
+ }) => {
27
27
  const { formatMessage } = useIntl();
28
28
  const { preset, maxLengthCharacters, ...options } = attribute.options;
29
29
 
@@ -44,13 +44,14 @@ const Wysiwyg = React.forwardRef((props, ref) => {
44
44
  value={value}
45
45
  presetName={preset}
46
46
  maxLength={maxLengthCharacters}
47
+ placeholder={placeholder}
47
48
  />
48
49
  <FieldHint />
49
50
  <FieldError />
50
51
  </Stack>
51
52
  </Field>
52
53
  );
53
- });
54
+ };
54
55
 
55
56
  Wysiwyg.propTypes = {
56
57
  intlLabel: PropTypes.object.isRequired,
@@ -63,5 +64,9 @@ Wysiwyg.propTypes = {
63
64
  labelAction: PropTypes.object,
64
65
  required: PropTypes.bool,
65
66
  value: PropTypes.string,
67
+ placeholder: PropTypes.object,
66
68
  };
67
- export default Wysiwyg;
69
+
70
+ const MemoizedWysiwyg = React.memo(Wysiwyg);
71
+
72
+ export default MemoizedWysiwyg;
@@ -227,4 +227,9 @@ export const common = css`
227
227
  }
228
228
  }
229
229
  }
230
+
231
+ .ck.ck-editor__editable > .ck-placeholder::before {
232
+ color: var(--ck-color-editor-base-text);
233
+ opacity: 0.65;
234
+ }
230
235
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_sh/strapi-plugin-ckeditor",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)",
5
5
  "private": false,
6
6
  "keywords": [