-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Implement support for Toolbar and Context Menu plugins #438
base: develop
Are you sure you want to change the base?
Implement support for Toolbar and Context Menu plugins #438
Conversation
Thanks a lot, appreciated! I will review your PR in-depth soon, it looks well taken care of at first sight. |
Great, thanks @josdejong! We appreciate your quick action and on-going maintenance of this project. |
Some other considerations to improve this feature:
Admittedly, my javascript is really rusty and I had some trouble with the context menu click handlers. This is why they are being wrapped at 2a6a65e#diff-0e52f886d57f8a2c0f91f314276ac9a9R1295. I'm sure the handlers could be constructed without needing to wrap them.
Edit: added two commits to address two of those points.
Edit: added one more commit.
|
…lick handlers. This allows us to remove the ugly callback wrapping when processing the contextMenuPlugins. Also updates test and documentation.
I noticed that the arrow only renders properly in some cases. For this reason, the submenuTitle only works sometimes.
cc82e94
to
fbd082d
Compare
…e themselves. Includes docs and tests. In the future, it may be preferable for disabled actions to be constructed and appear in the context menu, appearing as disabled (grayed out).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for unrelated clean up.
@@ -44,6 +44,20 @@ var util = require('./util'); | |||
* {boolean} sortObjectKeys If true, object keys are | |||
* sorted before display. | |||
* false by default. | |||
* {Object[]} toolbarPlugins Array of custom toolbar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docblock is outdated and should be removed entirely. API Doc should be sufficient for documenting this.
I've just checked out your PR @dhughes-xumak, thanks a lot again! You have implemented a solid API, you really know what you're doing and the code looks good. On a side note: I'm working on a complete new version of the JSONEditor, "v6", see #337. I had planned features that you're implementing right now for v6.1. This means that we'll have to re-implement them some day for v6 (which is ok, most work is figuring out the right API, not the code itself). Here some points of feedback:
EDIT: we can discuss point 6 and 7 in #440 |
Commit bde68cf adds a Currently, it sets the icon background to transparent for context menus and #d3d3d3 for toolbars. If a plugin icon is added to the icon sheet, that should be used as the default. Updated test_plugins to test and demonstrate icon overrides for plugins. |
@dhughes-xumak That looks way better already :) I've just fixed the issue with the broken multiselection (see 2110d25, will do a release today), and have done some adjustments in the css of the context menu so it wraps long text neatly. This resolves points 6, 7, and 8. So the left over action points are now:
|
(the merge conflict that's there now is just two new blocks of CSS inserted at the same location) |
@dhughes-xumak this PR is still open, are you still interested in completing it? |
No, sorry. It would be great to see this included in the project, but I will not be completing it. |
Ok clear! At least we have a nice start :) If anyone is interested in finishing this feature please let me know. |
Related to #435. This adds options for easily defining additional buttons to the Toolbar and Context Menu. Though multi-select is currently broken, this should support additional custom Context Menu options for multiple selections.
This contribution is graciously provided by XumaK (http://xumak.com/)
XumaK helps reduce the uncertainty and risk that is normally involved for companies trying to transform themselves digitally.
We provide professional services teams with years of experience to deliver the project, using our end-to-end delivery platform, which ensures your project will be on time and on budget. We deliver world class customer solutions through innovative industry leading products.