@bbl-digital/snorre 4.0.88 → 4.0.89

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -35435,7 +35435,7 @@ to {top: 100vh;}
35435
35435
  }) => {
35436
35436
  const [quill, setQuill] = React.useState(null);
35437
35437
  const isMounted = React.useRef(false);
35438
- const editorRef = React.useRef(null);
35438
+ const containerRef = React.useRef(null);
35439
35439
  const {
35440
35440
  alert
35441
35441
  } = react.useTheme();
@@ -35454,8 +35454,10 @@ to {top: 100vh;}
35454
35454
  }
35455
35455
  }, [quill, onChange]);
35456
35456
  React.useEffect(() => {
35457
- if (editorRef.current && !isMounted.current) {
35458
- const quillInstance = new Quill__default["default"](editorRef.current, {
35457
+ if (!isMounted.current) {
35458
+ const editor = document.createElement('div');
35459
+ containerRef.current?.appendChild(editor);
35460
+ const quillInstance = new Quill__default["default"](editor, {
35459
35461
  theme: 'snow',
35460
35462
  modules,
35461
35463
  formats,
@@ -35470,7 +35472,7 @@ to {top: 100vh;}
35470
35472
  applySizes(quillInstance);
35471
35473
  setQuill(quillInstance);
35472
35474
  }
35473
- }, [editorRef, modules, formats, placeholder, readOnly, onFocus, onBlur, initialValue, handleChange]);
35475
+ }, []);
35474
35476
  React.useEffect(() => {
35475
35477
  if (quill && disabled) {
35476
35478
  quill.disable();
@@ -35515,7 +35517,6 @@ to {top: 100vh;}
35515
35517
  width && (quill.root.style.width = `${width}px`);
35516
35518
  height && (quill.root.style.height = `${height}px`);
35517
35519
  minWidth && (quill.root.style.minWidth = `${minWidth}px`);
35518
- console.log('applied sizes', quill.root.style);
35519
35520
  };
35520
35521
  return jsxRuntime.jsxs("div", {
35521
35522
  css: theme => [styles.default(theme, maxHeight)],
@@ -35531,7 +35532,7 @@ to {top: 100vh;}
35531
35532
  ...style
35532
35533
  },
35533
35534
  children: jsxRuntime.jsx("div", {
35534
- ref: editorRef
35535
+ ref: containerRef
35535
35536
  })
35536
35537
  }), invalidMessage && jsxRuntime.jsx(ErrorWrapper, {
35537
35538
  children: jsxRuntime.jsxs(Text, {
@@ -61,7 +61,7 @@ const QuillEditor = ({
61
61
  }) => {
62
62
  const [quill, setQuill] = useState(null);
63
63
  const isMounted = useRef(false);
64
- const editorRef = useRef(null);
64
+ const containerRef = useRef(null);
65
65
  const {
66
66
  alert
67
67
  } = useTheme();
@@ -80,8 +80,10 @@ const QuillEditor = ({
80
80
  }
81
81
  }, [quill, onChange]);
82
82
  useEffect(() => {
83
- if (editorRef.current && !isMounted.current) {
84
- const quillInstance = new Quill(editorRef.current, {
83
+ if (!isMounted.current) {
84
+ const editor = document.createElement('div');
85
+ containerRef.current?.appendChild(editor);
86
+ const quillInstance = new Quill(editor, {
85
87
  theme: 'snow',
86
88
  modules,
87
89
  formats,
@@ -96,7 +98,7 @@ const QuillEditor = ({
96
98
  applySizes(quillInstance);
97
99
  setQuill(quillInstance);
98
100
  }
99
- }, [editorRef, modules, formats, placeholder, readOnly, onFocus, onBlur, initialValue, handleChange]);
101
+ }, []);
100
102
  useEffect(() => {
101
103
  if (quill && disabled) {
102
104
  quill.disable();
@@ -141,7 +143,6 @@ const QuillEditor = ({
141
143
  width && (quill.root.style.width = `${width}px`);
142
144
  height && (quill.root.style.height = `${height}px`);
143
145
  minWidth && (quill.root.style.minWidth = `${minWidth}px`);
144
- console.log('applied sizes', quill.root.style);
145
146
  };
146
147
  return _jsxs("div", {
147
148
  css: theme => [styles.default(theme, maxHeight)],
@@ -157,7 +158,7 @@ const QuillEditor = ({
157
158
  ...style
158
159
  },
159
160
  children: _jsx("div", {
160
- ref: editorRef
161
+ ref: containerRef
161
162
  })
162
163
  }), invalidMessage && _jsx(ErrorWrapper, {
163
164
  children: _jsxs(Text, {
package/jest.config.js CHANGED
@@ -23,7 +23,12 @@ module.exports = {
23
23
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
24
24
  moduleNameMapper: {
25
25
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
26
+ quill: '<rootDir>/node_modules/quill/dist/quill.js',
26
27
  },
28
+ transformIgnorePatterns: [
29
+ 'node_modules/quill',
30
+ '<rootDir>/src/QuillEditor/Attributors',
31
+ ],
27
32
 
28
33
  testEnvironment: 'jsdom',
29
34
  }
@@ -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;AAqC3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuK3C,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;AAqC3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8J3C,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -61,7 +61,7 @@ const QuillEditor = ({
61
61
  }) => {
62
62
  const [quill, setQuill] = useState(null);
63
63
  const isMounted = useRef(false);
64
- const editorRef = useRef(null);
64
+ const containerRef = useRef(null);
65
65
  const {
66
66
  alert
67
67
  } = useTheme();
@@ -80,8 +80,10 @@ const QuillEditor = ({
80
80
  }
81
81
  }, [quill, onChange]);
82
82
  useEffect(() => {
83
- if (editorRef.current && !isMounted.current) {
84
- const quillInstance = new Quill(editorRef.current, {
83
+ if (!isMounted.current) {
84
+ const editor = document.createElement('div');
85
+ containerRef.current?.appendChild(editor);
86
+ const quillInstance = new Quill(editor, {
85
87
  theme: 'snow',
86
88
  modules,
87
89
  formats,
@@ -96,7 +98,7 @@ const QuillEditor = ({
96
98
  applySizes(quillInstance);
97
99
  setQuill(quillInstance);
98
100
  }
99
- }, [editorRef, modules, formats, placeholder, readOnly, onFocus, onBlur, initialValue, handleChange]);
101
+ }, []);
100
102
  useEffect(() => {
101
103
  if (quill && disabled) {
102
104
  quill.disable();
@@ -141,7 +143,6 @@ const QuillEditor = ({
141
143
  width && (quill.root.style.width = `${width}px`);
142
144
  height && (quill.root.style.height = `${height}px`);
143
145
  minWidth && (quill.root.style.minWidth = `${minWidth}px`);
144
- console.log('applied sizes', quill.root.style);
145
146
  };
146
147
  return _jsxs("div", {
147
148
  css: theme => [styles.default(theme, maxHeight)],
@@ -157,7 +158,7 @@ const QuillEditor = ({
157
158
  ...style
158
159
  },
159
160
  children: _jsx("div", {
160
- ref: editorRef
161
+ ref: containerRef
161
162
  })
162
163
  }), invalidMessage && _jsx(ErrorWrapper, {
163
164
  children: _jsxs(Text, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.0.88",
3
+ "version": "4.0.89",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",