I am going to make Folder drag to drop in Flutter dropzone onDrop but I can't get event's structure
Future onDrop(
dynamic event, //this event
DropzoneViewController controller,
) async { ... }
How can I get this event's structure?
Or how can I do Folder drag to drop in Flutter dropzone onDrop?
Related
I would like to extend the CheckoutPage/PaymentInformation/paymentMethods.js component from my own package so that it can be used without having to manually change the source code from venia-ui.
I can change inside the component by intercepting to a target for my custom payment method like so
checkoutPagePaymentTypes.tap(payments =>
payments.add({
paymentCode: 'fairstone',
importPath:
'#magento/fairstone_pwa_venia_sample/src/components/fspaymentmethod.js'
})
);
But when I want to update the look of my payment method option before clicking into the component there isnt a target that i can hook into to extend the paymentMethods.js component.
I'm not super familiar with PWA-Studio and Venia-UI. How do i extend this parent component that doesn't have an object on the api to point a path to.
I'm using React-Native-Navigation from Wix (version 2) to setup navigation in my React Native app. I'm using the sideMenu layout with the center section being a stack. When the user selects one of the side menu items the selected view is pushed onto that center stack. If the user presses their back button on Android, then the view is popped from the stack, but I don't always want this to happen, mainly if the view they selected is a WebView.
If the view is a WebView, I want to manually handle the user pressing the hardware back button. If the WebView can "goBack" then the view will go back, but if it can't then the view will be popped from the stack (as it normally would).
I've tried overriding the back button press using the BackHandler class from react-native and this allows me to capture that press and have the WebView go back if able, but the act of popping the view from the stack also fires. Is there a way in React-Native-Navigation v2 to tell it, "Hey I got this, don't pop unless I tell you to."?
My current code for this section is as follows:
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.backHandler);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
}
backHandler = () => {
if (this.state.canGoBack) {
this.webviewRef.current.goBack();
// I thought this might force the back press to be
// ignored by react-native-navigation, but no dice.
return false;
} else {
// WebView can't go back so pop view like normal
Navigation.pop(this.props.componentId);
}
}
I was expecting this to only pop the view from the stack if the WebView can't currently go back and otherwise just have the WebView go back.
What actually occurs is both events fire. I.e. the WebView goes back, but the view is also popped from the stack.
I was able to find the answer to this through some more digging in the React Native Navigation and React Native docs.
The event subscriptions are called in reverse order (i.e. last registered subscription first), and if one subscription returns true then subscriptions registered earlier will not be called.
So the issue was in my backHandler method. Instead of returning false I needed to return true.
backHandler = () => {
if (this.state.canGoBack) {
this.webviewRef.current.goBack();
// We've handled the event so we return true and the
// handler on the view's parent can effectively be ignored. Yay!
return true;
} else {
// WebView can't go back so pop view like normal
Navigation.pop(this.props.componentId);
}
}
I can't seem to "click" on these select boxes using vue-test-utils and Vue 2. I am using mocha + webpack.
I am determining this by seeing that the visible-change event is never triggered as it should on click. Here is how my spec file is like:
...
const wrapper = mount(EntityItem, { propsData });
const selectBox = wrapper.find("el-select");
// I tried these:
selectBox.trigger("click");
selectBox.trigger("click.native");
As last resort if this doesn't work, I'd have to manually change the model attribute to simulate the component change.
----UPDATE----
When I set up a callback for the click event I see something, but I am unable to "select" anything in this select input component.
the component you are using does not use select input element. In order to simulate selecting an option, you would do something like this.
wrapper.findAll('.el-select-dropdown__item').at(1).trigger('click'); // simulates clicking of one of the options
if you want to simulate clicking of select element itself(to show the dropdown). you could do the following.
wrapper.find('.el-select-dropdown').trigger('click');
Whitespace's answer above helped, however also needed to ensure you use
await Vue.nextTick()
before your expect statement. Like so:
wrapper.findAll('.el-select-dropdown__item').at(1).trigger('click');
await Vue.nextTick();
expect(enterResultBtn.is('[disabled]')).toBe(true);
This allows the DOM to update it's cycle, more info here
I'm writing an extension that reacts to right-clicks on images on the page. I'd like to know the image's dimensions to do further processing.
Out of the box, my callback gets a reference to the tab and an "info" object (OnClickData), which only exposes minimal information.
Has anyone hit this scenario before? I'm thinking of either
loading the image again based on the srcUrl (may not be reproducible if the URL is dynamic) and interrogating it
trying to walk the DOM of the tab to find the image and interrogate it (not sure if this would require a content script to cross the boundary from extension to webpage)
What the Image Properties Context Menu extension does is to use a user script in combination with the context menu API.
The user script is injected into all pages, listens for context menu events, and sends the information about the image to the extension via chrome.extension.sendRequest:
document.addEventListener("contextmenu", function (e) {
var elem = e.srcElement;
if (elem instanceof HTMLImageElement) {
var img = {
src: elem.src,
alt: elem.alt,
height: elem.height,
width: elem.width
}
chrome.extension.sendRequest(img);
}
}, true);
The background page uses chrome.extension.onRequest.addListener to receive this data, and stores it in a global variable. The context menu API click callback reads data from this global variable.
That assumes that the chrome.extension.sendRequest call is always handled before the click callback, which may not always be the case. You may want to make the callback check if the data has arrived, and if not, try again a little while later (by using setTimeout).
I'm developing a chrome extension where I need to create dynamic sub-contextMenus based on some selected text. Like If you select a text, it'll send an ajaxrequest from the background.html and create some child context menu based on the returned results. Is that possible? I've been trying for sometime. But no luck.
You can add right mouse button event listener in a content script:
document.addEventListener("mousedown", function(event){
if(event.button == 2) {
//get selected text and send request to bkgd page to create menu
}
}, true);
There is also oncontextmenu event, can try it as well (I think mousedown is fired earlier though).