@bbl-digital/snorre 3.0.38 → 3.0.40

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -32152,24 +32152,22 @@
32152
32152
  }).length);
32153
32153
  };
32154
32154
 
32155
- const handleBlur = () => onBlur && onBlur(value);
32155
+ const handleBlur = () => onBlur?.(value);
32156
32156
 
32157
32157
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
32158
32158
  React.useEffect(() => {
32159
- const editor = editorRef.current?.editor;
32159
+ const editor = editorRef?.current;
32160
32160
  if (!editor) return;
32161
32161
 
32162
32162
  if (overrideValue === null) {
32163
- editor?.selection.setContent('', {
32164
- no_selection: true
32165
- });
32163
+ setValue(() => '');
32164
+ editor.setContent('');
32166
32165
  return;
32167
32166
  }
32168
32167
 
32169
32168
  if (!overrideValue?.length) return;
32170
- editor.selection.setContent(overrideValue, {
32171
- no_selection: true
32172
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
32169
+ setValue(() => overrideValue);
32170
+ editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
32173
32171
  }, [overrideValue]);
32174
32172
  return jsxRuntime$1.jsxs("div", {
32175
32173
  css: theme => [styles$3.default(theme), !loaded && styles$3.hideEditor],
@@ -32178,9 +32176,11 @@
32178
32176
  }), jsxRuntime$1.jsx("div", {
32179
32177
  className: "editor-wrapper",
32180
32178
  children: jsxRuntime$1.jsx(tinymceReact.Editor, {
32181
- ref: editorRef,
32182
32179
  onBlur: handleBlur,
32183
- onInit: () => setLoaded(true),
32180
+ onInit: (_e, editor) => {
32181
+ setLoaded(true);
32182
+ editorRef.current = editor;
32183
+ },
32184
32184
  apiKey: TINYMCE_API_KEY,
32185
32185
  value: value,
32186
32186
  onEditorChange: handleChange,
@@ -48,24 +48,22 @@ const Editor = ({
48
48
  }).length);
49
49
  };
50
50
 
51
- const handleBlur = () => onBlur && onBlur(value);
51
+ const handleBlur = () => onBlur?.(value);
52
52
 
53
53
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
54
54
  useEffect(() => {
55
- const editor = editorRef.current?.editor;
55
+ const editor = editorRef?.current;
56
56
  if (!editor) return;
57
57
 
58
58
  if (overrideValue === null) {
59
- editor?.selection.setContent('', {
60
- no_selection: true
61
- });
59
+ setValue(() => '');
60
+ editor.setContent('');
62
61
  return;
63
62
  }
64
63
 
65
64
  if (!overrideValue?.length) return;
66
- editor.selection.setContent(overrideValue, {
67
- no_selection: true
68
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
65
+ setValue(() => overrideValue);
66
+ editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
69
67
  }, [overrideValue]);
70
68
  return _jsxs("div", {
71
69
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -74,9 +72,11 @@ const Editor = ({
74
72
  }), _jsx("div", {
75
73
  className: "editor-wrapper",
76
74
  children: _jsx(TinyEditor, {
77
- ref: editorRef,
78
75
  onBlur: handleBlur,
79
- onInit: () => setLoaded(true),
76
+ onInit: (_e, editor) => {
77
+ setLoaded(true);
78
+ editorRef.current = editor;
79
+ },
80
80
  apiKey: TINYMCE_API_KEY,
81
81
  value: value,
82
82
  onEditorChange: handleChange,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Editor/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAA;AAkBpC,UAAU,MAAM;IACd,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wHAAwH;IACxH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA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EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACzB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB;IACjB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,mBAAmB;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3D;AAID,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,CA4HtB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -48,24 +48,22 @@ const Editor = ({
48
48
  }).length);
49
49
  };
50
50
 
51
- const handleBlur = () => onBlur && onBlur(value);
51
+ const handleBlur = () => onBlur?.(value);
52
52
 
53
53
  const toolbar = type === 'basic' ? basicToolbar : type === 'rich' ? richToolbar : customToolbar;
54
54
  useEffect(() => {
55
- const editor = editorRef.current?.editor;
55
+ const editor = editorRef?.current;
56
56
  if (!editor) return;
57
57
 
58
58
  if (overrideValue === null) {
59
- editor?.selection.setContent('', {
60
- no_selection: true
61
- });
59
+ setValue(() => '');
60
+ editor.setContent('');
62
61
  return;
63
62
  }
64
63
 
65
64
  if (!overrideValue?.length) return;
66
- editor.selection.setContent(overrideValue, {
67
- no_selection: true
68
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
65
+ setValue(() => overrideValue);
66
+ editor.setContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
69
67
  }, [overrideValue]);
70
68
  return _jsxs("div", {
71
69
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -74,9 +72,11 @@ const Editor = ({
74
72
  }), _jsx("div", {
75
73
  className: "editor-wrapper",
76
74
  children: _jsx(TinyEditor, {
77
- ref: editorRef,
78
75
  onBlur: handleBlur,
79
- onInit: () => setLoaded(true),
76
+ onInit: (_e, editor) => {
77
+ setLoaded(true);
78
+ editorRef.current = editor;
79
+ },
80
80
  apiKey: TINYMCE_API_KEY,
81
81
  value: value,
82
82
  onEditorChange: handleChange,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "3.0.38",
3
+ "version": "3.0.40",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",