Skip to content

Commit

Permalink
feat: use Ace's Flix mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Nov 5, 2023
1 parent 51b828b commit 1e2a2d5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 121 deletions.
47 changes: 23 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"homepage": "https://flix.dev/",
"dependencies": {
"bootstrap": "^4.5.3",
"brace": "^0.11.1",
"react": "^16.0.0",
"react-ace": "^7.0.5",
"react-ace": "^10.1.0",
"react-dom": "^16.0.0",
"react-fontawesome": "^1.7.1",
"react-icons": "^4.1.0",
Expand Down
12 changes: 3 additions & 9 deletions src/util/Editor.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import React, {Component} from 'react';
import AceEditor from 'react-ace'
import 'brace/mode/scala'

import FlixMode from './FlixMode'
import 'brace/theme/chrome';
import 'ace-builds/src-noconflict/mode-flix'
import 'ace-builds/src-noconflict/theme-chrome'

class Editor extends Component {
componentDidMount() {
let customMode = new FlixMode();
this.refs.aceEditor.editor.getSession().setMode(customMode);
}

onChange(input) {
this.props.notifyTextChanged(input)
};

render() {
return (
<AceEditor width="100%"
mode='text'
mode='flix'
theme='chrome'
ref="aceEditor"
showGutter={false}
Expand Down
77 changes: 0 additions & 77 deletions src/util/FlixMode.js

This file was deleted.

12 changes: 3 additions & 9 deletions src/util/InlineEditor.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, {Component} from 'react';
import AceEditor from 'react-ace'
import 'brace/mode/scala'

import FlixMode from './FlixMode'
import 'brace/theme/chrome';
import 'ace-builds/src-noconflict/mode-flix'
import 'ace-builds/src-noconflict/theme-chrome'

class InlineEditor extends Component {
constructor(props) {
Expand All @@ -17,18 +16,13 @@ class InlineEditor extends Component {
}
}

componentDidMount() {
const customMode = new FlixMode();
this.refs.aceEditor.editor.getSession().setMode(customMode);
}

render() {
return (
<div className="inline-editor-frame">
<div className="inline-editor-code">
<AceEditor
style={{"background": "inherit", "width": "95%"}}
mode='text'
mode='flix'
theme='chrome'
ref="aceEditor"
readOnly={true}
Expand Down

0 comments on commit 1e2a2d5

Please sign in to comment.