Educational Resource Editor

Page Version: 1.0

The Educational Resource Editor is a powerful, multi-format content creation and management tool designed specifically for educators. It supports a wide range of document types including Plain Text, Rich Text (RTF), HTML, LaTeX, Images, PDFs, and Word documents. The editor provides a unified interface where teachers can create, edit, format, and manage educational content with precise control over layout and formatting to ensure compatibility with standard A4 paper output.

Educational Resource Editor Main Interface

Educational Resource Editor Interface

Table of Contents

Interface Overview Supported Formats Content Creation File Management Database Operations Paper Layout System Advanced Features

Interface Overview

Primary Workspace

The editor is organized into two main content areas:

Control Panels

Universal Width Constraint: All content areas are fixed to a width of 6.19 inches (converted to pixels based on DPI settings). This ensures all content fits properly within the A4 paper layout during printing or PDF generation.

Key Interface Components

Navigation Controls

Metadata Panel

Action Buttons

Supported Document Formats

The editor supports multiple document formats, each with specific handling characteristics:

📝 Plain Text

🎨 Rich Text (RTF)

🌐 HTML

📐 LaTeX

🖼️ Image

📄 PDF

📘 Word (DOCX)

Important Note: LaTeX and HTML documents are saved as raw source code. They must be processed ("Run LaTeX" or "Run HTML") before they can be properly displayed or distributed. Unprocessed LaTeX/HTML will appear as source code in generated materials.

Content Creation Tools

Toolbar Icons and Functions

TeX - LaTeX tools (new script, compile)
🌐 - HTML tools (new script, render)
🖼️+ - Insert image into existing content
✂️ - Screen capture/snipping tool
📤 - Upload file (replaces content)
🔍 - Search database by ID
📝 - Clear content (start new)
🔖 - Add [MARKED] bookmark

Content Toolbar (Top)

Located above the Content Editor, provides tools specifically for the main content area:

Answer Toolbar (Bottom)

Located above the Answer Editor, provides identical tools for the answer section:

Screen Capture Tip: The snipping tool automatically hides the main window, allowing you to capture any part of your screen. The captured image is automatically inserted at the current cursor position and resized to fit the 6.19-inch content width.
Content and Answer Toolbars

Content (Top) and Answer (Bottom) Toolbars

File Management

Uploading Files

The Upload menu (📤 button) provides access to all supported file types:

Image Upload

PDF Upload

Text-based Formats

Content and Answer Toolbars

Uploading Files options

File Type Detection and Handling

The editor automatically detects file types and applies appropriate processing:

PDF Limitations: Only the first page of PDF files is processed. For multi-page documents, consider splitting into separate resources or using image mode for specific pages.

Database Operations

Navigation and Search

Record Navigation

Database Search

Data Management

Content and Answer Toolbars

Database Operations

Storage Strategy

The editor uses intelligent storage based on content type:

Storage Logic:
1. Plain Text & RTF → Converted to HTML using toHtml()
2. HTML & LaTeX → Saved as raw text using toPlainText()
3. Images → Converted to Base64 and embedded in HTML
4. All content → Stored with fixed width constraint (6.19 inches)
5. Format detection → Uses helper.is_rtf() on load

Bookmark Feature

The 🔖 bookmark button adds a [MARKED] tag to Additional Details:

Content and Answer Toolbars

Bookmark

Data Integrity: The editor maintains data integrity through automatic format detection. When loading resources, it checks if content contains RTF/HTML formatting and applies the appropriate restoration method (setHtml() for formatted content, setPlainText() for raw source code).

Paper Layout System

A4 Paper Constraints

All content is designed to fit within A4 paper dimensions with proper margins:

A4 Paper Layout (210mm × 297mm / 8.27in × 11.69in)
0.5 inch Margins (Left & Right)
Column 1
0.54 in
CONTENT AREA
6.19 inches (157mm)
Fixed width for all educational content
Column 3
0.54 in
0.5 inch Margins (Left & Right)

Width Calculation

The content width is calculated based on DPI (Dots Per Inch) settings:

Consistent Output: The fixed 6.19-inch width ensures all educational resources maintain consistent formatting when printed or converted to PDF. Images and other content are automatically scaled to this width, guaranteeing proper alignment in the final output.

HTML Template Structure

Generated HTML content includes proper width constraints:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en">
<head>
  <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="width:{app_context.EDU_ITEM_PIXELS}px;">
  <main>
    <b>Add here main content.</b>
  </main>
</body>
</html>

Advanced Features

LaTeX Processing

The editor includes built-in LaTeX compilation capabilities:

Screen Capture Integration

The snipping tool provides seamless screen capture functionality:

Format Detection Algorithm

Intelligent detection of content format on load:

Detection Logic (helpers.is_rtf()):
1. Check for HTML meta tags (qrichtext, viewport)
2. Look for HTML/XML doctype declarations
3. Detect RTF formatting markers
4. Identify LaTeX document structure
5. Fallback: Plain text detection

Result: Apply setHtml() for formatted content, setPlainText() for raw source

Error Handling and User Feedback

Notification System

Validation

Prerequisites for Advanced Features:
1. LaTeX: Requires LaTeX distribution (TeX Live, MiKTeX) with xepersian package
2. Word Documents: Requires pypandoc and Pandoc installation
3. PDF Processing: Requires PyMuPDF (fitz) library
4. Screen Capture: Requires proper screen permissions
Best Practices:
1. Use Plain Text for simple questions and instructions
2. Use RTF for formatted text with images and tables
3. Use LaTeX for mathematical content and formal documents
4. Use HTML for web-based content and complex layouts
5. Always "Run LaTeX" or "Run HTML" before saving if using those formats
6. Use the [MARKED] bookmark for resources needing review
7. Regularly save work to avoid data loss