Open rickygarg opened 1 year ago
Seems interesting :) I can try this one.
@rickygarg can you please explain the 3rd point ?
Moreover,
Any link to a working example will help a lot. Thanks.
@rickygarg can you please explain the 3rd point ?
Like the autocomplete feature in Gmail Smart Compose. Here's a pic.
Are we gonna use something like Stencil.js ?
We use lit for our other web components and web apps, so that's ideal.
How should the basic UI of this editor look like ?
Open to suggestions on design. Note that the formulas can typically have upto 10 variables, so in-line editing in a table view might not be easy. Rather, we can have a dedicated screen (or multi line div) per formula. Perhaps maximum of one parentheses per line, with auto indentation for easy readability. I found an example that follows similar principles (pic).
Any link to a working example will help a lot. Thanks.
We'll commit an example by Monday.
Thanks. I will learn Lit
in the mean time :)
@rickygarg what is the expected file hierarchy?
Hey @rickygarg @Isha-Sharma
I read lit-elements
a bit, and have come up with a solution like -
contenteditable
for the 'input field'
@change
to a callback that parses the string and converts it to the respective formatted code. Like +
becomes bold, etc.Does this sound good to you ?
This looks good.
Any link to a working example will help a lot. Thanks.
Here's an example of a lit component.
Can also try looking for any public component that might fit.
Seems like a good idea. After many unsuccessful attempts at getting the editor to behave like wysiwyg
, I was planning of having two divs, one on top of another, where the top one will have opacity: 0
and will be editable, whereas the bottom one will show the formatted output :laughing:
Also, is the component supposed to explicitly tell what's going wrong in the formula? Like a red text below saying the variable doesn't exist
? Or simply having a red underline is fine?
Also, is the component supposed to explicitly tell what's going wrong in the formula? Like a red text below saying
the variable doesn't exist
? Or simply having a red underline is fine?
@rickygarg @Isha-Sharma
<formula-editor></formula-editor>
Requirements
WYSIWYG editor that allows a user to type in simple formulas such as:
b + a
z - x
q * r
v / w
l - (k + n)
Highlight mathematical operators using different formatting b + a
Use autosuggest (menu or tab/swipe complete) variable names from a predefined list of available variables.
Validate input on each key press to highlight invalid variable names or improper mathemetical formulas (e.g. a red-underline or a light red background).
(i) Variable doesn't exist: nonExistentVariable + 1 (ii) Improper math:
a ** b
(iii) Too many decimal points:a + 1.0000000000001
(iv) Division by zero:a / 0
{ "variableCode": "c", "formula": "b+a" }