
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@xyz/editor
Advanced tools
A Nuxt layer that provides a TinyMCE self-hosted editor component for rich text editing in Nuxt applications.
app.config.tsEditor (vanilla) and UEditor (Nuxt UI compatible)npm install @xyz/editor
The layer requires the following dependencies:
@tinymce/tinymce-vue - TinyMCE Vue componenttinymce - TinyMCE core library@nuxt/ui - For UEditor component (optional, only if using UEditor)Note: If you're using the UEditor component, you'll need to install @nuxt/ui which includes @nuxtjs/color-mode:
npm install @nuxt/ui
Then add it to your nuxt.config.ts:
export default defineNuxtConfig({
extends: ['@xyz/editor'],
modules: ['@nuxt/ui']
})
Add the layer to your nuxt.config.ts:
export default defineNuxtConfig({
extends: ['@xyz/editor']
})
<template>
<div>
<h1>My Rich Text Editor</h1>
<Editor v-model="content" />
</div>
</template>
<script setup>
const content = ref('<p>Start typing here...</p>')
</script>
<template>
<div>
<h1>My Nuxt UI Editor</h1>
<UEditor v-model="content" size="lg" />
</div>
</template>
<script setup>
const content = ref('<p>Start typing here...</p>')
</script>
Note: UEditor requires @nuxt/ui to be installed and configured in your nuxt.config.ts (includes @nuxtjs/color-mode).
| Feature | Editor.vue | UEditor.vue |
|---|---|---|
| Theme System | Custom theme state | Nuxt UI useColorMode() |
| Styling | Custom CSS variables | Nuxt UI design tokens |
| Props | init, autoTheme | init, size, disabled, placeholder |
| Theme Detection | Manual page detection | Automatic Nuxt UI sync |
| Dependencies | None | Requires @nuxt/ui (includes color-mode) |
| Use Case | General purpose | Nuxt UI applications |
Both editors include a built-in theme switcher button in the toolbar:
You can customize the editor configuration in your app.config.ts using standard TinyMCE options:
export default defineAppConfig({
editor: {
// CDN Configuration (Layer-specific)
cdn: {
scriptUrl: 'https://your-cdn.com/tinymce/tinymce.min.js',
baseUrl: 'https://your-cdn.com/tinymce'
},
// Standard TinyMCE Configuration (fully compatible)
height: 500,
menubar: true,
toolbar_mode: 'wrap',
plugins: 'link image code',
editimage_cors_hosts: ['your-domain.com'],
toolbar: 'undo redo | bold italic | alignleft aligncenter alignright',
// Any other TinyMCE options work here:
content_style: 'body { font-family: Arial, sans-serif; }',
setup: (editor) => {
// Custom setup logic
},
init_instance_callback: (editor) => {
// Custom initialization
},
// Layer-specific required configuration (always applied)
_required: {
branding: false
}
}
})
<template>
<Editor
v-model="content"
:init="customConfig"
:auto-theme="true"
/>
</template>
<script setup>
const content = ref('')
const customConfig = {
height: 300,
plugins: 'link image code',
toolbar: 'undo redo | bold italic | link image | code'
// Note: Theme switcher will be automatically appended to your toolbar
}
</script>
<template>
<UEditor
v-model="content"
:init="customConfig"
size="lg"
:disabled="false"
placeholder="Start writing your content..."
/>
</template>
<script setup>
const content = ref('')
const customConfig = {
height: 300,
plugins: 'link image code',
toolbar: 'undo redo | bold italic | link image | code'
// Note: Theme switcher will be automatically appended to your toolbar
}
</script>
Even when you provide a custom toolbar, the theme switcher is automatically added:
<template>
<Editor
v-model="content"
:init="{ toolbar: 'bold italic | link' }"
/>
</template>
<!-- Result: toolbar will be 'bold italic | link | theme-switcher' -->
The layer is fully compatible with TinyMCE's native configuration. You can use any standard TinyMCE option directly in your app.config.ts:
| Option | Type | Default | Description |
|---|---|---|---|
cdn.scriptUrl | string | 'https://cdn.xyz.dev/tinymce/tinymce.min.js' | TinyMCE script URL |
cdn.baseUrl | string | 'https://cdn.xyz.dev/tinymce' | Base URL for TinyMCE assets |
_required | object | { branding: false } | Required configuration (always applied) |
| Prop | Type | Default | Description |
|---|---|---|---|
init | Partial<RawEditorOptions> | undefined | Custom TinyMCE configuration |
autoTheme | boolean | true | Auto-detect and sync with page theme |
| Prop | Type | Default | Description |
|---|---|---|---|
init | Partial<RawEditorOptions> | undefined | Custom TinyMCE configuration |
size | 'sm' | 'md' | 'lg' | 'md' | Editor size (affects height) |
disabled | boolean | false | Disable the editor |
placeholder | string | 'Start typing...' | Placeholder text |
All standard TinyMCE configuration options are supported. Here are some common ones:
| Option | Type | Default | Description |
|---|---|---|---|
height | number | 400 | Editor height in pixels |
menubar | boolean | false | Show menubar |
toolbar_mode | string | 'floating' | Toolbar display mode |
plugins | string | See below | Enabled plugins (comma-separated) |
toolbar | string | See below | Toolbar items |
editimage_cors_hosts | string[] | ['picsum.photos'] | CORS hosts for image editing |
content_style | string | - | Custom CSS for editor content |
setup | function | - | Setup callback function |
init_instance_callback | function | - | Initialization callback |
Note: You can use any TinyMCE configuration option. The layer only adds CDN management, required settings, and the theme switcher on top of the standard TinyMCE API.
The editor supports both light and dark themes with automatic switching:
oxide (light)default/content.min.cssoxide-dark (dark)dark/content.min.cssYou can integrate the theme switcher with your app's theme system:
<script setup>
// Sync with your app's theme
const appTheme = useAppConfig().theme // or your theme system
const editorTheme = computed(() => appTheme.value === 'dark' ? 'dark' : 'light')
</script>
{
height: 400,
menubar: false,
toolbar_mode: 'floating',
plugins: 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons accordion',
editimage_cors_hosts: ['picsum.photos'],
toolbar: "undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl"
}
The editor components are optimized for performance with several key features:
Make sure to install the dependencies:
pnpm install
The .playground directory helps you test your layer during development:
pnpm dev
This will start the development server with your layer loaded.
To publish your layer to NPM:
npm publish --access public
MIT
FAQs
TinyMCE self-hosted editor as a Nuxt Layer
We found that @xyz/editor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.