You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to find a way how to modify the client-function of an event.
I would like to capture text highlighted by the user and open a menu upon right-clcik which offers different functions to interact with this text (e.g. highlight it in certain colour, or send to the server for look-up in a DB). For this I need the client to execute at least two functions:
preventDefault() - to overrule the display of the normal contextmenu
window.getSelection() - to capture the highlighted text and send it back to the server side Jupyther Notebook
Is there a possibility to define the client function?
I could not find anything in the docs or online about it. Is there a way to define the client-functions in ipyvuetify?
If not, that would be a handy feature to have.
The text was updated successfully, but these errors were encountered:
Finally, I found a way.
Actually it was already present here in some of the examples, just not apparent for my limited Vue/vuetify knowledge.
For other people having similar problems, I leave an example here.
It renders a button that allows a user to copy the value of a python variable to his/her clipboard:
import ipyvuetify as v
from traitlets import Unicode
class clipboardBtn(v.VuetifyTemplate):
clipboardValue = Unicode('').tag(sync=True)
label = Unicode('Copy').tag(sync=True)
template = Unicode('''<v-btn
color="primary"
class="ma-1"
@click="copyVar2Clip(clipboardValue)"
>
{{ label }}
</v-btn>
<script>
export default {
methods: {
copyVar2Clip (value) {
var dummy = $('<input>').val(value).appendTo('body').select();
document.execCommand('copy');
dummy.parentNode.removeChild(dummy);
},
},
}
</script>''').tag(sync=True)
Feel free to include it in the examples if you want.
Hello,
I'm currently trying to find a way how to modify the client-function of an event.
I would like to capture text highlighted by the user and open a menu upon right-clcik which offers different functions to interact with this text (e.g. highlight it in certain colour, or send to the server for look-up in a DB). For this I need the client to execute at least two functions:
I have modified the example from the Vuetify-Website about menus: https://vuetifyjs.com/en/components/menus/#absolute-without-activator
Is there a possibility to define the client function?
I could not find anything in the docs or online about it. Is there a way to define the client-functions in ipyvuetify?
If not, that would be a handy feature to have.
The text was updated successfully, but these errors were encountered: