feat: add rich text editor integration for global variables & shortcodes plugins#757
Open
cp-bwg wants to merge 1 commit intoSonicJs-Org:mainfrom
Open
Conversation
…des plugins (SonicJs-Org#756) Implements Part 2 (Rich Text Inline Tokens) from SonicJs-Org#719: - Enhanced global-variables-plugin with full CRUD admin page, Quill blots (blue chips), TinyMCE PluginManager integration, and editor toggle - New shortcodes-plugin with [[shortcode]] syntax, handler registry, CRUD admin, live preview, Quill blots (purple chips), and TinyMCE support - Shared editor utilities: Quill constructor Proxy, searchable picker dropdown, TinyMCE PluginManager approach, admin HTML template - Content resolution: variables (priority 50) → shortcodes (priority 60) - 5 built-in shortcode handlers: current_date, phone_link, cta_button, plan_count, provider_rating Closes SonicJs-Org#719 Extends SonicJs-Org#743 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Note: Filed #758 about the global-variables plugin from PR #743 having dead routes — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Part 2 (Rich Text Inline Tokens) from #719 and extends PR #743 with full rich text editor integration for both Quill and TinyMCE editors, plus a new Shortcodes plugin.
[[shortcode_name param="value"]]syntax, handler registry, CRUD admin with live preview, Quill shortcode blots (purple chips), and TinyMCE integrationChanges
Enhanced:
global-variables-plugin(3 files modified)index.ts— Complete rewrite with:install/uninstalllifecycle hooks for table managementgetVariableBlotScript()— Quill integration with custom VariableBlot (blue chip), searchable pickergetVariableTinyMceScript()— TinyMCE integration via PluginManager.add()manifest.json— Updated to v1.1.0 with admin menu, routes, and lifecycle hooksvariable-resolver.ts— Unchanged (already solid from feat: add dynamic content variables / inline tokens #743)New:
shortcodes-plugin(3 files)index.ts— Full plugin with:[[shortcode_name param="value"]]token syntaxPOST /api/shortcodes/preview)content:readhook at priority 60 (runs after variables at 50)getShortcodeBlotScript()— Quill integration with ShortcodeBlot (purple chip)getShortcodeTinyMceScript()— TinyMCE integration via PluginManager.add()shortcode-resolver.ts— Parser + handler registry with 5 built-in handlers:current_date— Formatted date outputphone_link— Clickable phone linkcta_button— Styled call-to-action buttonplan_count— Dynamic plan count placeholderprovider_rating— Star rating displaymanifest.json— Plugin metadataNew:
_shared/directory (4 files)admin-template.ts— HTML wrapper with Tailwind + HTMX + CSRFquill-shared.ts— Quill constructor Proxy (custom format whitelisting), searchable picker dropdown, enhancer polling frameworktinymce-shared.ts— TinyMCE PluginManager approach (official API), picker dropdown, chip CSS injection into editor iframeindex.ts— Barrel exportsModified:
core-plugins/index.ts'shortcodes'toCORE_PLUGIN_IDSHow It Works
Editor Integration Flow
get*BlotScript()/get*TinyMceScript()afterAuthmiddleware{key}/[[name]]syntax on saveQuill Approach
Embedblots (VariableBlot, ShortcodeBlot) registered viaQuill.register()Proxywraps Quill constructor to inject custom formats into the whitelisttext-changehandler serializes chips → tokens in hidden inputTinyMCE Approach
tinymce.PluginManager.add()— the official TinyMCE plugin APISetContenthandler converts{key}→ chip spans;GetContenthandler reverseseditor.on('init')Content Resolution
?resolve_variables=false,?resolve_shortcodes=falseTesting
All changes were developed and tested against a full SonicJS instance with:
Related