質問

First: I am not entirely sure of the difference between ranges and selections.

I want to:

  1. Highlight some text

  2. Click on a button and wrap a class around the selected text (I am able to do this using rangy, BUT rangy needs the text to be in a highlighted state, BUT that click removes the highlight on the text.)

Question:

How do i reproduce the highlighted text after that click, so that rangy has something to work with?

Thanks!

役に立ちましたか?

解決

There is an example on the rangy code repository that does exactly what it seems you want.

Have a look at this: http://rangy.googlecode.com/svn/trunk/demos/highlighter.html

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top