Found the reason: the onselectionchange event was removed between switching to code view and normal view. I'm using a workaround:
- var tabEditOnCommandRunning = false;
- function CuteEditor_OnCommand(editor, command, ui, value) {
- if (command.toLowerCase() == 'tabedit') {
- if (tabEditOnCommandRunning) return false;
- tabEditOnCommandRunning = true;
- editor.ExecCommand(command, ui, value);
- var editdoc = editor.GetDocument();
- if (editdoc.attachEvent)
- editdoc.attachEvent('onselectionchange', function(event) { ... });
- else if (editdoc.addEventListener)
- editdoc.addEventListener('selectionchange', function(event) { ... }, true);
- tabEditOnCommandRunning = false;
- return true;
- }
- }
so it works now. I'm not too sure if you guys think this is a bug/ unsupported feature, but I'm leaning towards bug.