“Smart tabs” sound better, a quick look at configuration files for both vim
and sublime text
:
Vim
---
noexpandtab
tabstop
smartindent
smarttab
Sublime Text
------------
tab_size
translate_tabs_to_spaces
use_tab_stops
...
smarttab
in vim is used to respect <BS>
character in some circumstances. For example if a tab key is to insert 4 spaces, a <BS>
will delete 4 spaces if it is performed after smartindent
/expandtab
inserts 4 spaces in front of a line.
In the case of EpicEditor, we are combining some of these features into one option:
- Enable tab key (and shift-tab);
- Don't expand tab to spaces (and use css: tab-size instead) – I think expansion of tabs could be useful, but may introduce too many options/variables. But it is something we can discuss: my position is to keep it simple, at least for this first implementation. But I will experiment with this, keen to see how this will work;
- By enabling tab key, we introduce smart indentation (rule where previous lines' indentation is respected).
What I can do is try and experiment with internal options such as smartIndentation
, smartTabs
, expandTab
and see how they pull up together. I am quite keen on seeing how others implement this first.
We can always change the name later on. I'll keep it as smartTabs
for now.
That's the goal and I'm already basically doing this with
_getText()
and_setText()
. The only tags I leave are<br>
s. I'll explain below in response to your #2 point.Yes, roll our own for sure. The
_getText
function in EE works great for stripping pasted text. The only problem I have is putting the cursor position in the place where the user pasted after pasting. If you can figure that out I'd love you forever :PHere's where I finally started looking for help but still didn't get any: http://stackoverflow.com/questions/11141439/how-do-i-not-lose-position-of-cursor-on-paste-with-javascript
Also an EE ticket for this: OscarGodson/EpicEditor#100
You can't just insert
\n
characters since it's acontentEditable
which means it's just an HTML document. If you put in new lines it won't do anything because, as you most likely know, HTML doesn't care about line breaks. That's why the only HTML tag I allow is<br>
sKeep in mind we'll still need to support our own HTML. Eventually we want to support Mou style editing and have nice right click context menus like Byword. This is later on in "V2", but something to keep in mind.
And about the tabbing stuff and older browsers, great that all sounds good!