@griddo/ax 11.12.1-rc.1 → 11.12.1-rc.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "11.12.1-rc.1",
4
+ "version": "11.12.1-rc.3",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -217,5 +217,5 @@
217
217
  "publishConfig": {
218
218
  "access": "public"
219
219
  },
220
- "gitHead": "8ea1525f89858a6dd6625fa997380f7666f9080f"
220
+ "gitHead": "7cfc307bcd23d652bc2a9e4fedfaa78ac8f9986c"
221
221
  }
@@ -70,7 +70,7 @@ describe("Browser component rendering", () => {
70
70
 
71
71
  renderBrowser(defaultProps);
72
72
 
73
- expect(screen.getByTestId("nav-actions-wrapper")).toBeInTheDocument();
73
+ expect(screen.queryByTestId("nav-actions-wrapper")).not.toBeInTheDocument();
74
74
  expect(screen.queryByTestId("navbar-iframe-wrapper")).not.toBeInTheDocument();
75
75
  expect(screen.getByTestId("browser-content-wrapper")).toBeInTheDocument();
76
76
  });
@@ -63,6 +63,7 @@ const Browser = (props: IBrowserProps): JSX.Element => {
63
63
  const isFormEditor = editorType === "form";
64
64
  const isHeadingsEditor = editorType === "headings";
65
65
  const isKeywordsEditor = editorType === "keywords";
66
+ const isZoomEditor = isPageEditor || isHeadingsEditor || isKeywordsEditor;
66
67
 
67
68
  const frameWrapperRef = useRef<HTMLDivElement>(null);
68
69
 
@@ -82,6 +83,8 @@ const Browser = (props: IBrowserProps): JSX.Element => {
82
83
  localStorage.setItem("selectedID", "0");
83
84
  (window as any).browserRef = null;
84
85
 
86
+ if (!isZoomEditor) return;
87
+
85
88
  const el = frameWrapperRef.current;
86
89
  if (!el) return;
87
90
 
@@ -99,7 +102,7 @@ const Browser = (props: IBrowserProps): JSX.Element => {
99
102
  observer.observe(el);
100
103
 
101
104
  return () => observer.disconnect();
102
- }, []);
105
+ }, [isZoomEditor]);
103
106
 
104
107
  // Fetch share data when in preview mode
105
108
  useEffect(() => {
@@ -188,7 +191,7 @@ const Browser = (props: IBrowserProps): JSX.Element => {
188
191
  }
189
192
  };
190
193
 
191
- const scaledWidth = !isPreview
194
+ const scaledWidth = isZoomEditor
192
195
  ? Math.floor(parseInt(dimensions.resolution) * (parseInt(dimensions.zoom) / 100))
193
196
  : undefined;
194
197
 
@@ -201,8 +204,13 @@ const Browser = (props: IBrowserProps): JSX.Element => {
201
204
 
202
205
  return (
203
206
  <S.OuterContainer ref={frameWrapperRef}>
204
- <S.BrowserWrapper data-testid="browser-wrapper" ref={browserRef} scaledWidth={scaledWidth} isPreview={isPreview}>
205
- {(isPageEditor || isHeadingsEditor || isKeywordsEditor) && (
207
+ <S.BrowserWrapper
208
+ data-testid="browser-wrapper"
209
+ ref={browserRef}
210
+ scaledWidth={scaledWidth}
211
+ isPreview={!isZoomEditor}
212
+ >
213
+ {isZoomEditor && (
206
214
  <S.NavBar>
207
215
  <S.NavUrl>{url}</S.NavUrl>
208
216
  {isPreview ? (
@@ -247,30 +255,34 @@ const Browser = (props: IBrowserProps): JSX.Element => {
247
255
  </S.IconWrapper>
248
256
  </S.NavActions>
249
257
  ) : (
250
- <S.NavActions data-testid="nav-actions-wrapper">
251
- <S.ResolutionWrapper>
252
- <S.SelectLabel>Screen</S.SelectLabel>
253
- <Select
254
- name="resolution"
255
- options={resolutionOptions}
256
- value={dimensions.resolution}
257
- onChange={handleResolutionChange}
258
- type="round"
259
- offSet="30%"
260
- mandatory
261
- />
262
- </S.ResolutionWrapper>
263
- <S.ZoomWrapper>
264
- <Select
265
- name="zoom"
266
- options={zoomOptionsWithDisabled}
267
- value={dimensions.zoom}
268
- onChange={handleZoomChange}
269
- type="round"
270
- mandatory
271
- />
272
- </S.ZoomWrapper>
273
- </S.NavActions>
258
+ <>
259
+ {showIframe && (
260
+ <S.NavActions data-testid="nav-actions-wrapper">
261
+ <S.ResolutionWrapper>
262
+ <S.SelectLabel>Screen</S.SelectLabel>
263
+ <Select
264
+ name="resolution"
265
+ options={resolutionOptions}
266
+ value={dimensions.resolution}
267
+ onChange={handleResolutionChange}
268
+ type="round"
269
+ offSet="30%"
270
+ mandatory
271
+ />
272
+ </S.ResolutionWrapper>
273
+ <S.ZoomWrapper>
274
+ <Select
275
+ name="zoom"
276
+ options={zoomOptionsWithDisabled}
277
+ value={dimensions.zoom}
278
+ onChange={handleZoomChange}
279
+ type="round"
280
+ mandatory
281
+ />
282
+ </S.ZoomWrapper>
283
+ </S.NavActions>
284
+ )}
285
+ </>
274
286
  )}
275
287
  </S.NavBar>
276
288
  )}
@@ -284,11 +296,7 @@ const Browser = (props: IBrowserProps): JSX.Element => {
284
296
  $compact={isCompact}
285
297
  />
286
298
  )}
287
- <S.FrameWrapper
288
- hasBorder={isPageEditor || isHeadingsEditor || isKeywordsEditor}
289
- isFormEditor={isFormEditor}
290
- data-testid="navbar-iframe-wrapper"
291
- >
299
+ <S.FrameWrapper hasBorder={isZoomEditor} isFormEditor={isFormEditor} data-testid="navbar-iframe-wrapper">
292
300
  {isPreview ? (
293
301
  <iframe
294
302
  title="Preview"
@@ -301,23 +309,23 @@ const Browser = (props: IBrowserProps): JSX.Element => {
301
309
  ) : (
302
310
  <div
303
311
  style={{
304
- width: `${scaledWidth}px`,
312
+ width: scaledWidth !== undefined ? `${scaledWidth}px` : "100%",
305
313
  height: "100%",
306
314
  overflow: "hidden",
307
- flexShrink: 0,
315
+ flexShrink: isZoomEditor ? 0 : "unset",
308
316
  }}
309
317
  >
310
318
  <iframe
311
319
  title="Preview"
312
- width={dimensions.resolution}
320
+ width={isZoomEditor ? dimensions.resolution : "100%"}
313
321
  src={urlPreview}
314
322
  loading="lazy"
315
323
  className="frame-content"
316
324
  style={{
317
325
  display: "block",
318
- transform: `scale(${parseInt(dimensions.zoom) / 100})`,
326
+ transform: isZoomEditor ? `scale(${parseInt(dimensions.zoom) / 100})` : "scale(1)",
319
327
  transformOrigin: "0 0",
320
- height: `${Math.round(100 / (parseInt(dimensions.zoom) / 100))}%`,
328
+ height: isZoomEditor ? `${Math.round(100 / (parseInt(dimensions.zoom) / 100))}%` : "100%",
321
329
  }}
322
330
  />
323
331
  </div>
@@ -70,7 +70,7 @@ const FrameWrapper = styled.div<{ hasBorder: boolean; isFormEditor: boolean }>`
70
70
  justify-content: center;
71
71
  flex: 1;
72
72
  min-height: 0;
73
- padding: ${(p) => (p.isFormEditor ? p.theme.spacing.m : "0")};
73
+ padding: ${(p) => (p.isFormEditor ? `${p.theme.spacing.m} 0 0 ${p.theme.spacing.m}` : "0")};
74
74
  `;
75
75
 
76
76
  const OuterContainer = styled.div`
@@ -67,12 +67,16 @@ const analyzeHeadings = (headings: HeadingNode[], isFiltering = false): IHeading
67
67
 
68
68
  // 2. Check for incorrect nesting (skipped levels)
69
69
  const nestingErrorIds: number[] = [];
70
+ let lastValidLevel = flatHeadings[0].level;
70
71
  for (let i = 1; i < flatHeadings.length; i++) {
71
- const prevLevel = flatHeadings[i - 1].level;
72
72
  const currLevel = flatHeadings[i].level;
73
73
 
74
- if (currLevel > prevLevel && currLevel - prevLevel > 1) {
74
+ if (currLevel > lastValidLevel + 1) {
75
+ // Heading skips levels - mark as error
75
76
  nestingErrorIds.push(flatHeadings[i].id);
77
+ } else {
78
+ // Correct nesting - update last valid level
79
+ lastValidLevel = currLevel;
76
80
  }
77
81
  }
78
82
  if (nestingErrorIds.length > 0) {
@@ -39,11 +39,22 @@ const KeywordsPreviewModal = (props: IKeywordsPreviewProps) => {
39
39
  const handleDeleteKeyword = (value: string) => {
40
40
  setDeletedKeyword(value);
41
41
  deleteKeyword(value);
42
+ setKeywordsFilter([]);
43
+ };
44
+
45
+ const handleCloseModal = () => {
46
+ setKeywordsFilter([]);
47
+ toggleModal();
48
+ };
49
+
50
+ const handleAddKeywords = (value: string[]) => {
51
+ setKeywordsFilter([]);
52
+ addKeywords(value);
42
53
  };
43
54
 
44
55
  return (
45
56
  <S.Wrapper>
46
- <FloatingPanel title="Keywords" toggleModal={toggleModal} closeOnOutsideClick={false} isOpen={isOpen} width={358}>
57
+ <FloatingPanel title="Keywords" toggleModal={handleCloseModal} closeOnOutsideClick={false} isOpen={isOpen} width={358}>
47
58
  {isOpen && (
48
59
  <S.KeywordsWrapper>
49
60
  {keywordsFilter.length > 0 && (
@@ -79,7 +90,7 @@ const KeywordsPreviewModal = (props: IKeywordsPreviewProps) => {
79
90
  </S.KeywordsWrapper>
80
91
  )}
81
92
  </FloatingPanel>
82
- <AddKeywordsModal isOpen={isAddOpen} toggleModal={toggleAddModal} addNewKeyword={addKeywords} />
93
+ <AddKeywordsModal isOpen={isAddOpen} toggleModal={toggleAddModal} addNewKeyword={handleAddKeywords} />
83
94
  {isVisible && <Toast message={toastState} setIsVisible={setIsVisible} />}
84
95
  </S.Wrapper>
85
96
  );
@@ -11,18 +11,27 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
11
11
 
12
12
  const [rwidth, setRwidth] = useState(MIN_WIDTH);
13
13
  const rightPanelRef = useRef<HTMLDivElement>(null);
14
+ const containerRef = useRef<HTMLDivElement>(null);
14
15
 
15
16
  const calculateFixedPanelMinWidth = (currentWidth: number) => {
16
- const minWidth = 1280 - currentWidth - 32;
17
- return minWidth < 500 ? "500px" : `${minWidth}px`;
17
+ const containerWidth = containerRef.current?.offsetWidth ?? 1280;
18
+ const minWidth = Math.max(500, containerWidth - currentWidth - 32);
19
+ return `${minWidth}px`;
18
20
  };
19
21
 
20
22
  useEffect(() => {
21
- requestAnimationFrame(() => {
22
- if (rightPanelRef.current) {
23
- setRwidth(rightPanelRef.current.offsetWidth);
24
- }
25
- });
23
+ const updateWidth = () => {
24
+ requestAnimationFrame(() => {
25
+ if (rightPanelRef.current) {
26
+ setRwidth(rightPanelRef.current.offsetWidth);
27
+ }
28
+ });
29
+ };
30
+
31
+ updateWidth();
32
+
33
+ window.addEventListener("resize", updateWidth);
34
+ return () => window.removeEventListener("resize", updateWidth);
26
35
  }, []);
27
36
 
28
37
  const resize = (value: number) => {
@@ -30,7 +39,7 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
30
39
  };
31
40
 
32
41
  return (
33
- <>
42
+ <div ref={containerRef} style={{ display: "flex", width: "100%", height: "100%" }}>
34
43
  <S.LeftPanel data-testid="left-panel">
35
44
  {fixed ? (
36
45
  <S.FixedPanel
@@ -48,7 +57,7 @@ const ResizePanel = (props: IResizePanelProps): JSX.Element => {
48
57
  <S.RightPanel ref={rightPanelRef} data-testid="right-panel" style={{ width: rwidth ? `${rwidth}px` : "auto" }}>
49
58
  {rightPanel}
50
59
  </S.RightPanel>
51
- </>
60
+ </div>
52
61
  );
53
62
  };
54
63
 
@@ -3,7 +3,7 @@ import styled from "styled-components";
3
3
  const LeftPanel = styled.section`
4
4
  position: relative;
5
5
  flex-grow: 1;
6
- min-width: 500px;
6
+ min-width: 620px;
7
7
  `;
8
8
 
9
9
  const RightPanel = styled.section`
@@ -12,7 +12,7 @@ const RightPanel = styled.section`
12
12
  padding: ${(p) => `0 ${p.theme.spacing.m} ${p.theme.spacing.m} ${p.theme.spacing.m}`};
13
13
  flex-shrink: 0;
14
14
  min-width: 368px;
15
- max-width: ${(p) => `calc(100% - 500px - ${p.theme.spacing.m})`};
15
+ max-width: ${(p) => `calc(100% - 620px - ${p.theme.spacing.m})`};
16
16
  flex-direction: column;
17
17
  `;
18
18
 
@@ -21,8 +21,8 @@ const Label = styled.span<{ $color: string; $above?: boolean }>`
21
21
  p.$above
22
22
  ? `
23
23
  transform: none;
24
- top: -25px;
25
- left: 1px;
24
+ top: -20px;
25
+ left: -2px;
26
26
  `
27
27
  : `
28
28
  transform: rotate(-90deg);