{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-track-changes",
  "framework": "angular",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "track-changes",
  "dependencies": [
    "@syncfusion/ej2-angular-documenteditor",
    "@syncfusion/ej2-angular-dropdowns",
    "@syncfusion/ej2-angular-buttons",
    "@syncfusion/ej2-angular-popups"
  ],
  "description": "Word editor shows tracked changes with accept and reject controls and a revision color dropdown.",
  "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/angular/llms.txt",
    "skillPack": "syncfusion/angular-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/angular/docx-editor-track-changes.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-track-changes/docx-editor.component.html",
      "content": "<div class=\"control-section\">\n    <div class=\"row\">\n        <div class=\"col-lg-10\">\n            <div id=\"default_title_bar\" class=\"e-de-ctn-title\"></div>\n            <div style=\"display:block; height: calc(100vh - 230px);\">\n                <ejs-documenteditorcontainer #documenteditor_default [enableToolbar]=true id=\"container\" [enableTrackChanges]=true [locale]=\"culture\" [toolbarMode]=\"'Ribbon'\" (created)=\"onCreate()\" [showPropertiesPane]=false\n                    (documentChange)=\"onDocumentChange()\" height=\"100%\" [serviceUrl]=\"hostUrl\"  style=\"display:block;\" userColor=\"#b70f34\" currentUser = \"Nancy Davolio\" [fileMenuItems]=\"fileMenuItems\" (fileMenuItemClick)=\"fileMenuItemClick($event)\"></ejs-documenteditorcontainer>\n            </div>\n        </div>\n        <div class=\"col-lg-2 property-section\">\n            <div style=\"padding-top: 20px;\">\n                <b>Revision Color Settings</b>\n            </div>\n            <div style=\"margin-top: 15px;\">\n                <div style=\"padding-top: 10px;\">\n                    <label style=\"display: block; margin-bottom: 5px; font-weight: 500;\">Insertion:</label>\n                    <ejs-dropdownlist\n                        id=\"insertion-color\"\n                        #insertionDrop\n                        [dataSource]=\"revisionColorData\"\n                        [fields]=\"fields\"\n                        value=\"byAuthor\"\n                        placeholder=\"Insertion\"\n                        floatLabelType=\"Never\"\n                        width=\"100%\"\n                        (change)=\"onColorChange()\"\n                    ></ejs-dropdownlist>\n                </div>\n                <div style=\"padding-top: 10px;\">\n                    <label style=\"display: block; margin-bottom: 5px; font-weight: 500;\">Deletion:</label>\n                    <ejs-dropdownlist\n                        id=\"deletion-color\"\n                        #deletionDrop\n                        [dataSource]=\"revisionColorData\"\n                        [fields]=\"fields\"\n                        value=\"byAuthor\"\n                        placeholder=\"Deletion\"\n                        floatLabelType=\"Never\"\n                        width=\"100%\"\n                        (change)=\"onColorChange()\"\n                    ></ejs-dropdownlist>\n                </div>\n                <div style=\"padding-top: 10px;\">\n                    <label style=\"display: block; margin-bottom: 5px; font-weight: 500;\">Inserted Rows:</label>\n                    <ejs-dropdownlist\n                        id=\"inserted-rows-color\"\n                        #insertedRowsDrop\n                        [dataSource]=\"revisionColorData\"\n                        [fields]=\"fields\"\n                        value=\"byAuthor\"\n                        placeholder=\"Inserted Rows\"\n                        floatLabelType=\"Never\"\n                        width=\"100%\"\n                        (change)=\"onColorChange()\"\n                    ></ejs-dropdownlist>\n                </div>\n                <div style=\"padding-top: 10px;\">\n                    <label style=\"display: block; margin-bottom: 5px; font-weight: 500;\">Deleted Rows:</label>\n                    <ejs-dropdownlist\n                        id=\"deleted-rows-color\"\n                        #deletedRowsDrop\n                        [dataSource]=\"revisionColorData\"\n                        [fields]=\"fields\"\n                        value=\"byAuthor\"\n                        placeholder=\"Deleted Rows\"\n                        floatLabelType=\"Never\"\n                        width=\"100%\"\n                        (change)=\"onColorChange()\"\n                    ></ejs-dropdownlist>\n                </div>\n            </div>\n            <div style=\"padding-top: 15px; margin-bottom: 10px;\">\n                <button\n                    ejs-button\n                    id=\"apply-btn\"\n                    #applyBtn\n                    cssClass=\"e-primary\"\n                    [disabled]=\"isApplyDisabled\"\n                    (click)=\"onApply()\"\n                >\n                    Apply\n                </button>\n            </div>\n        </div>\n    </div>\n</div>\n<style>\n    @import '../style.css';\n#documenteditor_title_contentEditor {\n        height: 26px;\n        max-width: 75%;\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    #default_title_bar {\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\t\tbox-sizing: border-box;\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.onbeforeunload = function () {\n        return 'Want to save your changes?';\n    };    \n</script>"
    },
    {
      "target": "src/components/docx-editor-track-changes/docx-editor.component.ts",
      "content": "import { Component, ViewEncapsulation, ViewChild } from '@angular/core';\nimport { ToolbarService, RibbonService, DocumentEditorContainerComponent, LayoutType, DocumentEditorContainerModule } from '@syncfusion/ej2-angular-documenteditor';\nimport { DropDownListModule, DropDownListComponent } from '@syncfusion/ej2-angular-dropdowns';\nimport { ButtonModule, ButtonComponent } from '@syncfusion/ej2-angular-buttons';\nimport { TitleBar } from '../title-bar';\nimport { trackchanges, WEB_API_ACTION } from '../datasource/docx-editor-data';\nimport { isNullOrUndefined } from '@syncfusion/ej2-base';\n\nimport { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-angular-popups';\n\n/**\n * Document Editor Component\n */\n@Component({\n    selector: 'control-content',\n    templateUrl: 'docx-editor.component.html',\n    encapsulation: ViewEncapsulation.None,\n    providers: [ToolbarService, RibbonService],\n    standalone: true,\n    imports: [DocumentEditorContainerModule, DropDownListModule, ButtonModule]\n})\nexport class TrackChangesComponent {\n    public hostUrl: string = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';\n    @ViewChild('documenteditor_default')\n    public container!: DocumentEditorContainerComponent;\n    @ViewChild('insertionDrop')\n    public insertionDrop!: DropDownListComponent;\n    @ViewChild('deletionDrop')\n    public deletionDrop!: DropDownListComponent;\n    @ViewChild('insertedRowsDrop')\n    public insertedRowsDrop!: DropDownListComponent;\n    @ViewChild('deletedRowsDrop')\n    public deletedRowsDrop!: DropDownListComponent;\n    @ViewChild('applyBtn')\n    public applyBtn!: ButtonComponent;\n\n    public isApplyDisabled: boolean = true;\n    public fields: Object = { text: 'Text', value: 'Value' };\n    public revisionColorData: { [key: string]: Object }[] = [\n        { Text: 'By author', Value: 'byAuthor' },\n        { Text: 'Blue', Value: '#0000FF' },\n        { Text: 'Red', Value: '#FF0000' },\n        { Text: 'Pink', Value: '#FFC0CB' },\n        { Text: 'Yellow', Value: '#FFFF00' }\n    ];\n\n    public culture: string = 'en-US';\n    titleBar!: TitleBar;\n    layoutType: LayoutType = \"Continuous\";\n\n    public fileMenuItems: any = [\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\n    public fileMenuItemClick(args: any): void {\n        if (args.item.id) {\n            let value: string = args.item.id;\n            switch (value) {\n                case 'docx':\n                this.container.documentEditor.save('Sample', 'Docx');\n                break;\n                case 'sfdt':\n                this.container.documentEditor.save('Sample', 'Sfdt');\n                break;\n                case 'text':\n                this.container.documentEditor.save('Sample', 'Txt');\n                break;\n                case 'dotx':\n                this.container.documentEditor.save('Sample', 'Dotx');\n                break;\n                case 'pdf':\n                this.formatSave('Pdf');\n                break;\n                case 'html':\n                this.formatSave('Html');\n                break;\n                case 'odt':\n                this.formatSave('Odt');\n                break;\n                case 'md':\n                this.formatSave('Md');\n                break;\n                case 'rtf':\n                this.formatSave('Rtf');\n                break;\n                case 'wordml':\n                this.formatSave('Xml');\n                break;\n            }\n        }\n    }\n\n    public formatSave(type: string): void {\n        createSpinner({\n            target: document.getElementById('container')!,\n        });\n        showSpinner(document.getElementById('container')!);\n        let format: string = type;\n        let url = this.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'; // Set the responseType to 'blob' to handle binary data\n\n        // Prepare data to send\n        let sfdt = {\n            Content: this.container.documentEditor.serialize(),\n            Filename: this.container.documentEditor.documentName,\n            Format: '.' + format,\n        };\n\n        // Set up event listener for the response\n        http.onload = () => {\n            if (http.status === 200) {\n                // Handle the response blob here\n                let responseData = http.response;\n\n                // Create a Blob URL for the response data\n                let blobUrl = URL.createObjectURL(responseData);\n\n                // Create a link element and trigger the download\n                let downloadLink = document.createElement('a');\n                downloadLink.href = blobUrl;\n                downloadLink.download = this.container.documentEditor.documentName + '.' + format.toLowerCase();\n                document.body.appendChild(downloadLink);\n                hideSpinner(document.getElementById('container')!);\n                downloadLink.click();\n\n                // Cleanup: Remove the link and revoke the Blob URL\n                document.body.removeChild(downloadLink);\n                URL.revokeObjectURL(blobUrl);\n            } else {\n                // Handle errors\n                console.error('Request failed with status:', http.status);\n                hideSpinner(document.getElementById('container')!);\n            }\n        };\n\n        // Send the request with JSON.stringify(sfdt) as the request body\n        http.send(JSON.stringify(sfdt));\n    }\n\n    onCreate(): void {\n        let titleBarElement: HTMLElement = document.getElementById('default_title_bar')!;\n        this.titleBar = new TitleBar(titleBarElement, this.container.documentEditor, true);\n        this.container.documentEditor.open(JSON.stringify(trackchanges));\n        this.container.documentEditor.documentName = 'Track Changes';\n        this.container.documentEditorSettings.showRuler = true;\n        this.titleBar.updateDocumentTitle();\n        this.titleBar.showButtons(false);\n    }\n    onDocumentChange(): void {\n        if (!isNullOrUndefined(this.titleBar)) {\n            this.titleBar.updateDocumentTitle();\n        }\n       this.container.documentEditor.focusIn();\n    }\n\n    public onColorChange(): void {\n        this.isApplyDisabled = false;\n        if (this.applyBtn) {\n            this.applyBtn.disabled = false;\n        }\n    }\n\n    public onApply(): void {\n        if (this.container) {\n            this.container.documentEditorSettings.revisionSettings = {\n                insertRevisionColor: this.insertionDrop?.value as string,\n                deleteRevisionColor: this.deletionDrop?.value as string,\n                insertedRowColor: this.insertedRowsDrop?.value as string,\n                deletedRowColor: this.deletedRowsDrop?.value as string\n            };\n        }\n    }\n}\n"
    }
  ]
}