How to get selected text
See original GitHub issueHow can I get the selected text in the editor? I checed the code, it call document.getSelection()
, how can I get it manually.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
How do I get the text value of a selected option?
Select elements typically have two values that you want to access. First there's the value ... The second is the text value of...
Read more >Get selected text from a drop-down list (select box) using jQuery
If you already have the dropdownlist available in a variable, this is what works for me: $("option:selected", myVar).text().
Read more >How to get selected text from a drop-down list using jQuery?
How to get selected text from a drop-down list using jQuery? ; By using val() method : The val() method is an inbuilt...
Read more >How to Retrieve the Text of the Selected option Element in a ...
In this article, we'll look at how to retrieve the text of the selected option element in a select element with JavaScript. Use...
Read more >Window.getSelection() - Web APIs | MDN
The Window.getSelection() method returns a Selection object representing the range of text selected by the user or the current position of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Here is my workaround
injectJavascript
method does not exist innode_modules/react-native-pell-rich-editor/src/RichEditor.js
and you have to add in manually Add these lines inRichEditor.js
To add
injectJavascript
automatically you can use postinstall script in package jsonpackage.json
Create
update_modules.sh
and add these linesHaving the ability to get both the selected text, surrounding html and character range would be very helpful.
For example:
<p>NORMAL TEXT. <b>BOLD TEXT.</b></p>
If we select “BOLD TEXT” in the editor, it would be awesome to have a method that could return the selected text and even more helpful if there was a method that could return
<b>BOLD TEXT.</b>
.React Native Quill editor has the ability to return the selection range. Its
onSelectionChange
method will return data like this:{"oldRange": {"index": 19, "length": 6}, "range": {"index": 18, "length": 7}, "source": "user"}