This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinline.tsx
More file actions
85 lines (79 loc) · 3.56 KB
/
inline.tsx
File metadata and controls
85 lines (79 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* RichTextEditor inline sample
*/
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { RichTextEditorComponent, Inject, ToolbarType, QuickToolbar, Image, Link, HtmlEditor, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import { SampleBase } from '../common/sample-base';
import { CheckBoxComponent, ChangeEventArgs } from '@syncfusion/ej2-react-buttons';
import { PropertyPane } from '../common/property-pane';
import './inline.css';
export class Inline extends SampleBase<{}, {}> {
private rteObj: RichTextEditorComponent;
public checkboxObj: CheckBoxComponent;
// set the value to RichTextEditor
private template: string = `<p>The sample is configured with inline mode of editor. Initially, the editor is rendered without a <a href="https://ej2.syncfusion.com/home/" target='_blank'>toolbar</a>. The toolbar becomes visible only when the content is selected.</p>`;
change(args: ChangeEventArgs): void {
this.rteObj.inlineMode.onSelection = (args as any).checked;
this.rteObj.dataBind();
}
private inlineMode: object = {
enable: true,
onSelection: true
};
private format: object = {
width: 'auto'
}
private fontFamily: object = {
width: 'auto'
}
// RichTextEditor items list
private items: string[] = ['Bold', 'Italic', 'Underline',
'Formats', '-', 'Alignments', 'OrderedList', 'UnorderedList',
'CreateLink'];
//RichTextEditor ToolbarSettings
private toolbarSettings: object = {
items: this.items
};
render() {
return (
<div id="dropdowndefault" className='control-pane'>
<div className='control-section' id='rteInline'>
<div className='col-lg-8' >
<div className="content-wrapper">
<RichTextEditorComponent id="defaultRTE" ref={(richtexteditor) => { this.rteObj = richtexteditor }}
valueTemplate={this.template} inlineMode={this.inlineMode} toolbarSettings={ this.toolbarSettings} format={this.format} fontFamily={this.fontFamily}>
<Inject services={[Image, Link, QuickToolbar, HtmlEditor, Toolbar]} />
</RichTextEditorComponent>
</div>
</div>
<div className='col-lg-4 property-section'>
<PropertyPane title='Properties'>
<table id="property" title="Properties">
<tbody>
<tr>
<td>
<div>
<CheckBoxComponent checked={true} label='Show on Selection' ref={(scope) => { this.checkboxObj = scope; }} change={this.change.bind(this)} ></CheckBoxComponent>
</div>
</td>
</tr>
</tbody>
</table>
</PropertyPane>
</div>
</div>
<div id="action-description">
<p>This sample demonstrates the toolbar show on inline mode. Toolbar show while selection on the below editable content and
it hide on focus out from edit area.</p>
</div>
<div id="description">
<p>The rich text editor provides an option to display toolbar on demand using mode property. Set mode as inline to enable
inline editor. The toolbar becomes visible only when the content is selected</p>
<p><b>Injecting Module</b></p>
<p>RichTextEditor component features are segregated into individual feature-wise modules. To use richtexteditor feature, we need to inject <code>Toolbar, Link, Image, Count, HtmlEditor, QuickToolbar</code> modules into the services.</p>
</div>
</div>
);
}
}