Draft-js saving and displaying HTML [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm wondering if anyone came up with any tutorial / walk through for Draft-js to simply save editor state and display it as html to the user. I've been searching and trying and still unable to display html. It seems like most are just saving the editor state and reloading it into the editor instead of displaying it as html.
It seems like most go with convertFromRaw and convertToRaw, but the amount of steps included in that seems like there are quite a few steps that should be simplified, and the example here: https://draftjs.org/docs/api-reference-data-conversion.html#content seems like it's only used to place the content back in the editor later.
Maybe I'm not even looking at the right tool - I simply want an editor to save formatted text and display it. I'm not sure why the resources are so hard to find, or if I'm just looking in the wrong spots (seems like there are too many packages for Draft-js with not much documentation and examples IMO). However, I'm sure this must not be hard to accomplish.

Draftjs is concentrating on displaying rich text within an editor. However, if you want to display the corresponding HTML you have to use an external package called draftjs-export-html.
import {stateToHTML} from 'draft-js-export-html';
you can get the html using let html = stateToHTML(editorState.getCurrentContent(), options); this will do the basic formatting of styles like bold, italic etc. You can also pass your own styling preferences of your draftjs entites using the option parameter.
https://www.npmjs.com/package/draft-js-export-html

Related

Is there any free library that I can use to make tree view structure in react JS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 months ago.
Improve this question
I want to make a tree view structure in React JS. I already use the package "goJS" but I am facing some issues in it. As the price of this package is very high so I can't purchase it.
The issue is that whenever I minimize the parent node it shifts to the left side and also I am unable to inspect the tree view.
I am also attaching the screenshot of my desired structure. Also I am performing some basic actions on each node and minimizing and expanding each node.
Can anybody please help out !
enter image description here
You can use MUI for your tree view structure.
https://mui.com/material-ui/react-tree-view/
Good luck.
At my job we implemented a similar view within our react front-end app using #visx/hierarchy, which is based on d3-hierarchy. I suggest you check the examples, they have some similar results than the image you linked, especially on the link types example.
Be aware that it's not an "out-of-the-box" solution, it'll require some work to obtain the exact result you want but the library will make it easier to compute the various nodes positions in a hierarchical layout.

How to describe this application behaviors? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I would like to find a js library that allow me to do similar things as same as gmail:
They got a textarea, when you typing it, it search things and provide a list of contract list for you to choose from, when you tab it, it becomes a separate element, you can delete it by pressing the X. I know it is not come with textarea, or standard html element, how can I describe / search related lib on the web? Any keywords ideas?
stackexchange tags and Pinterest filters work similarly.
I did a google search with
"tags interface" filter
I searched both normal and images.
The images quickly allow you to focus in on an interface.
For example, the jQuery plugin Bootstrap Tags Input jumped out.
A further search on the following brought up more google images which seem right on.
"Tags Input"
I suggest this is better suited for the UX - User Experience StackExchange site. There is one discussion I found here
Good luck. I will likely write something myself in the not too distant future. It is a user friendly interface.

wiris plugin is working in tinymce on equation save [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I'm using wiris plugin to enter equation. However, when i save the editor and refresh the page the equation is replaced with plain text. Anyone else having this issue? any other equation plugin for tiniMCE?
Please review the installation instructions at http://www.wiris.com/plugins/docs/tinymce. Are you using the plugin in any specific CMS? Please note that we have specific instructions for some CMS like Joomla or Wordpress. In any case, we believe that you have skipped step 5 of the documentation. WIRIS formulas, from plugin version 3.50.x, are stored in the database as MathML. You need to include WIRISplugin.js, as detailed on step 5 of the general TinyMCE plugin documentation, in order to convert MathML to formula images. You can check more details at http://www.wiris.com/en/plugins/docs/full-mathml-mode.

Code colors in Html using CSS or javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have a website and I teach Java on it.
I know html and css if it helps..
I have lectures in my site and in my lectures there are descriptions: in the description I write code sometimes so I made a class for code so everytime I type code I do and it looks good, but not perfect.
I want to make specific words to be bold and in blue or pink color for example.
Is there a way to do it? maybe with javascript?
I know I can create a new class for special words and then to do for example but this will be too much job to write this span every time that it's not worth it.
So is there a way to do it maybe with html5 or js? Thank you.
edit: I use the usefedora.com platform so it's more difficult to do it, does somebody knows how to do it on usefedora's platform?
the thing you are searching for is a codemirror. There are many codemirrors but only one of them is called codemirror.
Code Mirror
There are also solutions that don't require you to write any javascript, using web components.
Prism.js
Here is one that's insanely trivial to use
There are plenty of code to html converters which do syntax highlighting if that's what your looking for e.g.
http://tohtml.com/java/
or
http://hilite.me/
You can take this HTML and use it on your site.
You can also download a jQuery plugin. SyntaxHighlighter is very popular.
The way they work is that you copy the files to your website, and then you just put your code into a tag, and the plugin automatically beautifies your code.
I would recommend choosing one of these libraries- PrismJS, Highlight.js, or Rainbow.
Each is designed for exactly this purpose. You just put your code into the web page, inside an HTML5 code tag decorated with the language name. They will automatically format your code with the necessary markup to attach color styles to. No need for any external tools. The first two provide their own styles as well, the last assumes you'll write your own.

Need a tiny, light html editor for web [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
As the title says, I am searching a very tiny rich text editor. Every editor I've seen is big and has too many features. All I need is buttons to make text bold, italic, set the font of text, set the style to a paragraph or a heading and to add/edit links. I won't have a big library for that.
I think I will need to change it a bit. I have to integrate an image upload (already existing) as a feature to add and resize images in the content.
Thank's in advance.
Check out:
TinyEditor
TinyEditor is a simple JavaScript WYSIWYG editor that is both
lightweight (8KB) and standalone. It can easily be customized to
integrate with any website through CSS and the multitude of
parameters. It handles most of the basic formatting needs and has some
functionality built in to help keep the rendered markup as clean as
possible.
If you using bootstrap. Consider to use summernote.
Super Simple WYSIWYG Editor on Bootstrap.
http://summernote.org
It depends on what you're looking for. Do you need WYSIWYG? If not, I've had success using markitup:
http://markitup.jaysalvat.com/home/
Did you look at TinyMCE?
If you're using bootstrap try Bootstrap-WYSIWYG
How about bootstrap-editor?
It's simple and beautiful. It extends bootstrap-wysihtml5 with file-uploading feature (by using jQuery-File-Upload).

Categories