@bbl-digital/snorre 3.0.40 → 3.0.42

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/dist/bundle.js CHANGED
@@ -32137,7 +32137,6 @@
32137
32137
  onChange,
32138
32138
  onBlur
32139
32139
  }) => {
32140
- const editorRef = React.useRef(null);
32141
32140
  const [loaded, setLoaded] = React.useState(false);
32142
32141
  const [value, setValue] = React.useState(initialValue || '');
32143
32142
  const {
@@ -32156,18 +32155,8 @@
32156
32155
 
32157
32156
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
32158
32157
  React.useEffect(() => {
32159
- const editor = editorRef?.current;
32160
- if (!editor) return;
32161
-
32162
- if (overrideValue === null) {
32163
- setValue(() => '');
32164
- editor.setContent('');
32165
- return;
32166
- }
32167
-
32168
- if (!overrideValue?.length) return;
32169
- setValue(() => overrideValue);
32170
- editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
32158
+ if (overrideValue === undefined) return;
32159
+ setValue(() => overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
32171
32160
  }, [overrideValue]);
32172
32161
  return jsxRuntime$1.jsxs("div", {
32173
32162
  css: theme => [styles$3.default(theme), !loaded && styles$3.hideEditor],
@@ -32177,10 +32166,7 @@
32177
32166
  className: "editor-wrapper",
32178
32167
  children: jsxRuntime$1.jsx(tinymceReact.Editor, {
32179
32168
  onBlur: handleBlur,
32180
- onInit: (_e, editor) => {
32181
- setLoaded(true);
32182
- editorRef.current = editor;
32183
- },
32169
+ onInit: _e => setLoaded(true),
32184
32170
  apiKey: TINYMCE_API_KEY,
32185
32171
  value: value,
32186
32172
  onEditorChange: handleChange,
@@ -9,7 +9,6 @@ import IconErrorOutline from '../../icons/General/IconErrorOutline';
9
9
  import { useTheme } from '@emotion/react';
10
10
  import { useIsMobile } from '../../hooks/useIsMobile';
11
11
  import { useEffect } from 'react';
12
- import { useRef } from 'react';
13
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
14
13
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
15
14
  const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s';
@@ -33,7 +32,6 @@ const Editor = ({
33
32
  onChange,
34
33
  onBlur
35
34
  }) => {
36
- const editorRef = useRef(null);
37
35
  const [loaded, setLoaded] = useState(false);
38
36
  const [value, setValue] = useState(initialValue || '');
39
37
  const {
@@ -52,18 +50,8 @@ const Editor = ({
52
50
 
53
51
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
54
52
  useEffect(() => {
55
- const editor = editorRef?.current;
56
- if (!editor) return;
57
-
58
- if (overrideValue === null) {
59
- setValue(() => '');
60
- editor.setContent('');
61
- return;
62
- }
63
-
64
- if (!overrideValue?.length) return;
65
- setValue(() => overrideValue);
66
- editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
53
+ if (overrideValue === undefined) return;
54
+ setValue(() => overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
67
55
  }, [overrideValue]);
68
56
  return _jsxs("div", {
69
57
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -73,10 +61,7 @@ const Editor = ({
73
61
  className: "editor-wrapper",
74
62
  children: _jsx(TinyEditor, {
75
63
  onBlur: handleBlur,
76
- onInit: (_e, editor) => {
77
- setLoaded(true);
78
- editorRef.current = editor;
79
- },
64
+ onInit: _e => setLoaded(true),
80
65
  apiKey: TINYMCE_API_KEY,
81
66
  value: value,
82
67
  onEditorChange: handleChange,
@@ -4,7 +4,7 @@ interface IProps {
4
4
  /** Input text */
5
5
  initialValue?: string;
6
6
  /** Input text that overrides the initialValue or already existing text value, if null is sent in we reset the field */
7
- overrideValue?: string | null;
7
+ overrideValue?: string;
8
8
  /** Editor type, defaults to basic */
9
9
  type?: 'basic' | 'rich' | 'custom';
10
10
  /** Adds a custom toolbar if type is set to cust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+GtB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -9,7 +9,6 @@ import IconErrorOutline from '../../icons/General/IconErrorOutline';
9
9
  import { useTheme } from '@emotion/react';
10
10
  import { useIsMobile } from '../../hooks/useIsMobile';
11
11
  import { useEffect } from 'react';
12
- import { useRef } from 'react';
13
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
14
13
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
15
14
  const TINYMCE_API_KEY = 'v1hbb9qthd0z2fr0keceoglnwbzhyjqwsj4q7n193ovikt8s';
@@ -33,7 +32,6 @@ const Editor = ({
33
32
  onChange,
34
33
  onBlur
35
34
  }) => {
36
- const editorRef = useRef(null);
37
35
  const [loaded, setLoaded] = useState(false);
38
36
  const [value, setValue] = useState(initialValue || '');
39
37
  const {
@@ -52,18 +50,8 @@ const Editor = ({
52
50
 
53
51
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
54
52
  useEffect(() => {
55
- const editor = editorRef?.current;
56
- if (!editor) return;
57
-
58
- if (overrideValue === null) {
59
- setValue(() => '');
60
- editor.setContent('');
61
- return;
62
- }
63
-
64
- if (!overrideValue?.length) return;
65
- setValue(() => overrideValue);
66
- editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
53
+ if (overrideValue === undefined) return;
54
+ setValue(() => overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
67
55
  }, [overrideValue]);
68
56
  return _jsxs("div", {
69
57
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -73,10 +61,7 @@ const Editor = ({
73
61
  className: "editor-wrapper",
74
62
  children: _jsx(TinyEditor, {
75
63
  onBlur: handleBlur,
76
- onInit: (_e, editor) => {
77
- setLoaded(true);
78
- editorRef.current = editor;
79
- },
64
+ onInit: _e => setLoaded(true),
80
65
  apiKey: TINYMCE_API_KEY,
81
66
  value: value,
82
67
  onEditorChange: handleChange,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "3.0.40",
3
+ "version": "3.0.42",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",