Opened 17 years ago
Last modified 13 years ago
#1424 confirmed New Feature
Delete / backspace next to "Control" elements should select that control, rather than deleting
Reported by: | Scott McNaught | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
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 (5)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
Keywords: | Discussion added |
---|---|
Milestone: | → FCKeditor 3.0 |
Type: | Bug → New Feature |
If not adding a lot of overhead to the code, I think it is a good idea. We can also make it configurable, for those guys who will (certainly) say that they prefer it the other way.
For now, targeting to the 3.0 for discussion.
comment:3 Changed 16 years ago by
Milestone: | CKEditor 3.0 → CKEditor 3.x |
---|
comment:5 Changed 13 years ago by
Status: | new → confirmed |
---|
When called from backspace function:
When called from delete function