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

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.2",
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": "edc26c065f085f6c1b2665d4a2f1bd3067fdc24d"
221
221
  }
@@ -82,6 +82,9 @@ const Browser = (props: IBrowserProps): JSX.Element => {
82
82
  localStorage.setItem("selectedID", "0");
83
83
  (window as any).browserRef = null;
84
84
 
85
+ // Only setup ResizeObserver for pageEditor
86
+ if (!isPageEditor) 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
+ }, [isPageEditor]);
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 = isPageEditor
192
195
  ? Math.floor(parseInt(dimensions.resolution) * (parseInt(dimensions.zoom) / 100))
193
196
  : undefined;
194
197
 
@@ -201,7 +204,12 @@ 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}>
207
+ <S.BrowserWrapper
208
+ data-testid="browser-wrapper"
209
+ ref={browserRef}
210
+ scaledWidth={scaledWidth}
211
+ isPreview={!isPageEditor}
212
+ >
205
213
  {(isPageEditor || isHeadingsEditor || isKeywordsEditor) && (
206
214
  <S.NavBar>
207
215
  <S.NavUrl>{url}</S.NavUrl>
@@ -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
  )}
@@ -301,23 +313,23 @@ const Browser = (props: IBrowserProps): JSX.Element => {
301
313
  ) : (
302
314
  <div
303
315
  style={{
304
- width: `${scaledWidth}px`,
316
+ width: scaledWidth !== undefined ? `${scaledWidth}px` : "100%",
305
317
  height: "100%",
306
318
  overflow: "hidden",
307
- flexShrink: 0,
319
+ flexShrink: isPageEditor ? 0 : "unset",
308
320
  }}
309
321
  >
310
322
  <iframe
311
323
  title="Preview"
312
- width={dimensions.resolution}
324
+ width={isPageEditor ? dimensions.resolution : "100%"}
313
325
  src={urlPreview}
314
326
  loading="lazy"
315
327
  className="frame-content"
316
328
  style={{
317
329
  display: "block",
318
- transform: `scale(${parseInt(dimensions.zoom) / 100})`,
330
+ transform: isPageEditor ? `scale(${parseInt(dimensions.zoom) / 100})` : "scale(1)",
319
331
  transformOrigin: "0 0",
320
- height: `${Math.round(100 / (parseInt(dimensions.zoom) / 100))}%`,
332
+ height: isPageEditor ? `${Math.round(100 / (parseInt(dimensions.zoom) / 100))}%` : "100%",
321
333
  }}
322
334
  />
323
335
  </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,17 @@ const analyzeHeadings = (headings: HeadingNode[], isFiltering = false): IHeading
67
67
 
68
68
  // 2. Check for incorrect nesting (skipped levels)
69
69
  const nestingErrorIds: number[] = [];
70
- for (let i = 1; i < flatHeadings.length; i++) {
71
- const prevLevel = flatHeadings[i - 1].level;
70
+ let expectedMaxLevel = 2; // Start: we expect H1 or H2
71
+ for (let i = 0; i < flatHeadings.length; i++) {
72
72
  const currLevel = flatHeadings[i].level;
73
73
 
74
- if (currLevel > prevLevel && currLevel - prevLevel > 1) {
74
+ if (currLevel > expectedMaxLevel) {
75
+ // Heading skips levels - mark as error
75
76
  nestingErrorIds.push(flatHeadings[i].id);
77
+ // Don't update expectedMaxLevel - stay strict on what we expect next
78
+ } else {
79
+ // Correct nesting - update expected max level for next heading
80
+ expectedMaxLevel = currLevel + 1;
76
81
  }
77
82
  }
78
83
  if (nestingErrorIds.length > 0) {
@@ -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);