Load external stylesheet into the jqxEditor.
A live JavaScript/jQuery example of jqxEditor, the jQWidgets Editor component, with its complete source code below. It is one of 14 jqxEditor demos for jQuery.
createCommand property – Sets or gets the jqxEditor's createCommand property.height property – Sets or gets the jqxEditor's height.stylesheets property – Sets or gets the jqxEditor's stylesheets.width property – Sets or gets the jqxEditor's width.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxEditor shows the setup step by step.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxlistbox.js, jqxdropdownlist.js, jqxdropdownbutton.js, jqxcolorpicker.js, jqxwindow.js, jqxeditor.js, jqxtooltip.js, jqxcheckbox.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
$(document).ready(function () {
$('#editor').jqxEditor({
height: "400px",
width: getWidth('editor'),
stylesheets: ['editor.css'],
createCommand: function (name) {
switch (name) {
case "font":
return {
init: function (widget) {
var source =
[{ label: 'Arial', value: 'Arial, Helvetica, sans-serif' },
{ label: 'Comic Sans MS', value: '"Comic Sans MS", cursive, sans-serif' },
{ label: 'Courier New', value: '"Courier New", Courier, monospace' },
{ label: 'Georgia', value: "Georgia,serif" },
{ label: 'Helvetica', value: "HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica" },
{ label: "Impact", value: "Impact,Charcoal,sans-serif" },
{ label: "Lucida Console", value: "'Lucida Console',Monaco,monospace" },
{ label: 'Tahoma', value: 'Tahoma,Geneva,sans-serif' },
{ label: "Times New Roman", value: "'Times New Roman',Times,serif" },
{ label: 'Trebuchet MS', value: '"Trebuchet MS",Helvetica,sans-serif' },
{ label: 'Verdana', value: "Verdana,Geneva,sans-serif" }];
this.value = source;
widget.jqxDropDownList({
source: source
});
}
}
}
}
});
});
<textarea id="editor"> <b>jqxEditor</b> is a HTML text editor designed to simplify web content creation. You can use it as a replacement of your Textarea or you can create it from a DIV element.
<br />
<br />
Features include:
<br />
<ul>
<li>Text formatting</li>
<li>Text alignment</li>
<li>Hyperlink dialog</li>
<li>Image dialog</li>
<li>Bulleted list</li>
<li>Numbered list</li>
</ul>
</textarea>