{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-document-list",
  "framework": "react",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "document-list",
  "dependencies": [
    "@syncfusion/ej2-react-documenteditor",
    "@syncfusion/ej2-react-popups"
  ],
  "description": "Document list dialog opens named Word documents by author into the editor with title bar.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": true,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/ts/docx-editor-document-list.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-document-list/DocxEditor.tsx",
      "content": "import { useEffect, useRef, useState } from 'react';\nimport { DocumentEditorContainerComponent, Ribbon, Toolbar } from '@syncfusion/ej2-react-documenteditor';\nimport { DialogComponent } from '@syncfusion/ej2-react-popups';\nimport { defaultDocument, characterFormat, paragraphFormat, styles, weblayout } from '../datasource/docx-editor-data';\nimport { TitleBar } from '../title-bar';\nimport '../default.component.css';\n\nDocumentEditorContainerComponent.Inject(Toolbar, Ribbon);\n\ninterface Dictionary {\n    [key: string]: object;\n}\n\nlet gridData: Object[] = [\n    {\n        FileName: 'Getting Started.docx', Author: 'Ryan Hodson'\n    },\n    {\n        FileName: 'Character Formatting.docx', Author: 'Elton Stoneman'\n    },\n    {\n        FileName: 'Paragraph Format.docx', Author: 'Peter Shaw'\n    },\n    {\n        FileName: 'Style.docx', Author: 'Cody Lindley'\n    },\n    {\n        FileName: 'Web Layout.docx', Author: 'Scott Allen'\n    },\n];\n\nconst Default = () => {\n    useEffect(() => {\n        // Initialize after first render to wire up title bar and editor defaults\n        setTimeout(() => initContainer(), 0);\n    }, []);\n    const [dictionary] = useState<Dictionary>({\n        'Getting Started.docx': defaultDocument,\n        'Character Formatting.docx': characterFormat,\n        'Paragraph Format.docx': paragraphFormat,\n        'Style.docx': styles,\n        'Web Layout.docx': weblayout\n    });\n\n    const dialogRef = useRef<DialogComponent>(null);\n    const containerRef = useRef<DocumentEditorContainerComponent>(null);\n    const [isDialogOpen, setDialogOpen] = useState(false);\n\n    const hostUrl: string = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';\n\n    let titleBar: TitleBar | null = null;\n\n    function initContainer(): void {\n        if (!containerRef.current) return;\n        const editor = containerRef.current.documentEditor;\n\n        // Title bar hookup\n        const titleBarElement = document.getElementById(\"documenteditor_titlebar\");\n        if (titleBarElement) {\n            titleBar = new TitleBar(\n                titleBarElement,\n                editor,\n                true, false, dialogRef.current ?? undefined\n            );\n        }\n\n        // Basic defaults\n        editor.pageOutline = '#E0E0E0';\n        editor.acceptTab = true;\n        containerRef.current.documentEditorSettings.showRuler = true;\n\n        // Keep title updated\n        containerRef.current.documentChange = () => {\n            titleBar?.updateDocumentTitle();\n            editor.focusIn();\n        };\n\n        containerRef.current.resize();\n    }\n\n    function dialogClose(): void {\n        setDialogOpen(false);\n    }\n\n    function dialogOpen(): void {\n        setDialogOpen(true);\n        // Ensure sizing is correct when dialog is visible\n        setTimeout(() => containerRef.current?.documentEditor?.resize(), 0);\n    }\n\n    function openDoc(mode: 'View' | 'Edit', row: any): void {\n        if (!containerRef.current) return;\n        dialogOpen();\n\n        const editor = containerRef.current.documentEditor;\n\n        // Load from in-memory dictionary for demo\n        if ((dictionary as any).hasOwnProperty(row.FileName)) {\n            editor.open(JSON.stringify((dictionary as any)[row.FileName]));\n        }\n\n        if (mode === 'View') {\n            editor.isReadOnly = true;\n            editor.enableContextMenu = false;\n\n            // Hide \"Share\" button if available, show close button in title-bar\n            const downloadButton = document.getElementById('documenteditor-share') as HTMLButtonElement | null;\n            if (downloadButton) downloadButton.style.display = 'none';\n            const closeButton = document.getElementById('de-close') as HTMLButtonElement | null;\n            if (closeButton) closeButton.style.display = 'block';\n\n            editor.documentName = row.FileName.replace('.docx', '');\n            const titleEl = document.getElementById('documenteditor_title_name');\n            if (titleEl) titleEl.textContent = editor.documentName;\n\n            containerRef.current.toolbarItems = ['Open', 'Separator', 'Find'];\n        } else {\n            editor.isReadOnly = false;\n            editor.enableContextMenu = true;\n\n            const downloadButton = document.getElementById('documenteditor-share') as HTMLButtonElement | null;\n            if (downloadButton) downloadButton.style.display = 'block';\n            const closeButton = document.getElementById('de-close') as HTMLButtonElement | null;\n            if (closeButton) closeButton.style.display = 'block';\n\n            editor.documentName = row.FileName.replace('.docx', '');\n            const titleEl = document.getElementById('documenteditor_title_name');\n            if (titleEl) titleEl.textContent = editor.documentName;\n\n            containerRef.current.toolbarItems = [\n                'New', 'Open', 'Separator', 'Undo', 'Redo', 'Separator', 'Image', 'Table', 'Hyperlink',\n                'Bookmark', 'TableOfContents', 'Separator', 'Header', 'Footer', 'PageSetup', 'PageNumber',\n                'Break', 'InsertFootnote', 'InsertEndnote', 'Separator', 'Find', 'Separator', 'Comments',\n                'TrackChanges', 'Separator', 'LocalClipboard', 'RestrictEditing', 'Separator', 'FormFields',\n                'UpdateFields'\n            ];\n        }\n        containerRef.current.resize();\n    }\n    return (\n        <div className=\"control-pane documenteditor-list-sample\">\n            {/* Bootstrap-like table (no Syncfusion Grid) */}\n            <div id=\"Grid\" style={{ \"display\": \"block\", \"height\": \"calc(100vh - 180px)\" }}>\n                <table className=\"table table-hover table-borderless align-middle\">\n                    <thead>\n                        <tr>\n                            <th scope=\"col\">File Name</th>\n                            <th scope=\"col\">Author</th>\n                            <th scope=\"col\" className=\"e-de-table-actions-header\">Actions</th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        {gridData.map((row: any, idx: number) => (\n                            <tr key={idx}>\n                                <td className=\"file-name-cell\">\n                                    <div>\n                                        <svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n                                            <path d=\"M3 3C3 1.34315 4.34315 0 6 0H16.7574C17.553 0 18.3161 0.316071 18.8787 0.87868L26.1213 8.12132C26.6839 8.68393 27 9.44699 27 10.2426V27C27 28.6569 25.6569 30 24 30H6C4.34315 30 3 28.6569 3 27V3Z\" fill=\"#4889EF\" />\n                                            <path d=\"M17.5 11H25V10.5042C25 9.76949 24.7304 9.0603 24.2422 8.51114L19.9463 3.67818C18.9974 2.61074 17.6374 2 16.2092 2H16V9.5C16 10.3284 16.6716 11 17.5 11Z\" fill=\"#D6E5FE\" />\n                                            <path d=\"M10.3044 12H10.8868H11.104H11.6817L12.6231 16.3922L13.3963 12H15L13.5719 19H12.777H12.5552H11.8943L10.993 15.0093L10.1103 19H9.44945H9.22761H8.42808L7 12H8.60832L9.38188 16.3816L10.3044 12Z\" fill=\"white\" />\n                                            <rect x=\"7\" y=\"21\" width=\"16\" height=\"2\" rx=\"1\" fill=\"white\" />\n                                            <rect x=\"7\" y=\"25\" width=\"11\" height=\"2\" rx=\"1\" fill=\"white\" />\n                                        </svg>\n                                        <span style={{ verticalAlign: 'super', marginLeft: '5px' }} title={row.FileName}>\n                                            {row.FileName}\n                                        </span>\n                                    </div>\n                                </td>\n                                <td className=\"e-de-table-author-cell\">{row.Author}</td>\n                                <td className=\"e-de-table-actions-cell\">\n                                    <button\n                                        type=\"button\"\n                                        className=\"btn btn-sm btn-link text-secondary p-2 e-de-view-btn\"\n                                        title=\"View\"\n                                        onClick={() => openDoc('View', row)}\n                                    >\n                                        <span className=\"e-icons e-eye e-flat e-de-view-icon\" aria-hidden=\"true\"></span>\n                                    </button>\n                                    <button\n                                        type=\"button\"\n                                        className=\"btn btn-sm btn-link text-secondary p-2 e-de-edit-btn\"\n                                        title=\"Edit\"\n                                        onClick={() => openDoc('Edit', row)}\n                                    >\n                                        <span className=\"e-icons e-edit e-flat e-de-edit-icon\" aria-hidden=\"true\"></span>\n                                    </button>\n                                </td>\n                            </tr>\n                        ))}\n                    </tbody>\n                </table>\n            </div>\n\n            <DialogComponent\n                id=\"defaultDialog\"\n                ref={dialogRef}\n                visible={isDialogOpen}\n                minHeight={'90%'}\n                width={'90%'}\n                height={'90%'}\n                isModal={true}\n                open={dialogOpen}\n                close={dialogClose}\n            >\n                <div>\n                    <div id=\"documenteditor_titlebar\" className=\"e-de-ctn-title\"></div>\n                    <div id=\"documenteditor_container_body\" style={{ \"display\": \"block\", \"height\": \"calc(100vh - 230px)\" }}>\n                        <DocumentEditorContainerComponent showPropertiesPane={false}\n                            id=\"container\" height='100%'\n                            ref={containerRef}\n                            style={{ display: \"block\" }}\n                            serviceUrl={hostUrl}\n                            zIndex={3000}\n                            enableToolbar={true}\n                            locale=\"en-US\"\n                        />\n                    </div>\n                </div>\n            </DialogComponent>\n        </div>\n    );\n}\nexport default Default;\n"
    }
  ]
}