-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
[Feature] Custom floating menu #305
Comments
You should be able to provide plugins to prosemirror directly via. new Editor({
plugins: [
// prosemirror plugins
],
}); or register a plugin on the fly like. const editor = new Editor();
editor.registerPlugin(plugin); Refer bubble component as an example https://github.com/sibiraj-s/ngx-editor/blob/master/src/lib/components/bubble/bubble.component.ts Inject the component into the element with Plus I am working on exposing commands so that would allow to build custom menu easily. like const editor = new Editor();
editor
.commands()
.bold()
.insertText()
.italic()
.exec(); but it will take few weeks. as I am occupied with personal work here. I hope this helps. |
Hi, I create a component for doing this. ballon.component.html ballon.component.css (see Prosemirror tooltip)
ballon.component.ts
Add Then replace
by
Result :I hope this can help you. |
Thanks @fredmabire . It is a good one. But I didn't add it to the lib yet since it was difficult to calculate the position of nodes with images in it. I need to try if I can do one will node_views. couldn't find time. Also this might overlap with the builtin link bubble that showsup when selection has a link or clicked on a link |
No idea if this resource can be useful to you, the Tiptap editor (usable with VueJS) also uses Prosemirror and they have a system where the toolbar appears in a bubble. In any case I am interested in this project. Today I'm using Quill and I'll be taking the arguments in favor of NgxEditor but that's another subject. |
Thanks @GitHubish . I just know Tiptap, not aware of its complete features. I will look into it. Also, I will try to add floating menu components and try to fix conflicts with link bubble that already exists. |
Hi @sibiraj-s ! Maybe I can help if you want. |
@fredmabire cool if I could make you discover a new library. Anyway great job @sibiraj-s |
Thanks @GitHubish. NgxEditor supports plugins. See https://github.com/joelewis/prosemirror-mentions. You can do this and no changes is required from the editor side for now. there are many community provided plugins. you can use them. If nothing is available we can add it. new Editor({
pluigins: [
new MentionsPlugin()
]
}) Create a discussion if you need any help regarding this. Let's continue it there if required. lets keep this discussion for floating menu alone. |
I have added a bubble with minimal options as floating menu built in in v8. It is also possible to make the current menu floating around selection with few lines of code. See https://stackblitz.com/edit/ngx-editor-floating-menu. The position calculation is not perfect yet. I will update that later. |
I have fixed the positioning issue in demo. I will see if I could provide the same as an easy to use built in component with better positioning. |
@sibiraj-s thank you it's already super cool! The problem I often see, which would be great to fix is when the editor is in a modal and the parent has an Do you think it can be done? |
Yes. I have forked your example and made few changes to append to body. Checkout stackblitz |
I just made rendering floating menu simpler in v8.0.0-beta.4 A Simple floating menu (default) <ngx-editor [editor]="editor"> </ngx-editor>
<ngx-editor-floating-menu [editor]="editor"></ngx-editor-floating-menu> // place this whererver required. To make the existing menu float <ngx-editor [editor]="editor"> </ngx-editor>
<ngx-editor-floating-menu [editor]="editor">
<ngx-editor-menu [editor]="editor"></ngx-editor-menu>
</ngx-editor-floating-menu> You can place the floating menu anywhere in the HTML. just make sure its wrapper has Demo: Default Floating Menu |
I don't know if its bug or feature but this info might be helpful for someone:
You can try it here (Ivy is disabled in this example. To fix menu just enable it): |
thanks @wkulinski. Angular 9 comes with ivy enabled by default. It didn't occur to me to test in non ivy mode at the time of development. I will check this. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread. |
I'm submitting a
Feature request
Description
Love the project! Thanks for your hard work.
I'm trying to implement a floating menu that would appear above the line when some text is selected
I saw the issue for menu on the bottom of the editor. I was wondering if It's possible to do it in prosemirror bypassing ngx-editor toolbar altogether?
Thanks for any pointers you can offer.
The text was updated successfully, but these errors were encountered: