/** * AlgorithmPress Command Palette Integration Guide * This guide demonstrates how to integrate modules with the Command Palette */ // Example of integrating WordPress Connector with Command Palette const wpConnectorCommandProvider = { id: 'wordpress-connector', name: 'WordPress Connector', getCommands: function() { return [ { id: 'wp-connect-site', name: 'Connect WordPress Site', description: 'Connect to a WordPress site via REST API', category: 'wordpress', keywords: ['wordpress', 'connect', 'site', 'api', 'wp'], context: ['always'], params: [ { name: 'url', type: 'string', required: true, description: 'WordPress site URL' } ], execute: function(params) { // Open WordPress connector if not open if (window.togglePanel) { window.togglePanel('wordpress-connector'); } else if (window.DockDesktopIntegration) { window.DockDesktopIntegration.openModule('wordpress-connector'); } // Connect to site with the provided URL if (window.WordPressConnector && typeof window.WordPressConnector.connectSite === 'function') { window.WordPressConnector.connectSite(params.url); return true; } return false; }, icon: 'fab fa-wordpress' }, { id: 'wp-list-posts', name: 'List WordPress Posts', description: 'Show recent posts from connected WordPress site', category: 'wordpress', keywords: ['wordpress', 'posts', 'list', 'recent', 'wp'], context: ['wordpress'], execute: function() { if (window.WordPressConnector && typeof window.WordPressConnector.listPosts === 'function') { window.WordPressConnector.listPosts(); return true; } return false; }, icon: 'fas fa-list' }, { id: 'wp-create-post', name: 'Create WordPress Post', description: 'Create a new post on connected WordPress site', category: 'wordpress', keywords: ['wordpress', 'post', 'create', 'new', 'wp'], context: ['wordpress'], execute: function() { if (window.WordPressConnector && typeof window.WordPressConnector.createPost === 'function') { window.WordPressConnector.createPost(); return true; } return false; }, icon: 'fas fa-plus' }, { id: 'wp-manage-plugins', name: 'Manage WordPress Plugins', description: 'View and manage plugins on connected WordPress site', category: 'wordpress', keywords: ['wordpress', 'plugins', 'manage', 'wp'], context: ['wordpress'], execute: function() { if (window.WordPressConnector && typeof window.WordPressConnector.managePlugins === 'function') { window.WordPressConnector.managePlugins(); return true; } return false; }, icon: 'fas fa-puzzle-piece' } ]; } }; // Example of integrating PHP Editor with Command Palette const phpEditorCommandProvider = { id: 'php-editor', name: 'PHP Editor', getCommands: function() { return [ { id: 'php-run-code', name: 'Run PHP Code', description: 'Execute the current PHP code', category: 'php', keywords: ['php', 'run', 'execute', 'code'], context: ['editor'], execute: function() { // Placeholder for actual implementation console.log('Running PHP code'); // If your PHP runner has a global function, call it if (window.runPHPCode) { window.runPHPCode(); return true; } return false; }, shortcut: 'F5', icon: 'fas fa-play' }, { id: 'php-format-code', name: 'Format PHP Code', description: 'Auto-format the current PHP code', category: 'php', keywords: ['php', 'format', 'beautify', 'indent'], context: ['editor'], execute: function() { // Placeholder for actual implementation console.log('Formatting PHP code'); // If your code formatter has a global function, call it if (window.formatPHPCode) { window.formatPHPCode(); return true; } return false; }, shortcut: 'Ctrl+Alt+F', icon: 'fas fa-align-left' }, { id: 'php-validate', name: 'Validate PHP Code', description: 'Check current PHP code for syntax errors', category: 'php', keywords: ['php', 'validate', 'check', 'syntax', 'errors'], context: ['editor'], execute: function() { // Placeholder for actual implementation console.log('Validating PHP code'); // If your validator has a global function, call it if (window.validatePHPCode) { window.validatePHPCode(); return true; } return false; }, shortcut: 'Ctrl+Alt+V', icon: 'fas fa-check-circle' }, { id: 'php-insert-snippet', name: 'Insert PHP Snippet', description: 'Insert a predefined code snippet', category: 'php', keywords: ['php', 'snippet', 'insert', 'template', 'code'], context: ['editor'], execute: function() { // Placeholder for actual implementation console.log('Inserting PHP snippet'); // If your snippet system has a global function, call it if (window.openSnippetSelector) { window.openSnippetSelector(); return true; } return false; }, icon: 'fas fa-code' } ]; } }; // Example of integrating Desktop system with Command Palette const desktopCommandProvider = { id: 'desktop', name: 'Desktop System', getCommands: function() { return [ { id: 'create-new-window', name: 'Create New Window', description: 'Create a new empty window', category: 'desktop', keywords: ['window', 'new', 'create'], context: ['desktop'], params: [ { name: 'title', type: 'string', required: false, description: 'Window title' } ], execute: function(params) { if (window.DesktopIntegration && window.DesktopIntegration.createWindow) { const title = params.title || 'New Window'; window.DesktopIntegration.createWindow(title, `
Empty window created via Command Palette