Basic usage
Or you can simply use the appropriate class
in you HTML :
The plugin automatically changes the textarea
s with the text-editor
class into a text editor.
Customization
You can override some configuration if you like :
Overriding URLs baseURL
If you need to override the URLs used in your editor. For example if you want to use a specific directory as the origin for relative URLs, just do so:
This will update the URLs in the preview element but keep the original ones in the result sent to your server. Pretty simple, isn't it?
Buttons className
If you want to add some custom class to the editor's buttons, just use this option:
Or you can use an Array:
Tailor-made buttons
If you want to use your own buttons, here's how to do it:
Options available
content
(required) : The content of the button. Can be any HTML string you want (but you may want to keep it simple)command
(optional) : The parameter to use withexecCommand
. Should be part of the following listcustomCommand
(optional) : Your custom command to execute when the button is clicked.this
will be theTextEditor
object and the first and only argument will be thebutton
object you're editingclassName
(optional) : The HTMLclass
attribute to apply to the button elementtitle
(optional) : The HTMLtitle
attribute to apply to the button element (may be useful to describe what it does)
Note that you should provide at least one the command
or customCommand
key to make the button do something. If you don't, pressing it will only refresh the content of the textarea
, which is already done automatically when typing into the replacement div
.