{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-track-changes",
  "framework": "vue",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "track-changes",
  "dependencies": [
    "@syncfusion/ej2-vue-buttons",
    "@syncfusion/ej2-vue-documenteditor",
    "@syncfusion/ej2-vue-dropdowns",
    "@syncfusion/ej2-vue-popups",
    "@syncfusion/ej2-vue-splitbuttons"
  ],
  "description": "Word editor shows tracked changes with accept and reject controls and revision color dropdowns.",
  "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/vue/llms.txt",
    "skillPack": "syncfusion/vue-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/vue/docx-editor-track-changes.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-track-changes/DocxEditor.vue",
      "content": "<template>\n    <div class=\"control-pane\">\n    <div class=\"row\">\n    <div class=\"col-lg-10 control-section\">\n    <div class=\"sample-container\">\n        <div class=\"default-section\">\n          <div ref=\"de_titlebar\" id=\"documenteditor_titlebar\" class=\"e-de-ctn-title\">\n            <div v-on:keydown=\"titleBarKeydownEvent\" v-on:click=\"titleBarClickEvent\" class=\"single-line\" id=\"documenteditor_title_contentEditor\" title=\"Document Name. Click or tap to rename this document.\" contenteditable=\"false\">\n                <label v-on:blur=\"titleBarBlurEvent\" id=\"documenteditor_title_name\" :style=\"titileStyle\" >{{documentName}}</label>\n            </div>\n            <ejs-button ref=\"de-print\" id=\"de-print\" :style=\"iconStyle\" :iconCss=\"printIconCss\" v-on:click=\"printBtnClick\" title=\"Print this document (Ctrl+P).\">Print</ejs-button>\n            <ejs-dropdownbutton ref=\"de-export\" :style=\"iconStyle\" :items=\"exportItems\" :iconCss=\"exportIconCss\" cssClass=\"e-caret-hide\" content=\"Download\" v-bind:select=\"onExport\" :open=\"openExportDropDown\" title=\"Download this document.\"></ejs-dropdownbutton>\n        </div>\n        <div id=\"documenteditor_container_body\" style=\"display:block; height: calc(100vh - 230px);\">\n        <ejs-documenteditorcontainer id=\"container\" ref=\"doceditcontainer\" :toolbarMode=\"'Ribbon'\" :serviceUrl=\"hostUrl\" :enableToolbar='true' :enableTrackChanges='true' :fileMenuItems=\"fileMenuItems\" :fileMenuItemClick=\"fileMenuItemClick\" height='100%' currentUser = 'Nancy Davolio' userColor='#b70f34' :showPropertiesPane=\"false\"></ejs-documenteditorcontainer>\n        </div>\n        </div>\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 id=\"insertion-color\" ref=\"insertionDrop\" :dataSource=\"revisionColorData\" :fields=\"colorFields\" value=\"byAuthor\" placeholder=\"Insertion\" :floatLabelType=\"'Never'\" width=\"100%\" :change=\"onColorChange\"></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 id=\"deletion-color\" ref=\"deletionDrop\" :dataSource=\"revisionColorData\" :fields=\"colorFields\" value=\"byAuthor\" placeholder=\"Deletion\" :floatLabelType=\"'Never'\" width=\"100%\" :change=\"onColorChange\"></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 id=\"inserted-rows-color\" ref=\"insertedRowsDrop\" :dataSource=\"revisionColorData\" :fields=\"colorFields\" value=\"byAuthor\" placeholder=\"Inserted Rows\" :floatLabelType=\"'Never'\" width=\"100%\" :change=\"onColorChange\"></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 id=\"deleted-rows-color\" ref=\"deletedRowsDrop\" :dataSource=\"revisionColorData\" :fields=\"colorFields\" value=\"byAuthor\" placeholder=\"Deleted Rows\" :floatLabelType=\"'Never'\" width=\"100%\" :change=\"onColorChange\"></ejs-dropdownlist>\n            </div>\n        </div>\n        <div style=\"padding-top: 15px; margin-bottom: 10px;\">\n            <ejs-button id=\"apply-btn\" ref=\"applyBtnRef\" cssClass=\"e-primary\" :disabled=\"isApplyDisabled\" v-on:click=\"onApply\">Apply</ejs-button>\n        </div>\n    </div>\n    </div>\n    </div>\n</template>\n<style>\n#documenteditor_titlebar {\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\n[contenteditable=\"true\"].single-line {\n    white-space: nowrap;\n    border-color: #e4e4e4 !important;\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</style>\n<script>\nimport { DocumentEditorContainerComponent, Toolbar, Ribbon } from \"@syncfusion/ej2-vue-documenteditor\";\nimport { DropDownButtonComponent } from \"@syncfusion/ej2-vue-splitbuttons\";\nimport { createSpinner, showSpinner, hideSpinner } from \"@syncfusion/ej2-vue-popups\";\nimport { trackchanges } from \"../datasource/docx-editor-data\";\nimport { ButtonComponent } from \"@syncfusion/ej2-vue-buttons\";\nimport { DropDownListComponent } from \"@syncfusion/ej2-vue-dropdowns\";\nimport \"../style.css\";\n\nexport default {\n    components: {\n        'ejs-documenteditorcontainer': DocumentEditorContainerComponent,\n        'ejs-dropdownbutton': DropDownButtonComponent,\n        'ejs-button': ButtonComponent,\n        'ejs-dropdownlist': DropDownListComponent\n    },\n    data: function() {\n        return {\n          hostUrl : 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/',\n          documentName : 'Track  Changes',\n          documentTitle: 'Untitled Document',\n          iconStyle: 'float:right;background: transparent;box-shadow:none;border-color: transparent;border-radius: 2px;color:inherit;font-size:12px;text-transform:capitalize;margin-top:4px;height:28px;font-weight:400;font-family:inherit;',\n            titileStyle: 'text-transform:capitalize;font-weight:400;font-family:inherit;text-overflow:ellipsis;white-space:pre;overflow:hidden;user-select:none;cursor:text',\n            openIconCss: 'e-de-icon-Open e-de-padding-right',\n            printIconCss: 'e-de-icon-Print e-de-padding-right',\n            exportIconCss: 'e-de-icon-Download e-de-padding-right',\n            exportItems: [\n                { text: 'Syncfusion Document Text (*.sfdt)', id: 'sfdt' },\n                { text: 'Word Document (*.docx)', id: 'word' },\n                { text: 'Word Template (*.dotx)', id: 'dotx' },\n                { text: 'Plain Text (*.txt)', id: 'txt' },\n            ],\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            revisionColorData: [\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            colorFields: { text: 'Text', value: 'Value' },\n            isApplyDisabled: true\n        };\n    },  \n    provide:{\n        DocumentEditorContainer:[Toolbar,Ribbon]\n    },\n      methods: {\n        fileMenuItemClick: function (args) {\n            if (args.item.id) {\n                let value = args.item.id;\n                let documentEditor = this.$refs.doceditcontainer.ej2Instances.documentEditor;\n                switch (value) {\n                    case 'docx':\n                        documentEditor.save(documentEditor.documentName === '' ? 'sample' : documentEditor.documentName, 'Docx');\n                        break;\n                    case 'sfdt':\n                        documentEditor.save(documentEditor.documentName === '' ? 'sample' : documentEditor.documentName, 'Sfdt');\n                        break;\n                    case 'text':\n                        documentEditor.save(documentEditor.documentName === '' ? 'sample' : documentEditor.documentName, 'Txt');\n                        break;\n                    case 'dotx':\n                        documentEditor.save(documentEditor.documentName === '' ? 'sample' : documentEditor.documentName, '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        onExport: function (args) {\n            switch (args.item.id) {\n                case 'word':\n                    this.save('Docx');\n                    break;\n                case 'sfdt':\n                    this.save('Sfdt');\n                    break;\n                case 'txt':\n                    this.save('Txt');\n                    break;\n                case 'dotx':\n                    this.save('Dotx');\n                    break;\n            }\n        },\n        openExportDropDown: function () {\n            // tslint:disable-next-line:max-line-length\n            document.getElementById('word').setAttribute('title', 'Download a copy of this document to your computer as a DOCX file.');\n            // tslint:disable-next-line:max-line-length\n            document.getElementById('sfdt').setAttribute('title', 'Download a copy of this document to your computer as an SFDT file.');\n            // tslint:disable-next-line:max-line-length\n            document.getElementById('txt').setAttribute('title', 'Download a copy of this document to your computer as a TXT file.');\n            // tslint:disable-next-line:max-line-length\n            document.getElementById('dotx').setAttribute('title', 'Download a copy of this document to your computer as a DOTX file.');\n        },\n        save: function (format) {\n            // tslint:disable-next-line:max-line-length\n             this.$refs.doceditcontainer.ej2Instances.documentEditor.save( this.$refs.doceditcontainer.ej2Instances.documentEditor.documentName === '' ? 'sample' :  this.$refs.doceditcontainer.ej2Instances.documentEditor.documentName, format);\n        },\n        formatSave: function (type) {\n            let documentEditor = this.$refs.doceditcontainer.ej2Instances.documentEditor;\n            let containerElement = this.$refs.doceditcontainer.ej2Instances.element;\n            createSpinner({ target: containerElement });\n            showSpinner(containerElement);\n            let format = type;\n            let url = 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            let sfdt = {\n                Content: documentEditor.serialize(),\n                Filename: documentEditor.documentName,\n                Format: '.' + format,\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 = documentEditor.documentName + '.' + format.toLowerCase();\n                    document.body.appendChild(downloadLink);\n                    hideSpinner(containerElement);\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(containerElement);\n                }\n            };\n            http.send(JSON.stringify(sfdt));\n        },\n        openBtnClick: function () {\n            this.$refs.uploadDocument.click();\n        },\n        printBtnClick: function () {\n            this.$refs.doceditcontainer.ej2Instances.documentEditor.print();\n        },\n        titleBarKeydownEvent: function (e) {\n            if (e.keyCode === 13) {\n                e.preventDefault();\n                document.getElementById(\"documenteditor_title_contentEditor\").contentEditable = 'false';\n                if (document.getElementById(\"documenteditor_title_contentEditor\").textContent === '') {\n                    document.getElementById(\"documenteditor_title_contentEditor\").textContent = 'Document1';\n                }\n            }\n        },\n        titleBarBlurEvent: function (args) {\n            if (document.getElementById(\"documenteditor_title_contentEditor\").textContent === '') {\n                document.getElementById(\"documenteditor_title_contentEditor\").textContent = 'Document1';\n            }\n            document.getElementById(\"documenteditor_title_contentEditor\").contentEditable = 'false';\n            this.$refs.doceditcontainer.ej2Instances.documentEditor.documentName = document.getElementById(\"documenteditor_title_name\").textContent;\n        },\n        titleBarClickEvent: function () {\n            this.updateDocumentEditorTitle();\n        },\n        updateDocumentEditorTitle: function () {\n            document.getElementById(\"documenteditor_title_contentEditor\").contentEditable = 'true';\n            document.getElementById(\"documenteditor_title_contentEditor\").focus();\n            window.getSelection().selectAllChildren(document.getElementById(\"documenteditor_title_contentEditor\"));\n        },\n        onColorChange: function () {\n            this.isApplyDisabled = false;\n            if (this.$refs.applyBtnRef && this.$refs.applyBtnRef.ej2Instances) {\n                this.$refs.applyBtnRef.ej2Instances.disabled = false;\n            }\n        },\n        onApply: function () {\n            let container = this.$refs.doceditcontainer;\n            if (container) {\n                container.ej2Instances.documentEditorSettings = {\n                    revisionSettings: {\n                        insertRevisionColor: this.$refs.insertionDrop.ej2Instances.value,\n                        deleteRevisionColor: this.$refs.deletionDrop.ej2Instances.value,\n                        insertedRowColor: this.$refs.insertedRowsDrop.ej2Instances.value,\n                        deletedRowColor: this.$refs.deletedRowsDrop.ej2Instances.value\n                    }\n                };\n            }\n        },\n        documentChangedEvent: function () {\n            var obj = this.$refs.doceditcontainer.ej2Instances.documentEditor;\n            this.documentTitle = obj.documentName === '' ? 'Untitled Document' : obj.documentName;\n            document.getElementById(\"documenteditor_title_name\").textContent = obj.documentName ;\n            setTimeout(() => { obj.scrollToPage(1); }, 10);\n        }\n    },\n    mounted() {\n        this.$nextTick(function () {\n          var obj = this.$refs.doceditcontainer.ej2Instances.documentEditor;\n          obj.open(JSON.stringify(trackchanges));         \t\t  \n          obj.documentName='Track Changes';\n\t\t  this.$refs.doceditcontainer.ej2Instances.showPropertiesPane = false;\n          this.$refs.doceditcontainer.ej2Instances.documentEditorSettings.showRuler = true;\n          this.$refs.doceditcontainer.ej2Instances.documentChange = () => {\n          this.documentChangedEvent();\n            };\n       });\n    }\n};\n</script>"
    }
  ]
}