Questions tagged [rangy]

Rangy is a cross-browser JavaScript range and selection library.

Rangy is a cross-browser JavaScript range and selection library. It provides a simple standards-based API for performing common DOM Range and Selection tasks in all major browsers, abstracting away the wildly different implementations of this functionality between Internet Explorer up to and including version 8 and DOM-compliant browsers.

The project website is http://code.google.com/p/rangy/.

225 questions
0
votes
2 answers

JQuery, how to append div after selected text in html?

Hi is that possible to add div after selected text? with jQuery or java-script and rangy js I'm try with below code but not working.. function pin_surroundRange() { var range = getFirstRange(); //get selected text via rangy js if(range !=…
Wiram Rathod
  • 1,895
  • 1
  • 19
  • 41
0
votes
1 answer

rangy fix boundaries

When selecting text there is some variation on exactly where the selection starts and ends as in sometimes it starts at the end of the previous element and sometimes at the start of the textnode. I'm trying to normalize this so it always starts at…
poby
  • 1,572
  • 15
  • 39
0
votes
0 answers

Hallo.js - Rangy is not defined

I just tried to add the Hallo.js editor to my website. It kind of works, but as soon as I'm editing a text, I see the following error in Chrome and Firefox. In Opera it seems to work fine. rangy is not defined (sel = rangy.getSelection(); Line…
MrSnoozles
  • 860
  • 8
  • 13
0
votes
2 answers

Why does the selection disappear when clicking on a div?

I'm using the following code to edit a text in contenteditable div by changing its font. when clicking on a div which is a stylized dropdown menu the selection disappears in chrome. It works fine in firefox, opera and even in IE! Rangy doesn't find…
Develop Smith
  • 146
  • 1
  • 3
  • 13
0
votes
2 answers

using Rangy.js to paste plain text without HTML tags

I tied to search and search around here and Google, But i not found any solution to do it so simple via using Rangy.js or native JS. If I have simple formatted text to copy like..
Copy me (All) : Soufflé chupa chups
l2aelba
  • 21,591
  • 22
  • 102
  • 138
0
votes
1 answer

How to use Rangy's toggleRange method?

I'm using the following code to insert a link inside the a range. I have the following function which being called by a button to save the selected text. Then it shows the linkBar div which include a text input for link insertion. Notice: when I…
Develop Smith
  • 146
  • 1
  • 3
  • 13
0
votes
0 answers

Rangy - selectNode() - different behaviour in different browsers?

I'm working with rangy and got a question relating to selection and its cross browser behaviour. I've got some elements inside a div (e.g. a hyperlink) and I'd like to be able to select the outerHTML when clicking inside this element.
Lorem…
vso
  • 199
  • 2
  • 17
0
votes
1 answer

How to select img, object tag... by rangy?

I use rangy highlight selection text (it wrap selection text by a span tag). But when i select text and image, it generate a span tag but span can't wrap img tag. it append before img tag. My code cssApplier =…
Anh Tú
  • 636
  • 7
  • 21
0
votes
1 answer

How to get a selection.range before mousedown event?

I don't understand why I can't get the right range object. It's hard for me to explain the problem. For example: I have five divs, each div contain a phrase. Logically if I trigger a mousedown event in one of these div I can get the event-target.…
koMah
  • 429
  • 5
  • 18
0
votes
1 answer

Object has no method 'methodeX'
i get an error in chrome: Uncaught TypeError: Object s1A has no method 'applyToSelection' in Firefox(firebug) i get this: TypeError: val.applyToSelection is not a function i use the rangy-core and the rangy-cssclassappliere my Code:
kuki
  • 79
  • 2
  • 9
0
votes
1 answer

Making rangy CSSClassApplier only toggle an element, not a class

Is there anyway/how can I make rangy's CSSClassApplier only toggle an element, not a class. I tried: var applier = rangy.createCssClassApplier(null, { elementTagName: 'strong' }); But is doesn't work.
Petah
  • 45,477
  • 28
  • 157
  • 213
0
votes
1 answer

Convert tokens into selection ranges

How would I convert a set of token ranges inside a jQuery selection, to a set of rangy ranges? For example I have this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas convallis dui…

Petah
  • 45,477
  • 28
  • 157
  • 213
0
votes
1 answer

With Rangy, even though I extend the range by setStartBefore method, range.canSurroundContents method still returns false

I have the following html:

Morbi quis augue vitae quam pharetra| varius at at| urna.

The selection is marked with | characters. Also a screenshot of the selection: I can extend this selection to contain the whole 'a' element…
matte
  • 1,196
  • 4
  • 13
  • 21
0
votes
0 answers

attribute name of span in rangy with css

How can i put the atribute name of a span in Ragy with cssApplier. One example: i try: highlighter.addCssClassApplier(rangy.createCssClassApplier("note", { ignoreWhiteSpace: true, …
Martin
  • 1,282
  • 1
  • 15
  • 43
0
votes
1 answer

Rangy move boundaries of user selection out of header element

I'm using rangy and have a case with a contenteditable div where the users selection can be saved and later restored so that HTML can be inserted. My problem is that if the user selects within a header element, I don't want the html inserted within…
Frank
  • 163
  • 2
  • 3
  • 11
1 2 3
14
15