#44 ✓resolved
JamLegend

Control.TextArea wrapSelection "double-effect" patch

Reported by JamLegend | January 20th, 2009 @ 08:38 PM | in 1.0

Current situation:

Select text, click bold. The selection is now surrounded by markdown for bold. Select the same region of text, click bold again. The selection is now "double-bolded." In most rich text editors, the effect would be to remove the bold.

Ergo, textarea.js wrapSelection could be implemented as:


var sel = this.getSelection();
if (sel.indexOf(before) == 0 && sel.lastIndexOf(after) == (sel.length - after.length)) {
    this.replaceSelection(sel.substring(before.length,sel.length - after.length));
} else {
    this.replaceSelection(before + sel + after);
}

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

NOTE: Please do not open tickets here. If you have an issue, please open it on http://github.com/syntacticx/livepipe-ui/issues/

High quality widgets and controls for web 2.0 applications built using the Prototype JavaScript Framework. Each control is well tested, highly extensible, fully documented and degrades gracefully for non JavaScript enabled browsers where possible. MIT licensed and actively maintained.

Pages