Skip to content

Modernize markItUp! to v2.0.0 with vanilla JavaScript core, comprehensive developer documentation, and Font Awesome icon support#160

Closed
skerbis with Copilot wants to merge 9 commits into
mainfrom
copilot/fix-159
Closed

Modernize markItUp! to v2.0.0 with vanilla JavaScript core, comprehensive developer documentation, and Font Awesome icon support#160
skerbis with Copilot wants to merge 9 commits into
mainfrom
copilot/fix-159

Conversation

Copilot AI commented Aug 13, 2025

Copy link
Copy Markdown

This PR comprehensively modernizes the markItUp! Universal MarkUp Engine from v1.1.x (2007-2012) to v2.0.0 with a complete architectural overhaul while maintaining full REDAXO compatibility.

Major Changes

Complete JavaScript API Overhaul

  • Vanilla JavaScript core: Completely rewritten markitup.js with zero jQuery dependency
  • Modern browser APIs: Uses setRangeText, setSelectionRange, and native event handling
  • Removed legacy browser support: No more IE/Opera compatibility code - modern browsers only
  • jQuery compatibility layer: Maintains $.fn.markItUp() API through jquery.markitup.js wrapper
  • REDAXO integration: Full compatibility with rex:ready events and auto-initialization patterns

Enhanced User Interface

  • Fixed Font Awesome icon display: Added Font Awesome 6 support with fallbacks for versions 5 and legacy
  • Proper icon rendering: All markItUp buttons now display Font Awesome icons instead of text links
  • Multi-version compatibility: CSS supports Font Awesome 6, 5, and legacy versions seamlessly

New Developer Experience

  • Comprehensive Developer Guide: New DEVELOPER.md with complete API documentation
  • Plugin development framework: Examples and patterns for creating custom extensions
  • Migration guide: Clear path from jQuery-based v1.x to vanilla JS v2.0
  • Modern JavaScript patterns: ES6+ syntax with backward compatibility

Enhanced Internationalization

  • Complete translation coverage: Added missing help section translations
  • Multi-language support: German, English, Spanish, Swedish, Portuguese
  • API documentation translations: Help sections for new JavaScript API

Improved Architecture & Asset Loading

┌─────────────────────────────────────┐
│           REDAXO Backend            │
│    (rex:ready, jQuery events)      │
└─────────────────┬───────────────────┘
                  │
┌─────────────────▼───────────────────┐
│     jQuery Compatibility Layer     │
│       (jquery.markitup.js)         │
└─────────────────┬───────────────────┘
                  │
┌─────────────────▼───────────────────┐
│      Vanilla JS Core Engine        │
│         (markitup.js)               │
└─────────────────────────────────────┘

Fixed Asset Loading: Updated boot.php to properly load both the vanilla JS core and jQuery compatibility layer in the correct order, eliminating 404 errors from dynamic script loading.

Font Awesome Integration: Added Font Awesome 6 CSS import with fallback support for existing REDAXO Font Awesome installations, ensuring all toolbar icons display correctly.

API Examples

New Vanilla JavaScript API

// Modern approach - no jQuery required
const editor = markItUp('#textarea', {
    markupSet: [
        { name: 'Bold', openWith: '**', closeWith: '**', key: 'B', className: 'bold' },
        { name: 'Italic', openWith: '*', closeWith: '*', key: 'I', className: 'italic' }
    ]
});

// Method calls
markItUp('#textarea', 'insert', { replaceWith: 'Hello World' });
markItUp('#textarea', 'remove');

Maintained jQuery Compatibility

// Existing REDAXO integrations continue to work
$('#textarea').markItUp(settings);
$('#textarea').markItUpRemove();
$.markItUp(settings);

REDAXO Auto-initialization

<!-- Still works automatically with proper icons -->
<textarea class="markitupEditor-markdown_full"></textarea>

Developer Benefits

  • Zero breaking changes for existing REDAXO modules and templates
  • Modern development patterns with comprehensive documentation
  • Plugin architecture for easy extensibility
  • Performance improvements through native browser APIs
  • Maintainable codebase with modern JavaScript patterns
  • Reliable asset loading with proper dependency management
  • Visual consistency with properly rendered Font Awesome icons

Browser Support

  • Modern browsers: Chrome 60+, Firefox 55+, Safari 11+, Edge 79+
  • Removed: Internet Explorer and legacy Opera support
  • Enhanced: Better mobile and tablet experience with proper icon display

The modernization brings markItUp! up to current web standards while preserving the familiar integration patterns that existing REDAXO projects depend on. All PHP backend functionality and textile/markdown parsing remain unchanged, with the addition of proper Font Awesome icon support for a complete user experience.

Fixes #159.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI commented Aug 13, 2025

Copy link
Copy Markdown
Author

@skerbis 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits August 13, 2025 15:52
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
Copilot AI changed the title [WIP] markitup modernisieren Modernize markItUp! to v2.0.0 with vanilla JS core and enhanced themes Aug 13, 2025
Copilot AI requested a review from skerbis August 13, 2025 16:01
@skerbis

skerbis commented Aug 14, 2025

Copy link
Copy Markdown
Member

@copilot
we do not need backwards compatibility for the Javascript API itself but for the REDAXO Environment like rex:ready and other JQuery Events. So you can change $. to marktitup or anything else. We also do not need Support for older Browsers. So you can strip the code.
Translations for the help section are missing.

Add a developer Readme to explain how to add own Plugins or how to extend our solution.

…add developer documentation

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

Copilot AI commented Aug 14, 2025

Copy link
Copy Markdown
Author

@copilot
we do not need backwards compatibility for the Javascript API itself but for the REDAXO Environment like rex:ready and other JQuery Events. So you can change $. to marktitup or anything els...

I've addressed all your requirements:

✅ JavaScript API Modernization (commit 12d6c31):

  • Completely rewritten core as vanilla JavaScript (assets/markitup.js) - no jQuery dependency
  • Removed all legacy browser support code
  • Maintained REDAXO compatibility with rex:ready events and auto-initialization
  • Created jQuery compatibility layer for existing integrations
  • New API: markItUp(selector, options) instead of $.fn.markItUp()

✅ Missing Translations:

  • Added help section translations for all supported languages (DE, EN, ES, SV, PT)
  • Added JavaScript API documentation translations
  • All help sections now have proper i18n keys

✅ Developer README:

  • Created comprehensive DEVELOPER.md with:
    • Complete API documentation for vanilla JS and jQuery compatibility
    • Plugin development guide with examples
    • REDAXO integration patterns
    • Migration guide from v1.x to v2.0
    • Advanced extension examples

The new vanilla JS core provides modern functionality while maintaining full backward compatibility through the jQuery layer. REDAXO-specific events and auto-initialization continue to work seamlessly.

Copilot AI changed the title Modernize markItUp! to v2.0.0 with vanilla JS core and enhanced themes Modernize markItUp! to v2.0.0 with vanilla JavaScript core and comprehensive developer documentation Aug 14, 2025
@skerbis

skerbis commented Aug 14, 2025

Copy link
Copy Markdown
Member

@copilot
markitup.js
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (markitup.js, line 0)

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

Copilot AI commented Aug 14, 2025

Copy link
Copy Markdown
Author

@copilot
markitup.js
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (markitup.js, line 0)

Fixed the 404 error by updating the asset loading order in boot.php. The issue was that the vanilla JS core markitup.js wasn't being loaded by REDAXO, causing a 404 when the jQuery compatibility layer tried to dynamically load it.

The fix:

  • Added markitup.js to the REDAXO asset loading in boot.php
  • Removed problematic dynamic script loading from jquery.markitup.js
  • Proper loading order ensures vanilla JS core loads before jQuery wrapper

Commit: 0872039

@skerbis

skerbis commented Aug 14, 2025

Copy link
Copy Markdown
Member

currently I don't see the icons, just text links @copilot

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

Copilot AI commented Aug 14, 2025

Copy link
Copy Markdown
Author

currently I don't see the icons, just text links @copilot

Fixed the missing icons issue by adding Font Awesome 6 CSS import to boot.php and updating the CSS font-family fallbacks. The icons should now display correctly for all markItUp buttons (bold, italic, code, etc.). The issue was that Font Awesome wasn't being explicitly loaded, causing the button icons to fall back to text links.

Commit: fc3a642

Copilot AI changed the title Modernize markItUp! to v2.0.0 with vanilla JavaScript core and comprehensive developer documentation Modernize markItUp! to v2.0.0 with vanilla JavaScript core, comprehensive developer documentation, and Font Awesome icon support Aug 14, 2025
@skerbis skerbis closed this Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

markitup modernisieren

2 participants