RedaktorYii plugin for WordPress
RedaktorYii (version 10.0.5) is the most fantastic yet beautiful and easy-to-use WYSIWYG editor on jQuery. It is lightning fast, small, scalable, and powerful. It replaces the default WordPress editor with the more elegant RedaktorYii (github.com/yiiext). RedaktorYii is free to use on non-profit sites, written in JavaScript
Cross-browser
- Features
- Awesome drag & drop files and images upload
- Keyboard shortcuts
- Many toolbar options
- Various display modes
- Source code view
- Incredible fullscreen view
- Autoresize as you type
- Autosave utility
- Multiple editors on the same page
- API
Download the plugin: redaktorYii_10.0.5.cab
Redactor is freely distributed under MIT/GPL.
Installation
Don’t forget to change file’s paths in case your Redactor is located in different folder.
1 |
Redactor// <textarea id="redactor_content" style="height: 560px" name="content"></textarea> |
Keyboard shortcuts
Ctrl + z — Undo
Ctrl + Shift + z — Redo
Tab — Increase indent
Shift + Tab — Decrease indent
Ctrl + m — Clear formatting
Ctrl + b — Bold
Ctrl + i — Italic
Ctrl + k — Numbered list
Ctrl + j — Bulleted list
Ctrl + l — Superscript
Settings
lang
English — en | Spanish – es | German – de |
Italian – it | French – fr | Brazilian Portuguese — pt_br |
Russian – ru | Latvian – lv | Polish — pl |
Turkish — tr | Dutch — nl | Ukrainian — ua |
Albanian – sq | Japanese – ja | Chinese Simpifiled — zh_cn |
Belorussian – by | Hungarian — hu | Bulgarian – bg |
Czech – cz |
toolbar
Default setting is ‚default‘
1 |
$('#redactor').redactor({ toolbar: 'mini' }); |
load (true)
If set to false, this setting turns off automatic connection of the ‚toolbar‘ and ‚language‘ files. You can connect them to Redactor manually.
1 |
$('#redactor').redactor({ load: false }); |
path (false)
If set to actual path, Redactor will connect styles, toolbar files and language files using this path.
1 |
$('#redactor').redactor({ path: 'http://site.com/js/' }); |
css (’style.css‘)
You can connect different styles to Redactor by setting this to css.
1 |
$('#redactor').redactor({ css: 'wym.css' }); |
focus
Default setting is false.
This option allows you to set whether Redactor gets cursor focus on load or not.
1 |
$('#redactor').redactor({ focus: true }); |
resize
Default setting is true.
You can turn on and off height resizing bar at the bottom of Redactor’s text area.
1 |
$('#redactor').redactor({ resize: false }); |
autoresize
Default setting is false.
This option turns on height autoresizing, which depends on amount of text.
1 |
$('#redactor').redactor({ autoresize: true }); |
fixed
Default setting is false.
If this option is turned on, Redactor’s toolbar will stick to the top of the browser’s window.
1 |
$('#redactor').redactor({ fixed: true }); |
autoformat
Default setting is true.
Turns on and off autoformatting in Redactor. With this option turned off, Redactor will not format text as paragraphs.
1 |
$('#redactor').redactor({ autoformat: false }); |
cleanUp
Default setting is true
Turns on and off garbage tags cleanup after pasting text form MS Word.
1 |
$('#redactor').redactor({ cleanUp: false }); |
convertDivs
Default setting is true.
Turns on and off div to p replacement.
1 |
$('#redactor').redactor({ convertDivs: false }); |
removeClasses
Default setting is true.
With this option turned on, Redactor will remove all tag’s classes.
1 |
$('#redactor').redactor({ removeClasses: false }); |
removeStyles
Default setting is false
With this option turned on, Redactor will remove all tag’s styles.
1 |
$('#redactor').redactor({ removeStyles: true }); |
convertLinks
Default setting is true
With this option turned on, Redactor will automatically replace URLs with hyperlinks.
1 |
$('#redactor').redactor({ convertLinks: false }); |
autosave
Default setting is false
If you set a path to the handler file, Redactor automatically sends the code with default intervals. Autosave will send variable $_POST[‚data‘] independently from textarea name.
1 |
$('#redactor').redactor({ autosave: '/save.php' }); |
interval
Default setting is 60
Autosave interval (in seconds).
1 |
$('#redactor').redactor({ autosave: '/save.php', interval: 30 }); |
imageGetJson
Default setting is false
A path to json file, which stores data about already uploaded files..
1 |
$('#redactor').redactor({ imageGetJson: '/images.json' }); |
json file example:
[
{ „thumb“: „/images/1m.jpg“, „image“: „/images/1.jpg“ },
{ „thumb“: „/images/2m.jpg“, „image“: „/images/2.jpg“ },
{ „thumb“: „/images/3m.jpg“, „image“: „/images/3.jpg“ },
{ „thumb“: „/images/4m.jpg“, „image“: „/images/4.jpg“ },
{ „thumb“: „/images/5m.jpg“, „image“: „/images/5.jpg“ }
]
imageUpload
Default setting is false
This option sets a path to a file, responsible for images‘ uploading. The handler will receive an array $_FILES[‚file‘].
1 |
$('#redactor').redactor({ imageUpload: '/image_upload.php' }); |
The handler should return JSON, for example:
$array = array(
‚filelink‘ => ‚/tmp/images/‘.$file
);
echo stripslashes(json_encode($array));
imageUploadCallback
Default setting is false
1 2 3 4 5 6 7 |
$('#redactor').redactor({ imageUpload: '/image_upload.php', imageUploadCallback: function(obj, json) { … } }); fileUpload Default setting is false This option sets a path to a file, responsible for files' uploading. The handler will receive an array $_FILES['file']. |
1 |
$('#redactor').redactor({ fileUpload: '/file_upload.php' }); |
The handler should return JSON, for example:
$array = array(
‚filelink‘ => ‚/files/‘.$_FILES[‚file‘][’name‘],
‚filename‘ => $_FILES[‚file‘][’name‘]
);
echo stripslashes(json_encode($array));
fileUploadCallback
Default setting is false
$(‚#redactor‘).redactor({
fileUpload: ‚/file_upload.php‘,
fileUploadCallback: function(obj, json) { … }
});
direction
Default setting is ltr
Set a text direction.
1 |
$('#redactor').redactor({ direction: 'rtl' }); |
fullscreen
Default setting is false
Activate fullscreen mode on start.
1 |
$('#redactor').redactor({ fullscreen: true }); |
overlay
Default setting is true
Turns on and off overlay for modal Redactor’s windows.
1 |
$('#redactor').redactor({ overlay: false }); |
callback
Default setting is false
Callback after a editor build.
1 2 3 |
$('#redactor').redactor({ callback: function(obj) { … } }); |
keyupCallback
Default setting is false
1 2 3 |
$('#redactor').redactor({ keyupCallback: function(obj, event) { … } }); |