From c2029e8f4efda5929fceb50c4bf8d22c854b04c2 Mon Sep 17 00:00:00 2001 From: kavitha Muralitharan Date: Thu, 3 Apr 2025 17:33:42 +0530 Subject: [PATCH 1/2] 933177: Added code to disable content control using cc properties --- .../document-editor/content-control.md | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ej2-asp-core-mvc/document-editor/content-control.md b/ej2-asp-core-mvc/document-editor/content-control.md index 9375c89b28..8ada8da1cb 100644 --- a/ej2-asp-core-mvc/document-editor/content-control.md +++ b/ej2-asp-core-mvc/document-editor/content-control.md @@ -68,9 +68,41 @@ container.documentEditor.editor.insertContentControl('Picture'); container.documentEditor.editor.insertContentControl('Picture', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADgSURBVEhLY3jx4sV/WuDBafCluXH/D6ydhlWObIMPLmn8/32KPBiD2OjyKAY7+zbDsX945/91azehiBWU9IPVgVwJMxSX4SgG65jXwrGVa+v/6TOXoojBDEZ2LQh/m676/+D+/XBzQJgsg0EY5GqQgSCDsYUz2QaDMCiosIUvCKMYDFKIjK9dvYrCB3kXJIaMkfUjY5JdDEpioCCAYZCFyGbAMFkGI0fcMDUYpAgZY4s8EEYWwxWBJLsYhJHFQIYjmwHDQ9xgkGEwDCp0QAYji8EMRhYjymBq4lGDofjFfwCV5AGEIf9DQQAAAABJRU5ErkJggg=='); {% endhighlight %} +## Content Control Properties + +Content control properties [`ContentControlInfo`] can be set using the [`setContentControlInfo`] + +* title : Specifies the title of the content control. +* tag: Specifies the tag associated with the content control. +* value: Specifies the value of the content control. +* canDelete: Specifies whether the content control can be deleted. +* canEdit: Specifies whether the content control can be edited. +* items: Specifies items for the content control, applicable if the type is combobox or dropdownlist. +* type : Specifies the type of content control. +* xmlString: Specifies the XML string used for data binding, XML content to be mapped within the content control. +* xmlPath?: Specifies the XPath expression for XML mapping, This path identifies the specific part of the XML data to bind to the content control. + +### Enable-Disable Content Control in Document editor control + +Document Editor content control can be enable/disable using the ContentControlInfo properties. + +The following example illustrates to disable the content control after inserting the content control in DocumentEditorContainer. + +{% highlight ts %} +container.documentEditor.editor.insertContentControl('RichText','{{product_code}}'); +var contentControlInfo = container.documentEditor.selection.getContentControlInfo(); +//Specifies whether the content control can be Edited. +// To Disable Editing use "true" and To Enable Editing use "false". +contentControlInfo.canEdit = true; +//Specifies whether the content control can be Deleted. +// To Disable Deleting use "true" and To Enable Editing use "false". +contentControlInfo.canDelete = true; +container.documentEditor.editor.setContentControlInfo(contentControlInfo); +{% endhighlight %} + ## Import content control properties -Content control properties can be set using the `ContentControlInfo` and import it using `importContentControlData` +Content control properties can be import using `importContentControlData` {% highlight ts %} var data = []; From 9f9b4a4d4b0c4e5edaee5d863aceef38116df490 Mon Sep 17 00:00:00 2001 From: kavitha Muralitharan Date: Wed, 7 May 2025 16:35:50 +0530 Subject: [PATCH 2/2] 933177: Updated Review Changes - separate content --- .../document-editor/content-control.md | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ej2-asp-core-mvc/document-editor/content-control.md b/ej2-asp-core-mvc/document-editor/content-control.md index 8ada8da1cb..d3ce4a571f 100644 --- a/ej2-asp-core-mvc/document-editor/content-control.md +++ b/ej2-asp-core-mvc/document-editor/content-control.md @@ -82,21 +82,33 @@ Content control properties [`ContentControlInfo`] can be set using the [`setCont * xmlString: Specifies the XML string used for data binding, XML content to be mapped within the content control. * xmlPath?: Specifies the XPath expression for XML mapping, This path identifies the specific part of the XML data to bind to the content control. -### Enable-Disable Content Control in Document editor control +### Prevent Editing Content Control in Document editor control -Document Editor content control can be enable/disable using the ContentControlInfo properties. +Document Editor content control can prevent editing using the ContentControlInfo properties. -The following example illustrates to disable the content control after inserting the content control in DocumentEditorContainer. +The following example illustrates how to prevent editing the content control after inserting the content control in DocumentEditorContainer. {% highlight ts %} container.documentEditor.editor.insertContentControl('RichText','{{product_code}}'); var contentControlInfo = container.documentEditor.selection.getContentControlInfo(); //Specifies whether the content control can be Edited. -// To Disable Editing use "true" and To Enable Editing use "false". -contentControlInfo.canEdit = true; +// Use "true" to restrict editing of the content control, and "false" to allow editing. +**contentControlInfo.canEdit = true;** +container.documentEditor.editor.setContentControlInfo(contentControlInfo); +{% endhighlight %} + +### Prevent Deleting Content Control in Document editor control + +Document Editor content control can be prevented from being deleted using the ContentControlInfo properties. + +The following example illustrates how to prevent deleting the content control after inserting the content control in DocumentEditorContainer. + +{% highlight ts %} +container.documentEditor.editor.insertContentControl('RichText','{{product_code}}'); +var contentControlInfo = container.documentEditor.selection.getContentControlInfo(); //Specifies whether the content control can be Deleted. -// To Disable Deleting use "true" and To Enable Editing use "false". -contentControlInfo.canDelete = true; +// Use "true" to prevent the deletion of the content control, and "false" to allow its removal. +**contentControlInfo.canDelete = true;** container.documentEditor.editor.setContentControlInfo(contentControlInfo); {% endhighlight %}