mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 20:11:04 +00:00
Scroll editor line into view after inserting a symbol (#6164)
GitOrigin-RevId: 20f80ec93148d36f951c956a942021f01490d120
This commit is contained in:
parent
a6625e872f
commit
6dec7fab63
2 changed files with 12 additions and 1 deletions
|
@ -56,6 +56,10 @@ export default EditorManager = (function () {
|
|||
},
|
||||
}
|
||||
|
||||
window.addEventListener('editor:insert-symbol', event => {
|
||||
this.$scope.editor.insertSymbol(event.detail)
|
||||
})
|
||||
|
||||
this.$scope.$on('entity:selected', (event, entity) => {
|
||||
if (this.$scope.ui.view !== 'history' && entity.type === 'doc') {
|
||||
return this.openDoc(entity)
|
||||
|
|
|
@ -77,7 +77,6 @@ export function EditorProvider({ children, settings }) {
|
|||
const [permissionsLevel] = useScopeValue('permissionsLevel')
|
||||
const [showSymbolPalette] = useScopeValue('editor.showSymbolPalette')
|
||||
const [toggleSymbolPalette] = useScopeValue('editor.toggleSymbolPalette')
|
||||
const [insertSymbol] = useScopeValue('editor.insertSymbol')
|
||||
|
||||
useEffect(() => {
|
||||
if (ide?.socket) {
|
||||
|
@ -119,6 +118,14 @@ export function EditorProvider({ children, settings }) {
|
|||
)
|
||||
}, [projectName, setTitle])
|
||||
|
||||
const insertSymbol = useCallback(symbol => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('editor:insert-symbol', {
|
||||
detail: symbol,
|
||||
})
|
||||
)
|
||||
}, [])
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
cobranding,
|
||||
|
|
Loading…
Reference in a new issue