Hello everyone!
Some of you are probably already familiar with @adrapereira 's canned replies plugin. For those who are not, canned replies are quick replies that can be inserted into the editor. The current plugin has some limitations and I am planning on solving some of those. This thread is a small update report.
Any feedback is appreciated.
One of the things I am trying to improve is the user interface. I am going to follow the “make the common case fast” principle. In this case, the common case here is inserting replies. There are two improvements I planned:
- improve the user interface (basically, decrease number of clicks needed and remove the modal) and use the preview pane to quickly list all canned replies
- use variables in templates so the user does not have to manually edit the replies every time they want to send a new one.
Mockup
First improvement is to add a keyboard shortcut. I thought Ctrl+Space is a good key combination since it is usually used for autocompletion.
Second improvement uses the preview pane to list all available canned replies. You can click on them to add or click on the little arrow by the title to show the content of the reply and other controls (this is an accordion of canned replies).
Those replies will be sorted by their usage, so the most used reply is going to be on top. More over, I was thinking of adding a couple of shortcuts for the first 3 or so replies (i.e. Ctrl+Shift+1 inserts first canned reply, Ctrl+Shift+2 inserts second canned reply, Ctrl+Shift+3 inserts third canned reply, etc.)
I discussed with @sam and he suggested two approaches for implementation:
- move “preview” into a preview component, then amend the layout for the preview component via plugin. Sam warned me that this may get messy soon.
- add a plugin outlet and allow plugins hide the cooked preview HTML. I like this approach more because it makes Discourse more customizable and other plugins can use the preview pane as well.
@eviltrout your feedback on this matter is greatly appreciated.
Modals are still going to be used for new and edit forms. For now, the mobile interface will stay the same.
Results
Before my updates if you would want to insert the most used reply you’d have to click on options icon from the toolbar, select canned replies, select the reply, press insert and change any variables like @user by hand (at least 5 clicks); after my update Ctrl+Space and Ctrl+Shift+1 should do the same trick.
TODO
-
Populate the title when creating a new topicPR - Add support for variables that are replaced when canned reply is inserted.
eg.: @user is replaced with current username, @op is the person who posted the thread, @last is last poster, etc. - Improve user interface (list canned replies in preview pane and add keyboard shortcuts).