Closed
Bug 1112276
Opened 10 years ago
Closed 9 years ago
"cut" should work for contentEditable selections
Categories
(Firefox for Android Graveyard :: Text Selection, defect, P5)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: miketaylr, Assigned: miketaylr)
References
Details
Attachments
(1 file)
See Bug 783846, which covered paste not working. Cut should also be possible to get working.
Comment 1•10 years ago
|
||
I noticed you can't use element.value to cut here
(contentEditable HTMLElements use nsHTMLEditor vs nsIEditor (iirc) ...)
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/SelectionHandler.js?rev=7a58fbd76acd&mark=673-673#664
Switching to something along the lines of:
Selectionhandler.getSelection().deleteFromDocument();
Should work for editables (HTMLInputElement, HTMLTextAreaElement) and contentEditables.
Assignee | ||
Comment 2•10 years ago
|
||
Oh sweet. My first attempt was substring'ing textContent but I wasn't sure how that would behave across nodes, etc.
Comment 3•10 years ago
|
||
exactly! In one edge case, if the user has (apparently) selected all content by dragging the handle to the right edge of an editable, the focusNode can become the next node with an offset of 0 (-ish - there's more to that story where it can actually wind up as the parent node with an offset of 1).
If the container is an <input>, the #text node is an anonymous node of an anonymous parent div. For <textareas> there can be a terminating anonymous <br> inside the editable, and other weird-ness
So that rats nest is best avoided :-D
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → miket
Assignee | ||
Comment 4•10 years ago
|
||
Here's a patch that has cut working, but I ran into some problems with the Robocop tests failing (for reasons I don't understand yet). I probably won't have time to get back into this for a few weeks if some one wants to take over.
Assignee | ||
Comment 5•10 years ago
|
||
To be more clear, the tests that were failing were the tests I'm trying to write for "cut". Everything else passed.
Comment 6•9 years ago
|
||
Pruning some old bugs (part 2) either:
) obviated by new Core/Layout AccessibleCaret implementation in m-c and stable, targeted for 47.
) Or no longer being observable.
If you still see what you consider incorrect behaviour with the new version, please file a new bug targeted there, and attach a test-case or example link to help things :-)
Specific Note here: Works now, using test page: [0], and contenteditable fields on bottom (TAP ME TAP ME) etc.
[0] https://www.dropbox.com/s/j5jcon30y8vda3u/test_bug988143.html?dl=0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•