@bbl-digital/snorre 4.0.89 → 4.0.91

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -35453,6 +35453,15 @@ to {top: 100vh;}
35453
35453
  onChange(html, delta, source, quill);
35454
35454
  }
35455
35455
  }, [quill, onChange]);
35456
+ const applySizes = () => {
35457
+ if (!quill) return;
35458
+ minHeight && (quill.root.style.minHeight = `${minHeight}px`);
35459
+ maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
35460
+ maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
35461
+ width && (quill.root.style.width = `${width}px`);
35462
+ height && (quill.root.style.height = `${height}px`);
35463
+ minWidth && (quill.root.style.minWidth = `${minWidth}px`);
35464
+ };
35456
35465
  React.useEffect(() => {
35457
35466
  if (!isMounted.current) {
35458
35467
  const editor = document.createElement('div');
@@ -35466,13 +35475,12 @@ to {top: 100vh;}
35466
35475
  readOnly
35467
35476
  });
35468
35477
  isMounted.current = true;
35469
- if (initialValue) {
35470
- quillInstance.root.innerHTML = initialValue;
35471
- }
35472
- applySizes(quillInstance);
35473
35478
  setQuill(quillInstance);
35474
35479
  }
35475
35480
  }, []);
35481
+ React.useEffect(() => {
35482
+ applySizes();
35483
+ }, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
35476
35484
  React.useEffect(() => {
35477
35485
  if (quill && disabled) {
35478
35486
  quill.disable();
@@ -35487,6 +35495,13 @@ to {top: 100vh;}
35487
35495
  }
35488
35496
  }
35489
35497
  }, [quill, overrideValue]);
35498
+ React.useEffect(() => {
35499
+ if (quill && initialValue !== undefined) {
35500
+ if (quill.root.innerHTML !== initialValue) {
35501
+ quill.root.innerHTML = initialValue;
35502
+ }
35503
+ }
35504
+ }, [quill, initialValue]);
35490
35505
  React.useEffect(() => {
35491
35506
  if (quill && readOnly) {
35492
35507
  quill.enable(false);
@@ -35510,14 +35525,6 @@ to {top: 100vh;}
35510
35525
  quill.off('selection-change');
35511
35526
  };
35512
35527
  }, [quill?.container]);
35513
- const applySizes = quill => {
35514
- minHeight && (quill.root.style.minHeight = `${minHeight}px`);
35515
- maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
35516
- maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
35517
- width && (quill.root.style.width = `${width}px`);
35518
- height && (quill.root.style.height = `${height}px`);
35519
- minWidth && (quill.root.style.minWidth = `${minWidth}px`);
35520
- };
35521
35528
  return jsxRuntime.jsxs("div", {
35522
35529
  css: theme => [styles.default(theme, maxHeight)],
35523
35530
  children: [label && jsxRuntime.jsx(Label, {
@@ -79,6 +79,15 @@ const QuillEditor = ({
79
79
  onChange(html, delta, source, quill);
80
80
  }
81
81
  }, [quill, onChange]);
82
+ const applySizes = () => {
83
+ if (!quill) return;
84
+ minHeight && (quill.root.style.minHeight = `${minHeight}px`);
85
+ maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
86
+ maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
87
+ width && (quill.root.style.width = `${width}px`);
88
+ height && (quill.root.style.height = `${height}px`);
89
+ minWidth && (quill.root.style.minWidth = `${minWidth}px`);
90
+ };
82
91
  useEffect(() => {
83
92
  if (!isMounted.current) {
84
93
  const editor = document.createElement('div');
@@ -92,13 +101,12 @@ const QuillEditor = ({
92
101
  readOnly
93
102
  });
94
103
  isMounted.current = true;
95
- if (initialValue) {
96
- quillInstance.root.innerHTML = initialValue;
97
- }
98
- applySizes(quillInstance);
99
104
  setQuill(quillInstance);
100
105
  }
101
106
  }, []);
107
+ useEffect(() => {
108
+ applySizes();
109
+ }, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
102
110
  useEffect(() => {
103
111
  if (quill && disabled) {
104
112
  quill.disable();
@@ -113,6 +121,13 @@ const QuillEditor = ({
113
121
  }
114
122
  }
115
123
  }, [quill, overrideValue]);
124
+ useEffect(() => {
125
+ if (quill && initialValue !== undefined) {
126
+ if (quill.root.innerHTML !== initialValue) {
127
+ quill.root.innerHTML = initialValue;
128
+ }
129
+ }
130
+ }, [quill, initialValue]);
116
131
  useEffect(() => {
117
132
  if (quill && readOnly) {
118
133
  quill.enable(false);
@@ -136,14 +151,6 @@ const QuillEditor = ({
136
151
  quill.off('selection-change');
137
152
  };
138
153
  }, [quill?.container]);
139
- const applySizes = quill => {
140
- minHeight && (quill.root.style.minHeight = `${minHeight}px`);
141
- maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
142
- maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
143
- width && (quill.root.style.width = `${width}px`);
144
- height && (quill.root.style.height = `${height}px`);
145
- minWidth && (quill.root.style.minWidth = `${minWidth}px`);
146
- };
147
154
  return _jsxs("div", {
148
155
  css: theme => [styles.default(theme, maxHeight)],
149
156
  children: [label && _jsx(Label, {
@@ -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,CA8J3C,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,CAuK3C,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -79,6 +79,15 @@ const QuillEditor = ({
79
79
  onChange(html, delta, source, quill);
80
80
  }
81
81
  }, [quill, onChange]);
82
+ const applySizes = () => {
83
+ if (!quill) return;
84
+ minHeight && (quill.root.style.minHeight = `${minHeight}px`);
85
+ maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
86
+ maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
87
+ width && (quill.root.style.width = `${width}px`);
88
+ height && (quill.root.style.height = `${height}px`);
89
+ minWidth && (quill.root.style.minWidth = `${minWidth}px`);
90
+ };
82
91
  useEffect(() => {
83
92
  if (!isMounted.current) {
84
93
  const editor = document.createElement('div');
@@ -92,13 +101,12 @@ const QuillEditor = ({
92
101
  readOnly
93
102
  });
94
103
  isMounted.current = true;
95
- if (initialValue) {
96
- quillInstance.root.innerHTML = initialValue;
97
- }
98
- applySizes(quillInstance);
99
104
  setQuill(quillInstance);
100
105
  }
101
106
  }, []);
107
+ useEffect(() => {
108
+ applySizes();
109
+ }, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
102
110
  useEffect(() => {
103
111
  if (quill && disabled) {
104
112
  quill.disable();
@@ -113,6 +121,13 @@ const QuillEditor = ({
113
121
  }
114
122
  }
115
123
  }, [quill, overrideValue]);
124
+ useEffect(() => {
125
+ if (quill && initialValue !== undefined) {
126
+ if (quill.root.innerHTML !== initialValue) {
127
+ quill.root.innerHTML = initialValue;
128
+ }
129
+ }
130
+ }, [quill, initialValue]);
116
131
  useEffect(() => {
117
132
  if (quill && readOnly) {
118
133
  quill.enable(false);
@@ -136,14 +151,6 @@ const QuillEditor = ({
136
151
  quill.off('selection-change');
137
152
  };
138
153
  }, [quill?.container]);
139
- const applySizes = quill => {
140
- minHeight && (quill.root.style.minHeight = `${minHeight}px`);
141
- maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
142
- maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
143
- width && (quill.root.style.width = `${width}px`);
144
- height && (quill.root.style.height = `${height}px`);
145
- minWidth && (quill.root.style.minWidth = `${minWidth}px`);
146
- };
147
154
  return _jsxs("div", {
148
155
  css: theme => [styles.default(theme, maxHeight)],
149
156
  children: [label && _jsx(Label, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.0.89",
3
+ "version": "4.0.91",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",