import { css } from '@emotion/css'; /** * editContext:false 路径下,macOS + 中文输入法场景存在 compositionend 丢失的问题: * textarea 卡在组合态(.ime-input),以可见颜色、整行高渲染在光标行, * 内容为镜像文本滚动后的切片,表现为随机的“重复/残影”文字(选中、复制、输入后出现)。 * * 这里无条件强制 inputarea 透明,彻底隐藏该镜像。代价是输入法组字过程中编辑器内 * 不回显组字文本(macOS 候选条中仍可见),查询输入框场景可接受。 * * monaco 0.56+ 修复 EditContext 剪贴板/输入问题后,可切回 editContext:true 并移除本样式。 */ export const hideMirroredInputAreaClassName = css` .monaco-editor .inputarea { color: transparent !important; } /* 应用全局 ::selection(如 the App.less 的 color !important)会覆盖 textarea 的 transparent,把镜像进 textarea 的选中文字显形为“残影”,这里一并屏蔽原生选区绘制 */ .monaco-editor .inputarea::selection { background: transparent !important; color: transparent !important; } `;