Customize commenting box

Tags: #<Tag:0x00007f249db33ad0>

Hi! I am playing with the Comments plugin. In my case I have a custom commenting editor elsewhere in my app (that includes @mentions and such) that I would like to use instead of the textarea editor. How might I achieve this? I don’t see anything in the Comments API that seems to allow customizing the editor, so a second option would be to show my own editor when the comment box is triggered to show. I see there’s a hidden div htComments that contains a htCommentTextArea, I guess I could hide the textarea with CSS and update the contents of htComments with my owner UI when the comment is triggered is show? But how do I know when the comment is shown? I don’t see a afterCommentShow hook or something like that.

That’s true… that textarea is even hard to style, not meeting adding any logic inside it.

Maybe you could try to clone the plugin and replace the textarea with a span. But I haven’t tried that and don’t know if that won’t break any comment alignment/display-related logic.

On the other hand. We have the ability to add a custom context menu option so you could add a new element on top of the cell. But then you’d need to create your own hooks. In v12 we added a simple way to add shortcuts (ShortcutManager) so that could also help to prepare some custom shortcuts for adding the custom comment.

I guess that the path to choose depends on the abilities that your ideal comment has to have.

1 Like