Editor and FileBrowser - Jodit. Pure javascript. No libraries! Lightweight:~32kB gzipped.
Read more
<textarea id="editor" name="editor"></textarea> <script> var editor = new Jodit('#editor', { uploader: { url: '../connector/index.php?action=upload', process: function (resp) { resp.baseurl = '/jodit/files/'; return resp; } }, filebrowser: { ajax: { url: '../connector/index.php', process: function (resp) { resp.baseurl = '/jodit/files/'; return resp; }, } } }); </script>
Download last release or
bower install jodit
npm install jodit
Include just two files
<link type="text/css" rel="stylesheet" href="jodit.min.css">
<script type="text/javascript" src="jodit.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jodit/2.3.30/jodit.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jodit/2.3.30/jodit.min.js"></script>
And some <textarea>
element
<textarea id="editor" name="editor"></textarea>
After this, you can init Jodit plugin
new Jodit('#editor');
- Latest Chrome (desktop)
- Latest Firefox (desktop only)
- Latest Safari (desktop)
- Latest Opera (webkit)
- Internet Explorer 10
- Microsoft Edge
Added editorCssClass option - Class name that can be appended to the editor Fixed internacionalization
Added triggerChangeEvent option Fix uploader's options - When the uploader is not configured, the editor still displays images upload button
Add Dom.defaultAjaxOptions.async By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false
Added headers
option in {@link module:FileBrowser|FileBrowser} and {@link module:Uploader|Uploader}. But primarily in {@link module:Dom|Dom}
var token = document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
editor = new Jodit("#redactor", {
uploader: {
url: '../connector/index.php?action=upload',
headers: {
'X-CSRF-Token': token
}
},
filebrowser: {
ajax: {
url: '../connector/index.php',
headers: {
'X-CSRF-Token': token
}
}
},
});
// or replace global options
Jodit.modules.Dom.defaultAjaxOptions.headers = {
headers: {
'X-CSRF-Token': token
}
};
Jodit.modules.Dom.ajax({
url: 'data.json',
headers: {
'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6,de;q=0.4,ja;q=0.2'
},
success: function (resp) {
console.log(resp)
}
})
Fixed #issues1
Fix dialog's module when was opened Promt window, after Enter submit the form and the page reloaded. Fix connector's bugs Update Jodit.i18n method. Now it can be used staticly
var editor = new Jodit("#redactor", {
langusage: 'ru'
});
console.log(editor.i18n('Cancel')) //Отмена;
Jodit.defaultOptions.language = 'ru';
console.log(Jodit.prototype.i18n('Cancel')) //Отмена
Jodit.lang.cs = {
Cancel: 'Zrušit'
};
Jodit.defaultOptions.language = 'cs';
console.log(Jodit.prototype.i18n('Cancel')) //Zrušit
Jodit.lang.cs = {
'Hello world': 'Hello 1$ Good 2$'
};
Jodit.defaultOptions.language = 'cs';
console.log(Jodit.prototype.i18n('Hello world', 'mr.Perkins', 'day')) //Hello mr.Perkins Good day
Fixed Jodit.destroy method
var editor = new Jodit('.jodit');
editor.destroy();
Fix bug when Dialog module was used without Jodit context
Jodit.Alert('Hello world!!!');
Fix dialog's module zIndex manage. Fix Dom.css method bug. That example has not worked.
Jodit.modules.Dom('.someelement').css('z-index', 1000)
Fix bug in Uploader module when http://sitename.net/jodit///files/fg.jpg
was replaced http:/sitename.net/jodit/files/fg.jpg
Added afterInsertImage
event - triggered after image was inserted selection.insertImage.
This method can executed from Filebrowser or Uploader
var editor = new Jodit("#redactor");
editor.events.on('afterInsertImage', function (image) {
image.className = 'bloghead4';
});
Fix bug with inserting table
Work with table became faster
- Fix filbrowser bug. When a new file is uploaded file list has not been updated
- Added dialog.zIndex option
Fix toolbar width fot fullsize mode
- Fix CodeMirror bug on download XML parser
- Fix CodeMirror bug endless cycle
- Fix overflow behavior in fullsize mode
Fix connector problem and fix item's style in filebrowser
Switched on FontAwesome icons
Added copy-paste image file for FireFox
Fix copy-paste for FireFox
Added copy-paste support by clipboard image. Try paste print screen.
Added the ability in the file browser to obtain data about the file not as a string and as an object with parameters {file: 'name.jpg', thumb: '_thumbs/name.jpg'}
Fix conflict between textProcessor and Beatyfier plugins
Fix BACKSPACE entering behavior. And fix ie10 support
Added iframe, iframeStyle, iframeIncludeJoditStyle, iframeCSSLinks, width, height, minHeight.
iframe
by default false. When this option is enabled, the editor's content will be placed in an iframe and isolated from the rest of the page.
width
and height
you can set size fot editor
Added internationalization. Read more http://xdsoft.net/jodit/doc/Jodit.defaultOptions.html#.language
Added Split mode. Added useSplitMode options (default true) Example here
Fix dialog bug
Added CodeMirror plugin. Enable by default {@link defaultOptions~codeMirror.|options.codeMirror}
We got rid of jQuery
Fix bug in filebrowser
Fix bug when selection.insertHTML dosn't work without focus
Fix bug with uploader and filebrowser
If source textarea
has placeholder
attribute then Jodit use it how placeholder
Added About button
First release