-
Notifications
You must be signed in to change notification settings - Fork 11
9756000: Added documentation for before paste #2065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ManoSF4839
wants to merge
12
commits into
hotfix/hotfix-v32.1.19
Choose a base branch
from
9756000-pasteH
base: hotfix/hotfix-v32.1.19
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
60906b9
975600̄: added documentation for before paste
ManoSF4839 34e116a
975600̄: modify for spelling
ManoSF4839 3f79193
9756000: Added the before Paste Document editor
ManoSF4839 59798bb
9756000: CI failure
ManoSF4839 38d5430
9756000: Ci failure
ManoSF4839 1d4a79f
Update clipboard documentation for ASP.NET Core
ManoSF4839 3fa4fe5
Update clipboard.md
ManoSF4839 ab223c4
9756000: modified pixel
ManoSF4839 e3475db
Merge branch '9756000-pasteH' of https://github.com/syncfusion-conten…
ManoSF4839 622b177
9756000: review changes
ManoSF4839 66fecd9
Fix formatting of beforePaste prop in clipboard.md
ManoSF4839 0b834bc
9756000: review changes
ManoSF4839 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| --- | ||
| layout: post | ||
| title: Clipboard in ASP.NET MVC Document Editor Component | ||
| title: Clipboard in ASP.NET MVC Document Editor Component | Syncfusion | ||
| description: Learn here all about clipboard in Syncfusion ASP.NET MVC Document Editor component of Syncfusion Essential JS 2 and more. | ||
| platform: document-processing | ||
| control: Clipboard | ||
| documentation: ug | ||
| --- | ||
|
|
||
|
|
||
| # Clipboard | ||
| # Clipboard in Document Editor Component | Syncfusion | ||
|
||
|
|
||
| Document editor takes advantage of system clipboard and allows to copy or move a portion of the document into it in HTML format, so that it can be pasted in any application that supports clipboard. | ||
|
|
||
|
|
@@ -42,11 +42,13 @@ Document editor exposes API to enable local paste within the control. On enablin | |
|
|
||
|
|
||
| {% tabs %} | ||
| {% highlight razor tabtitle="CSHTML" %} | ||
| {% highlight cshtml tabtitle="CSHTML" %} | ||
| {% include code-snippet/document-editor/asp-net-mvc/clipboard/razor %} | ||
| {% endhighlight %} | ||
| {% highlight c# tabtitle="Clipboard.cs" %} | ||
| {% endhighlight %}{% endtabs %} | ||
| {% highlight c# tabtitle="Document-editor.cs" %} | ||
| {% include code-snippet/document-editor/asp-net-mvc/clipboard/document-editor.cs %} | ||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
|
|
||
|
|
||
|
|
@@ -81,6 +83,20 @@ This paste option appears as follows. | |
|
|
||
|  | ||
|
|
||
| ## Events | ||
| DocumentEditor provides the `beforePaste` event, which is triggered before content is pasted into the document. This event gives an opportunity to `cancel` the paste operation, modifying the incoming content using `pasteContent`, and determining its format with `pasteType`. The event handler receives a `BeforePasteEventArgs` object that contains all the necessary details about the paste operation. | ||
|
|
||
| The following code snippet illustrates how to achieve this: | ||
|
|
||
| {% tabs %} | ||
| {% highlight cshtml tabtitle="CSHTML" %} | ||
| {% include code-snippet/document-editor/asp-net-mvc/clipboard-event/razor %} | ||
| {% endhighlight %} | ||
| {% highlight c# tabtitle="Document-editor.cs" %} | ||
| {% include code-snippet/document-editor/asp-net-mvc/clipboard-event/document-editor.cs %} | ||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
| ## See Also | ||
|
|
||
| * [Keyboard shortcuts](./keyboard-shortcut) | ||
Binary file modified
BIN
-107 KB
(47%)
Document-Processing/Word/Word-Processor/asp-net-mvc/images/paste.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-59.7 KB
(43%)
Document-Processing/Word/Word-Processor/vue/images/paste.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
...t-Processing/code-snippet/document-editor/asp-net-core/clipboard-event/document-editor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| public ActionResult Default() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
21 changes: 21 additions & 0 deletions
21
Document-Processing/code-snippet/document-editor/asp-net-core/clipboard-event/razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @Html.EJS().DocumentEditorContainer("container").EnableToolbar(true).Height("590px").beforePaste("handleBeforePaste").Render() | ||
| <script> | ||
| var documenteditor; | ||
| var container; | ||
| function onCreated() { | ||
| var documenteditorElement = document.getElementById('container'); | ||
| container = documenteditorElement.ej2_instances[0]; | ||
| documenteditor = container.documentEditor; | ||
| } | ||
| function handleBeforePaste (args) { | ||
| // Block HTML pasteType and Modify the content | ||
| if (args.pasteType === "Html") { | ||
| args.pasteContent = `{"sections":[{"blocks":[{"inlines":[{"characterFormat":{"bold":true,"italic":true}, | ||
| "text":"HTML Content"}]}],"headersFooters":{}}]}`; | ||
| } | ||
| // Cancel paste if content matches 'Software' | ||
| if(args.pasteContent == 'Software'){ | ||
| args.cancel = true; | ||
| } | ||
| } | ||
| </script> |
23 changes: 23 additions & 0 deletions
23
Document-Processing/code-snippet/document-editor/asp-net-core/clipboard-event/tagHelper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <ejs-documenteditorcontainer id="container" serviceUrl="/api/DocumentEditor/" enableToolbar=true created="onCreated" beforePaste="handleBeforePaste " height="590px"></ejs-documenteditorcontainer> | ||
|
|
||
| <script> | ||
| var documenteditor; | ||
| var container; | ||
| function onCreated() { | ||
| var documenteditorElement = document.getElementById('container'); | ||
| container = documenteditorElement.ej2_instances[0]; | ||
| documenteditor = container.documentEditor; | ||
| } | ||
| function handleBeforePaste (args){ | ||
| // Block HTML pasteType and Modify the content | ||
| if (args.pasteType === "Html") { | ||
| args.pasteContent = `{"sections":[{"blocks":[{"inlines":[{"characterFormat":{"bold":true,"italic":true}, | ||
| "text":"HTML Content"}]}],"headersFooters":{}}]}`; | ||
| } | ||
| // Cancel paste if content matches 'Software' | ||
| if(args.pasteContent == 'Software'){ | ||
| args.cancel = true; | ||
| } | ||
| } | ||
| </script> | ||
|
|
5 changes: 5 additions & 0 deletions
5
...nt-Processing/code-snippet/document-editor/asp-net-mvc/clipboard-event/document-editor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| public ActionResult Default() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
21 changes: 21 additions & 0 deletions
21
Document-Processing/code-snippet/document-editor/asp-net-mvc/clipboard-event/razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @Html.EJS().DocumentEditorContainer("container").EnableToolbar(true).Height("590px").beforePaste("handleBeforePaste").Render() | ||
| <script> | ||
| var documenteditor; | ||
| var container; | ||
| function onCreated() { | ||
| var documenteditorElement = document.getElementById('container'); | ||
| container = documenteditorElement.ej2_instances[0]; | ||
| documenteditor = container.documentEditor; | ||
| } | ||
| function handleBeforePaste (args) { | ||
| // Block HTML pasteType and Modify the content | ||
| if (args.pasteType === "Html") { | ||
| args.pasteContent = `{"sections":[{"blocks":[{"inlines":[{"characterFormat":{"bold":true,"italic":true}, | ||
| "text":"HTML Content"}]}],"headersFooters":{}}]}`; | ||
| } | ||
| // Cancel paste if content matches 'Software' | ||
| if(args.pasteContent == 'Software'){ | ||
| args.cancel = true; | ||
| } | ||
| } | ||
| </script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...., modify the content to be pasted using...
Change like this