Skip to content

Commit

Permalink
Fixed issue with long lines in Code Editor Example (#3130)
Browse files Browse the repository at this point in the history
* broadcasting

* Simplified broadcasting

* Updated for broadcasting

* Changed to camel case

* Camel case and auto formating

* Added comments

* Skip if matrices have the same size

* Fixed issue with undefined variable

missing dot  in `A._size`

* Implemented broadcasting in all functions

* Added helper functions

* Added function to check for broadcasting rules

* Tests for broadcasted arithmetic

* Fixed issue with matrix the size of a vector

* Documented and updated broadcasting

* Included broadcast.test

* Included math to syntax when missing

* Add code editor example

* Vite mini project

* Initial example

* added alpine debounce

* Fixed display

* Added parser.clear

* Added mathjs-language

* Made module to get expressions

* Added custom events

* Issue with help formatting

* Simplified help format

* Restored package.json

* removed unneded icons

* Added readme file

* Fixed versions

* Commented getExpressions

* Documented main.js

* Fixed title

* Fixed alpine version

* Removed AlpineJS

* Added documentation and renamed variables for clarity

* Fixed naming errors

* Fixed issue with long lines

* Edge case where multiple expressions are on the same line not ending in ";"

---------

Co-authored-by: David Contreras <[email protected]>
Co-authored-by: Jos de Jong <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent 1bae71c commit 4475dac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ Evan Miller <[email protected]>
Timur <[email protected]>
Ari Markowitz <[email protected]>
Jay Wang <[email protected]>
David Contreras <[email protected]>
Jaeu Jeong <[email protected]>
cyavictor88 <[email protected]>
David Contreras <[email protected]>
Jakub Riegel <[email protected]>
Angus Comrie <[email protected]>
TMTron <[email protected]>
Expand Down
5 changes: 3 additions & 2 deletions examples/code editor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let startState = EditorState.create({
extensions: [
basicSetup,
StreamLanguage.define(mathjsLang(math)),
EditorView.lineWrapping,
EditorView.updateListener.of((update) => {
if (update.docChanged) {
// if doc changed debounce and update results after a timeout
Expand Down Expand Up @@ -110,9 +111,9 @@ function processExpressions(expressions) {
const outputs = formatResult(result)
// Determine visibility based on the result type:
// - Undefined results are hidden.
// - Results with an `isResultSet` property are hidden.
// - Results with an `isResultSet` property are hidden when empty.
// - All other results are visible.
const visible = result === undefined ? false : result.isResultSet ? false : true
const visible = result === undefined ? false : (result.isResultSet && result.entries.length === 0) ? false : true
return ({
...expression,
outputs,
Expand Down
4 changes: 3 additions & 1 deletion examples/code editor/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ body {
flex: 1;
height: auto;
display: flex;
overflow: auto;
}

#editor>.cm-editor {
flex: 1
flex: 1;
overflow: scroll;
}

#app>article {
Expand Down

0 comments on commit 4475dac

Please sign in to comment.