Ticket #1424 (new New Feature)
Delete / backspace next to "Control" elements should select that control, rather than deleting
| Reported by: | Scott | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.0 |
| Component: | General | Version: | |
| Keywords: | Discussion | Cc: |
Description
When the cursor is placed next to (as IE puts it) a "control" element, such as an image or a table, it should select it on delete / backspace.
This improves the intuitiveness of deleting and makes sure people dont delete things accidently.
Here is a function partially implemented which does this
FCKListsLib.ControlElements = {'img':1, 'table':1, 'input':1};
// Helper function upon deleting a node that may be a control (must select it first)
// A control is something like an image or table which can be selected with the cursor
FCKEnterKey.prototype.HandleControlNodeSelect = function(pRange, bIsForward)
{
// Check to see if we are about to delete an image or table
// TODO: this is IE specific at the moment!
if(FCKBrowserInfo.IsIE)
{
// TODO: this only works when a element is in a block
var pStartBlock = pRange.StartBlock;
if(pStartBlock)
{
var iDirection = bIsForward ? 0 : -1;
var iOffset = pRange._Range.startOffset;
var pPrevious = pStartBlock.childNodes[iOffset + iDirection];
if(pPrevious && FCKListsLib.ControlElements[nodeGetTagName(pPrevious)] != null)
{
FCKSelection.SelectNode(pPrevious);
return true;
}
}
}
return false;
}
Change History
Note: See
TracTickets for help on using
tickets.