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
Unable to drag and drop with vue-draggable/sortable.js #311
Comments
I made a possible fix to the |
installed with
After a clean build, it didn't seem to fix the problem. Everything still works in IE11, Edge, and Chrome. |
I tested master against https://www.dropzonejs.com and drag & drop works just fine. The problem seems to be in your code. |
Lets see if I can give you some better context on how I'm using drag and drop functionality:
and displaying lists of items as:
and dragging from there into:
I'm building it into static content with ``npm run build``` The code for the pywebview window is:
Then the pyinstaller command is:
Is there anything else I should show you that might be specific to the build process and with pywebview? Should I be exposing some JS element with |
I could not reproduce the problem with https://david-desmaisons.github.io/draggable-example/ either. |
Would it be possible for you to provide the code you used with vue-draggable that worked so I can compare and see what exactly might be causing my problem? |
import webview
"""
This example demonstrates how to create a webview window.
"""
if __name__ == '__main__':
# Create a standard webview window
webview.create_window('Simple browser',
'https://david-desmaisons.github.io/draggable-example/')
|
I pulled down the draggable-example code, built it and packaged it with the same commands I was using and it worked successfully. I will determine what I was doing wrong in my codebase and let you know what was causing the breakage. |
@r0x0r All of the following was over many hours and lots of testing to narrow down exactly what was breaking. I created a fresh vue-cli 3 project using I did a manual install and enabled Typescript, Router, and CSS Pre-Processors. I then selected ESLint + Airbnb config, lint on save, and in package.json, etc.... After these steps, the draggable code did not work. I then proceeded to remove each of the manual package additions incrementally until it worked. After removing each manual thing and then finally resorting to a default package install, I was still not successful in getting the draggable function to work. All these iterations worked within a browser at the same time as the executable was open (so the server was serving the same static files to both pywebview and ie/edge/chrome at the same time). This leads me to believe it is a problem with pywebview instead of posting in vue-draggable about the issue. Even when running pywebview in CLI without packaging, the draggable option still does not work. I am working to determine what the vue-draggable team did differently in their example compared to a fresh installation of vue-cli that causes their version to build and work correctly. As of right now I found out that if I do a fresh vue-cli, the example vue-draggable code AND THEN take their package-lock.json, it works with pywebview. This was really strange and I was dreading continuing seeing as I know how immense a package-lock file is.... I eventually have narrowed it down to a specific difference in packages in the package-lock.json (NOT the package.json)
broke the functionality, but
made it work. Something in the change from 1.7 to 1.8.1 breaks pywebview in some way. Making this change in Please let me know if I can help in any way to identify what changes caused pywebview from preventing the dragging and dropping functionality to stop between Sortable.js v1.7.0 to v1.8.1! |
This is quite a heroic effort at debugging this problem. There was a problem with escaping strings when loading Javascript via Have you got a chance to test it on a different platform (Mac or Linux)? |
Thanks! It was a problem that I seriously had to fix haha. I have tested it on Linux (Ubuntu 16.04) and pywebview works. It seems it was something specific with ie11/trident on windows. I will try a rebuild with CEF on windows and see if the problem persists and let you know if it does or not. Honestly, my expectation is that CEF will fix the problems (and no I don't really care too much about the executable size considering my linux package ended up being approx 260mb lol). So yeah, I'll test CEF with draggable on windows and let you know 👍 ! |
@r0x0r finally got to working with CEF on windows. Seems that running it actively works, but once I package it with pyinstaller I get:
Do you know if there is anything else that I'm required to include in the build? I also noticed that |
@r0x0r I have gotten a bit further. It all seems to work using this file from cefpython3's repo: https://github.com/cztomczak/cefpython/blob/f94eaa6220fbd49ce9af1fa69d4984f8aa18bcef/examples/pyinstaller/hook-cefpython3.py However, trying to package it into a single file executable seems to be a limitation of pywebview. The building process is successful but I'm getting the following now:
Which from my understanding has to do with providing the locales and other pak files properly in the path. Because it is being packaged, the only way we can go about this is with MEIPASS. In
as per: https://groups.google.com/forum/#!topic/cefpython/4R22vCWIjk8 Would it be possible to provide an option to append to |
@jakobroberts-kpmg I have not attempted to freeze a CEF app, so you know probably know more about this matter at this point I would not like to introduce new options just for CEF, but rather write logic that would handle this edge case automatically. For example support for PyInstaller is baked in ´base_uri´ of util.py (line 24). Something like this could be done for CEF as well. Ie the code would look for |
@r0x0r After many hours of attempting the switch to CEF with pywebview I've given up and I'm sticking to ie11 and trident for the time being.... There are just too many factors from what I can see trying to make it into a single executable and I need it working for the interim. I would be up for working together with you to bake in the logic though. |
I have added support for pyinstalle's one file mode to CEF. Changes are in master. |
Specification
Description
I'm building a standalone application in a bit of a complicated way as it will be migrated eventually. It is working for the most part but I can't get draggable functionality to work in a pywebview window.
I'm using Flask with Vue.js, pywebview, then packaging with pyinstaller.
I'm building the vue.js frontend into static files and using pywebview to display the static content served by flask. It is then being put into a single executable with pyinstaller.
All of the functionality works except I am using vue-draggable that uses sortable.js and that functionality seems to be failing only in the pywebview window.
When I launch the executable, I can access the webserver that is run via local browsers and also from the pywebview window. Chrome 72, Edge 16 and IE 11 all work and allow draggable elements between lists, but the pywebview window does not allow it even though it is telling me it is running using IE 11.
web-client check script
Asks
Honestly I am unsure where to even begin looking to understand why the dragging isn't working. I have tried turning on
text-select=True
anddebug=True
, but neither seems to have helped with the dragging problem.Is this a known issue or is there a quick fix? I saw the PR with CEF and thought that might be a possible option/fix if that comes out within the next few days, but if there is an immediate alternative, I would be grateful.
My current build command for pyinstaller is
My current create.window command for pyinstaller is
The text was updated successfully, but these errors were encountered: