I want to test out various implementations of the rich text editor. The Lexical Rich Text Editor has more uses than just being used in the article builder, it also can be used for comments or inputs that require more than just plain text. The rich text editor will be used fo render comments, render various things for the poll implementation.
I am using this page to test out the various implementations, figure out wha capabilities I want each of the implementations to have, to figure out how they will be rendered, and to
Below, you can test out the various lexical implementations. You can read about / test what their capabilities are and the click the SUBMIT button to submit the
form and see how that version of the lexical implementation is rendered.
This class is used often when registering listeners on the lexical editor. The class can be used on the same <div> element has the <div> element that has the [data-rich-text-editor] attribute - and this is how it should be when you are just rendering the editor (not editing). There is no styling directly related to this class, but there are styles related to the elements related to the class.
[data-rich-text-editor]
The JavaScript searches for div[data-rich-text-editor] elements when looking for editors to register.
[data-type]
Tells the JavaScript which kind of editor to register.
Here is a list of different types:
full: The type that should be with articles. Includes all nodes.
comment: The type that should be used with comments. Restricts some types of nodes.
text-only: The type that you should include when you only want the user to insert text and paragraph nodes.
text-with-links: The type that you should include when you only want the user to insert text, link, and paragraph nodes.
text-block-elements: The type that you should include when you only want the user to insert text, link, paragraph, blockquote, list, code, math, and table nodes.
The elements below might be removed.
article: Initially used for article nodes. Should be removed by now and replaced with
poll-question: Currently used for poll questions. Will probably be replaced with a customized comment node.
poll-short-blog: Currently used for polls. Will probably be replaced with comment editors.
poll-option: Currently used for polls. Will probably be replaced with comment editors.
range-description: Currently used for polls. Will probably be replaced with comment editors.
[data-editable]
This optional attribute can be set to true or false. When set to false, then the editable state of the editor is immediately set to false.
[data-no-color]
This optional attribute, when included, tells the JavaScript to not allow the user to change the background-color or text-color of anything in the editor.
[data-char-min-length]
This optional attribute tells the user what the minimum length of the text inside the editor should be.
[data-char-max-length]
This optional attribute tells the user what the maximum length of the text inside the editor should be.
[data-max-restrictions]
This optional attribute tells the user how many nodes of certain types are allowed in the editor.
The comment implementation of the rich text editor is used to allow users to create comments for articles, polls, or other entities.
The comment implementation should not include heading nodes or section heading nodes because that might introduce semantically incorrect HTML - unless you wrap each comment in an <article> tag.
The comment implementation should be implemented with a min/max length character counter, you should constrain the size of images on the server, and you should be able to constrain how many of certain types of nodes are inserted into the Lexical editor, i.e. one image node OR one video node OR one table.
There might need to be a type of node created so that you can constrain the height of the node on initial rendering. Like a hide/show node that can be used to limit the initial height of long comments. This would need to be added to the editor on the server.
The text only implementation of the rich text editor should be used in places where you want the user to create something more customizable than
what is allowed with just a <textarea>.
The text only implementation should come in versions that allow users to change the background color / text color of the text and change the style of the paragraph and versions that do not allow the user to change colors / styles of the paragraph.
You will need to change the implementation of the floating action toolbar to prevent the users from inserting links and from inserting
The text with links lexical implementation of the rich text editor should be used in places where you want the user to embed links in an input. It should be basically like
the text only implementation, except that it should also allow for links.
Are you sure you want to delete this article section? You can not undo this change.
Add a Comment
Annotate Article
Share Article
Successfully copied article URL to clipboard!
Something went wrong copying the article URL to the clipboard.
Successfully copied editor state to clipboard!
Successfully copied URL to clipboard!
Copied code to clipboard.
Copied TeX code to clipboard.
Uploaded file must be an image of type .jpeg, .jpg, .png, .webp, .gif, .bmp, or .svg.
Image Size must be less than 5MB.
Uploaded file must be an image of type jpeg, jpg, png, webp, avif, tiff, or svg.
Something went wrong uploading the image to the database. Try reloading the page.
The maximum number of images you can upload is 30.
There was an error taking an image using the device's camera. Try uploading an image instead.
Uploaded file must be an audio file.
Audio file must be an audio file of type .m4a, .flac, .mp3, .mp4, .wav, .wma, .aac, .webm, or .mpeg.
Audio file must be less than 300 MB in size.
Something went wrong uploading the audio file. Try reloading the page.
The maximum number of audio files you can upload is 10.
There was an error capturing an audio recording using the device's microphone. Try uploading an audio recording or video instead.
Uploaded file must be an video file.
Video file must be an audio file of type .mp4, .mov, .avi, .wmv, .avchd, .webm, or .flv.
Video file must be less than 300 MB in size.
Something went wrong uploading the video file. Try reloading the page.
The maximum number of video files you can upload is 10.
There was an error taking a video using the device's camera / microphone. Try uploading a video instead.
Comment Implementation
The comment implementation of the rich text editor is used to allow users to create comments for articles, polls, or other entities.
The comment implementation should not include heading nodes or section heading nodes because that might introduce semantically incorrect HTML - unless you wrap each comment in an
<article>
tag.The comment implementation should be implemented with a min/max length character counter, you should constrain the size of images on the server, and you should be able to constrain how many of certain types of nodes are inserted into the Lexical editor, i.e. one image node OR one video node OR one table.
There might need to be a type of node created so that you can constrain the height of the node on initial rendering. Like a hide/show node that can be used to limit the initial height of long comments. This would need to be added to the editor on the server.
Input
Output