Implement a dedicated Neo.component.Markdown component to encapsulate Markdown rendering logic and styling, promoting reuse and consistency across LivePreview and ContentComponent.
Scope:
Create src/component/Markdown.mjs:
- Config:
ntype: 'markdown', reactive value_ (markdown string).
- Logic: Uses
MarkdownRenderer internally. When value changes, delegates rendering to the renderer.
- Lifecycle: Delegates
destroy() to renderer.destroyComponents().
- Styling: Move styles from
ContentComponent.scss to a new src/component/Markdown.scss (or similar shared location) and apply them here.
Refactor LivePreview.mjs:
- When
language is 'markdown', instantiate Neo.component.Markdown inside the preview container instead of using the renderer directly on the container.
- Bind the editor value to the markdown component's
value.
Refactor ContentComponent.mjs:
- Extend
Neo.component.Markdown instead of Neo.component.Base.
- Inherit the rendering and styling logic.
- Retain specific Portal logic (fetching, routing, intersection observer).
Goal:
Decouple styling from the view and logic from the renderer, creating a self-contained Markdown component that can be used anywhere (e.g., LivePreview, Dashboards).
Note: This ticket focuses on the component creation and integration. Consolidating logic from MarkdownRenderer into the component itself is out of scope for this task and will be considered later.
Implement a dedicated
Neo.component.Markdowncomponent to encapsulate Markdown rendering logic and styling, promoting reuse and consistency acrossLivePreviewandContentComponent.Scope:
Create
src/component/Markdown.mjs:ntype: 'markdown', reactivevalue_(markdown string).MarkdownRendererinternally. Whenvaluechanges, delegates rendering to the renderer.destroy()torenderer.destroyComponents().ContentComponent.scssto a newsrc/component/Markdown.scss(or similar shared location) and apply them here.Refactor
LivePreview.mjs:languageis'markdown', instantiateNeo.component.Markdowninside the preview container instead of using the renderer directly on the container.value.Refactor
ContentComponent.mjs:Neo.component.Markdowninstead ofNeo.component.Base.Goal: Decouple styling from the view and logic from the renderer, creating a self-contained Markdown component that can be used anywhere (e.g., LivePreview, Dashboards).
Note: This ticket focuses on the component creation and integration. Consolidating logic from
MarkdownRendererinto the component itself is out of scope for this task and will be considered later.