Iframe
16 Jan 20246 minutes to read
When the IframeSettings
option is enabled, the Rich Text Editor creates the iframe element as the content area on control initialization; it is used to display and editing the content. In content area, the editor displays only the body tag of a < iframe >
document.
@Html.EJS().RichTextEditor("iframe").ContentTemplate(@<div>
<p>
The Rich Text Editor control is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content.
Users can format their content using standard toolbar commands.
</p>
<p><b> Key features:</b></p>
<ul>
<li><p> Provides < IFRAME > and < DIV > modes </p></li>
<li><p> Capable of handling markdown editing.</p></li>
<li><p> Contains a modular library to load the necessary functionality on demand.</p></li>
<li><p> Provides a fully customizable toolbar.</p></li>
<li><p> Provides HTML view to edit the source directly for developers.</p></li>
<li><p> Supports third - party library integration.</p></li>
<li><p> Allows preview of modified content before saving it.</p></li>
<li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>
<li><p> Contains undo / redo manager.</p></li>
<li><p> Creates bulleted and numbered lists.</p></li>
</ul>
</div>).IframeSettings(iframeSettings => iframeSettings.Enable(true)).Render()
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
Iframe Attributes
The editor allows you to pass an additional attribute to body tag of a < iframe > element using attributes fields of the attributes
fields of IframeSettings
property. This property contains name/value pairs in string format. It is used to override the default appearance of the content area.
@Html.EJS().RichTextEditor("iframe").ContentTemplate(@<div>
<p>
The Rich Text Editor control is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content.
Users can format their content using standard toolbar commands.
</p>
<p><b> Key features:</b></p>
<ul>
<li><p> Provides < IFRAME > and < DIV > modes </p></li>
<li><p> Capable of handling markdown editing.</p></li>
<li><p> Contains a modular library to load the necessary functionality on demand.</p></li>
<li><p> Provides a fully customizable toolbar.</p></li>
<li><p> Provides HTML view to edit the source directly for developers.</p></li>
<li><p> Supports third - party library integration.</p></li>
<li><p> Allows preview of modified content before saving it.</p></li>
<li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>
<li><p> Contains undo / redo manager.</p></li>
<li><p> Creates bulleted and numbered lists.</p></li>
</ul>
</div>).Created("created").IframeSettings(iframeSettings => iframeSettings.Enable(true)).Render()
<script>
function created() {
this.setProperties({
iframeSettings: {
attributes: {
readonly: 'readonly'
}
}
}, false);
}
</script>
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
Adding External CSS/Script File
The editor offers you to add external CSS file to style the < iframe >
element. Easily change the appearance of editor’s content using an external CSS file using styles
field in IframeSettings
property.
Likewise, add the external script file to the <iframe>
element using scripts
field of IframeSettings
to provide the additional functionalities to the Rich Text Editor.
@Html.EJS().RichTextEditor("iframe").ContentTemplate(@<div>
<p>
The Rich Text Editor control is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content.
Users can format their content using standard toolbar commands.
</p>
<p><b> Key features:</b></p>
<ul>
<li><p> Provides < IFRAME > and < DIV > modes </p></li>
<li><p> Capable of handling markdown editing.</p></li>
<li><p> Contains a modular library to load the necessary functionality on demand.</p></li>
<li><p> Provides a fully customizable toolbar.</p></li>
<li><p> Provides HTML view to edit the source directly for developers.</p></li>
<li><p> Supports third - party library integration.</p></li>
<li><p> Allows preview of modified content before saving it.</p></li>
<li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>
<li><p> Contains undo / redo manager.</p></li>
<li><p> Creates bulleted and numbered lists.</p></li>
</ul>
</div>).IframeSettings(iframeSettings => iframeSettings.Enable(true).Resources(ViewBag.resources)).Render()
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.resources = new
{
styles = new[] { "myStyle.css" }
};
return View();
}
}