directus-extension-mdc-editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # 🧩 MDC Editor for Directus
2
+
3
+ > [!CAUTION]
4
+ > ### 🚨 Beware: Early Development
5
+ > This extension is in active, early development. **Breaking changes can happen at any moment.** Use with caution in production environments and always back up your component definitions.
6
+
7
+ ---
8
+
9
+ A hybrid **TipTap + Monaco** editor designed for content creators who need the comfort of a visual editor but the precision (and portability) of raw Markdown.
10
+
11
+ ## 🤖 Why this editor? (The AI-Refinement Workflow)
12
+
13
+ If you use AI to help write or refine your blog posts, you know the frustration: copy-pasting from a standard visual editor into ChatGPT or Claude often strips your headers, breaks your links, and ruins your formatting.
14
+
15
+ **This editor is built to solve that:**
16
+ - **Visual Drafting:** Use the TipTap-powered visual mode for a seamless writing experience.
17
+ - **Markdown Integrity:** Unlike standard TipTap setups, this editor doesn't just "export" HTML. It manages a real **MDC Markdown** AST.
18
+ - **The Raw Toggle:** Switch to the **Raw Mode** (powered by Monaco) to get a perfect Markdown string.
19
+ - **AI Round-tripping:** Copy the raw Markdown into your AI chatbot. When the AI gives you an improved version, paste it straight back into the Raw window. Toggle back to Visual, and your formatting remains perfectly intact.
20
+
21
+ ---
22
+
23
+ ## ✨ Features
24
+
25
+ - **Hybrid Toggling:** Seamlessly switch between Visual (TipTap) and Raw (Monaco) modes.
26
+ - **MDC Native:** Full support for Nuxt MDC syntax (`::block-component` and `:inline-component`).
27
+ - **Slash Commands:** Type `/` to insert headings, tables, code blocks, or custom components.
28
+ - **Component Manager:** Define your custom UI components (Alerts, Cards, Badges) via a dedicated Directus collection (`mdc_components`) created automatically on install.
29
+ - **Directus Asset Integration:** Select images and files from your Directus Library with native focal point and transformation support.
30
+ - **Variables & Bindings:** Support for dynamic data via `{{ variable || default }}`.
31
+
32
+ ---
33
+
34
+ ## 🚀 Installation
35
+
36
+ **This extension is intended to be installed only via the Directus Marketplace.**
37
+
38
+ 1. Inside your Directus Admin project, go to **Settings > Marketplace**.
39
+ 2. Search for `mdc-editor`.
40
+ 3. Click **Install**.
41
+
42
+ *Note: Upon installation, a system hook will automatically create the `mdc_components` collection. You may need to refresh your browser to see it.*
43
+
44
+ ---
45
+
46
+ ## 🛠 Configuration
47
+
48
+ After installation, select **MDC Editor** as the interface for any "Text" or "Markdown" field.
49
+
50
+ - **Monaco Theme:** Set the code editor to follow Directus's theme or use standard Monaco colors.
51
+ - **Syntax Highlighting:** Choose the Shiki theme used for rendering code blocks.
52
+ - **Output Preferences:** Configure whether images, videos, and files should be saved as standard Markdown syntax or as MDC components (e.g., `<nuxt-img>`).
53
+
54
+ ---
55
+
56
+ ## 🎨 Nuxt Integration
57
+
58
+ The editor saves **clean MDC Markdown** to your database. It is designed to be paired with the `@nuxtjs/mdc` module on your frontend.
59
+
60
+ ```vue
61
+ <template>
62
+ <!-- Content from Directus is rendered natively as Nuxt Components -->
63
+ <MDC :value="post.content" />
64
+ </template>
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 📝 MDC Syntax Examples
70
+
71
+ **Block Component:**
72
+ ```markdown
73
+ ::alert{type="success"}
74
+ The AI successfully refined this post!
75
+ ::
76
+ ```
77
+
78
+ **Inline Component:**
79
+ ```markdown
80
+ Check out this :icon{name="heroicons:sparkles"} feature.
81
+ ```
82
+
83
+ **Variable Binding:**
84
+ ```markdown
85
+ Hello {{ first_name || "Writer" }}!
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 🙏 Credits
91
+
92
+ This project builds upon the excellent work from [Nuxt Studio](https://github.com/nuxt-content/nuxt-studio) by the Nuxt Content team. Significant portions of the TipTap editor integration and MDC parsing logic were adapted from their open-source codebase.
93
+
94
+
95
+ ---
96
+
97
+ ## 📄 License
98
+ MIT License - Copyright (c) Lupinum 2026