Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8bc1d445
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8bc1d445
编写于
4月 01, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Splitting webview into browser and electron-browser sections
上级
4e25bc19
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
149 addition
and
60 deletion
+149
-60
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+3
-3
src/vs/workbench/contrib/update/electron-browser/releaseNotesEditor.ts
...nch/contrib/update/electron-browser/releaseNotesEditor.ts
+2
-2
src/vs/workbench/contrib/webview/browser/webviewCommands.ts
src/vs/workbench/contrib/webview/browser/webviewCommands.ts
+1
-1
src/vs/workbench/contrib/webview/browser/webviewEditor.ts
src/vs/workbench/contrib/webview/browser/webviewEditor.ts
+8
-13
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
...s/workbench/contrib/webview/browser/webviewEditorInput.ts
+5
-4
src/vs/workbench/contrib/webview/browser/webviewEditorInputFactory.ts
...ench/contrib/webview/browser/webviewEditorInputFactory.ts
+0
-0
src/vs/workbench/contrib/webview/browser/webviewEditorService.ts
...workbench/contrib/webview/browser/webviewEditorService.ts
+0
-0
src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts
...vs/workbench/contrib/webview/browser/webviewFindWidget.ts
+3
-3
src/vs/workbench/contrib/webview/browser/webviewService.ts
src/vs/workbench/contrib/webview/browser/webviewService.ts
+83
-0
src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
.../contrib/webview/electron-browser/webview.contribution.ts
+8
-5
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
...kbench/contrib/webview/electron-browser/webviewElement.ts
+6
-29
src/vs/workbench/contrib/webview/electron-browser/webviewService.ts
...kbench/contrib/webview/electron-browser/webviewService.ts
+30
-0
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
8bc1d445
...
...
@@ -16,9 +16,9 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
ExtHostContext
,
ExtHostWebviewsShape
,
IExtHostContext
,
MainContext
,
MainThreadWebviewsShape
,
WebviewInsetHandle
,
WebviewPanelHandle
,
WebviewPanelShowOptions
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
editorGroupToViewColumn
,
EditorViewColumn
,
viewColumnToEditorGroup
}
from
'
vs/workbench/api/common/shared/editor
'
;
import
{
CodeInsetController
}
from
'
vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution
'
;
import
{
WebviewEditor
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditor
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditorInput
'
;
import
{
ICreateWebViewShowOptions
,
IWebviewEditorService
,
WebviewInputOptions
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditorService
'
;
import
{
WebviewEditor
}
from
'
vs/workbench/contrib/webview/browser/webviewEditor
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorInput
'
;
import
{
ICreateWebViewShowOptions
,
IWebviewEditorService
,
WebviewInputOptions
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorService
'
;
import
{
WebviewElement
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewElement
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
ACTIVE_GROUP
,
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
src/vs/workbench/contrib/update/electron-browser/releaseNotesEditor.ts
浏览文件 @
8bc1d445
...
...
@@ -20,9 +20,9 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
addGAParameters
}
from
'
vs/platform/telemetry/node/telemetryNodeUtils
'
;
import
{
IWebviewEditorService
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditorService
'
;
import
{
IWebviewEditorService
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorService
'
;
import
{
IEditorService
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditorInput
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorInput
'
;
import
{
KeybindingParser
}
from
'
vs/base/common/keybindingParser
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
...
...
src/vs/workbench/contrib/webview/
electron-
browser/webviewCommands.ts
→
src/vs/workbench/contrib/webview/browser/webviewCommands.ts
浏览文件 @
8bc1d445
...
...
@@ -8,7 +8,7 @@ import { Command } from 'vs/editor/browser/editorExtensions';
import
*
as
nls
from
'
vs/nls
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
WebviewEditor
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditor
'
;
import
{
WebviewEditor
}
from
'
vs/workbench/contrib/webview/browser/webviewEditor
'
;
export
class
ShowWebViewEditorFindWidgetCommand
extends
Command
{
public
static
readonly
ID
=
'
editor.action.webvieweditor.showFind
'
;
...
...
src/vs/workbench/contrib/webview/
electron-
browser/webviewEditor.ts
→
src/vs/workbench/contrib/webview/browser/webviewEditor.ts
浏览文件 @
8bc1d445
...
...
@@ -9,7 +9,6 @@ import { Emitter, Event } from 'vs/base/common/event';
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -17,11 +16,10 @@ import { IWindowService } from 'vs/platform/windows/common/windows';
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewEditorInput
'
;
import
{
WebviewEditorInput
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorInput
'
;
import
{
IWebviewService
,
Webview
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkbenchLayoutService
,
Parts
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
WebviewElement
}
from
'
./webviewElement
'
;
/** A context key that is set when the find widget in a webview is visible. */
export
const
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
=
new
RawContextKey
<
boolean
>
(
'
webviewFindWidgetVisible
'
,
false
);
...
...
@@ -29,7 +27,7 @@ export const KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE = new RawContextKey<
export
class
WebviewEditor
extends
BaseEditor
{
protected
_webview
:
Webview
Element
|
undefined
;
protected
_webview
:
Webview
|
undefined
;
protected
findWidgetVisible
:
IContextKey
<
boolean
>
;
public
static
readonly
ID
=
'
WebviewEditor
'
;
...
...
@@ -50,9 +48,8 @@ export class WebviewEditor extends BaseEditor {
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IThemeService
themeService
:
IThemeService
,
@
IContextKeyService
private
_contextKeyService
:
IContextKeyService
,
@
IW
orkbenchLayoutService
private
readonly
_layoutService
:
IWorkbenchLayout
Service
,
@
IW
ebviewService
private
readonly
_webviewService
:
IWebview
Service
,
@
IWorkspaceContextService
private
readonly
_contextService
:
IWorkspaceContextService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
IWindowService
private
readonly
_windowService
:
IWindowService
,
@
IStorageService
storageService
:
IStorageService
...
...
@@ -178,7 +175,7 @@ export class WebviewEditor extends BaseEditor {
this
.
withWebviewElement
(
webview
=>
webview
.
redo
());
}
private
withWebviewElement
(
f
:
(
element
:
Webview
Element
)
=>
void
):
void
{
private
withWebviewElement
(
f
:
(
element
:
Webview
)
=>
void
):
void
{
if
(
this
.
_webview
)
{
f
(
this
.
_webview
);
}
...
...
@@ -264,7 +261,7 @@ export class WebviewEditor extends BaseEditor {
return
rootPaths
;
}
private
getWebview
(
input
:
WebviewEditorInput
):
Webview
Element
{
private
getWebview
(
input
:
WebviewEditorInput
):
Webview
{
if
(
this
.
_webview
)
{
return
this
.
_webview
;
}
...
...
@@ -279,14 +276,12 @@ export class WebviewEditor extends BaseEditor {
this
.
findWidgetVisible
=
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
.
bindTo
(
this
.
_contextKeyService
);
}
this
.
_webview
=
this
.
_instantiationService
.
createInstance
(
WebviewElement
,
this
.
_layoutService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
_webview
=
this
.
_webviewService
.
createWebview
(
{
allowSvgs
:
true
,
extension
:
input
.
extension
,
enableFindWidget
:
input
.
options
.
enableFindWidget
},
{});
},
{});
this
.
_webview
.
mountTo
(
this
.
_webviewContent
);
input
.
webview
=
this
.
_webview
;
...
...
src/vs/workbench/contrib/webview/
electron-
browser/webviewEditorInput.ts
→
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
浏览文件 @
8bc1d445
...
...
@@ -11,7 +11,7 @@ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import
{
EditorInput
,
EditorModel
,
GroupIdentifier
,
IEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IWorkbenchLayoutService
,
Parts
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
WebviewEvents
,
WebviewInputOptions
}
from
'
./webviewEditorService
'
;
import
{
Webview
Element
,
WebviewOptions
}
from
'
./webviewElement
'
;
import
{
Webview
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
export
class
WebviewEditorInput
extends
EditorInput
{
private
static
handlePool
=
0
;
...
...
@@ -57,7 +57,7 @@ export class WebviewEditorInput extends EditorInput {
private
_currentWebviewHtml
:
string
=
''
;
public
_events
:
WebviewEvents
|
undefined
;
private
_container
?:
HTMLElement
;
private
_webview
:
WebviewElement
|
undefined
;
private
_webview
?:
Webview
;
private
_webviewOwner
:
any
;
private
_webviewDisposables
:
IDisposable
[]
=
[];
private
_group
?:
GroupIdentifier
;
...
...
@@ -234,11 +234,11 @@ export class WebviewEditorInput extends EditorInput {
return
this
.
_container
;
}
public
get
webview
():
Webview
Element
|
undefined
{
public
get
webview
():
Webview
|
undefined
{
return
this
.
_webview
;
}
public
set
webview
(
value
:
Webview
Element
|
undefined
)
{
public
set
webview
(
value
:
Webview
|
undefined
)
{
this
.
_webviewDisposables
=
dispose
(
this
.
_webviewDisposables
);
this
.
_webview
=
value
;
...
...
@@ -272,6 +272,7 @@ export class WebviewEditorInput extends EditorInput {
}
public
claimWebview
(
owner
:
any
)
{
this
.
_webviewOwner
=
owner
;
}
...
...
src/vs/workbench/contrib/webview/
electron-
browser/webviewEditorInputFactory.ts
→
src/vs/workbench/contrib/webview/browser/webviewEditorInputFactory.ts
浏览文件 @
8bc1d445
文件已移动
src/vs/workbench/contrib/webview/
electron-
browser/webviewEditorService.ts
→
src/vs/workbench/contrib/webview/browser/webviewEditorService.ts
浏览文件 @
8bc1d445
文件已移动
src/vs/workbench/contrib/webview/
electron-
browser/webviewFindWidget.ts
→
src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts
浏览文件 @
8bc1d445
...
...
@@ -5,13 +5,13 @@
import
{
SimpleFindWidget
}
from
'
vs/editor/contrib/find/simpleFindWidget
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
WebviewElement
}
from
'
./webviewElement
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Webview
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
export
class
WebviewFindWidget
extends
SimpleFindWidget
{
constructor
(
private
_webview
:
Webview
Element
|
undefined
,
private
_webview
:
Webview
|
undefined
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
...
...
@@ -29,7 +29,7 @@ export class WebviewFindWidget extends SimpleFindWidget {
}
const
val
=
this
.
inputValue
;
if
(
val
)
{
this
.
_webview
.
find
(
val
,
{
findNext
:
true
,
forward
:
!
previous
}
);
this
.
_webview
.
find
(
val
,
previous
);
}
}
...
...
src/vs/workbench/contrib/webview/browser/webviewService.ts
0 → 100644
浏览文件 @
8bc1d445
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
const
IWebviewService
=
createDecorator
<
IWebviewService
>
(
'
webviewService
'
);
export
interface
IWebviewService
{
_serviceBrand
:
any
;
createWebview
(
options
:
WebviewOptions
,
contentOptions
:
WebviewContentOptions
,
):
Webview
;
}
export
interface
WebviewPortMapping
{
readonly
port
:
number
;
readonly
resolvedPort
:
number
;
}
export
interface
WebviewOptions
{
readonly
allowSvgs
?:
boolean
;
readonly
extension
?:
{
readonly
location
:
URI
;
readonly
id
?:
ExtensionIdentifier
;
};
readonly
enableFindWidget
?:
boolean
;
}
export
interface
WebviewContentOptions
{
readonly
allowScripts
?:
boolean
;
readonly
svgWhiteList
?:
string
[];
readonly
localResourceRoots
?:
ReadonlyArray
<
URI
>
;
readonly
portMappings
?:
ReadonlyArray
<
WebviewPortMapping
>
;
}
export
interface
Webview
{
contents
:
string
;
options
:
WebviewContentOptions
;
initialScrollProgress
:
number
;
state
:
string
|
undefined
;
readonly
onDidFocus
:
Event
<
void
>
;
readonly
onDidClickLink
:
Event
<
URI
>
;
readonly
onDidScroll
:
Event
<
{
scrollYPercentage
:
number
}
>
;
readonly
onDidUpdateState
:
Event
<
string
|
undefined
>
;
readonly
onMessage
:
Event
<
any
>
;
sendMessage
(
data
:
any
):
void
;
update
(
value
:
string
,
options
:
WebviewContentOptions
,
retainContextWhenHidden
:
boolean
):
void
;
layout
():
void
;
mountTo
(
parent
:
HTMLElement
):
void
;
focus
():
void
;
dispose
():
void
;
showFind
():
void
;
hideFind
():
void
;
reload
():
void
;
selectAll
():
void
;
copy
():
void
;
paste
():
void
;
cut
():
void
;
undo
():
void
;
redo
():
void
;
find
(
value
:
string
,
previous
:
boolean
):
void
;
startFind
(
value
:
string
):
void
;
stopFind
(
keepSelection
?:
boolean
):
void
;
}
src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
浏览文件 @
8bc1d445
...
...
@@ -14,13 +14,15 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
EditorDescriptor
,
Extensions
as
EditorExtensions
,
IEditorRegistry
}
from
'
vs/workbench/browser/editor
'
;
import
{
Extensions
as
ActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
Extensions
as
EditorInputExtensions
,
IEditorInputFactoryRegistry
}
from
'
vs/workbench/common/editor
'
;
import
{
WebviewEditorInputFactory
}
from
'
vs/workbench/contrib/webview/
electron-
browser/webviewEditorInputFactory
'
;
import
{
HideWebViewEditorFindCommand
,
OpenWebviewDeveloperToolsAction
,
ReloadWebviewAction
,
ShowWebViewEditorFindWidgetCommand
,
SelectAllWebviewEditorCommand
,
CopyWebviewEditorCommand
,
PasteWebviewEditorCommand
,
CutWebviewEditorCommand
,
UndoWebviewEditorCommand
,
RedoWebviewEditorCommand
}
from
'
./webviewCommands
'
;
import
{
WebviewEditor
,
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
}
from
'
./webviewEditor
'
;
import
{
WebviewEditorInput
}
from
'
./webviewEditorInput
'
;
import
{
IWebviewEditorService
,
WebviewEditorService
}
from
'
./webviewEditorService
'
;
import
{
WebviewEditorInputFactory
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorInputFactory
'
;
import
{
HideWebViewEditorFindCommand
,
OpenWebviewDeveloperToolsAction
,
ReloadWebviewAction
,
ShowWebViewEditorFindWidgetCommand
,
SelectAllWebviewEditorCommand
,
CopyWebviewEditorCommand
,
PasteWebviewEditorCommand
,
CutWebviewEditorCommand
,
UndoWebviewEditorCommand
,
RedoWebviewEditorCommand
}
from
'
.
./browser
/webviewCommands
'
;
import
{
WebviewEditor
,
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
}
from
'
.
./browser
/webviewEditor
'
;
import
{
WebviewEditorInput
}
from
'
.
./browser
/webviewEditorInput
'
;
import
{
IWebviewEditorService
,
WebviewEditorService
}
from
'
.
./browser
/webviewEditorService
'
;
import
{
InputFocusedContextKey
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
IWebviewService
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
import
{
WebviewService
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewService
'
;
(
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
)).
registerEditor
(
new
EditorDescriptor
(
WebviewEditor
,
...
...
@@ -33,6 +35,7 @@ Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactor
WebviewEditorInputFactory
);
registerSingleton
(
IWebviewEditorService
,
WebviewEditorService
,
true
);
registerSingleton
(
IWebviewService
,
WebviewService
,
true
);
const
webviewDeveloperCategory
=
localize
(
'
developer
'
,
"
Developer
"
);
...
...
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
浏览文件 @
8bc1d445
...
...
@@ -17,36 +17,12 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
*
as
colorRegistry
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
DARK
,
ITheme
,
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
registerFileProtocol
,
WebviewProtocol
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewProtocols
'
;
import
{
areWebviewInputOptionsEqual
}
from
'
./webviewEditorService
'
;
import
{
WebviewFindWidget
}
from
'
./webviewFindWidget
'
;
import
{
areWebviewInputOptionsEqual
}
from
'
.
./browser
/webviewEditorService
'
;
import
{
WebviewFindWidget
}
from
'
.
./browser
/webviewFindWidget
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
WebviewContentOptions
,
WebviewPortMapping
,
WebviewOptions
,
Webview
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
export
interface
WebviewPortMapping
{
readonly
port
:
number
;
readonly
resolvedPort
:
number
;
}
export
interface
WebviewPortMapping
{
readonly
port
:
number
;
readonly
resolvedPort
:
number
;
}
export
interface
WebviewOptions
{
readonly
allowSvgs
?:
boolean
;
readonly
extension
?:
{
readonly
location
:
URI
;
readonly
id
?:
ExtensionIdentifier
;
};
readonly
enableFindWidget
?:
boolean
;
}
export
interface
WebviewContentOptions
{
readonly
allowScripts
?:
boolean
;
readonly
svgWhiteList
?:
string
[];
readonly
localResourceRoots
?:
ReadonlyArray
<
URI
>
;
readonly
portMappings
?:
ReadonlyArray
<
WebviewPortMapping
>
;
}
interface
IKeydownEvent
{
key
:
string
;
...
...
@@ -316,7 +292,7 @@ class WebviewKeyboardHandler extends Disposable {
}
export
class
WebviewElement
extends
Disposable
{
export
class
WebviewElement
extends
Disposable
implements
Webview
{
private
_webview
:
Electron
.
WebviewTag
;
private
_ready
:
Promise
<
void
>
;
...
...
@@ -640,12 +616,13 @@ export class WebviewElement extends Disposable {
*
* @param value The string to search for. Empty strings are ignored.
*/
public
find
(
value
:
string
,
options
?:
Electron
.
FindInPageOptions
):
void
{
public
find
(
value
:
string
,
previous
:
boolean
):
void
{
// Searching with an empty value will throw an exception
if
(
!
value
)
{
return
;
}
const
options
=
{
findNext
:
true
,
forward
:
!
previous
};
if
(
!
this
.
_findStarted
)
{
this
.
startFind
(
value
,
options
);
return
;
...
...
src/vs/workbench/contrib/webview/electron-browser/webviewService.ts
0 → 100644
浏览文件 @
8bc1d445
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
WebviewElement
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewElement
'
;
import
{
IWorkbenchLayoutService
,
Parts
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IWebviewService
,
WebviewOptions
,
WebviewContentOptions
,
Webview
}
from
'
vs/workbench/contrib/webview/browser/webviewService
'
;
export
class
WebviewService
implements
IWebviewService
{
_serviceBrand
:
any
;
constructor
(
@
IWorkbenchLayoutService
private
readonly
_layoutService
:
IWorkbenchLayoutService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
)
{
}
createWebview
(
options
:
WebviewOptions
,
contentOptions
:
WebviewContentOptions
):
Webview
{
const
element
=
this
.
_instantiationService
.
createInstance
(
WebviewElement
,
this
.
_layoutService
.
getContainer
(
Parts
.
EDITOR_PART
),
options
,
contentOptions
);
return
element
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录