|
3 | 3 | [](https://supportcenter.devexpress.com/ticket/details/T1223158) |
4 | 4 | [](https://docs.devexpress.com/GeneralInformation/403183) |
5 | 5 | <!-- default badges end --> |
6 | | -# DXHtmlEditor |
7 | 6 |
|
8 | | -This is the repository template for creating new examples. Describe the solved task here. |
| 7 | +# Integrate JavaScript HTML Editor into a WinForms App |
9 | 8 |
|
10 | | -Put a screenshot that illustrates the result here. |
| 9 | +This example integrates the JavaScript WYSIWYG HTML Editor (a components that ships as part of [DevExteme UI component suite](https://js.devexpress.com)) within a WinForms application. The client-side HTML Editor is embedded into the Microsoft Edge WebView2 control (`DXHtmlEditorWebView`). |
11 | 10 |
|
12 | | -Then, add implementation details (steps, code snippets, and other technical information in a free form), or add a link to an existing document with implementation details. |
| 11 | + |
13 | 12 |
|
14 | | -## Files to Review |
| 13 | +## HTML Editor Features |
| 14 | + |
| 15 | +- HTML and Markdown Support |
| 16 | +- HTML Editor features include: |
| 17 | +- Inline and Block Formats |
| 18 | +- Copy/Paste Rich Text Formatting |
| 19 | +- Insert Media and Upload Images |
| 20 | +- Tables |
| 21 | +- Mail Merge |
| 22 | +- UI Customization |
| 23 | +- Light/Dark Themes |
| 24 | + |
| 25 | +> Note |
| 26 | +> - Using DevExpress JavaScript HTML Editor within your desktop application requires an active [DevExtreme license](https://www.devexpress.com/buy/js/). |
| 27 | +> - The DevExtreme HTML Editor does not support all HTML-related features and tags ([read about limitations](https://js.devexpress.com/Angular/Documentation/Guide/UI_Components/HtmlEditor/Overview/)). |
15 | 28 |
|
16 | | -- link.cs (VB: link.vb) |
17 | | -- link.js |
18 | | -- ... |
| 29 | +The example also implements the following: |
19 | 30 |
|
20 | | -## Documentation |
| 31 | +- Auto-syncs the WinForms application skin with the HTML Editor’s theme. When switching from a dark to a light color palette (and vice versa), the corresponding theme (dark or light) is applied to the HTML Editor. |
| 32 | +- Undo/Redo Ribbon commands allow users to revert or redo actions within the HTML Editor. |
21 | 33 |
|
22 | | -- link |
23 | | -- link |
24 | | -- ... |
| 34 | +## Use the HTML Editor in Your WinForms App |
25 | 35 |
|
26 | | -## More Examples |
| 36 | +1. Copy the `DXHtmlEditor` folder to your project. |
| 37 | +2. Install the `Microsoft.Web.WebView2` NuGet package. |
| 38 | +3. Open the *DXHtmlEditorClient.cs* file and specify the default namespace within the `OnWebResourceRequested` method: |
| 39 | + ```csharp |
| 40 | + void OnWebResourceRequested(object sender, CoreWebView2WebResourceRequestedEventArgs e) { |
| 41 | + var environment = webView?.Environment; |
| 42 | + if(environment == null) |
| 43 | + return; |
| 44 | + string asset = $@"{nameof(MyDefaultNamespace)}.{nameof(DXHtmlEditor)}.Assets.{e.Request.Uri.Substring(rootURIFilter.Length - 1)}"; |
| 45 | + // ... |
| 46 | + } |
| 47 | + ``` |
| 48 | +4. Set **Build Action** to "Embedded Resource" for all files in the Assets folder. |
| 49 | +5. Build the solution. |
| 50 | +6. Drop the `DXHtmlEditorWebView` component from the toolbox onto a form. |
| 51 | + |
| 52 | +## Files to Review |
27 | 53 |
|
28 | | -- link |
29 | | -- link |
30 | | -- ... |
| 54 | +- [DXHtmlEditorClient.cs](./DXHtmlEditor/DXHtmlEditorClient.cs) |
| 55 | +- [DXHtmlEditorWebView.cs](./DXHtmlEditor/DXHtmlEditorWebView.cs) |
| 56 | +- [MainForm.cs](./MainForm.cs) |
| 57 | +- [index.js](./DXHtmlEditor/Assets/index.js) |
0 commit comments