mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #30490 from overleaf/mg-context-menu-a11y
[web] Add a11y support for context menu GitOrigin-RevId: 3cbe66ee3ee8345dd0e89f89561928889832a50d
This commit is contained in:
@@ -168,12 +168,19 @@ export const addComment = () => {
|
||||
}
|
||||
|
||||
export const deleteSelection: Command = view => {
|
||||
const { from, to } = view.state.selection.main
|
||||
if (from === to) return false
|
||||
if (view.state.selection.ranges.every(range => range.empty)) return false
|
||||
|
||||
view.dispatch({
|
||||
changes: { from, to, insert: '' },
|
||||
selection: { anchor: from },
|
||||
const transaction = view.state.changeByRange(range => {
|
||||
if (range.empty) {
|
||||
return { changes: [], range }
|
||||
}
|
||||
|
||||
return {
|
||||
changes: { from: range.from, to: range.to, insert: '' },
|
||||
range: EditorSelection.cursor(range.from),
|
||||
}
|
||||
})
|
||||
|
||||
view.dispatch(transaction)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user