@bbl-digital/snorre 4.0.88 → 4.0.90
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 +19 -15
- package/esm/core/QuillEditor/index.js +19 -15
- package/jest.config.js +5 -0
- package/lib/core/QuillEditor/index.d.ts.map +1 -1
- package/lib/core/QuillEditor/index.js +19 -15
- package/package.json +1 -1
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
|
|
35438
|
+
const containerRef = React.useRef(null);
|
|
35439
35439
|
const {
|
|
35440
35440
|
alert
|
|
35441
35441
|
} = react.useTheme();
|
|
@@ -35453,9 +35453,20 @@ 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
|
-
if (
|
|
35458
|
-
const
|
|
35466
|
+
if (!isMounted.current) {
|
|
35467
|
+
const editor = document.createElement('div');
|
|
35468
|
+
containerRef.current?.appendChild(editor);
|
|
35469
|
+
const quillInstance = new Quill__default["default"](editor, {
|
|
35459
35470
|
theme: 'snow',
|
|
35460
35471
|
modules,
|
|
35461
35472
|
formats,
|
|
@@ -35467,10 +35478,12 @@ to {top: 100vh;}
|
|
|
35467
35478
|
if (initialValue) {
|
|
35468
35479
|
quillInstance.root.innerHTML = initialValue;
|
|
35469
35480
|
}
|
|
35470
|
-
applySizes(quillInstance);
|
|
35471
35481
|
setQuill(quillInstance);
|
|
35472
35482
|
}
|
|
35473
|
-
}, [
|
|
35483
|
+
}, []);
|
|
35484
|
+
React.useEffect(() => {
|
|
35485
|
+
applySizes();
|
|
35486
|
+
}, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
|
|
35474
35487
|
React.useEffect(() => {
|
|
35475
35488
|
if (quill && disabled) {
|
|
35476
35489
|
quill.disable();
|
|
@@ -35508,15 +35521,6 @@ to {top: 100vh;}
|
|
|
35508
35521
|
quill.off('selection-change');
|
|
35509
35522
|
};
|
|
35510
35523
|
}, [quill?.container]);
|
|
35511
|
-
const applySizes = quill => {
|
|
35512
|
-
minHeight && (quill.root.style.minHeight = `${minHeight}px`);
|
|
35513
|
-
maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
|
|
35514
|
-
maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
|
|
35515
|
-
width && (quill.root.style.width = `${width}px`);
|
|
35516
|
-
height && (quill.root.style.height = `${height}px`);
|
|
35517
|
-
minWidth && (quill.root.style.minWidth = `${minWidth}px`);
|
|
35518
|
-
console.log('applied sizes', quill.root.style);
|
|
35519
|
-
};
|
|
35520
35524
|
return jsxRuntime.jsxs("div", {
|
|
35521
35525
|
css: theme => [styles.default(theme, maxHeight)],
|
|
35522
35526
|
children: [label && jsxRuntime.jsx(Label, {
|
|
@@ -35531,7 +35535,7 @@ to {top: 100vh;}
|
|
|
35531
35535
|
...style
|
|
35532
35536
|
},
|
|
35533
35537
|
children: jsxRuntime.jsx("div", {
|
|
35534
|
-
ref:
|
|
35538
|
+
ref: containerRef
|
|
35535
35539
|
})
|
|
35536
35540
|
}), invalidMessage && jsxRuntime.jsx(ErrorWrapper, {
|
|
35537
35541
|
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
|
|
64
|
+
const containerRef = useRef(null);
|
|
65
65
|
const {
|
|
66
66
|
alert
|
|
67
67
|
} = useTheme();
|
|
@@ -79,9 +79,20 @@ 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
|
-
if (
|
|
84
|
-
const
|
|
92
|
+
if (!isMounted.current) {
|
|
93
|
+
const editor = document.createElement('div');
|
|
94
|
+
containerRef.current?.appendChild(editor);
|
|
95
|
+
const quillInstance = new Quill(editor, {
|
|
85
96
|
theme: 'snow',
|
|
86
97
|
modules,
|
|
87
98
|
formats,
|
|
@@ -93,10 +104,12 @@ const QuillEditor = ({
|
|
|
93
104
|
if (initialValue) {
|
|
94
105
|
quillInstance.root.innerHTML = initialValue;
|
|
95
106
|
}
|
|
96
|
-
applySizes(quillInstance);
|
|
97
107
|
setQuill(quillInstance);
|
|
98
108
|
}
|
|
99
|
-
}, [
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
applySizes();
|
|
112
|
+
}, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
|
|
100
113
|
useEffect(() => {
|
|
101
114
|
if (quill && disabled) {
|
|
102
115
|
quill.disable();
|
|
@@ -134,15 +147,6 @@ const QuillEditor = ({
|
|
|
134
147
|
quill.off('selection-change');
|
|
135
148
|
};
|
|
136
149
|
}, [quill?.container]);
|
|
137
|
-
const applySizes = quill => {
|
|
138
|
-
minHeight && (quill.root.style.minHeight = `${minHeight}px`);
|
|
139
|
-
maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
|
|
140
|
-
maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
|
|
141
|
-
width && (quill.root.style.width = `${width}px`);
|
|
142
|
-
height && (quill.root.style.height = `${height}px`);
|
|
143
|
-
minWidth && (quill.root.style.minWidth = `${minWidth}px`);
|
|
144
|
-
console.log('applied sizes', quill.root.style);
|
|
145
|
-
};
|
|
146
150
|
return _jsxs("div", {
|
|
147
151
|
css: theme => [styles.default(theme, maxHeight)],
|
|
148
152
|
children: [label && _jsx(Label, {
|
|
@@ -157,7 +161,7 @@ const QuillEditor = ({
|
|
|
157
161
|
...style
|
|
158
162
|
},
|
|
159
163
|
children: _jsx("div", {
|
|
160
|
-
ref:
|
|
164
|
+
ref: containerRef
|
|
161
165
|
})
|
|
162
166
|
}), invalidMessage && _jsx(ErrorWrapper, {
|
|
163
167
|
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,
|
|
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,CAkK3C,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
|
|
64
|
+
const containerRef = useRef(null);
|
|
65
65
|
const {
|
|
66
66
|
alert
|
|
67
67
|
} = useTheme();
|
|
@@ -79,9 +79,20 @@ 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
|
-
if (
|
|
84
|
-
const
|
|
92
|
+
if (!isMounted.current) {
|
|
93
|
+
const editor = document.createElement('div');
|
|
94
|
+
containerRef.current?.appendChild(editor);
|
|
95
|
+
const quillInstance = new Quill(editor, {
|
|
85
96
|
theme: 'snow',
|
|
86
97
|
modules,
|
|
87
98
|
formats,
|
|
@@ -93,10 +104,12 @@ const QuillEditor = ({
|
|
|
93
104
|
if (initialValue) {
|
|
94
105
|
quillInstance.root.innerHTML = initialValue;
|
|
95
106
|
}
|
|
96
|
-
applySizes(quillInstance);
|
|
97
107
|
setQuill(quillInstance);
|
|
98
108
|
}
|
|
99
|
-
}, [
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
applySizes();
|
|
112
|
+
}, [quill, height, width, maxHeight, maxWidth, minHeight, minWidth]);
|
|
100
113
|
useEffect(() => {
|
|
101
114
|
if (quill && disabled) {
|
|
102
115
|
quill.disable();
|
|
@@ -134,15 +147,6 @@ const QuillEditor = ({
|
|
|
134
147
|
quill.off('selection-change');
|
|
135
148
|
};
|
|
136
149
|
}, [quill?.container]);
|
|
137
|
-
const applySizes = quill => {
|
|
138
|
-
minHeight && (quill.root.style.minHeight = `${minHeight}px`);
|
|
139
|
-
maxHeight && (quill.root.style.maxHeight = `${maxHeight}px`);
|
|
140
|
-
maxWidth && (quill.root.style.maxWidth = `${maxWidth}px`);
|
|
141
|
-
width && (quill.root.style.width = `${width}px`);
|
|
142
|
-
height && (quill.root.style.height = `${height}px`);
|
|
143
|
-
minWidth && (quill.root.style.minWidth = `${minWidth}px`);
|
|
144
|
-
console.log('applied sizes', quill.root.style);
|
|
145
|
-
};
|
|
146
150
|
return _jsxs("div", {
|
|
147
151
|
css: theme => [styles.default(theme, maxHeight)],
|
|
148
152
|
children: [label && _jsx(Label, {
|
|
@@ -157,7 +161,7 @@ const QuillEditor = ({
|
|
|
157
161
|
...style
|
|
158
162
|
},
|
|
159
163
|
children: _jsx("div", {
|
|
160
|
-
ref:
|
|
164
|
+
ref: containerRef
|
|
161
165
|
})
|
|
162
166
|
}), invalidMessage && _jsx(ErrorWrapper, {
|
|
163
167
|
children: _jsxs(Text, {
|