Skip to content

How It Works

minsusun edited this page Feb 20, 2024 · 1 revision

This is how 'Easy Markdown Editor' works:

image{width="614" height="487"}

The system is largely implemented in two types of observer patterns. (1) blocks notifies the blockManager, (2) blockManager notifies the MarkdownEditor. This structure helped to lower the degree of decoupling among objects.

This class diagram briefly shows the relationships among the actual classes.

image{width="653" height="516"}

  1. block is a basic class where we change markdown contents. They contain mdText, which is a raw text for .md file. Features are implemented for how blocks should be displayed as well as mouse activity listeners.

  2. SingleLineBlock and MultiLineBlock extends block, and they have different purposes to help convenient markdown usages.

    Because these two block types have different behaviors in terms of keyboard activities, SingleLineBlock and MultiLineBlock have different keyListeners. MultiLineBlock has additional field called type, which literally carries the type such as ordered/unordered list, quotes, checkbox, etc. Picture below elaborates which block type is responsible for the functions of markdown.

    image{width=410 height=238}

  3. blockManager has a linked list for the blocks, and blockEvent handling functions. blockManager also merges/seperates/type-casts blocks. You can see the types of blockEvent below.

    image{width="395" height="174"}

  4. markdownEditor handles the total system. This class loads the text in the beginning, and saves in the end. It also has role to update UI during the operation.

Clone this wiki locally