|
|
|
@ -4,6 +4,7 @@ import Editor, { loader } from '@monaco-editor/react' |
|
|
|
|
import { reducerActions, reducerListener, initialState } from './actions/editor' |
|
|
|
|
import { language, conf } from './syntax' |
|
|
|
|
import { cairoLang, cairoConf } from './cairoSyntax' |
|
|
|
|
import { IMarkdownString } from 'monaco-editor' |
|
|
|
|
|
|
|
|
|
import './remix-ui-editor.css' |
|
|
|
|
import { loadTypes } from './web-types' |
|
|
|
@ -39,6 +40,25 @@ type sourceMarker = { |
|
|
|
|
hide: boolean |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export type lineText = { |
|
|
|
|
position: { |
|
|
|
|
start: { |
|
|
|
|
line: number |
|
|
|
|
column: number |
|
|
|
|
}, |
|
|
|
|
end: { |
|
|
|
|
line: number |
|
|
|
|
column: number |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
from?: string // plugin name
|
|
|
|
|
content: string |
|
|
|
|
className: string |
|
|
|
|
afterContentClassName: string |
|
|
|
|
hide: boolean, |
|
|
|
|
hoverMessage: IMarkdownString | IMarkdownString[] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
loader.config({ paths: { vs: 'assets/js/monaco-editor/dev/vs' } }) |
|
|
|
|
|
|
|
|
|
export type DecorationsReturn = { |
|
|
|
@ -259,7 +279,7 @@ export const EditorUI = (props: EditorUIProps) => { |
|
|
|
|
}
|
|
|
|
|
}, [props.currentFile]) |
|
|
|
|
|
|
|
|
|
const convertToMonacoDecoration = (decoration: sourceAnnotation | sourceMarker, typeOfDecoration: string) => { |
|
|
|
|
const convertToMonacoDecoration = (decoration: lineText | sourceAnnotation | sourceMarker, typeOfDecoration: string) => { |
|
|
|
|
if (typeOfDecoration === 'sourceAnnotationsPerFile') { |
|
|
|
|
decoration = decoration as sourceAnnotation |
|
|
|
|
return { |
|
|
|
@ -289,6 +309,19 @@ export const EditorUI = (props: EditorUIProps) => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (typeOfDecoration === 'lineTextPerFile') { |
|
|
|
|
const lineTextDecoration = decoration as lineText |
|
|
|
|
return { |
|
|
|
|
type: typeOfDecoration, |
|
|
|
|
range: new monacoRef.current.Range(lineTextDecoration.position.start.line + 1, lineTextDecoration.position.start.column + 1, lineTextDecoration.position.start.line + 1, 1024), |
|
|
|
|
options: { |
|
|
|
|
after: { content: ` ${lineTextDecoration.content}`, inlineClassName: `${lineTextDecoration.className}` }, |
|
|
|
|
afterContentClassName: `${lineTextDecoration.afterContentClassName}`, |
|
|
|
|
hoverMessage : lineTextDecoration.hoverMessage |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
props.editorAPI.clearDecorationsByPlugin = (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => { |
|
|
|
|