-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to insert text to cursor position? #282
Comments
Dear HackerWins? Any help on this? Thanks. |
Would like to see how this can be done. Have the same requirement. |
I would also like this looked at for issue #354 |
any news on it? |
Hi, juste replace "this.substring" with "oldContent.substring" Dear HackerWins, thanks a lot for your work, if you could add this function to summernote plugin it would be great !! |
👍 |
👍 |
I'm also interested in this feature. |
@mrjunaidali, @abishekrsrikaanth, @Diabz, @studojunkyard, @baptistedonaux, @atuttle For now, You can insert text with plugin (develop branch only). below example plugin link.
If you access editor instance you can use other editor's functions(insertNode, undo, bold, ...) https://github.com/HackerWins/summernote/blob/develop/src/js/editing/Editor.js |
@hackerwins: At first glance it looks like this could be problematic if there are multiple editors on the same page, though I haven't tested it. If that is true, it would be better if there were a |
Is it possible to do text insertion without using the bleeding edge code? How soon do you expect to have it completed and available in master? |
@atuttle Now v0.6.0 released. |
I'll probably get a chance to try it later this week, but I still have my initial question: Is |
@hackerwins what is '$editable'. |
$editable is jquery element with contenteditable attribute. <div class="note-editable" contenteditable="true" style="height: 300px;"></div> |
Please use new summernote api. refer to http://summernote.org/#/deep-dive |
The new summernote api did not fix #1611, custom drop down does not insert selected list item at cursor position but enters it at the beginning of the editor. |
Use the $('#summernote').summernote('editor.saveRange');
// Editor loses selected range (e.g after blur)
$('#summernote').summernote('editor.restoreRange');
$('#summernote').summernote('editor.focus');
$('#summernote').summernote('editor.insertText', 'This text should appear at the cursor'); Alternatively, you can context.invoke('editor.saveRange');
// Editor loses selected range (e.g after blur)
context.invoke('editor.restoreRange');
context.invoke('editor.focus');
context.invoke('editor.insertText', 'This text should appear at the cursor'); It's how the summernote/src/js/base/module/Clipboard.js Lines 72 to 74 in 24f20fe
|
@jimmynguyc You saved my life ! 👍 |
@jimmynguyc You save my life, |
@jimmynguyc hey Jimmy, thanks for the info. But it seems that saveRange and restoreRange aren't working in Safari (Version 11.0.3). Can anyone confirm this? |
@msqar indeed, I got the same problem. It's not working on safari apparently EDIT: I was using insertNode, i now use pasteHTML and it's working with safari. |
Do you found any solutions? |
Hi All,
its a nice, easy and very light too.
I want o have an option to insert text to cursor position? any help?
Thanks
Junaid
The text was updated successfully, but these errors were encountered: