@bbl-digital/snorre 4.1.19 → 4.1.20

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,12 +35538,13 @@ to {top: 100vh;}
35538
35538
  }
35539
35539
  }
35540
35540
  };
35541
- const handleChange = React.useCallback((delta, _oldDelta, source, instance) => {
35542
- const html = instance.root.innerHTML;
35541
+ const handleChange = React.useCallback((delta, _oldDelta, source, quill) => {
35542
+ if (!quill) return;
35543
+ const html = quill.root.innerHTML;
35543
35544
  if (onChange) {
35544
- onChange(html, delta, source, instance);
35545
+ onChange(html, delta, source, quill);
35545
35546
  }
35546
- }, [onChange]);
35547
+ }, [onChange, quill]);
35547
35548
  const applySizes = quill => {
35548
35549
  if (!quill) return;
35549
35550
  minHeight && (quill.root.style.minHeight = `${minHeight}px`);
@@ -35561,7 +35562,10 @@ to {top: 100vh;}
35561
35562
  quillRef.current = new Quill__default["default"](`#editor${editorId.current}`, {
35562
35563
  theme: 'snow',
35563
35564
  modules: {
35564
- ...modules
35565
+ ...modules,
35566
+ keyboard: {
35567
+ scrollingContainer: null
35568
+ }
35565
35569
  },
35566
35570
  formats,
35567
35571
  placeholder,
@@ -35579,6 +35583,10 @@ to {top: 100vh;}
35579
35583
  }, (range, context) => {
35580
35584
  return handleBackspaceWithIndentetList(range, context, quillRef.current);
35581
35585
  });
35586
+ quillRef.current.root.style.touchAction = 'pan-y';
35587
+ quillRef.current.root.style.overflowY = 'auto';
35588
+ quillRef.current.disable();
35589
+ quillRef.current.enable(true);
35582
35590
  // Move the last binding in the list, to the top. Ensure that the custom binding is called first.
35583
35591
  quillRef.current.keyboard.bindings['Backspace'].unshift(quillRef.current.keyboard.bindings['Backspace'].pop());
35584
35592
  quillRef.current.keyboard.addBinding({
@@ -35608,6 +35616,38 @@ to {top: 100vh;}
35608
35616
  quillRef.current = null;
35609
35617
  };
35610
35618
  }, [quillRef]);
35619
+ React.useEffect(() => {
35620
+ if (!quillRef.current) return;
35621
+ const handleBlur = () => {
35622
+ document.body.style.overflow = 'auto';
35623
+ };
35624
+ const handleFocus = () => {
35625
+ console.log('sets hidden', document);
35626
+ document.body.style.overflow = 'hidden';
35627
+ };
35628
+ quillRef.current.root.addEventListener('blur', handleBlur);
35629
+ quillRef.current.root.addEventListener('focus', handleFocus);
35630
+ return () => {
35631
+ if (quillRef.current) {
35632
+ quillRef.current.root.removeEventListener('blur', handleBlur);
35633
+ quillRef.current.root.removeEventListener('focus', handleFocus);
35634
+ }
35635
+ };
35636
+ }, [quillRef]);
35637
+ React.useEffect(() => {
35638
+ if (!quill) return;
35639
+ const resizeQuill = () => {
35640
+ const quillContainer = quill.container;
35641
+ quillContainer.style.height = `${window.innerHeight - 100}px`; // Adjust as needed
35642
+ quill.update();
35643
+ };
35644
+ window.addEventListener('resize', resizeQuill);
35645
+ window.addEventListener('orientationchange', resizeQuill);
35646
+ return () => {
35647
+ window.removeEventListener('resize', resizeQuill);
35648
+ window.removeEventListener('orientationchange', resizeQuill);
35649
+ };
35650
+ }, [quill]);
35611
35651
  React.useEffect(() => {
35612
35652
  if (!quill) return;
35613
35653
  quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
@@ -10,6 +10,7 @@ export const Default = {
10
10
  onChange: e => console.log(e),
11
11
  onBlur: html => console.log('blur', html),
12
12
  onFocus: () => console.log('focus'),
13
+ maxHeight: 500,
13
14
  initialValue: `<p>Beskrivelse av selve styremøtet.</p><p><br></p><ol><li data-list="ordered"><span class="ql-ui" contenteditable="false"></span>test</li><li data-list="ordered"><span class="ql-ui" contenteditable="false"></span>test</li><li data-list="ordered" style="margin-left: 1em;"><span class="ql-ui" contenteditable="false"></span>test</li></ol>`,
14
15
  pasteAsText: true
15
16
  });
@@ -134,12 +134,13 @@ const QuillEditor = ({
134
134
  }
135
135
  }
136
136
  };
137
- const handleChange = useCallback((delta, _oldDelta, source, instance) => {
138
- const html = instance.root.innerHTML;
137
+ const handleChange = useCallback((delta, _oldDelta, source, quill) => {
138
+ if (!quill) return;
139
+ const html = quill.root.innerHTML;
139
140
  if (onChange) {
140
- onChange(html, delta, source, instance);
141
+ onChange(html, delta, source, quill);
141
142
  }
142
- }, [onChange]);
143
+ }, [onChange, quill]);
143
144
  const applySizes = quill => {
144
145
  if (!quill) return;
145
146
  minHeight && (quill.root.style.minHeight = `${minHeight}px`);
@@ -157,7 +158,10 @@ const QuillEditor = ({
157
158
  quillRef.current = new Quill(`#editor${editorId.current}`, {
158
159
  theme: 'snow',
159
160
  modules: {
160
- ...modules
161
+ ...modules,
162
+ keyboard: {
163
+ scrollingContainer: null
164
+ }
161
165
  },
162
166
  formats,
163
167
  placeholder,
@@ -175,6 +179,10 @@ const QuillEditor = ({
175
179
  }, (range, context) => {
176
180
  return handleBackspaceWithIndentetList(range, context, quillRef.current);
177
181
  });
182
+ quillRef.current.root.style.touchAction = 'pan-y';
183
+ quillRef.current.root.style.overflowY = 'auto';
184
+ quillRef.current.disable();
185
+ quillRef.current.enable(true);
178
186
  // Move the last binding in the list, to the top. Ensure that the custom binding is called first.
179
187
  quillRef.current.keyboard.bindings['Backspace'].unshift(quillRef.current.keyboard.bindings['Backspace'].pop());
180
188
  quillRef.current.keyboard.addBinding({
@@ -204,6 +212,38 @@ const QuillEditor = ({
204
212
  quillRef.current = null;
205
213
  };
206
214
  }, [quillRef]);
215
+ useEffect(() => {
216
+ if (!quillRef.current) return;
217
+ const handleBlur = () => {
218
+ document.body.style.overflow = 'auto';
219
+ };
220
+ const handleFocus = () => {
221
+ console.log('sets hidden', document);
222
+ document.body.style.overflow = 'hidden';
223
+ };
224
+ quillRef.current.root.addEventListener('blur', handleBlur);
225
+ quillRef.current.root.addEventListener('focus', handleFocus);
226
+ return () => {
227
+ if (quillRef.current) {
228
+ quillRef.current.root.removeEventListener('blur', handleBlur);
229
+ quillRef.current.root.removeEventListener('focus', handleFocus);
230
+ }
231
+ };
232
+ }, [quillRef]);
233
+ useEffect(() => {
234
+ if (!quill) return;
235
+ const resizeQuill = () => {
236
+ const quillContainer = quill.container;
237
+ quillContainer.style.height = `${window.innerHeight - 100}px`; // Adjust as needed
238
+ quill.update();
239
+ };
240
+ window.addEventListener('resize', resizeQuill);
241
+ window.addEventListener('orientationchange', resizeQuill);
242
+ return () => {
243
+ window.removeEventListener('resize', resizeQuill);
244
+ window.removeEventListener('orientationchange', resizeQuill);
245
+ };
246
+ }, [quill]);
207
247
  useEffect(() => {
208
248
  if (!quill) return;
209
249
  quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
@@ -1 +1 @@
1
- {"version":3,"file":"QuillEditor.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/QuillEditor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;wBAKlC,IAAI;AAHT,wBAGS;AAET,eAAO,MAAM,OAAO;;;CAanB,CAAA;AAED,eAAO,MAAM,IAAI;;;CAGhB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AAED,eAAO,MAAM,UAAU;;;CAKtB,CAAA;AAED,eAAO,MAAM,WAAW;;;CAKvB,CAAA;AAED,eAAO,MAAM,SAAS;;;CAQrB,CAAA"}
1
+ {"version":3,"file":"QuillEditor.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/QuillEditor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;wBAKlC,IAAI;AAHT,wBAGS;AAET,eAAO,MAAM,OAAO;;;CAcnB,CAAA;AAED,eAAO,MAAM,IAAI;;;CAGhB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AAED,eAAO,MAAM,UAAU;;;CAKtB,CAAA;AAED,eAAO,MAAM,WAAW;;;CAKvB,CAAA;AAED,eAAO,MAAM,SAAS;;;CAQrB,CAAA"}
@@ -10,6 +10,7 @@ export const Default = {
10
10
  onChange: e => console.log(e),
11
11
  onBlur: html => console.log('blur', html),
12
12
  onFocus: () => console.log('focus'),
13
+ maxHeight: 500,
13
14
  initialValue: `<p>Beskrivelse av selve styremøtet.</p><p><br></p><ol><li data-list="ordered"><span class="ql-ui" contenteditable="false"></span>test</li><li data-list="ordered"><span class="ql-ui" contenteditable="false"></span>test</li><li data-list="ordered" style="margin-left: 1em;"><span class="ql-ui" contenteditable="false"></span>test</li></ol>`,
14
15
  pasteAsText: true
15
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AASA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA+D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAyP3C,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AASA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA+D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2S3C,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -134,12 +134,13 @@ const QuillEditor = ({
134
134
  }
135
135
  }
136
136
  };
137
- const handleChange = useCallback((delta, _oldDelta, source, instance) => {
138
- const html = instance.root.innerHTML;
137
+ const handleChange = useCallback((delta, _oldDelta, source, quill) => {
138
+ if (!quill) return;
139
+ const html = quill.root.innerHTML;
139
140
  if (onChange) {
140
- onChange(html, delta, source, instance);
141
+ onChange(html, delta, source, quill);
141
142
  }
142
- }, [onChange]);
143
+ }, [onChange, quill]);
143
144
  const applySizes = quill => {
144
145
  if (!quill) return;
145
146
  minHeight && (quill.root.style.minHeight = `${minHeight}px`);
@@ -157,7 +158,10 @@ const QuillEditor = ({
157
158
  quillRef.current = new Quill(`#editor${editorId.current}`, {
158
159
  theme: 'snow',
159
160
  modules: {
160
- ...modules
161
+ ...modules,
162
+ keyboard: {
163
+ scrollingContainer: null
164
+ }
161
165
  },
162
166
  formats,
163
167
  placeholder,
@@ -175,6 +179,10 @@ const QuillEditor = ({
175
179
  }, (range, context) => {
176
180
  return handleBackspaceWithIndentetList(range, context, quillRef.current);
177
181
  });
182
+ quillRef.current.root.style.touchAction = 'pan-y';
183
+ quillRef.current.root.style.overflowY = 'auto';
184
+ quillRef.current.disable();
185
+ quillRef.current.enable(true);
178
186
  // Move the last binding in the list, to the top. Ensure that the custom binding is called first.
179
187
  quillRef.current.keyboard.bindings['Backspace'].unshift(quillRef.current.keyboard.bindings['Backspace'].pop());
180
188
  quillRef.current.keyboard.addBinding({
@@ -204,6 +212,38 @@ const QuillEditor = ({
204
212
  quillRef.current = null;
205
213
  };
206
214
  }, [quillRef]);
215
+ useEffect(() => {
216
+ if (!quillRef.current) return;
217
+ const handleBlur = () => {
218
+ document.body.style.overflow = 'auto';
219
+ };
220
+ const handleFocus = () => {
221
+ console.log('sets hidden', document);
222
+ document.body.style.overflow = 'hidden';
223
+ };
224
+ quillRef.current.root.addEventListener('blur', handleBlur);
225
+ quillRef.current.root.addEventListener('focus', handleFocus);
226
+ return () => {
227
+ if (quillRef.current) {
228
+ quillRef.current.root.removeEventListener('blur', handleBlur);
229
+ quillRef.current.root.removeEventListener('focus', handleFocus);
230
+ }
231
+ };
232
+ }, [quillRef]);
233
+ useEffect(() => {
234
+ if (!quill) return;
235
+ const resizeQuill = () => {
236
+ const quillContainer = quill.container;
237
+ quillContainer.style.height = `${window.innerHeight - 100}px`; // Adjust as needed
238
+ quill.update();
239
+ };
240
+ window.addEventListener('resize', resizeQuill);
241
+ window.addEventListener('orientationchange', resizeQuill);
242
+ return () => {
243
+ window.removeEventListener('resize', resizeQuill);
244
+ window.removeEventListener('orientationchange', resizeQuill);
245
+ };
246
+ }, [quill]);
207
247
  useEffect(() => {
208
248
  if (!quill) return;
209
249
  quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.1.19",
3
+ "version": "4.1.20",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",