Explorar o código

Revert "Cite an article by pasting the DOI (#29994)" (#30607)

This reverts commit a68af023b24fcf87bbc608395f2898df8e9b41a5.

GitOrigin-RevId: c0dd9ae3f6a0e12e6ba7d1e856327ea89eae8157
Alf Eaton hai 7 meses
pai
achega
861b66b007

+ 0 - 26
services/web/frontend/js/features/source-editor/extensions/autocomplete-on-paste.ts

@@ -1,26 +0,0 @@
-import { EditorView } from '@codemirror/view'
-import { startCompletion } from '@codemirror/autocomplete'
-import { ancestorNodeOfType } from '@/features/source-editor/utils/tree-operations/ancestors'
-import { containsDOI } from '../utils/doi'
-
-// open autocomplete when a DOI is pasted into a \cite argument
-export const autocompleteOnPaste = EditorView.domEventHandlers({
-  paste(event, view) {
-    const text = event.clipboardData?.getData('text/plain')
-    if (text && containsDOI(text)) {
-      const node = ancestorNodeOfType(
-        view.state,
-        view.state.selection.main.from,
-        'BibKeyArgument',
-        -1
-      )
-
-      if (node) {
-        // allow time for the pasted content to appear in the state
-        window.setTimeout(() => {
-          startCompletion(view)
-        })
-      }
-    }
-  },
-})

+ 0 - 2
services/web/frontend/js/features/source-editor/extensions/index.ts

@@ -55,7 +55,6 @@ import { trackDetachedComments } from './track-detached-comments'
 import { reviewTooltip } from './review-tooltip'
 import { tooltipsReposition } from './tooltips-reposition'
 import { selectionListener } from '@/features/source-editor/extensions/selection-listener'
-import { autocompleteOnPaste } from '@/features/source-editor/extensions/autocomplete-on-paste'
 
 const moduleExtensions: Array<(options: Record<string, any>) => Extension> =
   importOverleafModules('sourceEditorExtensions').map(
@@ -175,5 +174,4 @@ export const createExtensions = (options: Record<string, any>): Extension[] => [
   fileTreeItemDrop(),
   tooltipsReposition(),
   selectionListener(options.setEditorSelection),
-  autocompleteOnPaste,
 ]

+ 0 - 4
services/web/frontend/js/features/source-editor/utils/doi.ts

@@ -1,4 +0,0 @@
-const doiRe = /10\.\d{4,}\/\S+/
-
-export const containsDOI = (text: string) =>
-  doiRe.test(decodeURIComponent(text))