-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction to the Serlo Editor
The Serlo editor is a tool to create content with different content types, such as an article with images and exercises. Within the Serlo environment it is embedded in the frontend and communicates through the API with the database where the content is stored. The editor consists of stand-alone plugins for the different content types and a store to implement the undo-redo logic and to keep the editor state.
The editor is built using TypeScript
and React
. The text plugin relies on the rich-text library SlateJS
. For the store redux and redux-saga is used.
For introductory material for TypeScript and React, consult our documentation.
We use the redux
library to save the state of the editor. Redux allows us to create a store for this purpose and dispatch actions to the store when changes arise in the editor. However, the limitation of redux is that it can implement pure actions, i.e. actions with no side effects. Application side effects like changes in a database cannot be implemented using Redux. This is why we use redux-saga which can also handle impure actions. We recommend to start the topic of state storage by reading through the redux documentation and then moving on to redux-saga and particularly the concepts of generators and put, call etc. For a more high-level introduction to the saga pattern, have a look at this talk.
SlateJS
is a library for rich-text editing which is key to the text plugin of the editor. To get a first idea, we recommend the walkthroughs in their documentation. To see how we use slate in the Serlo editor, have a look at these slides.
See the Frontend Readme for setting up your local environment.
Within the Serlo infrastructure, the editor is embedded in the frontend. To learn more about the Serlo infrastructure, have a look at this documentation.
Redux-devtools
is a tool that allows developers to trace all the actions dispatched to the store, inspect the payload, undo and redo the actions to get a better understanding of the redux process. To set it up, replace composeEnhancers here by
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
Additionally, switch the trace function on to select an action in the history and see the callstack that triggered it:
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
traceLimit: 25,
}) || compose
Furthermore, install the browser extension (for Firefox).
When you then open the storybook using yarn start, you can open the Redux Devtools panel by right-clicking and selecting Redux Devtools -> Open in a panel
. Now any change you make in the storybook will be traced in the panel.
- Home
- Serlo Infrastructure
- Serlo Infrastructure for Non programmers
- Resources for new programmers
- Setup of the toolchain
- Best Practices
- Data Privacy for Devs
- How Tos
- Single Sign On
- Integration with the Data Wallet
- User Journey
- Integration of "Datenraum" into the Serlo Editor
- Introduction to the Serlo editor
- Core concepts of the Serlo editor
- Packages of the Serlo editor
- Creating a new plugin (outdated)
- Redux process in the Serlo editor
- The content format of the Serlo editor
- Serlo Editor Plugin Initial State
- How the Serlo Editor is integrated into edu-sharing via LTI
- Learner Events and xAPI