Git Product home page Git Product logo

rich-text-editor's Introduction

Node.js CI

Abitti.dev

Abitti.dev

Use of Abitti Trademark policy

Rich text editor with math support for Finnish Matriculation Examination Board. Live demo can be found at https://math-demo.abitti.fi/

Since v4.0.0, only ES2017 code with ES modules is provided (in the dist directory). If you want to use this library, a bundler such as Webpack or Rollup is probably needed.

Goal (Read this before submitting)

Rich text editor has been developed to allow candidates of Finnish Matriculation Examination to attach screenshots and write equations as part of their submissions. Our aim is not to create a general-purpose drop-in replacement for textarea but an editor which works in Abitti and its embedded browser.

While we celebrate every bug report, feature request and pull request we kindly ask you to remember following:

  • Most of the issues related to entering formulae and rendering LaTeX are caused by MathJax and MathQuill libraries. We do not have resources to write pull requests based on issues submitted to us. For similar reasons we will not pass upstream issues reported to us.
  • We are not paying attention to issues or pull requests which fall outside our mission - Abitti.

We hope you understand our desire to focus on our goal specified by law.

Dependencies

Getting started

  1. Install Node.js
  2. Run npm install.
  3. Run npm run dev.
  4. Browser tests: http://localhost:5111/test/tests.html
  5. Manual testing: http://localhost:5111/test/tests.html?grep=manual

Example of direct usage

Demo: http://digabi.github.io/rich-text-editor/

Source: https://github.com/digabi/rich-text-editor/blob/master/index.html

License

https://opensource.org/licenses/MIT

rich-text-editor's People

Contributors

agartman avatar akiseppanen avatar antti-manninen-vmv avatar apsiv11 avatar auramo avatar bluelhf avatar chacal avatar dependabot-preview[bot] avatar dependabot[bot] avatar eeroan avatar eeropic avatar elahti avatar emlai avatar gekkio avatar hvrauhal avatar jjv avatar kunring avatar lateks avatar mikaukora avatar mplattu avatar mtreinik avatar orva avatar pejuam avatar pellko avatar samisaves avatar sluukkonen avatar sulanto avatar timotm avatar wedrawde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rich-text-editor's Issues

Support for EN translations

I noticed that there is no English translations for the editor.
Would you be interested of receiving a PR for adding that?

Adding line breaks breaks preview

Adding a line break \\ in LaTeX makes the preview disappear completely. This is extremely inconvenient. Also typing something to the preview in that state will make you lose everything. Here's a screenshot:
image

Resize images in the editor

Pictures used to show a source for a solution always show up really big with no way of changing it except for downloading the HTML file and adjusting the size there with CSS.

Add support for \xrightarrow

\xrightleftharpoons already works (but \rightleftharpoons doesn't in preview), so could you add support for \xrightarrow (and \xleftarrow) also. This would help in writing some chemical reactions.

Dfrac changes to frac if edited

Dfrac formula \dfrac{\frac{1}{2}}{\dfrac{3}{4}} changes to frac if edited \frac{\frac{1}{2}}{\frac{3}{4}
dfrac
frac

The formula changes from dfrac to frac when editing

Automatic \text{} insertion fails with äöå

It seems to be an intended feature that inserting \ followed by something that isn't a latex command will insert the text inside \text{}. This is useful behaviour for quickly writing one word \text{} blocks
Peek 2022-01-21 21-49

This feature does not work with all expected characters. As far as I can tell, it seems to cancel the text block for any non a-z character. This should support äöå.
Peek 2022-01-21 21-50

Set custom position for toolbar

Is it possible to set custom position for the toolbar? I would like to have it visible at all times and inside my component instead of top of the page.

Problems with powers inside LaTeX editor

Here are a few examples of the issues which I've found with rendering powers written incorrectly in LaTeX

image

It seems to me like it's trying to automatically fix the syntax, but that only happens when re-entering the editor instead of right away when exiting which causes the rendering to change. This shouldn't cause any huge problems, but it could cause some small annoyances.

Mhchem not rendering in preview but works otherwise

When using mhchem with \ce, the result does not render on the preview view. Like here:
image
But it does render after closing the field:
image

Also, \ce should probably have a shortcut in the top bar if this issue is fixed.

The demo is broken.

The index.html file has an invalid link to the mathquill.css file. This is causing the math editor to not display one's text in the text box while writing it in the "Lisää kaava"-section.

Unwelcome automatic changing of LaTeX code

When writing custom LaTeX in the editor, some of it is not supported by MathQuill (the wysiwyg-editor), but is supported by the final renderer. This is fine, and I can use all the functionality. However, when reopening the equation for editing, all raw LaTeX is reinterpreted and a lot of code that isn't supported by MathQuill changes.

Example

I write some LaTeX that isn't quite supported by MathQuill:
Step 1

Exit the editor and it displays fine:
Step 2

But, when reopening the editor, the code has changed:
Step 3

And finally, closing the editor again, the final render has changed.
Step 4

The same kind of behaviour can be observed with many other features as well, such as symbol names changing to their aliases (not a deal-breaker necessarily), or writing "minimum" and not wanting it to be changed to "\min imum".

Pasting formulas not working

When you clone this repository and try to copy paste math from https://cheat.abitti.fi/ it doesn't work as in the https://math-demo.abitti.fi/ I would need more information how the serverside rendering should be implemented in order to get it working like in the official versions. Ticket is related to my earlier ticket: #156 Could you provide more information how to get the copy paste working on localhost?

Copying formulas between different editor implementations

With a setup of multiple editor implementations copying and pasting formulas from one editor to another does not work.

The editor has no standard way of storing its formula data. Some implementations store the svg formula data statically in the html as base64. In the static implementation there is no server handling the conversion. In dynamic implementations the svg image is stored as a link src="/math.svg?latex=x" which the server resolves. The lack of standardization causes the following formula copying issues.

Dynamic to static:

Formulas cannot be copied from dynamic implementations to static implementations, since the dynamic implementations only work with a server resolving the svg images.
To fix this, the 2 methods of implementations should be clearly separated. The data coming from a different editor type could be parsed when the paste event happens to convert it to a format which the paste target expects.

Static to dynamic:

This theoretically works, but the lack of standards still causes issues. Dynamic editors expect dynamic data when saving the answer. A conversion of the data when pasting would guarantee compatibility.

Dynamic to dynamic:

Copying a formula between 2 dynamic implementations does not work, because the image src in the paste data references the url it was copied from. This one is easier to fix, the paste event handler just needs to parse the incoming data and remove the base url references.
Fix for this part: #422

To achieve compatibility between different implementation types the paste event handler needs to convert the data into what the editor expects. This would require a config for the editor, where the type of implementation is defined.

Static version

Hi

I'm exploring whether it would be feasible to use the Abitti editor in an e-learning system. We already have exercises where students type into a textarea element but that's rather horrible. The easiest way to utilize the editor would be to compile the whole thing into a static site without the Node server. This would, of course, drop out the upload functionality, but whatever.

From my five-minute testing it seems that once you fire up the editor, the only realtime connections are required for the math.svg in order to render something nice on the screen.

Question: when this architecture was chosen, was it investigated whether this whole thing https://github.com/digabi/rich-text-editor/blob/master/server/mathSvg.js could be done on the client without any additional HTTP requests? It should be a matter of finding Latex SVG libraries or something like that, the SVG construction is a trivial thing in itself.

If the SVG rendering could be done in the client AND if I'm not missing something critical, I think it would not be too big a hurdle to build a static version which one could use by just including necessary CSS, JS, and font files and putting some <div id="editor-here"> in their own templates.

Please note I really haven't dug deep here. Just some ideas, I could be missing a lot.

Thanks a lot!

guideline on using this library

NOT AN ISSUEI have been trying to use this library in Angular/Ionic project to no avail, kindly provide a guideline or documentation on how to use this library
PS Thanks for such a nice library

No "TAB" character

I am using the digabi editor for school and I want to use the TAB charcter like there is in for example MS Word and other text editors.

Editor "corrects" some changes I make in the LaTeX code section that I don't want corrected

\begin{array}{l|c|r}
abcde&ab&ab\
\hline
&&abcd\
\hline
ab&abcde&
\end{array}

If I input this and click outside the editor so it closes, it correctly displays the second \hline and the text alignment changes stated in {l|c|r}, but when I click back on the text to continue editing it, the {l|c|r} is replaced with {l|l} and the second \hline is gone, returning it to the default array state. It could be useful if this was optional.

Pasting inside \text{} inserts js code as a string

Peek 2021-12-18 21-06

Pasting the text results in javascript code to be inserted as a string instead of the clipboard contents.
The weird looking image result is working, it's trying to write that entire text block on one line which results in a 28030 px wide image

Stepping inside \mathbb breaks things

Within formulas \mathbb{} is used to display the characters ℤℝℕℚ

The problem is this can be accidentally stepped into:
Peek 2022-01-21 20-45

Writing inside mathbb doesn't seem to be intended - or at least wasn't tested properly.
Stepping inside it should probably just be disabled entirely.

Here are some of the issues I quickly found

Peek 2022-01-21 20-50
The behavior above happens with (), [], {}, | |,

It erases latex brackets, which breaks half of the formulas
Peek 2022-01-21 20-56

\lim, upper index and lower index multiply on interaction:
Peek 2022-01-21 21-01

Extending formula doesn't render correctly

Extending formula renders wrong.

Latex: ^{X\text{)}}\frac{X}{X}

Matikkaeditori - Google Chrome_042

As you can see the x) renders almost in the middle of the formula. Should be on top like where it is when typing the code.

Inconsistent behaviour with placement of new formulas

New formula with enter

Starting a formula (and writing any content) and ending it with enter should place the formula (where it would be placed with any formula exit method) and start a new formula, which if finished, will be positioned after the previous formula and 1 newline.

This behaviour gets inconsistent in the following situation:
Place a newline (and keep your caret at the start of the new line)
Write a formula (with content)
End this formula with enter

The inconsistent behaviour is that this will start the new formula after 2 newlines instead of 1.
Peek 2021-12-12 22-38
Keys pressed here: enter, ctrl+e, a, enter, b, esc

The new formula should be placed after 1 newline.

Issue with \deg(ree)

When typing \deg to the LaTex-field in the editor, the preview shows the degree symbol (°) correctly. But after you unfocus the LaTex field, it turns into plain text "deg". After activating the editor again, the LaTex is now \degree, the preview is again correct, but after unfocusing it the symbol/formula fails.

There is a shortcut button in the toolbar, but some students prefer typing it in LaTex.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.