Bug Tracker

Opened 9 years ago

Closed 9 years ago

#6691 closed feature (invalid)

Feature request: Text Selection

Reported by: vitorhsb Owned by:
Priority: low Milestone:
Component: misc Version: 1.4.2
Keywords: text selection support Cc:
Blocked by: Blocking:

Description

Hi everyone,

what do you think about adding the feature to retrieve/replace the text selected in a page? This would be just like retrieving/replacing text for a jQuery object, by using the text() and text("example text") accordingly, but it would only affect the selected text.

I know that there is a short code for retrieving the text (which involves verifying the suitable javascript method based on the browser) but having it with a simple jQuery shortcut it would be nice... Also, a replace text function would be awesome.

Thanks.

/ retrieve selected text in a page */

function getSelText() {

var SelText = ; if (window.getSelection) {

SelText = window.getSelection();

} else if (document.getSelection) {

SelText = document.getSelection();

} else if (document.selection) {

SelText = document.selection.createRange().text;

} return SelText;

}

Change History (3)

comment:1 Changed 9 years ago by dmethvin

Component: supportmisc

comment:2 Changed 9 years ago by SlexAxton

Milestone: 1.4.31.5
Priority: low
Status: newopen

I think this might be a great plugin, but adding as a valid request.

comment:3 Changed 9 years ago by john

Resolution: invalid
Status: openclosed

Yeah, this will be a fine plugin.

Note: See TracTickets for help on using tickets.