Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
007f704e
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
007f704e
编写于
1月 22, 2021
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove IME special cases for Edge Legacy
上级
4fac328d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
54 deletion
+13
-54
src/vs/editor/browser/controller/textAreaHandler.ts
src/vs/editor/browser/controller/textAreaHandler.ts
+3
-9
src/vs/editor/browser/controller/textAreaInput.ts
src/vs/editor/browser/controller/textAreaInput.ts
+10
-45
未找到文件。
src/vs/editor/browser/controller/textAreaHandler.ts
浏览文件 @
007f704e
...
@@ -54,7 +54,7 @@ class VisibleTextAreaData {
...
@@ -54,7 +54,7 @@ class VisibleTextAreaData {
}
}
}
}
const
canUseZeroSizeTextarea
=
(
browser
.
is
Edge
||
browser
.
is
Firefox
);
const
canUseZeroSizeTextarea
=
(
browser
.
isFirefox
);
export
class
TextAreaHandler
extends
ViewPart
{
export
class
TextAreaHandler
extends
ViewPart
{
...
@@ -280,14 +280,8 @@ export class TextAreaHandler extends ViewPart {
...
@@ -280,14 +280,8 @@ export class TextAreaHandler extends ViewPart {
}));
}));
this
.
_register
(
this
.
_textAreaInput
.
onCompositionUpdate
((
e
:
ICompositionData
)
=>
{
this
.
_register
(
this
.
_textAreaInput
.
onCompositionUpdate
((
e
:
ICompositionData
)
=>
{
if
(
browser
.
isEdge
)
{
// adjust width by its size
// Due to isEdgeOrIE (where the textarea was not cleared initially)
this
.
_visibleTextArea
=
this
.
_visibleTextArea
!
.
setWidth
(
measureText
(
e
.
data
,
this
.
_fontInfo
));
// we cannot assume the text consists only of the composited text
this
.
_visibleTextArea
=
this
.
_visibleTextArea
!
.
setWidth
(
0
);
}
else
{
// adjust width by its size
this
.
_visibleTextArea
=
this
.
_visibleTextArea
!
.
setWidth
(
measureText
(
e
.
data
,
this
.
_fontInfo
));
}
this
.
_render
();
this
.
_render
();
}));
}));
...
...
src/vs/editor/browser/controller/textAreaInput.ts
浏览文件 @
007f704e
...
@@ -221,8 +221,7 @@ export class TextAreaInput extends Disposable {
...
@@ -221,8 +221,7 @@ export class TextAreaInput extends Disposable {
this
.
_textAreaState
.
selectionStartPosition
?
new
Position
(
this
.
_textAreaState
.
selectionStartPosition
.
lineNumber
,
this
.
_textAreaState
.
selectionStartPosition
.
column
-
1
)
:
null
,
this
.
_textAreaState
.
selectionStartPosition
?
new
Position
(
this
.
_textAreaState
.
selectionStartPosition
.
lineNumber
,
this
.
_textAreaState
.
selectionStartPosition
.
column
-
1
)
:
null
,
this
.
_textAreaState
.
selectionEndPosition
this
.
_textAreaState
.
selectionEndPosition
);
);
}
else
if
(
!
browser
.
isEdge
)
{
}
else
{
// In IE we cannot set .value when handling 'compositionstart' because the entire composition will get canceled.
this
.
_setAndWriteTextAreaState
(
'
compositionstart
'
,
TextAreaState
.
EMPTY
);
this
.
_setAndWriteTextAreaState
(
'
compositionstart
'
,
TextAreaState
.
EMPTY
);
}
}
...
@@ -251,27 +250,7 @@ export class TextAreaInput extends Disposable {
...
@@ -251,27 +250,7 @@ export class TextAreaInput extends Disposable {
return
[
newState
,
typeInput
];
return
[
newState
,
typeInput
];
};
};
const
compositionDataInValid
=
(
locale
:
string
):
boolean
=>
{
// https://github.com/microsoft/monaco-editor/issues/339
// Multi-part Japanese compositions reset cursor in Edge/IE, Chinese and Korean IME don't have this issue.
// The reason that we can't use this path for all CJK IME is IE and Edge behave differently when handling Korean IME,
// which breaks this path of code.
if
(
browser
.
isEdge
&&
locale
===
'
ja
'
)
{
return
true
;
}
return
false
;
};
this
.
_register
(
dom
.
addDisposableListener
(
textArea
.
domNode
,
'
compositionupdate
'
,
(
e
:
CompositionEvent
)
=>
{
this
.
_register
(
dom
.
addDisposableListener
(
textArea
.
domNode
,
'
compositionupdate
'
,
(
e
:
CompositionEvent
)
=>
{
if
(
compositionDataInValid
(
e
.
locale
))
{
const
[
newState
,
typeInput
]
=
deduceInputFromTextAreaValue
(
/*couldBeEmojiInput*/
false
);
this
.
_textAreaState
=
newState
;
this
.
_onType
.
fire
(
typeInput
);
this
.
_onCompositionUpdate
.
fire
(
e
);
return
;
}
const
[
newState
,
typeInput
]
=
deduceComposition
(
e
.
data
||
''
);
const
[
newState
,
typeInput
]
=
deduceComposition
(
e
.
data
||
''
);
this
.
_textAreaState
=
newState
;
this
.
_textAreaState
=
newState
;
this
.
_onType
.
fire
(
typeInput
);
this
.
_onType
.
fire
(
typeInput
);
...
@@ -284,23 +263,15 @@ export class TextAreaInput extends Disposable {
...
@@ -284,23 +263,15 @@ export class TextAreaInput extends Disposable {
if
(
!
this
.
_isDoingComposition
)
{
if
(
!
this
.
_isDoingComposition
)
{
return
;
return
;
}
}
if
(
compositionDataInValid
(
e
.
locale
))
{
// https://github.com/microsoft/monaco-editor/issues/339
const
[
newState
,
typeInput
]
=
deduceInputFromTextAreaValue
(
/*couldBeEmojiInput*/
false
);
this
.
_textAreaState
=
newState
;
this
.
_onType
.
fire
(
typeInput
);
}
else
{
const
[
newState
,
typeInput
]
=
deduceComposition
(
e
.
data
||
''
);
this
.
_textAreaState
=
newState
;
this
.
_onType
.
fire
(
typeInput
);
}
// Due to
const
[
newState
,
typeInput
]
=
deduceComposition
(
e
.
data
||
''
);
// isEdgeOrIE (where the textarea was not cleared initially)
this
.
_textAreaState
=
newState
;
// and isChrome (the textarea is not updated correctly when composition ends)
this
.
_onType
.
fire
(
typeInput
);
// and isFirefox (the textare ais not updated correctly after inserting emojis)
// we cannot assume the text at the end consists only of the composited text
// isChrome: the textarea is not updated correctly when composition ends
if
(
browser
.
isEdge
||
browser
.
isChrome
||
browser
.
isFirefox
)
{
// isFirefox: the textarea is not updated correctly after inserting emojis
// => we cannot assume the text at the end consists only of the composited text
if
(
browser
.
isChrome
||
browser
.
isFirefox
)
{
this
.
_textAreaState
=
TextAreaState
.
readFromTextArea
(
this
.
_textArea
);
this
.
_textAreaState
=
TextAreaState
.
readFromTextArea
(
this
.
_textArea
);
}
}
...
@@ -527,13 +498,7 @@ export class TextAreaInput extends Disposable {
...
@@ -527,13 +498,7 @@ export class TextAreaInput extends Disposable {
}
}
if
(
this
.
_hasFocus
)
{
if
(
this
.
_hasFocus
)
{
if
(
browser
.
isEdge
)
{
this
.
writeScreenReaderContent
(
'
focusgain
'
);
// Edge has a bug where setting the selection range while the focus event
// is dispatching doesn't work. To reproduce, "tab into" the editor.
this
.
_setAndWriteTextAreaState
(
'
focusgain
'
,
TextAreaState
.
EMPTY
);
}
else
{
this
.
writeScreenReaderContent
(
'
focusgain
'
);
}
}
}
if
(
this
.
_hasFocus
)
{
if
(
this
.
_hasFocus
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录