Skip to content
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

Add WebContents insertCSS functionality #559

Merged
merged 1 commit into from
Jul 1, 2021
Merged

Add WebContents insertCSS functionality #559

merged 1 commit into from
Jul 1, 2021

Conversation

nfichter
Copy link

Electron has functionality to insert CSS into a webpage using webContents.insertCSS. This PR implements that functionality in Electron.NET.

In WebContents.cs, the method public void InsertCSS(bool isBrowserWindow, string path) is added, which emits a socket message, webContents-insertCSS, along with the WebContents ID, the path to the file to insert, and whether the WebContents belongs to a BrowserWindow (isBrowserWindow = true) or to a BrowserView (isBrowserWindow = false).

In webContents.ts, the message is received and locates the BrowserWindow or BrowserView that matches the ID (since BrowserViews' WebContents IDs are incremented by 1000 on the Electron.NET side but not on the Host side, the comparison here is done against the Host IDs + 1000), and calls the insertCSS on the BrowserWindow or BrowserView's WebContents.

@GregorBiswanger GregorBiswanger self-assigned this Jul 1, 2021
@GregorBiswanger GregorBiswanger added this to the 13.5.1 milestone Jul 1, 2021
@GregorBiswanger GregorBiswanger merged commit 9f78098 into ElectronNET:master Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants