Overriding getstate function of command #3339
mguinness
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had a requirement to limit the
cut
command to files only, not directories. I knew that I needed to override thegetstate
function of that command as shown below:elFinder/js/commands/cut.js
Lines 16 to 21 in bc6a08b
I struggled how to achieve this without replacing the entire command as shown in Overriding the “Open” Menu Item in elFinder.
Then I came across the question How to change function inside constructor in JavaScript? which allowed me to achieve what I wanted. The solution below can be added to bootCallback function in the configuration options.
I hope this helps others as it took me a while to figure out. If anyone has a more elegant way to achieve the same result please share!
Beta Was this translation helpful? Give feedback.
All reactions