The Controller
The controller file 🕹, located inside of app/Http/Livewire/MarkdownX.php
, is the controller that handles the back-end logic for the editor. This includes updating the content preview, uploading images, handling GIF searches, and rendering the view.
This file is fairly well documented; however, there is one function that I want to point out. The updateContentPreview()
function:
public function updateContentPreview(){
$this->contentPreview = Str::markdown($this->content);
}
This is using the default Laravel Markdown string helper. Since markdown does not natively support some of the block items like GIPHY or Youtube, we will show you how to render these items when we talk about Liquid Tags. That means that function is the only part of the editor that you will/should edit.
We will elaborate more on the updatedContent()
function, when we learn about the Editor Events. But, for now, let's move on to talking about the editor view 🤓.