javascripthtmlangulartypescriptcefsharp

Angular draging not working inside wpf app


I have windows 10, 64 bit and I was trying to run angular app inside my wpf application. Page seams to render fine ,but when i try to use basic dragging (and draging related functions) it's only works when i put all the scripts inside index.html. When I run my app it's always working for chrome and other browsers ,but in cefsharp there is problem when web application is splited in many files.

I build my angular app with command ng build and copy output files to the folder ".\Assets\HTML\GPS". CefSharp is running in the code below:

public UcGpsWeb()
        {
            CefSettings settings = new CefSettings();
            settings.CefCommandLineArgs["disable-features"] = "BlockInsecurePrivateNetworkRequests";
            settings.CefCommandLineArgs.Add("disable-web-security", "disable-web-security");
            settings.RegisterScheme(new CefCustomScheme
            {
                SchemeName = "localfolder",
                DomainName = "cefsharp",
                SchemeHandlerFactory = new FolderSchemeHandlerFactory(
                    rootFolder: @".\Assets\HTML\GPS\",
                    hostName: "cefsharp",
                    defaultPage: "index.html" // will default to index.html
                )
            });
            CefSharp.Cef.Initialize(settings);
            InitializeComponent();
            Loaded += (s, e) =>
            {
                //WebBrowser.ShowDevTools();
                WebBrowser.Address = "localfolder://cefsharp/";
            };
        }

When I use ng serve application works fine in both scenarios in the chrome and other browsers, but when I deploy my application it entirely works only when all code is put inside index.html

I have created 2 simple projects that have exacly the same code with only difference between them being the localization of html code and only one of them is working. Working Not working Draging functions are very important to my aplication. Honestly have spend on this whole week and I still dont know if the problem is inside wpf app, or should I use some different approach to produce working web app files from Angular.

Every othe script or function that I use works in both cases ,but for example dragstart only works if scripts are located in index.html


Solution

  • Ok I have found the problem. The Cefsharp have drag functions is disabled by defalut. While functions called for example by dragstart still starts ,it wont use dragevent. To fix i added

    AllowDrop= true;
    

    to the "Loaded" scope in Cefsharp