Back to Devexpress

Options Interface

aspnetcore-js-devexpress-dot-richedit-4c2af023.md

latest12.2 KB
Original Source

Options Interface

Declares Rich Text Editor options.

Declaration

ts
export interface Options

Properties

authentication Property

Provides access to authentication settings.

Declaration

ts
authentication?: IAuthenticationSettings

Property Value

TypeDescription
IAuthenticationSettings

An interface that declares authentication settings.

|

autoCorrect Property

Provides access to autocorrect settings.

Declaration

ts
autoCorrect?: IAutocorrectSettings

Property Value

TypeDescription
IAutocorrectSettings

An interface that declares autocorrect settings.

|

bookmarks Property

Provides access to bookmark settings.

Declaration

ts
bookmarks?: IBookmarkSettings

Property Value

TypeDescription
IBookmarkSettings

An interface that declares bookmark settings.

|

confirmOnLosingChanges Property

Allows you to customize settings of a confirmation message that is displayed when unsaved data changes may be lost.

Declaration

ts
confirmOnLosingChanges?: IConfirmOnLosingChangesSettings

Property Value

TypeDescription
IConfirmOnLosingChangesSettings

An interface that declares confirmation message settings.

|

Remarks

javascript
options.confirmOnLosingChanges.enabled = true;
options.confirmOnLosingChanges.message = "Are you sure you want to close the document?";

contextMenu Property

Provides access to context menu settings.

Declaration

ts
contextMenu?: IContextMenu

Property Value

TypeDescription
IContextMenu

An object that implements the IContextMenu interface and contains the context menu settings.

|

Remarks

javascript
const options = DevExpress.RichEdit.createOptions();
var contextMenu = options.contextMenu;
// remove default items
contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.DecreaseParagraphIndent);
contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.IncreaseParagraphIndent);
// add an item that executes a default command
contextMenu.insertItem(new DevExpress.RichEdit.ContextMenuItem(
    DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField, {
    icon: 'clock', text: 'Insert Date Field'
}), 1);
// add a custom item
contextMenu.insertItem(new DevExpress.RichEdit.ContextMenuItem('googleSearch', {
    icon: 'search', beginGroup: true, text: 'Google Search...'
}), 1);

See Also

Context Menu Customization

document Property

Specifies a document that is initially loaded in the control.

Declaration

ts
document?: {
    content?: File | Blob | ArrayBuffer | string;
    name?: string;
    format?: DocumentFormat;
    onLoaded?: (importSuccess: boolean) => void;
}

Property Value

NameTypeDescription
contentstringFile

The document content.

| | format | DocumentFormat |

The document format.

| | name | string |

The document name.

| | onLoaded | (importSuccess: boolean) => void |

A function that is called after the control attempted to load the document. The importSuccess parameter specifies whether the document is successfully loaded.

|

Remarks

javascript
var documentAsBase64 = "e1xydGYxXGRlZmYwe1xmb250dGJse1xmMCBDYWxpYnJpO319e1xjb2xvcnRibCA7XHJlZDB"
    + "cZ3JlZW4wXGJsdWUyNTUgO1xyZWQyNTVcZ3JlZW4yNTVcYmx1ZTI1NSA7fXtcKlxkZWZjaHAgXGZzMjJ9e1xzdHl"    
    + "sZXNoZWV0IHtccWxcZnMyMiBOb3JtYWw7fXtcKlxjczFcZnMyMiBEZWZhdWx0IFBhcmFncmFwaCBGb250O317XCp"
    + "cY3MyXGZzMjJcY2YxIEh5cGVybGluazt9e1wqXHRzM1x0c3Jvd2RcZnMyMlxxbFx0c3ZlcnRhbHRcdHNjZWxsY2J"
    + "wYXQyXHRzY2VsbHBjdDBcY2x0eGxydGIgTm9ybWFsIFRhYmxlO319e1wqXGxpc3RvdmVycmlkZXRhYmxlfXtcaW5"
    + "mb31cbm91aWNvbXBhdFxzcGx5dHduaW5lXGh0bWF1dHNwXGV4cHNocnRuXHNwbHRwZ3BhclxkZWZ0YWI3MjBcc2V"
    + "jdGRcbWFyZ2xzeG4xNDQwXG1hcmdyc3huMTQ0MFxtYXJndHN4bjE0NDBcbWFyZ2JzeG4xNDQwXGhlYWRlcnk3MjB"
    + "cZm9vdGVyeTcyMFxwZ3dzeG4xMjI0MFxwZ2hzeG4xNTg0MFxjb2xzMVxjb2xzeDcyMFxwYXJkXHBsYWluXHFse1x"
    + "mczIyXGNmMFxjczEgRG9jdW1lbnQgdGV4dH1cZnMyMlxjZjBccGFyfQ==";
options.document = {
    content: documentAsBase64,
    format: DevExpress.RichEdit.DocumentFormat.Rtf,
    onLoaded: function(success) {
        console.log('Initial document is loaded: ' + success);
    },
};

If the document property is not specified, the control creates and loads a new document.

After the onLoaded function is processed, the documentLoaded event is fired.

events Property

Provides access to a list of client-side events specific to the RichEdit control.

Declaration

ts
events: EventHandlers

Property Value

TypeDescription
EventHandlers

An object that allows you to assign handlers to the client-side events.

|

exportUrl Property

Specifies the path where the exported document is sent for saving.

Declaration

ts
exportUrl?: string

Property Value

TypeDescription
string

The URL.

|

Remarks

When a user clicks the Save button or the saveDocument method is called, the Rich Text Editor converts the document’s content to base64 and invokes the Saving event. If the event is not handled, specify the exportUrl property to save the document on the server side.

You can write the Saved event handler to perform custom actions after a server sends a response to a save request.

The ExportUrl property is not in effect if the document saving is implemented on the client side (the handled property is set to true ).

Note

When RichText Editor sends a document to the server, the control encodes the document content in UTF-8. To get the file content in string format, use a converter.

csharp
byte[] fileContents = System.Convert.FromBase64String(base64);
string rtfText = Encoding.UTF8.GetString(fileContents);

See Also

Save a Document

fields Property

Provides access to field settings.

Declaration

ts
fields?: IFieldsSettings

Property Value

TypeDescription
IFieldsSettings

An interface that declares field settings.

|

fonts Property

Provides access to font settings.

Declaration

ts
fonts?: IRichEditFontsSettings

Property Value

TypeDescription
IRichEditFontsSettings

An interface that declares font settings.

|

height Property

Specifies the RichEdit height.

Declaration

ts
height?: string

Property Value

TypeDescription
string

The height.

|

mailMerge Property

Provides access to mail merge settings.

Declaration

ts
mailMerge?: IMailMergeSettings

Property Value

TypeDescription
IMailMergeSettings

An interface that declares mail merge settings.

|

nonce Property

Specifies the nonce value.

Declaration

ts
nonce?: string

Property Value

TypeDescription
string

A String that specifies the nonce value.

|

pdf Property

Provides access to PDF export settings.

Declaration

ts
pdf?: IRichEditPdfSettings

Property Value

TypeDescription
IRichEditPdfSettings

An interface that declares PDF export settings.

|

printing Property

Provides access to printing settings.

Declaration

ts
printing?: IPrintingSettings

Property Value

TypeDescription
IPrintingSettings

An interface that declares printing settings.

|

rangePermissions Property

Provides access to range permission settings.

Declaration

ts
rangePermissions?: IRangePermissionsSettings

Property Value

TypeDescription
IRangePermissionsSettings

An interface that declares range permission settings.

|

readOnly Property

Specifies whether document modifications are prohibited.

Declaration

ts
readOnly?: boolean

Property Value

TypeDescription
boolean

true if the document is in a read-only state; otherwise, false.

|

Remarks

javascript
options.readOnly = true;

ribbon Property

Provides access to ribbon settings.

Declaration

ts
ribbon: Ribbon

Property Value

TypeDescription
Ribbon

An object that contains ribbon settings.

|

See Also

Ribbon Customization

search Property

Provides access to search settings.

Declaration

ts
search?: IRichEditSearchSettings

Property Value

TypeDescription
IRichEditSearchSettings

Search settings.

|

Remarks

The search panel and the Find and Replace dialog allow users to locate and modify text in a document opened in the Rich Text Editor. You can filter search results to prevent users from modifying certain document intervals. The example below demonstrates how to exclude intervals that contain fields from search results:

javascript
const options = DevExpress.RichEdit.createOptions();
options.search.filterInterval = (subDocument, interval) =>
    subDocument.fields.find(interval).length == 0;
// ...

spellCheck Property

Provides access to spell checking settings.

Declaration

ts
spellCheck?: ISpellCheck

Property Value

TypeDescription
ISpellCheck

An interface that declares spell checking settings.

|

unit Property

Specify unit for dimensions in Rich Text Editor dialogs.

Declaration

ts
unit?: RichEditUnit

Property Value

TypeDescription
RichEditUnit

The unit.

|

Remarks

javascript
options.unit = DevExpress.RichEdit.RichEditUnit.Centimeter;

view Property

Provides access to view settings.

Declaration

ts
view?: IViewSettings

Property Value

TypeDescription
IViewSettings

An interface that declares view settings.

|

width Property

Specifies the RichEdit width.

Declaration

ts
width?: string

Property Value

TypeDescription
string

The width.

|