Search results

Clipboard

Word processor component (a.k.a Document Editor) provides built-in support for clipboard operations such as cut, copy, and paste. You can perform the clipboard operations using keyboard shortcuts, touch, and keyboard interactions. Also, the same functionalities can be invoked programmatically.

There is a built-in clipboard (local clipboard) with this Word processor component, which allows the users to perform cut, copy, and paste faster. If you want to use system clipboard instead of local clipboard, turn off the local clipboard by setting the EnableLocalPaste to false.

If you need to copy or paste the contents from other applications, use system clipboard. To copy or paste the contents within the Word processor component, use local clipboard.

Let’s see how to invoke each clipboard operations using code.

Copy

You can copy the selected contents using the Copy method as shown in the following code example.

@using Syncfusion.EJ2.DocumentEditor.Blazor

<button @onclick="CopyClick">Copy</button>
<EjsDocumentEditorContainer @ref="container" EnableToolbar=true></EjsDocumentEditorContainer>

@code {

    EjsDocumentEditorContainer container;
    protected void CopyClick(object args)
    {
        container.GetDocumentEditor().GetSelection().Copy();
    }
}

Cut

You can cut the selected content using the “Cut” method as shown in the following code example.

@using Syncfusion.EJ2.DocumentEditor.Blazor

<button @onclick="CutClick">Cut</button>
<EjsDocumentEditorContainer @ref="container" EnableToolbar=true></EjsDocumentEditorContainer>

@code {

    EjsDocumentEditorContainer container;

    protected void CutClick(object args)
    {
        container.GetDocumentEditor().GetEditor().Cut();
    }
}

Paste

Local paste

The following code example shows how to perform the paste operation from the local clipboard.

@using Syncfusion.EJ2.DocumentEditor.Blazor

<button @onclick="PasteClick">Paste</button>
<EjsDocumentEditorContainer @ref="container" EnableToolbar=true EnableLocalPaste=true></EjsDocumentEditorContainer>
@code {

    EjsDocumentEditorContainer container;
    protected void PasteClick(object args)
    {
        container.GetDocumentEditor().GetEditor().Paste();
    }
}