feat: Implement in-place MText editor with formatting toolbar and live preview

- Added SVG icons for text formatting options (bold, italic, underline, overline, strike, uppercase, lowercase).
- Introduced a new `MTextEditorState` struct to manage the state of the MText editor.
- Implemented functionality to open the MText editor from the command line and edit existing MText entities.
- Added message handling for various MText editor actions (formatting, height, style, font, justification, alignment, line spacing).
- Created a dedicated preview area for MText rendering within the editor.
- Updated the command structure to support opening the MText editor and handling text input.
- Refactored existing MText command logic to integrate with the new editor.
This commit is contained in:
Hakan Seven 2026-05-30 23:24:06 +03:00
commit de08bd598c
20 changed files with 871 additions and 36 deletions

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round">
<line x1="4" y1="6" x2="20" y2="6"/>
<line x1="7" y1="11" x2="17" y2="11"/>
<line x1="5" y1="16" x2="19" y2="16"/>
<line x1="8" y1="21" x2="16" y2="21"/>
</svg>

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round">
<line x1="4" y1="6" x2="20" y2="6"/>
<line x1="4" y1="11" x2="20" y2="11"/>
<line x1="4" y1="16" x2="20" y2="16"/>
<line x1="4" y1="21" x2="20" y2="21"/>
</svg>

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round">
<line x1="4" y1="6" x2="20" y2="6"/>
<line x1="4" y1="11" x2="14" y2="11"/>
<line x1="4" y1="16" x2="18" y2="16"/>
<line x1="4" y1="21" x2="12" y2="21"/>
</svg>

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round">
<line x1="4" y1="6" x2="20" y2="6"/>
<line x1="10" y1="11" x2="20" y2="11"/>
<line x1="6" y1="16" x2="20" y2="16"/>
<line x1="12" y1="21" x2="20" y2="21"/>
</svg>

After

Width:  |  Height:  |  Size: 324 B

3
assets/icons/mt_bold.svg Normal file
View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path d="M8 5 h5 a3 3 0 0 1 0 6 h-5 z M8 11 h6 a3.2 3.2 0 0 1 0 6.4 h-6 z" fill="#e0e0e0"/>
</svg>

After

Width:  |  Height:  |  Size: 185 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e06c6c" stroke-width="2.5" stroke-linecap="round">
<line x1="6" y1="6" x2="18" y2="18"/>
<line x1="18" y1="6" x2="6" y2="18"/>
</svg>

After

Width:  |  Height:  |  Size: 242 B

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round">
<line x1="10" y1="5" x2="17" y2="5"/>
<line x1="7" y1="19" x2="14" y2="19"/>
<line x1="14" y1="5" x2="10" y2="19"/>
</svg>

After

Width:  |  Height:  |  Size: 282 B

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="7" cy="14" r="3.2"/>
<line x1="10.2" y1="11" x2="10.2" y2="17.2"/>
<circle cx="16.5" cy="14" r="3.2"/>
<line x1="19.7" y1="11" x2="19.7" y2="17.2"/>
</svg>

After

Width:  |  Height:  |  Size: 353 B

3
assets/icons/mt_ok.svg Normal file
View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#4ccf6f" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 13 l4 4 l10 -11"/>
</svg>

After

Width:  |  Height:  |  Size: 219 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="6" y1="4" x2="18" y2="4"/>
<path d="M7 8 v6 a5 5 0 0 0 10 0 v-6"/>
</svg>

After

Width:  |  Height:  |  Size: 265 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M8 6 v4 a4 4 0 0 0 8 0 v-4"/>
<line x1="5" y1="13" x2="19" y2="13"/>
</svg>

After

Width:  |  Height:  |  Size: 266 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M7 5 v6 a5 5 0 0 0 10 0 v-6"/>
<line x1="6" y1="20" x2="18" y2="20"/>
</svg>

After

Width:  |  Height:  |  Size: 267 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M3 18 L7 6 L11 18 M4.3 14 H9.7"/>
<path d="M14 18 L17.5 8 L21 18 M15.1 14.7 H19.9"/>
</svg>

After

Width:  |  Height:  |  Size: 282 B