@gcforms/editor 1.0.20 → 1.0.22

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/CHANGELOG.md CHANGED
@@ -5,9 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.22] - 2026-08-21
9
+
10
+ - Fix collapsible icon warnings
11
+
12
+ ## [1.0.21] - 2026-08-19
13
+
14
+ - Enable collapsible / details extension
15
+
8
16
  ## [1.0.20] - 2026-08-19
9
17
 
10
- - Updste collapsible / details extension styles
18
+ - Update collapsible / details extension styles
11
19
 
12
20
  ## [1.0.19] - 2026-08-17
13
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcforms/editor",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "author": "Canadian Digital Service",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/src/Editor.tsx CHANGED
@@ -36,7 +36,6 @@ interface EditorProps {
36
36
  className?: string;
37
37
  maxLength?: number;
38
38
  enableDraggableBlocks?: boolean;
39
- enableCollapsibleBlocks?: boolean;
40
39
 
41
40
  onChange?(...args: unknown[]): unknown;
42
41
  }
@@ -53,7 +52,6 @@ export const Editor = ({
53
52
  className,
54
53
  maxLength,
55
54
  enableDraggableBlocks = false,
56
- enableCollapsibleBlocks = false,
57
55
  }: EditorProps) => {
58
56
  contentLocale = contentLocale || locale;
59
57
 
@@ -76,11 +74,7 @@ export const Editor = ({
76
74
  <ToolbarContext>
77
75
  <LexicalExtensionComposer extension={editorExtension} contentEditable={null}>
78
76
  <div className="gc-editor-container">
79
- <ToolbarPlugin
80
- editorId={editorId}
81
- setIsLinkEditMode={setIsLinkEditMode}
82
- enableCollapsibleBlocks={enableCollapsibleBlocks}
83
- />
77
+ <ToolbarPlugin editorId={editorId} setIsLinkEditMode={setIsLinkEditMode} />
84
78
  <ShortcutsPlugin setIsLinkEditMode={setIsLinkEditMode} />
85
79
  <RichTextPlugin
86
80
  contentEditable={
package/src/i18n/en.json CHANGED
@@ -23,6 +23,6 @@
23
23
  "tooltipOutdent": "Outdent",
24
24
  "indent": "Indent",
25
25
  "outdent": "Outdent",
26
- "tooltipInsertCollapsible": "Details component",
26
+ "tooltipInsertCollapsible": "Details",
27
27
  "insertCollapsible": "Insert collapsible container"
28
28
  }
package/src/i18n/fr.json CHANGED
@@ -23,6 +23,6 @@
23
23
  "tooltipOutdent": "Suppression d'indentation",
24
24
  "indent": "Indentation",
25
25
  "outdent": "Suppression d'indentation",
26
- "tooltipInsertCollapsible": "Composant détails",
26
+ "tooltipInsertCollapsible": "Détails",
27
27
  "insertCollapsible": "Insérer un conteneur réductible"
28
28
  }
@@ -1,11 +1,18 @@
1
1
  export const CollapsibleIcon = () => (
2
- <svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M9 6.25L3 9.5V3L9 6.25Z" fill="black" />
4
+ <path d="M17.5 8L14 3L21 3L17.5 8Z" fill="black" />
3
5
  <path
4
- d="m5 7 5 5 5-5"
5
- stroke="currentColor"
6
- strokeWidth="1.8"
6
+ d="M3 14.5H10M3 21H10M3 17.75H10"
7
+ stroke="#64748B"
8
+ strokeWidth="2"
9
+ strokeLinecap="round"
10
+ />
11
+ <path
12
+ d="M14 14.5L21 14.5M14 21H21M14 17.75L21 17.75"
13
+ stroke="black"
14
+ strokeWidth="2"
7
15
  strokeLinecap="round"
8
- strokeLinejoin="round"
9
16
  />
10
17
  </svg>
11
18
  );
@@ -48,11 +48,9 @@ import { CollapsibleIcon } from "../../icons/CollapsibleIcon";
48
48
  export default function ToolbarPlugin({
49
49
  editorId,
50
50
  setIsLinkEditMode,
51
- enableCollapsibleBlocks,
52
51
  }: {
53
52
  editorId: string;
54
53
  setIsLinkEditMode: (isLinkEditMode: boolean) => void;
55
- enableCollapsibleBlocks: boolean;
56
54
  }) {
57
55
  const [editor] = useLexicalComposerContext();
58
56
 
@@ -73,7 +71,7 @@ export default function ToolbarPlugin({
73
71
  }
74
72
  }, [activeEditor, setIsLinkEditMode, toolbarState.isLink]);
75
73
 
76
- const toolbarItemCount = enableCollapsibleBlocks ? 10 : 9;
74
+ const toolbarItemCount = 10;
77
75
 
78
76
  const itemsRef = useRef<[HTMLButtonElement] | []>([]);
79
77
  const [currentFocusIndex, setCurrentFocusIndex] = useState(0);
@@ -414,24 +412,22 @@ export default function ToolbarPlugin({
414
412
  </button>
415
413
  </ToolTip>
416
414
 
417
- {enableCollapsibleBlocks && (
418
- <ToolTip text={t("tooltipInsertCollapsible")}>
419
- <button
420
- tabIndex={currentFocusIndex == 9 ? 0 : -1}
421
- ref={(el) => {
422
- const index = "button-9" as unknown as number;
423
- if (el && itemsRef.current) itemsRef.current[index] = el;
424
- }}
425
- disabled={!isEditable}
426
- onClick={() => insertCollapsible(editor)}
427
- className="toolbar-item"
428
- aria-label={t("insertCollapsible")}
429
- data-testid="collapsible-button"
430
- >
431
- <CollapsibleIcon />
432
- </button>
433
- </ToolTip>
434
- )}
415
+ <ToolTip text={t("tooltipInsertCollapsible")}>
416
+ <button
417
+ tabIndex={currentFocusIndex == 9 ? 0 : -1}
418
+ ref={(el) => {
419
+ const index = "button-9" as unknown as number;
420
+ if (el && itemsRef.current) itemsRef.current[index] = el;
421
+ }}
422
+ disabled={!isEditable}
423
+ onClick={() => insertCollapsible(editor)}
424
+ className="toolbar-item"
425
+ aria-label={t("insertCollapsible")}
426
+ data-testid="collapsible-button"
427
+ >
428
+ <CollapsibleIcon />
429
+ </button>
430
+ </ToolTip>
435
431
  </div>
436
432
  </>
437
433
  );
@@ -50,9 +50,9 @@ describe("Lexical Editor", () => {
50
50
  // Toolbar has aria-controls attribute
51
51
  expect(toolbar).toHaveAttribute("aria-controls", contentArea.id);
52
52
 
53
- // Collapsible content is disabled by default.
54
- expect(toolbarButtons).toHaveLength(9);
55
- expect(within(toolbar).queryByTestId("collapsible-button")).not.toBeInTheDocument();
53
+ // Details component is enabled by default.
54
+ expect(toolbarButtons).toHaveLength(10);
55
+ expect(within(toolbar).getByTestId("collapsible-button")).toBeInTheDocument();
56
56
 
57
57
  // Content area has default content and attributes
58
58
  expect(contentArea).toHaveAttribute("aria-label", "AriaLabel");
@@ -66,12 +66,7 @@ describe("Lexical Editor", () => {
66
66
  it("can insert collapsible content from the toolbar", async () => {
67
67
  const onChange = vi.fn();
68
68
  const rendered = render(
69
- <Editor
70
- id="editor-test"
71
- content="Here is some content"
72
- onChange={onChange}
73
- enableCollapsibleBlocks
74
- />
69
+ <Editor id="editor-test" content="Here is some content" onChange={onChange} />
75
70
  );
76
71
 
77
72
  await act(async () => {