-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
853d290
commit e635d14
Showing
111 changed files
with
17,953 additions
and
12,873 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,69 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ScriptEditorComponent from '../ScriptEditorVanilaMonaco'; | ||
import type { AdminConnection, ThemeName, ThemeType } from '@iobroker/adapter-react-v5'; | ||
|
||
const styles = { | ||
import type { DebuggerLocation, SetBreakpointParameterType } from './types'; | ||
|
||
const styles: Record<string, React.CSSProperties> = { | ||
editorDiv: { | ||
height: '100%', | ||
width: '100%', | ||
overflow: 'hidden', | ||
position: 'relative' | ||
position: 'relative', | ||
}, | ||
}; | ||
|
||
class Editor extends React.Component { | ||
constructor(props) { | ||
interface EditorProps { | ||
runningInstances: Record<string, boolean>; | ||
socket: AdminConnection; | ||
sourceId: string | null; | ||
script: string; | ||
scriptName: string; | ||
adapterName: string; | ||
paused: boolean; | ||
breakpoints: SetBreakpointParameterType[]; | ||
location: DebuggerLocation | null; | ||
themeType: ThemeType; | ||
themeName: ThemeName; | ||
onToggleBreakpoint: (i: number) => void; | ||
} | ||
|
||
interface EditorState { | ||
lines: string[]; | ||
} | ||
|
||
class Editor extends React.Component<EditorProps, EditorState> { | ||
constructor(props: EditorProps) { | ||
super(props); | ||
|
||
this.state = { | ||
lines: (this.props.script || '').split(/\r\n|\n/) | ||
lines: (this.props.script || '').split(/\r\n|\n/), | ||
}; | ||
} | ||
|
||
editorDidMount(editor, monaco) { | ||
this.monaco = monaco; | ||
this.editor = editor; | ||
editor.focus(); | ||
} | ||
|
||
render() { | ||
return <div style={styles.editorDiv} key="scriptEditorDiv2"> | ||
<ScriptEditorComponent | ||
key="scriptEditor2" | ||
name={this.props.scriptName} | ||
adapterName={this.props.adapterName} | ||
readOnly | ||
code={this.props.script || ''} | ||
isDark={this.props.themeType === 'dark'} | ||
socket={this.props.socket} | ||
runningInstances={this.props.runningInstances} | ||
language={'javascript'} | ||
|
||
breakpoints={this.props.breakpoints} | ||
location={this.props.paused ? this.props.location : null} | ||
onToggleBreakpoint={i => this.props.onToggleBreakpoint(i)} | ||
/> | ||
</div>; | ||
render(): React.JSX.Element { | ||
return ( | ||
<div | ||
style={styles.editorDiv} | ||
key="scriptEditorDiv2" | ||
> | ||
<ScriptEditorComponent | ||
key="scriptEditor2" | ||
name={this.props.scriptName} | ||
adapterName={this.props.adapterName} | ||
readOnly | ||
code={this.props.script || ''} | ||
isDark={this.props.themeType === 'dark'} | ||
socket={this.props.socket} | ||
runningInstances={this.props.runningInstances} | ||
language={'javascript'} | ||
breakpoints={this.props.breakpoints} | ||
location={this.props.paused ? this.props.location : null} | ||
onToggleBreakpoint={i => this.props.onToggleBreakpoint(i)} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Editor.propTypes = { | ||
runningInstances: PropTypes.object, | ||
socket: PropTypes.object, | ||
sourceId: PropTypes.string, | ||
script: PropTypes.string, | ||
scriptName: PropTypes.string, | ||
adapterName: PropTypes.string, | ||
paused: PropTypes.bool, | ||
breakpoints: PropTypes.array, | ||
location: PropTypes.object, | ||
themeType: PropTypes.string, | ||
themeName: PropTypes.string, | ||
onToggleBreakpoint: PropTypes.func, | ||
}; | ||
|
||
export default Editor; |
Oops, something went wrong.