Fix "add new comment" keyboard shortcut (#15404)

GitOrigin-RevId: d675abbf0977d5c60f332136e98c55a765cf87e9
This commit is contained in:
Alf Eaton 2023-10-24 14:02:17 +01:00 committed by Copybot
parent e06f40173d
commit 9868ce46ec
2 changed files with 11 additions and 2 deletions

View file

@ -12,6 +12,8 @@ import { useCodeMirrorViewContext } from '../../codemirror-editor'
import Modal, { useBulkActionsModal } from '../entries/bulk-actions-entry/modal'
import getMeta from '../../../../../utils/meta'
import useScopeValue from '../../../../../shared/hooks/use-scope-value'
import useScopeEventListener from '@/shared/hooks/use-scope-event-listener'
import { useCallback } from 'react'
function EditorWidgets() {
const { t } = useTranslation()
@ -54,6 +56,13 @@ function EditorWidgets() {
}, 0)
}
useScopeEventListener(
'comment:start_adding',
useCallback(() => {
setIsAddingComment(true)
}, [setIsAddingComment])
)
return ReactDOM.createPortal(
<>
<div className="rp-in-editor-widgets react-rp-in-editor-widgets">

View file

@ -786,7 +786,7 @@ export default App.controller('ReviewPanelController', [
ide.$scope.addNewComment = function (e) {
e.preventDefault()
$scope.$broadcast('comment:start_adding')
ide.$scope.$broadcast('comment:start_adding')
return $scope.toggleReviewPanel()
}
@ -802,7 +802,7 @@ export default App.controller('ReviewPanelController', [
}
return $timeout(function () {
ide.$scope.$broadcast('review-panel:layout')
return $scope.$broadcast('comment:start_adding')
ide.$scope.$broadcast('comment:start_adding')
})
}