diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs new file mode 100644 index 0000000000..e1cd786115 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs @@ -0,0 +1,9 @@ + public class HomeController : Controller + { + + public ActionResult Index() + { + return View(); + } + + } \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/razor b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/razor new file mode 100644 index 0000000000..2dd9d003c5 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/razor @@ -0,0 +1,10 @@ +@Html.EJS().RichTextEditor("clipboardCleanup").BeforeClipboardWrite("beforeClipboardWrite").Render() + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/tagHelper b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/tagHelper new file mode 100644 index 0000000000..ecfb44b209 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup-customize/tagHelper @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/controller.cs b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/controller.cs new file mode 100644 index 0000000000..e1cd786115 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/controller.cs @@ -0,0 +1,9 @@ + public class HomeController : Controller + { + + public ActionResult Index() + { + return View(); + } + + } \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/razor b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/razor new file mode 100644 index 0000000000..e37d66fec9 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/razor @@ -0,0 +1,2 @@ + +@Html.EJS().RichTextEditor("clipboardCleanup").Render() \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/tagHelper b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/tagHelper new file mode 100644 index 0000000000..fc14abcee9 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/rich-text-editor/clipboard-cleanup/tagHelper @@ -0,0 +1 @@ + diff --git a/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.MVC/clipboard-cleanup.md b/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.MVC/clipboard-cleanup.md new file mode 100644 index 0000000000..6dafb378ac --- /dev/null +++ b/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.MVC/clipboard-cleanup.md @@ -0,0 +1,79 @@ +--- +layout: post +title: Clipboard Cleanup in ##Platform_Name## Syncfusion Rich Text Editor Component +description: Learn here all about Clipboard Cleanup in Syncfusion ##Platform_Name## Rich Text Editor component of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Clipboard Cleanup +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Clipboard Cleanup in ##Platform_Name## Rich Text Editor Control + +The Rich Text Editor supports automatic cleanup of clipboard content during copy (`Ctrl + C`) and cut (`Ctrl + X`) operations. When this feature is enabled, unwanted inline styles are automatically removed from the clipboard content while preserving important structural elements such as tables, lists, and images. You can enable this behavior using the [EnableClipboardCleanup](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.richtexteditor.richtexteditor.html#Syncfusion_EJ2_RichTextEditor_RichTextEditor_EnableClipboardCleanup) property. + +When `EnableClipboardCleanup` is set to `true`, copy and cut operations are intercepted to remove unwanted inline styles. When set to `false` the browser’s default copy and cut behavior applies. + +> For a cleaner editing experience, `EnableClipboardCleanup` is `true` by default. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/controller.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/controller.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + +## Customizing Copied/Cut Content + +You can use the [BeforeClipboardWrite](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.richtexteditor.richtexteditor.html#Syncfusion_EJ2_RichTextEditor_RichTextEditor_BeforeClipboardWrite) event, which fires before content is written to the clipboard during copy or cut operations. This event lets you to modify the HTML and plain-text representations of the content and also determine whether the action is a copy or a cut. + +In this example, the `BeforeClipboardWrite` event is used to customize the selected content only during a copy operation, while the cut operation remains unaffected. To observe this behavior, try copying any text within the Rich Text Editor. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + +## Best Practices & Troubleshooting + +### Best Practices + +- Use `BeforeClipboardWrite` sparingly — heavy processing can slightly delay `Ctrl+C`. + +### Common Issues + +- “Event not firing” → Make sure you’re using the correct event name `BeforeClipboardWrite` (PascalCase in MVC). diff --git a/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.NETCORE/clipboard-cleanup.md b/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.NETCORE/clipboard-cleanup.md new file mode 100644 index 0000000000..b8391864f1 --- /dev/null +++ b/ej2-asp-core-mvc/rich-text-editor/EJ2_ASP.NETCORE/clipboard-cleanup.md @@ -0,0 +1,80 @@ +--- +layout: post +title: Clipboard Cleanup in ##Platform_Name## Syncfusion Rich Text Editor Control +description: Learn here all about Clipboard Cleanup in Syncfusion ##Platform_Name## Rich Text Editor control of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Clipboard Cleanup +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Clipboard Cleanup in ##Platform_Name## Rich Text Editor Control + +The Rich Text Editor supports automatic cleanup of clipboard content during copy (`Ctrl + C`) and cut (`Ctrl + X`) operations. When this feature is enabled, unwanted inline styles are automatically removed from the clipboard content while preserving important structural elements such as tables, lists, and images. You can enable this behavior using the [enableClipboardCleanup](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.richtexteditor.richtexteditor.html#Syncfusion_EJ2_RichTextEditor_RichTextEditor_EnableClipboardCleanup) property. + +When `enableClipboardCleanup` is set to `true`, copy and cut operations are intercepted to remove unwanted inline styles. When set to `false` the browser’s default copy and cut behavior applies. + +> For a cleaner editing experience, `enableClipboardCleanup` is `true` by default. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/controller.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup/controller.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + +## Customizing Copied/Cut Content + +You can use the [beforeClipboardWrite](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.RichTextEditor.RichTextEditor.html#Syncfusion_EJ2_RichTextEditor_RichTextEditor_BeforeClipboardWrite) event, which fires before content is written to the clipboard during copy or cut operations. This event lets you to modify the HTML and plain-text representations of the content and also determine whether the action is a copy or a cut. + +In this example, the `beforeClipboardWrite` event is used to customize the selected content only during a copy operation, while the cut operation remains unaffected. To observe this behavior, try copying any text within the Rich Text Editor. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/razor %} +{% endhighlight %} +{% highlight c# tabtitle="Controller.cs" %} +{% include code-snippet/rich-text-editor/clipboard-cleanup-customize/controller.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + +## Best Practices & Troubleshooting + +### Best Practices + +- Use `beforeClipboardWrite` sparingly — heavy processing can slightly delay `Ctrl+C`. + +### Common Issues + +- “Event not firing” → Make sure you’re using the correct event name `beforeClipboardWrite` (camelCase in Core). + diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index c19f6ed8da..7c20d150b9 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -2247,6 +2247,7 @@
  • Code Block
  • Remove Formatting
  • Format Painter
  • +
  • Clipboard Cleanup
  • Paste Cleanup
  • Enter Key Configuration
  • Undo Redo
  • diff --git a/ej2-asp-mvc-toc.html b/ej2-asp-mvc-toc.html index 67318929d7..91a5d04b14 100644 --- a/ej2-asp-mvc-toc.html +++ b/ej2-asp-mvc-toc.html @@ -2201,6 +2201,7 @@
  • Code Block
  • Remove Formatting
  • Format Painter
  • +
  • Clipboard Cleanup
  • Paste Cleanup
  • Enter Key Configuration
  • Undo Redo