mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Fix "add new comment" keyboard shortcut (#15404)
GitOrigin-RevId: d675abbf0977d5c60f332136e98c55a765cf87e9
This commit is contained in:
parent
e06f40173d
commit
9868ce46ec
2 changed files with 11 additions and 2 deletions
|
@ -12,6 +12,8 @@ import { useCodeMirrorViewContext } from '../../codemirror-editor'
|
||||||
import Modal, { useBulkActionsModal } from '../entries/bulk-actions-entry/modal'
|
import Modal, { useBulkActionsModal } from '../entries/bulk-actions-entry/modal'
|
||||||
import getMeta from '../../../../../utils/meta'
|
import getMeta from '../../../../../utils/meta'
|
||||||
import useScopeValue from '../../../../../shared/hooks/use-scope-value'
|
import useScopeValue from '../../../../../shared/hooks/use-scope-value'
|
||||||
|
import useScopeEventListener from '@/shared/hooks/use-scope-event-listener'
|
||||||
|
import { useCallback } from 'react'
|
||||||
|
|
||||||
function EditorWidgets() {
|
function EditorWidgets() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
@ -54,6 +56,13 @@ function EditorWidgets() {
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useScopeEventListener(
|
||||||
|
'comment:start_adding',
|
||||||
|
useCallback(() => {
|
||||||
|
setIsAddingComment(true)
|
||||||
|
}, [setIsAddingComment])
|
||||||
|
)
|
||||||
|
|
||||||
return ReactDOM.createPortal(
|
return ReactDOM.createPortal(
|
||||||
<>
|
<>
|
||||||
<div className="rp-in-editor-widgets react-rp-in-editor-widgets">
|
<div className="rp-in-editor-widgets react-rp-in-editor-widgets">
|
||||||
|
|
|
@ -786,7 +786,7 @@ export default App.controller('ReviewPanelController', [
|
||||||
|
|
||||||
ide.$scope.addNewComment = function (e) {
|
ide.$scope.addNewComment = function (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$scope.$broadcast('comment:start_adding')
|
ide.$scope.$broadcast('comment:start_adding')
|
||||||
return $scope.toggleReviewPanel()
|
return $scope.toggleReviewPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +802,7 @@ export default App.controller('ReviewPanelController', [
|
||||||
}
|
}
|
||||||
return $timeout(function () {
|
return $timeout(function () {
|
||||||
ide.$scope.$broadcast('review-panel:layout')
|
ide.$scope.$broadcast('review-panel:layout')
|
||||||
return $scope.$broadcast('comment:start_adding')
|
ide.$scope.$broadcast('comment:start_adding')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue