Facebook opened the code for Lexical, a library for creating text editors

Facebook (banned in the Russian Federation) has opened the source code for the Lexical JavaScript library, which offers components for creating text editors and advanced text editing web forms for websites and web applications. The distinguishing qualities of the library are ease of integration into sites, compact design, modularity and support for tools for people with disabilities, such as screen readers. The code is written in JavaScript and distributed under the MIT license. To get acquainted with the possibilities of the library, several interactive demonstrations have been prepared.

The library is designed to be easy to plug in and doesn't depend on external web frameworks, while providing out-of-the-box bindings for easy integration with the React framework. To use Lexical, it is enough to bind an editor instance to the element being edited, after which, during editing, you can control the state of the editor through event and command processing. The library allows you to track the states of the editor at any time and reflect changes in the DOM based on the calculation of the differences between the states.

It is possible to create both forms for entering plain text without markup, as well as building interfaces for visual editing of documents that resemble word processors and provide features such as inserting tables, images and lists, manipulating fonts, and controlling text alignment. The developer has the ability to override the behavior of the editor or connect handlers to implement atypical functionality.

The basic framework of the library contains the minimum required set of components, the functionality of which is extended through the connection of plugins. For example, through plugins, you can connect additional interface elements, panels, tools for visual editing in WYSIWYG mode, support for the markdown format, or components for working with certain types of content, such as lists and tables. In the form of plugins, such functions as input auto-completion, limiting the maximum size of input data, opening and saving files, attaching notes / comments, voice input, etc. are also available.

Source: opennet.ru

Add a comment