Reputation: 1773
Is it possible to get CKEditor to recognize tab as a feature inside the editor, especially when in source code mode? Right now, when I hit the tab key, the cursor goes to the next field on the page.
I'd like to get the tab character working so CKEditor can work more like a code editor in which I can format my markup with tab spaces.
I'd really appreciate any help I can get with this.
I'm using CKEDitor 4.0.1
Or, perhaps this feature is supported in one of the newer versions of CKEditor?
Upvotes: 5
Views: 13231
Reputation: 1
If you using inline element, you can use like this
var editor2 = CKEDITOR.inline( 'your div id', { tabSpaces : 5, });
Upvotes: 0
Reputation: 1165
<textarea name="text_note" id="text_note"> </textarea>
<!-- tabSpaces:4 add this in your script like as bellow code.-->
<script type="text/javascript">
CKEDITOR.replace('text_note',{tabSpaces:4});
</script>
Upvotes: 1
Reputation: 166
The code is config.tabSpaces = 4;
if you are saving to config.js. If you are setting configurations inside the file, the code will be as follows:
var editor = CKEDITOR.replace( 'editor1', {
tabSpaces: 4
});
it should be noticed, as Kamil Sama commented in rvighne answer, that this requires the tab plugin: tab plugin
Upvotes: 1
Reputation: 21887
This link might help: http://get-simple.info/forums/showthread.php?tid=1347
Basically, just add
config.tabSpaces = 4; // or some other value
to config.js
and every time Tab is hit, you get that number of spaces.
Upvotes: 18