@mirrormedia/lilith-draft-editor 3.0.9 → 3.0.11

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.
@@ -14,9 +14,7 @@ var _modals = require("@keystone-ui/modals");
14
14
 
15
15
  var _fields = require("@keystone-ui/fields");
16
16
 
17
- var _styledComponents = _interopRequireDefault(require("styled-components"));
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
20
18
 
21
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
20
 
@@ -26,6 +24,40 @@ const Label = _styledComponents.default.label`
26
24
  display: block;
27
25
  font-weight: 600;
28
26
  margin: 10px 0;
27
+ `; // Global styles for Drawer on mobile devices
28
+
29
+ const DrawerMobileStyles = (0, _styledComponents.createGlobalStyle)`
30
+ @media (max-width: 767px) {
31
+ /* Target all possible Drawer containers - emotion may generate different class names */
32
+ div[role="dialog"][aria-modal="true"],
33
+ form[role="dialog"][aria-modal="true"],
34
+ [role="dialog"][aria-modal="true"] {
35
+ width: 100vw !important;
36
+ max-width: 100vw !important;
37
+ min-width: 0 !important;
38
+ left: 0 !important;
39
+ right: 0 !important;
40
+ margin-left: 0 !important;
41
+ margin-right: 0 !important;
42
+ }
43
+
44
+ /* Ensure content doesn't overflow */
45
+ [role="dialog"][aria-modal="true"] > * {
46
+ max-width: 100% !important;
47
+ box-sizing: border-box !important;
48
+ }
49
+
50
+ [role="dialog"][aria-modal="true"] * {
51
+ max-width: 100% !important;
52
+ box-sizing: border-box !important;
53
+ }
54
+
55
+ /* Input fields */
56
+ [role="dialog"][aria-modal="true"] input {
57
+ width: 100% !important;
58
+ max-width: 100% !important;
59
+ }
60
+ }
29
61
  `;
30
62
 
31
63
  function getYoutubeId(urlOrId = '') {
@@ -53,9 +85,37 @@ function YoutubeInput(props) {
53
85
 
54
86
  const clearInputValue = () => {
55
87
  setInputValue(initialInputValue);
56
- };
88
+ }; // Apply mobile styles dynamically when drawer is open
89
+ // This ensures we override emotion's inline styles
90
+
57
91
 
58
- return /*#__PURE__*/_react.default.createElement(_modals.DrawerController, {
92
+ (0, _react.useEffect)(() => {
93
+ if (!isOpen) return;
94
+
95
+ const applyMobileStyles = () => {
96
+ const drawer = document.querySelector('[role="dialog"][aria-modal="true"]');
97
+
98
+ if (drawer && window.innerWidth <= 767) {
99
+ // Use setProperty with important flag
100
+ drawer.style.setProperty('width', '100vw', 'important');
101
+ drawer.style.setProperty('max-width', '100vw', 'important');
102
+ drawer.style.setProperty('min-width', '0', 'important');
103
+ drawer.style.setProperty('left', '0', 'important');
104
+ drawer.style.setProperty('right', '0', 'important');
105
+ drawer.style.setProperty('margin', '0', 'important');
106
+ }
107
+ }; // Apply immediately and after delays to ensure drawer is fully rendered
108
+
109
+
110
+ applyMobileStyles();
111
+ const timeout1 = setTimeout(applyMobileStyles, 10);
112
+ const timeout2 = setTimeout(applyMobileStyles, 50);
113
+ return () => {
114
+ clearTimeout(timeout1);
115
+ clearTimeout(timeout2);
116
+ };
117
+ }, [isOpen]);
118
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(DrawerMobileStyles, null), /*#__PURE__*/_react.default.createElement(_modals.DrawerController, {
59
119
  isOpen: isOpen
60
120
  }, /*#__PURE__*/_react.default.createElement(_modals.Drawer, {
61
121
  title: `Insert Youtube video`,
@@ -100,7 +160,7 @@ function YoutubeInput(props) {
100
160
  placeholder: "youtubeId or url",
101
161
  id: "youtubeIdOrUrl",
102
162
  value: inputValue.youtubeIdOrUrl
103
- })));
163
+ }))));
104
164
  }
105
165
 
106
166
  function YoutubeButton(props) {
@@ -352,6 +352,10 @@ const DraftEditorControlsWrapper = _styledComponents.default.div`
352
352
  flex-wrap: wrap;
353
353
  padding-right: 45px;
354
354
  column-gap: 5px;
355
+
356
+ @media (max-width: 767px) {
357
+ padding-right: 10px;
358
+ }
355
359
  `;
356
360
  const TextEditorWrapper = _styledComponents.default.div`
357
361
  /* Rich-editor default setting (.RichEditor-editor)*/
@@ -438,7 +442,7 @@ const DraftEditorContainer = _styledComponents.default.div`
438
442
  }
439
443
  `;
440
444
  const ButtonGroup = _styledComponents.default.div`
441
- margin: 0 10px 0 0;
445
+ margin: 0;
442
446
  ${({
443
447
  isDisabled
444
448
  }) => isDisabled ? (0, _styledComponents.css)`
@@ -106,7 +106,7 @@ const ImageMetaGridsWrapper = _styledComponents.default.div`
106
106
  overflow: auto;
107
107
  `;
108
108
  const ImageMetaGridWrapper = _styledComponents.default.div`
109
- width: 33.3333%;
109
+ width: 100%;
110
110
  cursor: pointer;
111
111
  padding: 0 10px 10px;
112
112
  `;
@@ -121,6 +121,9 @@ const Label = _styledComponents.default.label`
121
121
  margin: 10px 0;
122
122
  font-weight: 600;
123
123
  `;
124
+ const StyledTextInput = (0, _styledComponents.default)(_fields.TextInput)`
125
+ width: 100%;
126
+ `;
124
127
  const SeparationLine = _styledComponents.default.div`
125
128
  border: #e1e5e9 1px solid;
126
129
  margin-top: 10px;
@@ -220,7 +223,7 @@ function ImageMetaGrid(props) {
220
223
  }
221
224
  }), /*#__PURE__*/_react.default.createElement(ImageName, null, image === null || image === void 0 ? void 0 : image.name), enableCaption && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Label, {
222
225
  htmlFor: "caption"
223
- }, "Image Caption:"), /*#__PURE__*/_react.default.createElement(_fields.TextInput, {
226
+ }, "Image Caption:"), /*#__PURE__*/_react.default.createElement(StyledTextInput, {
224
227
  id: "caption",
225
228
  type: "text",
226
229
  placeholder: image === null || image === void 0 ? void 0 : image.name,
@@ -234,7 +237,7 @@ function ImageMetaGrid(props) {
234
237
  })
235
238
  })), enableUrl && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Label, {
236
239
  htmlFor: "url"
237
- }, "Url:"), /*#__PURE__*/_react.default.createElement(_fields.TextInput, {
240
+ }, "Url:"), /*#__PURE__*/_react.default.createElement(StyledTextInput, {
238
241
  id: "url",
239
242
  type: "text",
240
243
  placeholder: "(Optional)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirrormedia/lilith-draft-editor",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {