mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #1526 from sharelatex/revert-1467-as-global-search-keybind
Revert "Enable search keybinding globally in editor" GitOrigin-RevId: 423bebb48a237c8bda935bb6cb70c5cf953b7015
This commit is contained in:
parent
43899589dc
commit
15a6169a06
3 changed files with 2 additions and 57 deletions
|
@ -19,8 +19,6 @@ define([
|
|||
'ide/editor/directives/aceEditor/track-changes/TrackChangesManager',
|
||||
'ide/editor/directives/aceEditor/track-changes/TrackChangesAdapter',
|
||||
'ide/editor/directives/aceEditor/metadata/MetadataManager',
|
||||
'ide/editor/directives/aceEditor/global-key-binding/GlobalKeybindingManager',
|
||||
'ide/editor/directives/aceEditor/global-key-binding/GlobalKeybindingAdapter',
|
||||
'ide/metadata/services/metadata',
|
||||
'ide/graphics/services/graphics',
|
||||
'ide/preamble/services/preamble',
|
||||
|
@ -40,9 +38,7 @@ define([
|
|||
CursorPositionAdapter,
|
||||
TrackChangesManager,
|
||||
TrackChangesAdapter,
|
||||
MetadataManager,
|
||||
GlobalKeybindingManager,
|
||||
GlobalKeybindingAdapter
|
||||
MetadataManager
|
||||
) {
|
||||
let syntaxValidationEnabled
|
||||
const { EditSession } = ace.require('ace/edit_session')
|
||||
|
@ -201,11 +197,8 @@ define([
|
|||
preamble,
|
||||
files
|
||||
)
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
const keybindingManager = new GlobalKeybindingManager(
|
||||
new GlobalKeybindingAdapter(editor)
|
||||
)
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
scope.$watch('onSave', function(callback) {
|
||||
if (callback != null) {
|
||||
|
@ -751,7 +744,6 @@ define([
|
|||
triggerEditorInitEvent()
|
||||
initSpellCheck()
|
||||
initTrackChanges()
|
||||
keybindingManager.init()
|
||||
|
||||
resetScrollMargins()
|
||||
|
||||
|
@ -802,7 +794,6 @@ define([
|
|||
var detachFromAce = function(sharejs_doc) {
|
||||
tearDownSpellCheck()
|
||||
tearDownTrackChanges()
|
||||
keybindingManager.tearDown()
|
||||
sharejs_doc.detachFromAce()
|
||||
sharejs_doc.off('remoteop.recordRemote')
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
define(['ace/ace', 'ace/ext-searchbox'], function() {
|
||||
const SearchBox = ace.require('ace/ext/searchbox')
|
||||
|
||||
class GlobalKeybindingAdapter {
|
||||
constructor(editor) {
|
||||
this.editor = editor
|
||||
}
|
||||
|
||||
handleF(e) {
|
||||
e.preventDefault()
|
||||
SearchBox.Search(this.editor, true)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return GlobalKeybindingAdapter
|
||||
})
|
|
@ -1,29 +0,0 @@
|
|||
define([], function() {
|
||||
const F_KEY = 70
|
||||
|
||||
class GlobalKeyBindingManager {
|
||||
constructor(adapter) {
|
||||
this.adapter = adapter
|
||||
this.handleKey = this.handleKey.bind(this)
|
||||
}
|
||||
|
||||
handleKey(e) {
|
||||
if (e.metaKey || e.ctrlKey) {
|
||||
switch (e.keyCode) {
|
||||
case F_KEY:
|
||||
return this.adapter.handleF(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
$(document).on('keydown', this.handleKey)
|
||||
}
|
||||
|
||||
tearDown() {
|
||||
$(document).off('keydown', this.handleKey)
|
||||
}
|
||||
}
|
||||
|
||||
return GlobalKeyBindingManager
|
||||
})
|
Loading…
Reference in a new issue