Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use Ace's Flix mode #109

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this entire class be dropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so. It's strictly about highlighting, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do in follow up PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're both talking about FlixMode then it's already removed :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant InlineEditor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe it is needed as a separate component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right now InlineEditor is used for the uneditable code boxes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

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
Loading