Selection no longer available
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 406
- Forks
- 131
- Avg merge
- 2h 32m
- Merged PRs (30d)
- 2
Description
Hi,
I'm using React and this seemed to work on the previous version. I'm grabbing a reference using the following...
<JoditEditor
ref={ refObj => { this.jodit = refObj; } }
value={this.state.content}
config={this.config}
onChange={this.onJoditEditorChange}
/>
Then elsewhere trying to add some HTML to the curser position or replace the selected text...
this.jodit.selection.insertHTML( "<p>some HTML</p>" );
The "this.jodit" is defined, but "selection" is NOT defined (ie crashes with an undefined error)!
Is there a different way I should be doing this? I've tried using the SelectStart and SelectEnd values. But they don't change, are always the length of the present value, therefore my HTML gets inserted at the end of the value.
Thanks
Dave
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown JoditEditor ref and the calls to selection.insertHTML, SelectStart, and SelectEnd. Trace how the React wrapper exposes the editor reference and selection state; done means inserting HTML at the cursor or replacing selected text works without an undefined selection error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100