-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CLOSED] Context Menu API, partial implementation #1006
Comments
Comment by mikechambers Can you provide a simple example of how an extension would create and open a context-menu? |
Comment by tvoliter Sure, here is a hello world demo you can paste into a main.js file to try it out as a plugin /_jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ /** Simple extension that adds a "File > Hello World" menu item */
}); -----Original Message----- Can you provide a simple example of how an extension would create and open a context-menu? Reply to this email directly or view it on GitHub: |
Comment by mikechambers Could the x,y coords to open be optional, and if they are not passed in default to the correct position relative to the current position of the mouse? Otherwise, there may be situations where the position of the menu should be different depending on the platform, that extension developers might not know about, or might not take into account. Plus, it covers the primary use case and would make the api easier to use. |
Comment by redmunds
After that, Brackets will attempt to display the menu at the specified coordinates, but will adjust the menu position as necessary to fit it in the Brackets window. |
Comment by mikechambers
|
Comment by tvoliter Great suggestion! -----Original Message----- Could the x,y coords to open be optional, and if they are not passed in default to the correct position relative to the current position of the mouse? Otherwise, there may be situations where the position of the menu should be different depending on the platform, that extension developers might not know about, or might not take into account. Plus, it covers the primary use case and would make the api easier to use. Reply to this email directly or view it on GitHub: |
Comment by mikechambers
|
Comment by mikechambers What happens if multiple extensions want to work with the context menu and / or add items to it? For example, imagine a context menu opened when text selected and the user right clicks it. How will multiple extensions be able to add items to a single context menu? Also, will there be default items (copy, cut, paste) that will always be in the context menu? |
Comment by tvoliter These are great questions and this is what I am actually investigating next. Early thoughts were that Brackets would have a few built in context menus tied to specific click areas like the editor, working set, file tree, etc. Plugins could add to these and could be more context sensitive by disabling/enabling items based on some criteria when the beforeContextMenuOpen event is triggered. I am also exploring how event bubbling and context menus will interact to see how Brackets will handle a general context menu that shows when clicking over a large div and a very specific context menu that shows when clicking on some small portion of that div. What are your expectations on how this should work? -----Original Message----- What happens if multiple extensions want to work with the context menu and / or add items to it? For example, imagine a context menu opened when text selected and the user right clicks it. How will multiple extensions be able to add items to a single context menu? Also, will there be default items (copy, cut, paste) that will always be in the context menu? Reply to this email directly or view it on GitHub: |
Comment by mikechambers I would expect that my extension would add to an existing menu, and would not create a new one from scratch. |
Comment by tvoliter I did a bit of research and it seems it's not possible to query the current mouse position in browsers without an event. However, to make this API for friendly I changed it so it can take a MouseEvent or a specific location. -----Original Message----- Could the x,y coords to open be optional, and if they are not passed in default to the correct position relative to the current position of the mouse? Otherwise, there may be situations where the position of the menu should be different depending on the platform, that extension developers might not know about, or might not take into account. Plus, it covers the primary use case and would make the api easier to use. Reply to this email directly or view it on GitHub: |
Issue by tvoliter
Thursday Jun 07, 2012 at 20:57 GMT
Originally opened as adobe/brackets#1012
Ready for review
tvoliter included the following code: https://github.com/adobe/brackets/pull/1012/commits
The text was updated successfully, but these errors were encountered: