Skip to content
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

Auto paste Templates #95

Closed
neocotic opened this issue Apr 17, 2012 · 2 comments
Closed

Auto paste Templates #95

neocotic opened this issue Apr 17, 2012 · 2 comments
Assignees
Milestone

Comments

@neocotic
Copy link
Member

Ticket 6 from uservoice:

If we could have the option to auto paste templates to the current field from the context menu it would help me to then start storing the hundreds of templates I use to create tickets in text fields.

  • David Tawater

My reply:

Hi David,

I'm not sure I understand here. Do you mean that if you right click an input field on a page and select a Template from the context menu that the generated text is automatically copied into that field? If so, that sounds like a fantastic idea. However, I'm worried that this has the same restrictions as the following issue;

#94

Unfortunately, the Context Menu API provided by Chrome doesn't currently allow developers to identify what was element the context menu was opened on. You can see exactly what's made available by this API below;

http://code.google.com/chrome/extensions/contextMenus.html#type-OnClickData

That said; I may be able to just invoke "paste" functionality on the originating tab once it's been generated. I'm only speculating here, as I'm not even sure this would be possible. Also, this would probably mean that the Template output would be pasted into whatever field is focused on the page (probably not a problem).

I've raised issue #95 to track this feature request;

#95

If you have anything further to add to this please do so on the link above, as I'm now closing this ticket off.

As mentioned in my reply this probably suffers the same problem as #94. However, there may be an alternative worth exploring.

@neocotic
Copy link
Member Author

While working on this in parallel with #94, the change I've added appears to be working great during testing. Some more tests to be carried out but I'm extremely happy with the results.

You can find the new option (disabled by default - is this best?) the Context Menu section of the options page (only visible if Enabled is checked for context menus).

It's worth noting that, while I'm not actually pasting from the clipboard, I'm changing the value of the right-clicked field in the same way. Therefore, how the current value of the field will be changed depending on its selection state. For example, if the Template output was bar;

  • | => bar
  • |foo => barfoo
  • foo| => foobar
  • f|oo => fbaroo
  • f|o|o => fbaro
  • |foo| => bar

| represents the cursor or the selection when there is more than one.

The reason that I chose not to actually paste from the system clipboard is that some Templates can take a few seconds to complete, so this allows the user to focus on other parts of the page, potentially stacking up multiple Template calls on various fields (which is where my remaining tests are focused).

Finally, this functionality is only available when accessing Templates via the context (right-click) menu and not the popup or keyboard shortcuts. Support for the latter may be added in a future release.

neocotic added a commit that referenced this issue Apr 20, 2012
@neocotic
Copy link
Member Author

I'm very happy with this and I'll be including it in this weekend's update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant