mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #7323 from overleaf/ta-synctex-disable-multi-one-way
Don't Disable Synctex PDF-to-Code Button GitOrigin-RevId: 90328e0fea8cb5358217ce866839f5e1a4a73b94
This commit is contained in:
parent
04bc5103ea
commit
a110c4d7bd
4 changed files with 9 additions and 23 deletions
|
@ -25,6 +25,10 @@ App.controller(
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$scope.$on('file-tree.reselectDoc', (ev, docId) => {
|
||||||
|
window.dispatchEvent(new CustomEvent('editor.openDoc', { detail: docId }))
|
||||||
|
})
|
||||||
|
|
||||||
// Set isConnected to true if:
|
// Set isConnected to true if:
|
||||||
// - connection state is 'ready', OR
|
// - connection state is 'ready', OR
|
||||||
// - connection state is 'waitingCountdown' and reconnection_countdown is null
|
// - connection state is 'waitingCountdown' and reconnection_countdown is null
|
||||||
|
|
|
@ -23,7 +23,6 @@ function GoToCodeButton({
|
||||||
syncToCode,
|
syncToCode,
|
||||||
syncToCodeInFlight,
|
syncToCodeInFlight,
|
||||||
isDetachLayout,
|
isDetachLayout,
|
||||||
hasSingleSelectedDoc,
|
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const tooltipPlacement = isDetachLayout ? 'bottom' : 'right'
|
const tooltipPlacement = isDetachLayout ? 'bottom' : 'right'
|
||||||
|
@ -51,7 +50,7 @@ function GoToCodeButton({
|
||||||
bsStyle="default"
|
bsStyle="default"
|
||||||
bsSize="xs"
|
bsSize="xs"
|
||||||
onClick={() => syncToCode(position, 72)}
|
onClick={() => syncToCode(position, 72)}
|
||||||
disabled={syncToCodeInFlight || !hasSingleSelectedDoc}
|
disabled={syncToCodeInFlight}
|
||||||
className={buttonClasses}
|
className={buttonClasses}
|
||||||
aria-label={t('go_to_pdf_location_in_code')}
|
aria-label={t('go_to_pdf_location_in_code')}
|
||||||
>
|
>
|
||||||
|
@ -367,7 +366,6 @@ function PdfSynctexControls() {
|
||||||
syncToCode={syncToCode}
|
syncToCode={syncToCode}
|
||||||
syncToCodeInFlight={syncToCodeInFlight}
|
syncToCodeInFlight={syncToCodeInFlight}
|
||||||
isDetachLayout
|
isDetachLayout
|
||||||
hasSingleSelectedDoc={hasSingleSelectedDoc}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -385,7 +383,6 @@ function PdfSynctexControls() {
|
||||||
position={position}
|
position={position}
|
||||||
syncToCode={syncToCode}
|
syncToCode={syncToCode}
|
||||||
syncToCodeInFlight={syncToCodeInFlight}
|
syncToCodeInFlight={syncToCodeInFlight}
|
||||||
hasSingleSelectedDoc={hasSingleSelectedDoc}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -399,7 +396,6 @@ GoToCodeButton.propTypes = {
|
||||||
position: PropTypes.object.isRequired,
|
position: PropTypes.object.isRequired,
|
||||||
syncToCode: PropTypes.func.isRequired,
|
syncToCode: PropTypes.func.isRequired,
|
||||||
syncToCodeInFlight: PropTypes.bool.isRequired,
|
syncToCodeInFlight: PropTypes.bool.isRequired,
|
||||||
hasSingleSelectedDoc: PropTypes.bool.isRequired,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GoToPdfButton.propTypes = {
|
GoToPdfButton.propTypes = {
|
||||||
|
|
|
@ -225,6 +225,7 @@ export default EditorManager = (function () {
|
||||||
if (doc.id === this.$scope.editor.open_doc_id && !options.forceReopen) {
|
if (doc.id === this.$scope.editor.open_doc_id && !options.forceReopen) {
|
||||||
// automatically update the file tree whenever the file is opened
|
// automatically update the file tree whenever the file is opened
|
||||||
this.ide.fileTreeManager.selectEntity(doc)
|
this.ide.fileTreeManager.selectEntity(doc)
|
||||||
|
this.$scope.$broadcast('file-tree.reselectDoc', doc.id)
|
||||||
this.$scope.$apply(() => {
|
this.$scope.$apply(() => {
|
||||||
return done(false)
|
return done(false)
|
||||||
})
|
})
|
||||||
|
|
|
@ -132,10 +132,6 @@ describe('<PdfSynctexControls/>', function () {
|
||||||
cy.get('body')
|
cy.get('body')
|
||||||
.findByRole('button', { name: 'Go to code location in PDF' })
|
.findByRole('button', { name: 'Go to code location in PDF' })
|
||||||
.should('be.disabled')
|
.should('be.disabled')
|
||||||
|
|
||||||
cy.get('body')
|
|
||||||
.findByRole('button', { name: /^Go to PDF location in code/ })
|
|
||||||
.should('be.disabled')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('disables button when a file is selected', function () {
|
it('disables button when a file is selected', function () {
|
||||||
|
@ -152,10 +148,6 @@ describe('<PdfSynctexControls/>', function () {
|
||||||
cy.get('body')
|
cy.get('body')
|
||||||
.findByRole('button', { name: 'Go to code location in PDF' })
|
.findByRole('button', { name: 'Go to code location in PDF' })
|
||||||
.should('be.disabled')
|
.should('be.disabled')
|
||||||
|
|
||||||
cy.get('body')
|
|
||||||
.findByRole('button', { name: /^Go to PDF location in code/ })
|
|
||||||
.should('be.disabled')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('with detacher role', function () {
|
describe('with detacher role', function () {
|
||||||
|
@ -285,16 +277,9 @@ describe('<PdfSynctexControls/>', function () {
|
||||||
|
|
||||||
cy.wait('@compile')
|
cy.wait('@compile')
|
||||||
|
|
||||||
cy.get('body')
|
cy.get('body').findByRole('button', {
|
||||||
.findByRole('button', { name: /^Go to PDF location in code/ })
|
name: /^Go to PDF location in code/,
|
||||||
.should('be.disabled')
|
})
|
||||||
.then(() => {
|
|
||||||
sysendTestHelper.receiveMessage({
|
|
||||||
role: 'detached',
|
|
||||||
event: 'state-has-single-selected-doc',
|
|
||||||
data: { value: true },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
cy.get('body')
|
cy.get('body')
|
||||||
.findByRole('button', { name: /^Go to PDF location in code/ })
|
.findByRole('button', { name: /^Go to PDF location in code/ })
|
||||||
|
|
Loading…
Reference in a new issue