Skip to content

Refactor triggering events in the Content Editor

Enrique Alcántara requested to merge refactor-event-bus-content-editor into master

What does this MR do and why?

This is a refactoring MR for the Content Editor. It refactors the modules used to emit events in the Content Editor. The Content Editor emits custom events for two purposes:

  • Signaling the different stages of loading Content into the editor
  • Signal important events that are displayed as an alert to the user.

The Content Editor emits custom events using two objects: The Titap Editor class and an event hub object. The purpose of this refactoring is centralizing all custom events in a single place: The event hub.

graph TD
    A[ContentEditor.js] -->|emits events| D
    B[Attachment ext] --> |emits events| D
    C[PasteMarkdown ext] --> |emits events| D
    D(Event hub) --> |sends events| E[EditorStateObserver]

Why is this refactoring valuable?

This MR is groundwork needed to implement Pasting Markdown Source in the Content Editor: #337145 (closed). We need to emit custom events to display a loading indicator when the Content Editor is parsing/rendering the Markdown pasted by the user.

We want to centralize all events that display a loading indicator in the event hub.

Screenshots or screen recordings

This MR doesn’t introduce user-facing changes

How to set up and validate locally

This MR doesn’t introduce user-facing changes

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Enrique Alcántara

Merge request reports

Loading