@bbl-digital/snorre 3.0.37 → 3.0.39

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -32152,20 +32152,24 @@
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?.resetContent('');
32163
+ editor.setContent('', {
32164
+ no_selection: true
32165
+ });
32164
32166
  return;
32165
32167
  }
32166
32168
 
32167
32169
  if (!overrideValue?.length) return;
32168
- editor.resetContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
32170
+ editor.setContent(overrideValue, {
32171
+ no_selection: true
32172
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
32169
32173
  }, [overrideValue]);
32170
32174
  return jsxRuntime$1.jsxs("div", {
32171
32175
  css: theme => [styles$3.default(theme), !loaded && styles$3.hideEditor],
@@ -32174,9 +32178,11 @@
32174
32178
  }), jsxRuntime$1.jsx("div", {
32175
32179
  className: "editor-wrapper",
32176
32180
  children: jsxRuntime$1.jsx(tinymceReact.Editor, {
32177
- ref: editorRef,
32178
32181
  onBlur: handleBlur,
32179
- onInit: () => setLoaded(true),
32182
+ onInit: (_e, editor) => {
32183
+ setLoaded(true);
32184
+ editorRef.current = editor;
32185
+ },
32180
32186
  apiKey: TINYMCE_API_KEY,
32181
32187
  value: value,
32182
32188
  onEditorChange: handleChange,
@@ -48,20 +48,24 @@ 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?.resetContent('');
59
+ editor.setContent('', {
60
+ no_selection: true
61
+ });
60
62
  return;
61
63
  }
62
64
 
63
65
  if (!overrideValue?.length) return;
64
- editor.resetContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ editor.setContent(overrideValue, {
67
+ no_selection: true
68
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
65
69
  }, [overrideValue]);
66
70
  return _jsxs("div", {
67
71
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -70,9 +74,11 @@ const Editor = ({
70
74
  }), _jsx("div", {
71
75
  className: "editor-wrapper",
72
76
  children: _jsx(TinyEditor, {
73
- ref: editorRef,
74
77
  onBlur: handleBlur,
75
- onInit: () => setLoaded(true),
78
+ onInit: (_e, editor) => {
79
+ setLoaded(true);
80
+ editorRef.current = editor;
81
+ },
76
82
  apiKey: TINYMCE_API_KEY,
77
83
  value: value,
78
84
  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;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,SAAS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AAsC;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,CA0HtB,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -48,20 +48,24 @@ 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?.resetContent('');
59
+ editor.setContent('', {
60
+ no_selection: true
61
+ });
60
62
  return;
61
63
  }
62
64
 
63
65
  if (!overrideValue?.length) return;
64
- editor.resetContent(overrideValue); // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ editor.setContent(overrideValue, {
67
+ no_selection: true
68
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
65
69
  }, [overrideValue]);
66
70
  return _jsxs("div", {
67
71
  css: theme => [styles.default(theme), !loaded && styles.hideEditor],
@@ -70,9 +74,11 @@ const Editor = ({
70
74
  }), _jsx("div", {
71
75
  className: "editor-wrapper",
72
76
  children: _jsx(TinyEditor, {
73
- ref: editorRef,
74
77
  onBlur: handleBlur,
75
- onInit: () => setLoaded(true),
78
+ onInit: (_e, editor) => {
79
+ setLoaded(true);
80
+ editorRef.current = editor;
81
+ },
76
82
  apiKey: TINYMCE_API_KEY,
77
83
  value: value,
78
84
  onEditorChange: handleChange,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "3.0.37",
3
+ "version": "3.0.39",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",