{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-document-protection",
  "framework": "javascript",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "document-protection",
  "dependencies": [
    "@syncfusion/ej2-documenteditor",
    "@syncfusion/ej2-popups"
  ],
  "description": "Document editor enabling protected sections, restricted edits, and permission controls.",
  "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/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/docx-editor-document-protection.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-document-protection/docx-editor.html",
      "content": "<div>\n    <div class=\"col-lg-9 control-section\">\n  <div class=\"content-wrapper\">\n        <div class=\"flex-container\">\n            <label class=\"switchLabel\" for=\"toolbarSwitch\">Ribbon UI</label>\n            <div class=\"e-message render-mode-info\">\n                <span class=\"e-msg-icon render-mode-info-icon\"                  title=\"Turn OFF to switch from Ribbon to toolbar UI\"></span>\n            </div>\n            <input cssClass=\"buttonSwitch\" id=\"toolbarSwitch\" change=\"onChange\" type=\"checkbox\" />\n        </div>\n    </div>\n        <div id='documenteditor_titlebar' class=\"e-de-ctn-title\"></div>\n        <div id=\"container\"></div>\n\n    </div>\n    <div class=\"col-lg-3 property-section\">\n        <div class=\"content-wrapper\">\n            <div class=\"heading-section\">\n                <h5><b>User Permission</b></h5>\n            </div>\n\n            <div class=\"control-label\"><b>Current User</b>\n            </div>\n            <div class=\"control-label\">\n                <input type=\"text\" tabindex=\"1\" id='ddlelement' />\n            </div>\n            <div class=\"control-label\"><b>User Color</b>\n            </div>\n            <input id=\"color-picker\" type=\"color\">\n        </div>\n    </div>\n</div>\n\n<style>\n    .ej2-new {\n        height: 590px;\n    }\n      .flex-container {\n        display: flex;\n        justify-content: flex-end;\n        align-items: center;\n    }\n\n    .render-mode-info {\n        background: none;\n        border: none;\n        padding-left: 0px;\n    }\n\n    .render-mode-info .render-mode-info-icon {\n        height: 16px;\n        width: 16px;\n    }\n\n    .switchLabel {\n        font-family: \"Segoe UI\", \"GeezaPro\", \"DejaVu Serif\", sans-serif;\n        font-weight: 400;\n        line-height: 20px;\n        letter-spacing: 0.24px;\n        text-align: right;\n        font-size: 14px;\n        margin-bottom: 0px;\n    }\n\n    .render-mode-info .render-mode-info-icon::before {\n        line-height: normal;\n    }\n\n    .buttonSwitch {\n        Width: 40px;\n        Height: 24px;\n    }\n    #documenteditor_titlebar {\n        border-bottom: 1px solid #2B3481;\n        height: 36px;\n        line-height: 26px;\n        width: 100%;\n        font-size: 12px;\n        padding-left: 15px;\n        padding-right: 10px;\n        font-family: inherit;\n    }\n\n    #documenteditor_title_contentEditor {\n        height: 26px;\n        max-width: 85%;\n        width: auto;\n        overflow: hidden;\n        display: inline-block;\n        padding-left: 4px;\n        padding-right: 4px;\n        margin: 5px;\n    }\n\n    .single-line {\n        cursor: text !important;\n        outline: none;\n    }\n\n    .single-line:hover {\n        border-color: #e4e4e4 !important;\n    }\n\n    [contenteditable=\"true\"].single-line {\n        white-space: nowrap;\n        border-color: #e4e4e4 !important;\n    }\n\n    .property-panel-table div {\n        padding-left: 0px;\n    }\n\n    .heading-section {\n        padding-bottom: 20px;\n        padding-top: 20px;\n    }\n\n    .control-label {\n        padding-bottom: 15px;\n    }\n\n    /** Document editor sample level font icons*/\n\n    @font-face {\n        font-family: 'Sample brower icons';\n        font-weight: normal;\n        font-style: normal;\n    }\n\n    [class^=\"e-de-icon-\"],\n    [class*=\" e-de-icon-\"] {\n        font-family: 'Sample brower icons' !important;\n    }\n\n    .e-de-icon-Print:before {\n        content: \"\\e723\";\n    }\n\n    .e-de-icon-Download:before {\n        content: \"\\e728\";\n    }\n\n    /** sample level font icons ends*/\n</style>\n<script>\n    window.addEventListener(\"beforeunload\", onbeforeunload);\n    function onbeforeunload() {\n        return 'Want to save your changes?';\n    };\n</script>"
    },
    {
      "target": "src/components/docx-editor-document-protection/docx-editor.ts",
      "content": "import { DocumentEditorContainer, Ribbon, Toolbar } from '@syncfusion/ej2-documenteditor';\nimport {\n  createSpinner,\n  showSpinner,\n  hideSpinner,\n} from '@syncfusion/ej2-popups';\nimport { sfdtdata } from '../datasource/docx-editor-data';\n\n/**\n * Default document editor sample\n */\n\nfunction formatSave(type: string) {\n    createSpinner({\n        target: document.getElementById('container'),\n    });\n    showSpinner(document.getElementById('container'));\n    let format: string = type;\n    let url = (window as any).container.documentEditor.serviceUrl + 'Export';\n    let http = new XMLHttpRequest();\n    http.open('POST', url);\n    http.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n    http.responseType = 'blob';\n\n    let sfdt = {\n        Content: (window as any).container.documentEditor.serialize(),\n        Filename: (window as any).container.documentEditor.documentName,\n        Format: '.' + format,\n    };\n\n    http.onload = function () {\n        if (http.status === 200) {\n            let responseData = http.response;\n            let blobUrl = URL.createObjectURL(responseData);\n            let downloadLink = document.createElement('a');\n            downloadLink.href = blobUrl;\n            downloadLink.download =\n                (window as any).container.documentEditor.documentName + '.' + format.toLowerCase();\n            document.body.appendChild(downloadLink);\n            hideSpinner(document.getElementById('container'));\n            downloadLink.click();\n            document.body.removeChild(downloadLink);\n            URL.revokeObjectURL(blobUrl);\n        } else {\n            console.error('Request failed with status:', http.status);\n            hideSpinner(document.getElementById('container'));\n        }\n    };\n\n    http.send(JSON.stringify(sfdt));\n}\n\nexport function initDocxEditorDocumentProtection(): void {\n\n    let hostUrl: string = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';\n\n    let container: DocumentEditorContainer = new DocumentEditorContainer({\n        toolbarMode: 'Ribbon',\n        serviceUrl: hostUrl,\n        enableToolbar: true,\n        height: '590px',\n        documentEditorSettings: { showRuler: true },\n        fileMenuItems: [\n            'New',\n            'Open',\n            {\n                text: 'Export',\n                id: 'custom_item',\n                iconCss: 'e-icons e-export',\n                items: [\n                    { id: 'sfdt', text: 'Syncfusion Document Text (*.sfdt)' },\n                    { id: 'docx', text: 'Word Document (*.docx)' },\n                    { id: 'dotx', text: 'Word Template (*.dotx)' },\n                    { id: 'text', text: 'Plain Text (*.txt)' },\n                    { id: 'pdf', text: 'PDF (*.pdf)' },\n                    { id: 'html', text: 'HyperText Markup Language (*.html)' },\n                    { id: 'rtf', text: 'Rich Text Format (*.rtf)' },\n                    { id: 'md', text: 'Markdown (*.md)' },\n                    { id: 'odt', text: 'OpenDocument Text (*.odt)' },\n                    { id: 'wordml', text: 'Word XML Document (*.xml)' }\n                ],\n            },\n            'Print',\n        ],\n        fileMenuItemClick: function (args) {\n            if (args.item.id) {\n                let value: string = args.item.id;\n                let sampleName: string = container.documentEditor.documentName === '' ? 'sample' : container.documentEditor.documentName;\n                switch (value) {\n                    case 'docx':\n                        container.documentEditor.save(sampleName, 'Docx');\n                        break;\n                    case 'sfdt':\n                        container.documentEditor.save(sampleName, 'Sfdt');\n                        break;\n                    case 'text':\n                        container.documentEditor.save(sampleName, 'Txt');\n                        break;\n                    case 'dotx':\n                        container.documentEditor.save(sampleName, 'Dotx');\n                        break;\n                    case 'pdf':\n                        formatSave('Pdf');\n                        break;\n                    case 'html':\n                        formatSave('Html');\n                        break;\n                    case 'odt':\n                        formatSave('Odt');\n                        break;\n                    case 'md':\n                        formatSave('Md');\n                        break;\n                    case 'rtf':\n                        formatSave('Rtf');\n                        break;\n                    case 'wordml':\n                        formatSave('Xml');\n                        break;\n                }\n            }\n        },\n    });\n    DocumentEditorContainer.Inject(Toolbar, Ribbon);\n    container.appendTo('#container');\n    (window as any).container = container;\n\n    container.documentEditor.open(JSON.stringify({ sfdt: sfdtdata }));\n    container.documentEditor.documentName = 'Document Protection';\n\n    container.documentChange = (): void => {\n        container.documentEditor.focusIn();\n    };\n}\n"
    }
  ]
}