|
| 1 | +@page |
| 2 | +@model Pages.IndexModel |
| 3 | + |
| 4 | +@{ |
| 5 | + var omegaToolbarItem = new |
| 6 | + { |
| 7 | + template = @"<button class='e-tbar-btn' onclick='addOmegaSymbol()'> |
| 8 | + <div style='font-size: 18px'>Ω</div> |
| 9 | + </button>", |
| 10 | + tooltipText = "Insert Symbol", |
| 11 | + }; |
| 12 | + |
| 13 | + var tools = new object[] { |
| 14 | + "Bold", "Italic", "Underline", "StrikeThrough", "InlineCode", "SuperScript", "SubScript", |
| 15 | + "|", "Formats", "Alignments", "OrderedList", "UnorderedList", "|", "CreateLink", "Image", |
| 16 | + "|", "Undo", "Redo", "SourceCode", "FullScreen", omegaToolbarItem |
| 17 | + }; |
| 18 | + |
| 19 | + var link = new object[] { "Open" }; |
| 20 | +} |
| 21 | +<div class="rte-container"> |
| 22 | + <ejs-richtexteditor id="rte" width="70%" floatingToolbarOffset="50"> |
| 23 | + <e-richtexteditor-toolbarsettings items="@tools" type="Scrollable" enableFloating="false" /> |
| 24 | + <e-richtexteditor-inlinemode enable="true" onSelection="false"></e-richtexteditor-inlinemode> |
| 25 | + <e-richtexteditor-quicktoolbarsettings link="@link"/> |
| 26 | + <e-content-template> |
| 27 | + <p> |
| 28 | + The <a href="https://www.syncfusion.com/aspnet-core-ui-controls/wysiwyg-rich-text-editor">Rich Text Editor</a> control is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content. |
| 29 | + Users can format their content using standard toolbar commands. |
| 30 | + </p> |
| 31 | + <p><b> Key features:</b></p> |
| 32 | + <ul> |
| 33 | + <li><p> Provides < IFRAME > and < DIV > modes </p></li> |
| 34 | + <li><p> Capable of handling markdown editing.</p></li> |
| 35 | + <li><p> Contains a modular library to load the necessary functionality on demand.</p></li> |
| 36 | + <li><p> Provides a fully customizable toolbar.</p></li> |
| 37 | + <li><p> Provides HTML view to edit the source directly for developers.</p></li> |
| 38 | + </ul> |
| 39 | + <img src='https://cdn.syncfusion.com/ej2/richtexteditor-resources/RTE-Portrait.png' |
| 40 | + style='width: 300px; height: 300px;' alt='Sky' /> |
| 41 | + </e-content-template> |
| 42 | +</ejs-richtexteditor> |
| 43 | +</div> |
| 44 | +<script> |
| 45 | + function addOmegaSymbol(){ |
| 46 | + var rte = document.getElementById('rte').ej2_instances[0]; |
| 47 | +
|
| 48 | + if (rte.formatter.getUndoRedoStack().length === 0) { |
| 49 | + rte.formatter.saveData(); |
| 50 | + } |
| 51 | + rte.executeCommand('insertText', 'Ω'); |
| 52 | + rte.formatter.saveData(); |
| 53 | + rte.formatter.enableUndo(rte); |
| 54 | + } |
| 55 | +</script> |
| 56 | +<style> |
| 57 | + .rte-container{ |
| 58 | + display: flex; |
| 59 | + justify-content: center; |
| 60 | + } |
| 61 | +</style> |
0 commit comments