aspnetcore-js-devexpress-dot-richedit-4ba8e26a.md
Declares Rich Text Editor event handlers.
export interface EventHandlers
Specifies a handler for the ActiveSubDocumentChanged event.
activeSubDocumentChanged?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The ActiveSubDocumentChanged event occurs when an active sub document is changed.
const options = DevExpress.RichEdit.createOptions();
options.events.activeSubDocumentChanged = function(s,e) { /* your custom actions */ };
Specifies a handler for the AutoCorrect event.
autoCorrect?: string | ((s: RichEdit, e: AutoCorrectEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: AutoCorrectEventArgs) => void |
The JavaScript function that handles the event.
|
The AutoCorrect event occurs when text is typed in the control. The event handler receives an argument of the AutoCorrectEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.autoCorrect = function(s,e) {
console.log('The inserted text is: ' + e.text);
};
beforeSend?: string | ((s: RichEdit, e: BeforeSendEventArgs) => void)
| Type |
|---|
| string |
| (s: RichEdit, e: BeforeSendEventArgs) => void |
Specifies a handler for the CalculateDocumentVariable event.
calculateDocumentVariable?: string | ((s: RichEdit, e: CalculateDocumentVariableEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: CalculateDocumentVariableEventArgs) => void |
The JavaScript function that handles the event.
|
The CalculateDocumentVariable event occurs when a DOCVARIABLE field is updated. The event handler receives an argument of the CalculateDocumentVariableEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.calculateDocumentVariable = function(s,e) {
if (e.variableName == 'sectionIndex')
e.value = (s.document.sections.find(e.fieldInterval.start).index + 1).toString();
};
Note
When the CalculateDocumentVariableAsyncEvent event handler is specified, the CalculateDocumentVariable event does not fire.
Specifies a handler for the CalculateDocumentVariableAsync event.
calculateDocumentVariableAsync?: string | ((s: RichEdit, e: CalculateDocumentVariableAsyncEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: CalculateDocumentVariableAsyncEventArgs) => void |
The JavaScript function that handles the event.
|
The CalculateDocumentVariableAsync event occurs when occurs when a DOCVARIABLE field is updated. The event handler receives an argument of the CalculateDocumentVariableAsyncEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.calculateDocumentVariableAsync = function(s,e){
e.data.forEach(function(data) {
data.callback('ResultOf' + data.variableName);
})
};
Note
When the CalculateDocumentVariableAsync event handler is specified, the CalculateDocumentVariable event does not fire.
Specifies a handler for the CharacterPropertiesChanged event.
characterPropertiesChanged?: string | ((s: RichEdit, e: ContentChangedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: ContentChangedEventArgs) => void |
The JavaScript function that handles the event.
|
The CharacterPropertiesChanged event occurs when the characters’ formatting is changed. The event handler receives an argument of the ContentChangedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.characterPropertiesChanged = function(s,e) { /* your custom actions */ };
Specifies a handler for the CommandStateChanged event.
commandStateChanged?: string | ((s: RichEdit, e: CommandStateChangedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: CommandStateChangedEventArgs) => void |
The JavaScript function that handles the event.
|
The CommandStateChanged event occurs after a command state has been changed. The event handler receives an argument of the CommandStateChangedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.commandStateChanged = function(s,e) { /* your custom actions */ };
Specifies a handler for the ContentInserted event.
contentInserted?: string | ((s: RichEdit, e: ContentChangedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: ContentChangedEventArgs) => void |
The JavaScript function that handles the event.
|
The ContentInserted event occurs when content is inserted into the document. The event handler receives an argument of the ContentChangedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.contentInserted = function(s,e) {
console.log('The inserted text is: ' + s.document.getText(e.interval));
};
Specifies a handler for the ContentRemoved event.
contentRemoved?: string | ((s: RichEdit, e: ContentRemovedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: ContentRemovedEventArgs) => void |
The JavaScript function that handles the event.
|
The ContentRemoved event occurs when content is removed from the document. The event handler receives an argument of the ContentRemovedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.contentRemoved = function(s,e) {
console.log('The removed text is: ' + e.removedText);
};
Specifies a handler for the ContextMenuShowing event.
contextMenuShowing?: string | ((s: RichEdit, e: ContextMenuShowingEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: ContextMenuShowingEventArgs) => void |
The JavaScript function that handles the event.
|
The ContextMenuShowing event occurs before the context menu is displayed. The event handler receives an argument of the ContextMenuShowingEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.contextMenuShowing = function(s,e) {
var characterProperties = s.selection.activeSubDocument.getCharacterProperties(s.selection.intervals[0]);
if (characterProperties.bold === true || characterProperties.bold === undefined) {
e.contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.Copy);
e.contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.Paste);
e.contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.Cut);
e.contextMenu.insertItem(new DevExpress.RichEdit.ContextMenuItem('CutCopy', {
icon: 'close', text: 'Copy Paste Disabled', disabled: true
}), 1);
}
};
Specifies a handler for the CustomCommandExecuted event.
customCommandExecuted?: string | ((s: RichEdit, e: CustomCommandExecutedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: CustomCommandExecutedEventArgs) => void |
The JavaScript function that handles the event.
|
The CustomCommandExecuted event occurs after a custom command has been executed on the client side. The event handler receives an argument of the CustomCommandExecutedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.customCommandExecuted = function(s,e) {
switch (e.commandName) {
case 'sendEmail':
var text = s.document.getText();
var mailto_link = 'mailto:[email protected]?subject=Test&body=' + encodeURIComponent(text);
window = window.open(mailto_link, 'emailWindow');
if(window && window.open && !window.closed)
window.close();
break;
}
};
See Also
How to: Create 'Change Image Size' ribbon items
Specifies a handler for the DocumentChanged event.
documentChanged?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The DocumentChanged event occurs if any change is made in the document.
const options = DevExpress.RichEdit.createOptions();
options.events.documentChanged = function(s,e) {
console.log('The document has been changed.');
};
Specifies a handler for the DocumentFormatted event.
documentFormatted?: string | ((s: RichEdit, e: DocumentFormattedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: DocumentFormattedEventArgs) => void |
The JavaScript function that handles the event.
|
The DocumentFormatted event occurs when a document layout is formatted. The event handler receives an argument of the DocumentFormattedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.documentFormatted = function(s,e) {
console.log('The document contains ' + e.pageCount + ' page(s).');
};
Specifies a handler for the DocumentLoaded event.
documentLoaded?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The DocumentLoaded event occurs when a document model is loaded into the control.
const options = DevExpress.RichEdit.createOptions();
options.events.documentLoaded = function(s,e) {
s.document.insertText(0, 'Dear Mr Stanley,');
s.document.insertParagraph(s.document.length);
var startPosition = s.document.length;
s.document.insertParagraph(startPosition);
s.document.insertText(startPosition, '[Type your text here]');
s.selection.setSelection(new DevExpress.RichEdit.Interval(startPosition, s.document.length - startPosition));
s.focus();
};
Specifies a handler for the GotFocus event.
gotFocus?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The GotFocus event occurs when the control receives focus.
const options = DevExpress.RichEdit.createOptions();
options.events.gotFocus = function(s,e) { /* your custom actions */ };
Specifies a handler for the HyperlinkClick event.
hyperlinkClick?: string | ((s: RichEdit, e: HyperlinkClickEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: HyperlinkClickEventArgs) => void |
The JavaScript function that handles the event.
|
The HyperlinkClick event occurs when a hyperlink is clicked. The event handler receives an argument of the HyperlinkClickEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.hyperlinkClick = function(s,e) {
console.log('Navigates to ' + e.hyperlink.hyperlinkInfo.url);
};
Specifies a handler for the KeyDown event.
keyDown?: string | ((s: RichEdit, e: KeyboardEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: KeyboardEventArgs) => void |
The JavaScript function that handles the event.
|
The KeyDown event occurs when a key is pressed while the RichEdit’s document has focus. The event handler receives an argument of the KeyboardEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.keyDown = function(s,e) {
console.log('The pressed key is: ' + e.htmlEvent.key);
};
Specifies a handler for the KeyUp event.
keyUp?: string | ((s: RichEdit, e: KeyboardEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: KeyboardEventArgs) => void |
The JavaScript function that handles the event.
|
The KeyUp event occurs when a key is released while the RichEdit’s document has focus. The event handler receives an argument of the KeyboardEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.keyUp = function(s,e) {
console.log('The released key is: ' + e.htmlEvent.key);
};
Specifies a handler for the LostFocus event.
lostFocus?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The LostFocus event occurs when the control loses focus.
const options = DevExpress.RichEdit.createOptions();
options.events.lostFocus = function(s,e) { /* your custom actions */ };
Specifies a handler for the ParagraphPropertiesChanged event.
paragraphPropertiesChanged?: string | ((s: RichEdit, e: ParagraphPropertiesChangedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: ParagraphPropertiesChangedEventArgs) => void |
The JavaScript function that handles the event.
|
The ParagraphPropertiesChanged event occurs when a paragraph’s formatting is changed. The event handler receives an argument of the ParagraphPropertiesChangedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.paragraphPropertiesChanged = function(s,e) { /* your custom actions */ };
Specifies a handler for the PdfExported event.
pdfExported?: string | ((s: RichEdit, e: PdfExportedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: PdfExportedEventArgs) => void |
The JavaScript function that handles the event.
|
The PdfExported event occurs after an exported PDF document is processed on the server side. The event handler receives an argument of the PdfExportedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.pdfExported = function(s,e) {
if (e.success)
console.log('The PDF document is successfully processed on the server.');
};
Specifies a handler for the PdfExporting event.
pdfExporting?: string | ((s: RichEdit, e: PdfExportingEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: PdfExportingEventArgs) => void |
The JavaScript function that handles the event.
|
The PdfExporting event occurs after the exportToPdf method was called and allows you to save an exported PDF document. The event handler receives an argument of the PdfExportingEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.pdfExporting = function(s,e) {
e.handled = true;
console.log(e.base64);
};
See Also
Specifies a handler for the PointerDown event.
pointerDown?: string | ((s: RichEdit, e: PointerEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: PointerEventArgs) => void |
The JavaScript function that handles the event.
|
For a mouse pointer, the PointerDown event occurs when a user presses a mouse button or wheel while the mouse pointer is over the Rich Text Editor. For touch and pen pointers, this event occurs when a pointer contacts a digitizer.
The event handler receives an argument of the PointerEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.pointerDown = function(s,e) { /* your custom actions */ };
Specifies a handler for the PointerUp event.
pointerUp?: string | ((s: RichEdit, e: PointerEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: PointerEventArgs) => void |
The JavaScript function that handles the event.
|
For a mouse pointer, the PointerUp event occurs when a user releases a mouse button or wheel while the mouse pointer is over the Rich Text Editor. For touch and pen pointers, this event occurs when a pointer stops physical contact with a digitizer.
The event handler receives an argument of the PointerEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.pointerUp = function(s,e) { /* your custom actions */ };
Specifies a handler for the Saved event.
saved?: string | ((s: RichEdit, e: SavedEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: SavedEventArgs) => void |
The JavaScript function that handles the event.
|
The Saved event occurs after a document is saved on the server side. The event handler receives an argument of the SavedEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.saved = function(s,e) {
if (e.success)
console.log('The document is successfully processed on the server.');
};
Specifies a handler for the SavingEvent event.
saving?: string | ((s: RichEdit, e: SavingEventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: SavingEventArgs) => void |
The JavaScript function that handles the event.
|
The SavingEvent event allows you to save a document. The event handler receives an argument of the SavingEventArgs type. The argument’s properties provide information specific to this event.
const options = DevExpress.RichEdit.createOptions();
options.events.saving = function(s,e) {
e.handled = true;
console.log(e.base64);
console.log(e.fileName);
console.log(e.format);
};
Specifies a handler for the SelectionChanged event.
selectionChanged?: string | ((s: RichEdit, e: EventArgs) => void)
| Type | Description |
|---|---|
| string |
The name of the JavaScript function that handles the event.
| | (s: RichEdit, e: EventArgs) => void |
The JavaScript function that handles the event.
|
The SelectionChanged event occurs when selection is changed in the document.
const options = DevExpress.RichEdit.createOptions();
options.events.selectionChanged = function(s,e) {
console.log('The current position is ' + s.selection.active);
};
See Also