import { html, css } from '@design.estate/dees-element';
import '@design.estate/dees-wcctools/demotools';
export const demoFunc = () => html`
{
// Get editor instances
const programmaticEditor = elementArg.querySelector('#programmatic-demo') as any;
const articleEditor = elementArg.querySelector('#article-editor') as any;
const dragDemoEditor = elementArg.querySelector('#drag-demo') as any;
// Programmatically set content for the article editor after render
if (articleEditor) {
const articleBlocks = [
{
id: 'intro-heading-' + Date.now(),
type: 'heading-2' as const,
content: 'Introduction'
},
{
id: 'intro-para-' + Date.now(),
type: 'paragraph' as const,
content: 'Modern web development has evolved significantly over the past decade. In this article, we\'ll explore the key technologies and best practices that define web development in 2024.'
},
{
id: 'tech-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'Key Technologies'
},
{
id: 'tech-list-' + Date.now(),
type: 'list' as const,
content: 'TypeScript - Type-safe JavaScript development\nWeb Components - Native component model\nES Modules - Modern module system',
metadata: { listType: 'ordered' }
},
{
id: 'start-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'Getting Started'
},
{
id: 'start-para-' + Date.now(),
type: 'paragraph' as const,
content: 'To begin building modern web applications, you\'ll need:'
},
{
id: 'req-list-' + Date.now(),
type: 'list' as const,
content: 'A solid understanding of JavaScript fundamentals\nFamiliarity with component-based architecture\nKnowledge of build tools and bundlers',
metadata: { listType: 'bullet' }
},
{
id: 'quote-' + Date.now(),
type: 'quote' as const,
content: 'The best way to predict the future is to invent it. - Alan Kay'
},
{
id: 'example-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'Code Example'
},
{
id: 'code-example-' + Date.now(),
type: 'code' as const,
content: 'class ModernWebApp extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: \'open\' });\n }\n \n connectedCallback() {\n this.render();\n }\n}'
},
{
id: 'divider-' + Date.now(),
type: 'divider' as const,
content: ' '
},
{
id: 'conclusion-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'Conclusion'
},
{
id: 'conclusion-para-' + Date.now(),
type: 'paragraph' as const,
content: 'Embracing modern web standards and tools enables developers to build faster, more maintainable applications.'
}
];
// Set the blocks instead of using .value with HTML
setTimeout(() => {
articleEditor.importBlocks(articleBlocks);
}, 500);
}
// Initialize drag demo editor with sample content
if (dragDemoEditor) {
const dragDemoBlocks = [
{
id: 'drag-title-' + Date.now(),
type: 'heading-1' as const,
content: 'Drag & Drop Demo'
},
{
id: 'drag-intro-' + Date.now(),
type: 'paragraph' as const,
content: 'This editor demonstrates drag and drop functionality. Try dragging these blocks around!'
},
{
id: 'drag-heading-' + Date.now(),
type: 'heading-2' as const,
content: 'How It Works'
},
{
id: 'drag-list-' + Date.now(),
type: 'list' as const,
content: 'Hover over any block to see the drag handle\nClick and hold the handle to start dragging\nDrag to reorder blocks\nRelease to drop in the new position',
metadata: { listType: 'ordered' }
},
{
id: 'drag-quote-' + Date.now(),
type: 'quote' as const,
content: 'The drag and drop feature makes it easy to reorganize your content without cutting and pasting.'
},
{
id: 'drag-code-' + Date.now(),
type: 'code' as const,
content: '// Example: The blocks can be reordered\nconst blocks = editor.exportBlocks();\n// Rearrange blocks array\neditor.importBlocks(blocks);'
},
{
id: 'drag-divider-' + Date.now(),
type: 'divider' as const,
content: ' '
},
{
id: 'drag-footer-' + Date.now(),
type: 'paragraph' as const,
content: 'Note: Divider blocks cannot be dragged, but other blocks can be moved around them.'
}
];
setTimeout(() => {
dragDemoEditor.importBlocks(dragDemoBlocks);
}, 600);
}
// Setup button handlers for programmatic demo
const generateReportBtn = elementArg.querySelector('#generate-report-btn');
const generateRecipeBtn = elementArg.querySelector('#generate-recipe-btn');
const clearEditorBtn = elementArg.querySelector('#clear-editor-btn');
if (generateReportBtn) {
generateReportBtn.addEventListener('click', () => {
const blocks = [
{
id: 'title-' + Date.now(),
type: 'heading-1' as const,
content: 'System Performance Report'
},
{
id: 'date-' + Date.now(),
type: 'paragraph' as const,
content: 'Generated on: ' + new Date().toLocaleString()
},
{
id: 'summary-heading-' + Date.now(),
type: 'heading-2' as const,
content: 'Executive Summary'
},
{
id: 'summary-' + Date.now(),
type: 'paragraph' as const,
content: 'This report provides an analysis of system performance metrics over the last 30 days.'
},
{
id: 'metrics-heading-' + Date.now(),
type: 'heading-2' as const,
content: 'Key Metrics'
},
{
id: 'metrics-list-' + Date.now(),
type: 'list' as const,
content: 'Average response time: 124ms\nUptime: 99.97%\nCPU utilization: 45%\nMemory usage: 2.3GB / 8GB',
metadata: { listType: 'bullet' }
},
{
id: 'analysis-heading-' + Date.now(),
type: 'heading-2' as const,
content: 'Performance Analysis'
},
{
id: 'analysis-quote-' + Date.now(),
type: 'quote' as const,
content: 'System performance remains within acceptable parameters with room for optimization in memory management.'
},
{
id: 'code-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'Sample Query Performance'
},
{
id: 'code-block-' + Date.now(),
type: 'code' as const,
content: 'SELECT AVG(response_time) as avg_time,\n COUNT(*) as total_requests,\n DATE(created_at) as date\nFROM performance_logs\nWHERE created_at >= NOW() - INTERVAL 30 DAY\nGROUP BY DATE(created_at)\nORDER BY date DESC;'
},
{
id: 'divider-' + Date.now(),
type: 'divider' as const,
content: ' '
},
{
id: 'footer-' + Date.now(),
type: 'paragraph' as const,
content: 'Report generated automatically by System Monitor v2.5.0'
}
];
programmaticEditor.importBlocks(blocks);
});
}
if (generateRecipeBtn) {
generateRecipeBtn.addEventListener('click', () => {
const blocks = [
{
id: 'recipe-title-' + Date.now(),
type: 'heading-1' as const,
content: 'Classic Margherita Pizza'
},
{
id: 'recipe-intro-' + Date.now(),
type: 'paragraph' as const,
content: 'A traditional Italian pizza with fresh basil, mozzarella, and tomato sauce.'
},
{
id: 'ingredients-heading-' + Date.now(),
type: 'heading-2' as const,
content: '🍕 Ingredients'
},
{
id: 'dough-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'For the Dough:'
},
{
id: 'dough-list-' + Date.now(),
type: 'list' as const,
content: '500g tipo "00" flour\n325ml warm water\n10g salt\n7g active dry yeast\n2 tbsp olive oil',
metadata: { listType: 'bullet' }
},
{
id: 'toppings-heading-' + Date.now(),
type: 'heading-3' as const,
content: 'For the Toppings:'
},
{
id: 'toppings-list-' + Date.now(),
type: 'list' as const,
content: '400g canned San Marzano tomatoes\n250g fresh mozzarella\nFresh basil leaves\nExtra virgin olive oil\nSalt and pepper to taste',
metadata: { listType: 'bullet' }
},
{
id: 'instructions-heading-' + Date.now(),
type: 'heading-2' as const,
content: '👨🍳 Instructions'
},
{
id: 'steps-list-' + Date.now(),
type: 'list' as const,
content: 'Dissolve yeast in warm water and let stand for 5 minutes\nMix flour and salt, create a well in center\nAdd yeast mixture and olive oil\nKnead for 10 minutes until smooth\nLet rise for 1-2 hours until doubled\nPunch down and divide into portions\nRoll out each portion to 12-inch circles\nTop with crushed tomatoes, mozzarella, and basil\nBake at 475°F (245°C) for 10-12 minutes',
metadata: { listType: 'ordered' }
},
{
id: 'tip-' + Date.now(),
type: 'quote' as const,
content: 'Pro tip: For an authentic taste, use a pizza stone and preheat it in the oven for at least 30 minutes before baking.'
},
{
id: 'divider-2-' + Date.now(),
type: 'divider' as const,
content: ' '
},
{
id: 'servings-' + Date.now(),
type: 'paragraph' as const,
content: 'Servings: 4 pizzas | Prep time: 2 hours | Cook time: 12 minutes'
}
];
programmaticEditor.importBlocks(blocks);
});
}
if (clearEditorBtn) {
clearEditorBtn.addEventListener('click', () => {
programmaticEditor.importBlocks([]);
});
}
}}>
A powerful block-based editor with slash commands, keyboard shortcuts, and multiple output formats. Perfect for content creation, blog posts, documentation, and more.
✓Slash commands (/)
✓Keyboard shortcuts
✓Block-based editing
✓Drag & drop reordering
✓HTML & Markdown output
✓Dark mode support
✓Mobile responsive
⌨️ Keyboard Shortcuts
/ Slash commands
# Heading 1
## Heading 2
### Heading 3
> Quote
\`\`\` Code block
* or - Bullet list
1. Numbered list
--- Divider
Perfect for creating rich content with multiple block types. The editor preserves formatting and provides a clean editing experience.
Welcome to Our Blog
This is an example blog post that demonstrates the capabilities of our WYSIWYG editor.
Features Overview
Our editor supports multiple block types including headings, paragraphs, quotes, and more.
The best way to predict the future is to invent it.
You can also create lists and code blocks for technical content.
'}
.outputFormat=${'html'}
>
Easily rearrange your content blocks by dragging them. Hover over any block to reveal the drag handle on the left side.
💡 Tips:
Hover over any block to see the drag handle (⋮⋮) on the left
Click and hold the drag handle to start dragging
Blue indicators show where the block will be dropped
Divider blocks cannot be dragged
The editor maintains focus on the moved block after dropping
Create comprehensive tutorials and documentation with code examples, lists, and structured content.
README.md\ngit add README.md\n```\n\n#### Committing Changes\n\n```bash\ngit commit -m "Initial commit"\n```\n\n> **Best Practice:** Write clear, descriptive commit messages that explain what changes were made and why.\n\n### 4. Working with Branches\n\nBranches allow you to work on features independently:\n\n```bash\n# Create and switch to a new branch\ngit checkout -b feature-branch\n\n# Make changes and commit\ngit add .\ngit commit -m "Add new feature"\n\n# Switch back to main\ngit checkout main\n\n# Merge the feature\ngit merge feature-branch\n```\n\n---\n\n## Common Commands Reference\n\n| Command | Description |\n|---------|-------------|\n| `git status` | Check repository status |\n| `git log` | View commit history |\n| `git diff` | Show changes |\n| `git pull` | Fetch and merge changes |\n| `git push` | Upload changes to remote |\n\n## Next Steps\n\n1. Learn about remote repositories\n2. Explore advanced Git features\n3. Practice with real projects\n4. Contribute to open source\n\n**Happy coding!** 🚀'}
>
Choose between HTML and Markdown output formats depending on your needs. Perfect for static site generators, documentation systems, or any content management workflow.
Q4 Planning Meeting
Date: December 15, 2024 Attendees: Product Team, Engineering, Design
Agenda Items'}>
Review Q3 achievements
Set Q4 objectives
Resource allocation
Timeline discussion
Key Decisions'}>
Launch new dashboard feature by end of January
Increase engineering team by 2 developers
Implement weekly design reviews
"Focus on user experience improvements based on Q3 feedback" - Product Manager
Action Items'}>
Sarah: Create detailed project timeline
Mike: Draft technical requirements
Lisa: Schedule user research sessions
Next meeting: January 5, 2025
'}
>
**Pro tip:** Room temperature ingredients mix better and create a more uniform dough.\n\n### Step 4: Add Wet Ingredients\n\nBeat in eggs one at a time, then add vanilla extract.\n\n### Step 5: Combine and Bake\n\nGradually blend in flour mixture, then stir in chocolate chips. Drop rounded tablespoons onto ungreased cookie sheets.\n\n---\n\n**Baking time:** 9-11 minutes or until golden brown\n\n**Yield:** About 5 dozen cookies'}
>
Create complex documents with mixed content types. The editor handles all formatting seamlessly.
API Documentation
Welcome to our API documentation. Below you\'ll find examples of how to use our endpoints.
Authentication
All API requests require authentication using an API key:
Authorization: Bearer YOUR_API_KEY
Endpoints
GET /users'}>
Retrieve a list of users from the system.
curl -X GET https://api.example.com/users \\\n -H "Authorization: Bearer YOUR_API_KEY"
Note: Rate limiting applies to all endpoints. You can make up to 100 requests per minute.
For more information, please refer to our complete documentation.
'}
.outputFormat=${'html'}
>
Seamlessly integrates with dees-form for complete form solutions. All standard form features like validation, required fields, and data binding work out of the box.
Create content programmatically using the block API for dynamic document generation.
The WYSIWYG editor provides multiple export formats and lossless save/restore capabilities for maximum flexibility.
Lossless Blocks
Export and import raw block structure for perfect round-trip editing
HTML Export
Get clean, semantic HTML regardless of output format setting
Markdown Export
Export as Markdown for docs, READMEs, and static sites
State Management
Save and restore complete editor state including settings
Software Release Notes
Version 2.5.0 - Released December 15, 2024
🎉 New Features
Added dark mode support across all components
Implemented real-time collaboration features
New dashboard analytics widgets
Export functionality for all report types
🐛 Bug Fixes
Fixed memory leak in data processing module
Resolved authentication timeout issues
Corrected timezone handling in scheduled tasks
⚡ Performance Improvements
Page load times reduced by 40% through lazy loading and code splitting
🔧 Technical Details
// New API endpoint for batch operations\nPOST /api/v2/batch\n{\n "operations": [\n { "method": "GET", "path": "/users/123" },\n { "method": "PUT", "path": "/settings", "body": {...} }\n ]\n}
💡 Migration Guide
Update your dependencies to the latest versions
Run database migrations: npm run migrate
Clear cache: npm run cache:clear
Restart all services
For questions or issues, please contact the development team or file a ticket in our issue tracker.