Merge pull request #1111 from sharelatex/as-fix-spell-check

Fix bug where read only editor would crash

GitOrigin-RevId: ed8ac8ddcec118b57e20916afaddb50d5062b2cf
This commit is contained in:
Alasdair Smith 2018-11-05 14:01:02 +00:00 committed by sharelatex
parent 659242b457
commit 221acb8207

View file

@ -594,6 +594,7 @@ define([
} }
const initSpellCheck = function() { const initSpellCheck = function() {
if (!spellCheckManager) return
spellCheckManager.init() spellCheckManager.init()
editor.on('changeSession', onSessionChangeForSpellCheck) editor.on('changeSession', onSessionChangeForSpellCheck)
onSessionChangeForSpellCheck({ session: editor.getSession() }) // Force initial setup onSessionChangeForSpellCheck({ session: editor.getSession() }) // Force initial setup
@ -601,6 +602,7 @@ define([
} }
const tearDownSpellCheck = function() { const tearDownSpellCheck = function() {
if (!spellCheckManager) return
editor.off('changeSession', onSessionChangeForSpellCheck) editor.off('changeSession', onSessionChangeForSpellCheck)
return editor.off( return editor.off(
'nativecontextmenu', 'nativecontextmenu',