-
Notifications
You must be signed in to change notification settings - Fork 259
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
Add slash command and emoji picker to mail composer #8594
Conversation
is it because the focus is lost when the picker shows? Could we get the last cursor position on blur? |
@hamza221 mind to resolve the conflicts and rebase on main? |
7253719
to
c9d4621
Compare
I can reproduce. CKEditor uses an internal structure to represent the content, and therefore it's a bit tricky to insert data or modify the content externally.
The approach to delete the last character only works for What we actually want is to take the current position, go back to the last slash and replace with the link. I found your approach connecting Tribute.js and CKEditor very creative, yet I have mixed feelings about it. CKEditor has a mentions plugin https://ckeditor.com/docs/ckeditor5/latest/features/mentions.html and there is also a poc for a slash commands based on it ckeditor/ckeditor5@865c940. Likely, an implementation based on the mentions plugin will take some time. |
CKEditor slash commands need a license #8514 (comment) |
Slash commands is a premium feature and requires a commercial license. My hope was/is that we could implement our slash commands based on the mentions plugin. The CKEditor slash commands is also using the mentions plugin internally. ckeditor/ckeditor5@865c940 is a poc done by a CKEditor developer. I would prefer an integration with CKEditor based on the mentions plugin, but cannot give you an estimate. |
Can you confirm that it only happens for the first link and the second, third, … work as expected? |
|
src/components/TextEditor.vue
Outdated
if (eventData.marker === '/') { | ||
getLinkWithPicker(item.id) | ||
.then((link) => { | ||
this.editorInstance.execute('InsertItem', link, '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.editorInstance.execute('InsertItem', link, '/') | |
this.editorInstance.execute('InsertItem', link, '/') | |
this.editorInstance.editing.view.focus() |
Seems to "workaround" the reset cursor issue.
If the reference picker is open window._nc_focus_trap shows three focus traps.
When closing the picker the focus goes back to ckeditor.
I'm still lost what is causing ckeditor to reset the cursor then, especially because we had a selection before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workaround works 👍
I expect the smart picker only to show if I press enter right after the slash |
It's because searchProvider returns 'Any Link' if there's no match which is not useful here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't comprehend the CKEditor magic but the feature works flawless now
🚀
a19fecb
to
ca45f13
Compare
Signed-off-by: hamza221 <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
ca45f13
to
f34f69b
Compare
Possible follow up:
|
@kesselb I'm not sure I understand , Do you mean what's happening in this screen recording? |
Closes #8514