Skip to content

Commit

Permalink
feat: more webview attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
KochiyaOcean committed Oct 12, 2023
1 parent d1a30a3 commit 926cbf1
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions views/components/etc/webview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ import { HandlerFields, useWebviewEventListener } from './webview-util'
type WebviewTagDOMAttrs = Partial<
Pick<
WebviewTag,
'src' | 'disablewebsecurity' | 'allowpopups' | 'preload' | 'useragent' | 'webpreferences'
| 'src'
| 'nodeintegration'
| 'nodeintegrationinsubframes'
| 'plugins'
| 'preload'
| 'httpreferrer'
| 'useragent'
| 'disablewebsecurity'
| 'partition'
| 'allowpopups'
| 'webpreferences'
| 'enableblinkfeatures'
| 'disableblinkfeatures'
>
>

Expand Down Expand Up @@ -43,11 +55,18 @@ const ElectronWebView = forwardRef<ExtendedWebviewTag | undefined, Props>(
className,
webviewTagClassName,
src,
webpreferences,
disablewebsecurity,
allowpopups,
nodeintegration,
nodeintegrationinsubframes,
plugins,
preload,
httpreferrer,
useragent,
disablewebsecurity,
partition,
allowpopups,
webpreferences,
enableblinkfeatures,
disableblinkfeatures,
...props
},
ref,
Expand Down Expand Up @@ -201,13 +220,22 @@ const ElectronWebView = forwardRef<ExtendedWebviewTag | undefined, Props>(
<webview
className={webviewTagClassName}
src={src}
webpreferences={webpreferences}
// @ts-expect-error wrong type definition
disablewebsecurity={disablewebsecurity ? 'on' : undefined}
nodeintegration={nodeintegration ? 'on' : undefined}
nodeintegrationinsubframes={nodeintegrationinsubframes ? 'on' : undefined}
// @ts-expect-error wrong type definition
allowpopups={allowpopups ? 'on' : undefined}
plugins={plugins ? 'on' : undefined}
preload={preload}
httpreferrer={httpreferrer}
useragent={useragent}
// @ts-expect-error wrong type definition
disablewebsecurity={disablewebsecurity ? 'on' : undefined}
partition={partition}
// @ts-expect-error wrong type definition
allowpopups={allowpopups ? 'on' : undefined}
webpreferences={webpreferences}
enableblinkfeatures={enableblinkfeatures}
disableblinkfeatures={disableblinkfeatures}
ref={(view: WebviewTag) => {
setView(view)
}}
Expand Down

0 comments on commit 926cbf1

Please sign in to comment.