<?php
/**
 * Plugin Name: Smart Whiteboard
 * Description: A plugin to draw or type on a canvas like a whiteboard with drawing tools, toggle draw mode, pencil settings, and text input.
 * Version: 1.0
 * Author: Your Name
 */

add_shortcode('smart_whiteboard', 'smart_whiteboard_shortcode');

function smart_whiteboard_shortcode() {
    ob_start(); ?>
    
    <div style="margin-bottom:10px;">
        <label>Mode:</label>
        <select id="boardMode">
            <option value="draw">Freehand</option>
            <option value="text">Text Input</option>
            <option value="line">Line</option>
            <option value="rectangle">Rectangle</option>
            <option value="circle">Circle</option>
        </select>

        <label>Color:</label>
        <input type="color" id="colorPicker" value="#000000">

        <label>Thickness:</label>
        <input type="range" id="thicknessPicker" min="1" max="10" value="2">

        <button onclick="clearCanvas()">Clear</button>
    </div>

    <canvas id="whiteboardCanvas" width="800" height="500" style="border:1px solid #ccc; cursor: crosshair;"></canvas>

    <?php
    wp_enqueue_script('whiteboard-js', plugin_dir_url(__FILE__) . 'whiteboard.js', [], false, true);
    return ob_get_clean();
}

add_action('wp_enqueue_scripts', function() {
    wp_enqueue_script('jquery');
});
