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

Comments

Projects
None yet
1 participant
@neocotic
Member

neocotic commented Apr 17, 2012

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

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Apr 20, 2012

Member

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.

Member

neocotic commented Apr 20, 2012

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

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Apr 20, 2012

Member

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

Member

neocotic commented Apr 20, 2012

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