@bbl-digital/snorre 4.1.10 → 4.1.12

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
@@ -35538,9 +35538,11 @@ to {top: 100vh;}
35538
35538
  }
35539
35539
  };
35540
35540
  const handleChange = React.useCallback((delta, _oldDelta, source) => {
35541
- if (quill && onChange) {
35541
+ if (quill) {
35542
35542
  const html = quill.root.innerHTML;
35543
- onChange(html, delta, source, quill);
35543
+ if (onChange) {
35544
+ onChange(html, delta, source, quill);
35545
+ }
35544
35546
  }
35545
35547
  }, [quill, onChange]);
35546
35548
  const handelFocus = React.useCallback(() => {
@@ -35608,15 +35610,15 @@ to {top: 100vh;}
35608
35610
  }, []);
35609
35611
  React.useEffect(() => {
35610
35612
  if (!quill) return;
35611
- quill.root.addEventListener('blur', e => {
35612
- const html = quill.root.innerHTML;
35613
- onBlur && onBlur(html);
35614
- });
35615
- return () => {
35616
- quill.root.removeEventListener('blur', e => {
35613
+ const handleBlur = () => {
35614
+ setTimeout(() => {
35617
35615
  const html = quill.root.innerHTML;
35618
35616
  onBlur && onBlur(html);
35619
- });
35617
+ }, 50);
35618
+ };
35619
+ quill.root.addEventListener('blur', handleBlur);
35620
+ return () => {
35621
+ quill.root.removeEventListener('blur', handleBlur);
35620
35622
  };
35621
35623
  }, [quill]);
35622
35624
  React.useEffect(() => {
@@ -35657,7 +35659,8 @@ to {top: 100vh;}
35657
35659
  }, [quill, pasteAsText]);
35658
35660
  React.useEffect(() => {
35659
35661
  if (quill && overrideValue !== undefined) {
35660
- if (quill.root.innerHTML !== overrideValue) {
35662
+ const currentContent = quill.root.innerHTML;
35663
+ if (currentContent !== overrideValue) {
35661
35664
  const delta = quill.clipboard.convert({
35662
35665
  html: overrideValue
35663
35666
  });
@@ -135,9 +135,11 @@ const QuillEditor = ({
135
135
  }
136
136
  };
137
137
  const handleChange = useCallback((delta, _oldDelta, source) => {
138
- if (quill && onChange) {
138
+ if (quill) {
139
139
  const html = quill.root.innerHTML;
140
- onChange(html, delta, source, quill);
140
+ if (onChange) {
141
+ onChange(html, delta, source, quill);
142
+ }
141
143
  }
142
144
  }, [quill, onChange]);
143
145
  const handelFocus = useCallback(() => {
@@ -205,15 +207,15 @@ const QuillEditor = ({
205
207
  }, []);
206
208
  useEffect(() => {
207
209
  if (!quill) return;
208
- quill.root.addEventListener('blur', e => {
209
- const html = quill.root.innerHTML;
210
- onBlur && onBlur(html);
211
- });
212
- return () => {
213
- quill.root.removeEventListener('blur', e => {
210
+ const handleBlur = () => {
211
+ setTimeout(() => {
214
212
  const html = quill.root.innerHTML;
215
213
  onBlur && onBlur(html);
216
- });
214
+ }, 50);
215
+ };
216
+ quill.root.addEventListener('blur', handleBlur);
217
+ return () => {
218
+ quill.root.removeEventListener('blur', handleBlur);
217
219
  };
218
220
  }, [quill]);
219
221
  useEffect(() => {
@@ -254,7 +256,8 @@ const QuillEditor = ({
254
256
  }, [quill, pasteAsText]);
255
257
  useEffect(() => {
256
258
  if (quill && overrideValue !== undefined) {
257
- if (quill.root.innerHTML !== overrideValue) {
259
+ const currentContent = quill.root.innerHTML;
260
+ if (currentContent !== overrideValue) {
258
261
  const delta = quill.clipboard.convert({
259
262
  html: overrideValue
260
263
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AAGA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA+D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkR3C,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AAGA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA+D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsR3C,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -135,9 +135,11 @@ const QuillEditor = ({
135
135
  }
136
136
  };
137
137
  const handleChange = useCallback((delta, _oldDelta, source) => {
138
- if (quill && onChange) {
138
+ if (quill) {
139
139
  const html = quill.root.innerHTML;
140
- onChange(html, delta, source, quill);
140
+ if (onChange) {
141
+ onChange(html, delta, source, quill);
142
+ }
141
143
  }
142
144
  }, [quill, onChange]);
143
145
  const handelFocus = useCallback(() => {
@@ -205,15 +207,15 @@ const QuillEditor = ({
205
207
  }, []);
206
208
  useEffect(() => {
207
209
  if (!quill) return;
208
- quill.root.addEventListener('blur', e => {
209
- const html = quill.root.innerHTML;
210
- onBlur && onBlur(html);
211
- });
212
- return () => {
213
- quill.root.removeEventListener('blur', e => {
210
+ const handleBlur = () => {
211
+ setTimeout(() => {
214
212
  const html = quill.root.innerHTML;
215
213
  onBlur && onBlur(html);
216
- });
214
+ }, 50);
215
+ };
216
+ quill.root.addEventListener('blur', handleBlur);
217
+ return () => {
218
+ quill.root.removeEventListener('blur', handleBlur);
217
219
  };
218
220
  }, [quill]);
219
221
  useEffect(() => {
@@ -254,7 +256,8 @@ const QuillEditor = ({
254
256
  }, [quill, pasteAsText]);
255
257
  useEffect(() => {
256
258
  if (quill && overrideValue !== undefined) {
257
- if (quill.root.innerHTML !== overrideValue) {
259
+ const currentContent = quill.root.innerHTML;
260
+ if (currentContent !== overrideValue) {
258
261
  const delta = quill.clipboard.convert({
259
262
  html: overrideValue
260
263
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.1.10",
3
+ "version": "4.1.12",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",