You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any interest from the maintainer in lifting up more monaco features into the react level? For example, I've implemented an onMouseUp prop, onMouseMove prop, and a decorations prop:
import{Editor,typeEditorProps}from'@monaco-editor/react';import{typeIDisposable,typeeditorasmonaco}from'monaco-editor';import{useEffect,useState}from'react';exportfunctionMonacoEditor(props: EditorProps&{onMouseUp?: (ev: monaco.IEditorMouseEvent)=>unknown;onMouseMove?: (ev: monaco.IEditorMouseEvent)=>unknown;decorations?: monaco.IModelDeltaDecoration[];},){const[editor,setEditor]=useState<monaco.IStandaloneCodeEditor>();const[decoColl,setDecoColl]=useState<monaco.IEditorDecorationsCollection>();useEffect(()=>{if(!editor)return;constcleanup: IDisposable[]=[];if(props.onMouseUp)cleanup.push(editor.onMouseUp(props.onMouseUp));if(props.onMouseMove)cleanup.push(editor.onMouseMove(props.onMouseMove));return()=>{cleanup.forEach((fn)=>fn.dispose());};},[editor,props.onMouseMove,props.onMouseUp]);useEffect(()=>{if(!decoColl||!props.decorations)return;decoColl.set(props.decorations);// if this gets slow, we should start diffing},[props.decorations,decoColl]);return(<Editor{...props}onMount={(ed)=>{setEditor(ed);setDecoColl(ed.createDecorationsCollection());}}/>);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there any interest from the maintainer in lifting up more monaco features into the react level? For example, I've implemented an
onMouseUp
prop,onMouseMove
prop, and adecorations
prop:Beta Was this translation helpful? Give feedback.
All reactions