From 6a1687e00a73c08126b711b74435186b5a7fd755 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 23 Jun 2026 11:48:21 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20add=20editor=20scaffolding=20=E2=80=94?= =?UTF-8?q?=20plugin=20manifest,=20Extension,=20SQL=20(3=20tables),=203=20?= =?UTF-8?q?helpers=20(Profile,=20Media,=20Template)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../en-GB/plg_editors_mokosuiteeditor.ini | 15 ++ .../en-GB/plg_editors_mokosuiteeditor.sys.ini | 2 + .../mokosuiteeditor.xml | 70 +++++ .../services/provider.php | 34 +++ .../sql/install.mysql.sql | 56 ++++ .../sql/uninstall.mysql.sql | 7 + .../src/Extension/MokoSuiteEditor.php | 99 +++++++ .../src/Helper/MediaHelper.php | 251 ++++++++++++++++++ .../src/Helper/ProfileHelper.php | 102 +++++++ .../src/Helper/TemplateHelper.php | 86 ++++++ 10 files changed, 722 insertions(+) create mode 100644 source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.ini create mode 100644 source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.sys.ini create mode 100644 source/packages/plg_editors_mokosuiteeditor/mokosuiteeditor.xml create mode 100644 source/packages/plg_editors_mokosuiteeditor/services/provider.php create mode 100644 source/packages/plg_editors_mokosuiteeditor/sql/install.mysql.sql create mode 100644 source/packages/plg_editors_mokosuiteeditor/sql/uninstall.mysql.sql create mode 100644 source/packages/plg_editors_mokosuiteeditor/src/Extension/MokoSuiteEditor.php create mode 100644 source/packages/plg_editors_mokosuiteeditor/src/Helper/MediaHelper.php create mode 100644 source/packages/plg_editors_mokosuiteeditor/src/Helper/ProfileHelper.php create mode 100644 source/packages/plg_editors_mokosuiteeditor/src/Helper/TemplateHelper.php diff --git a/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.ini b/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.ini new file mode 100644 index 0000000..9aebf26 --- /dev/null +++ b/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.ini @@ -0,0 +1,15 @@ +PLG_EDITORS_MOKOSUITEEDITOR="Editors - MokoSuite Editor" +PLG_EDITORS_MOKOSUITEEDITOR_DESC="Advanced WYSIWYG editor built on TinyMCE 7 with CodeMirror 6 source editing, role-based profiles, and integrated media management." +PLG_EDITORS_MOKOSUITEEDITOR_PROFILES="Editor Profiles" +PLG_EDITORS_MOKOSUITEEDITOR_DEFAULT_PROFILE="Default Profile" +PLG_EDITORS_MOKOSUITEEDITOR_ADMIN_TOOLBAR="Admin Toolbar Layout" +PLG_EDITORS_MOKOSUITEEDITOR_AUTHOR_TOOLBAR="Author Toolbar Layout" +PLG_EDITORS_MOKOSUITEEDITOR_BASIC_TOOLBAR="Basic Toolbar Layout" +PLG_EDITORS_MOKOSUITEEDITOR_MEDIA="Media Settings" +PLG_EDITORS_MOKOSUITEEDITOR_MAX_UPLOAD_MB="Max Upload Size (MB)" +PLG_EDITORS_MOKOSUITEEDITOR_AUTO_RESIZE_WIDTH="Auto Resize Width (px)" +PLG_EDITORS_MOKOSUITEEDITOR_WEBP_CONVERSION="Auto Convert to WebP" +PLG_EDITORS_MOKOSUITEEDITOR_WEBP_QUALITY="WebP Quality" +PLG_EDITORS_MOKOSUITEEDITOR_SOURCE_EDITING="Source Editing" +PLG_EDITORS_MOKOSUITEEDITOR_ENABLE_SOURCE_EDITING="Enable Source Editing" +PLG_EDITORS_MOKOSUITEEDITOR_CODEMIRROR_THEME="CodeMirror Theme" diff --git a/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.sys.ini b/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.sys.ini new file mode 100644 index 0000000..2bd60cb --- /dev/null +++ b/source/packages/plg_editors_mokosuiteeditor/language/en-GB/plg_editors_mokosuiteeditor.sys.ini @@ -0,0 +1,2 @@ +PLG_EDITORS_MOKOSUITEEDITOR="Editors - MokoSuite Editor" +PLG_EDITORS_MOKOSUITEEDITOR_DESC="Advanced WYSIWYG editor built on TinyMCE 7 with CodeMirror 6 source editing, role-based profiles, and integrated media management." diff --git a/source/packages/plg_editors_mokosuiteeditor/mokosuiteeditor.xml b/source/packages/plg_editors_mokosuiteeditor/mokosuiteeditor.xml new file mode 100644 index 0000000..5ebceb3 --- /dev/null +++ b/source/packages/plg_editors_mokosuiteeditor/mokosuiteeditor.xml @@ -0,0 +1,70 @@ + + + Editors - MokoSuite Editor + mokosuiteeditor + Moko Consulting + 2026-06-23 + Copyright (C) 2026 Moko Consulting. All rights reserved. + GPL-3.0-or-later + hello@mokoconsulting.tech + https://mokoconsulting.tech + 01.00.10 + 8.3 + PLG_EDITORS_MOKOSUITEEDITOR_DESC + Moko\Plugin\Editors\MokoSuiteEditor + + src + services + language + sql + + + en-GB/plg_editors_mokosuiteeditor.ini + en-GB/plg_editors_mokosuiteeditor.sys.ini + + + + sql/install.mysql.sql + + + + + sql/uninstall.mysql.sql + + + + +
+ + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + + + + +
+
+
+
diff --git a/source/packages/plg_editors_mokosuiteeditor/services/provider.php b/source/packages/plg_editors_mokosuiteeditor/services/provider.php new file mode 100644 index 0000000..518ca26 --- /dev/null +++ b/source/packages/plg_editors_mokosuiteeditor/services/provider.php @@ -0,0 +1,34 @@ +set( + PluginInterface::class, + function (Container $container) { + $dispatcher = $container->get(DispatcherInterface::class); + $plugin = new MokoSuiteEditor($dispatcher, (array) PluginHelper::getPlugin('editors', 'mokosuiteeditor')); + $plugin->setApplication(Factory::getApplication()); + + return $plugin; + } + ); + } +}; diff --git a/source/packages/plg_editors_mokosuiteeditor/sql/install.mysql.sql b/source/packages/plg_editors_mokosuiteeditor/sql/install.mysql.sql new file mode 100644 index 0000000..4c5a61e --- /dev/null +++ b/source/packages/plg_editors_mokosuiteeditor/sql/install.mysql.sql @@ -0,0 +1,56 @@ +-- +-- MokoSuite Editor Tables +-- + +CREATE TABLE IF NOT EXISTS `#__mokosuiteeditor_profiles` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(255) NOT NULL, + `user_groups` JSON DEFAULT NULL, + `toolbar_config` JSON DEFAULT NULL, + `allowed_tags` TEXT DEFAULT NULL, + `source_editing` TINYINT NOT NULL DEFAULT 1, + `media_upload` TINYINT NOT NULL DEFAULT 1, + `max_upload_mb` INT UNSIGNED NOT NULL DEFAULT 10, + `auto_resize_width` INT UNSIGNED NOT NULL DEFAULT 1920, + `webp_conversion` TINYINT NOT NULL DEFAULT 1, + `published` TINYINT NOT NULL DEFAULT 1, + `ordering` INT NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`), + KEY `idx_published` (`published`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuiteeditor_templates` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(255) NOT NULL, + `content` TEXT NOT NULL, + `category` VARCHAR(100) NOT NULL DEFAULT '', + `thumbnail` VARCHAR(500) NOT NULL DEFAULT '', + `published` TINYINT NOT NULL DEFAULT 1, + `ordering` INT NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`), + KEY `idx_category` (`category`), + KEY `idx_published` (`published`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `#__mokosuiteeditor_media_presets` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(255) NOT NULL, + `max_width` INT UNSIGNED NOT NULL DEFAULT 1920, + `max_height` INT UNSIGNED NOT NULL DEFAULT 1080, + `quality` INT UNSIGNED NOT NULL DEFAULT 85, + `format` ENUM('webp','jpg','png') NOT NULL DEFAULT 'webp', + `created` DATETIME NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Default profiles +-- + +INSERT INTO `#__mokosuiteeditor_profiles` (`title`, `user_groups`, `toolbar_config`, `allowed_tags`, `source_editing`, `media_upload`, `max_upload_mb`, `auto_resize_width`, `webp_conversion`, `published`, `ordering`, `created`) +VALUES +('Admin', '[8]', '{"toolbar": "undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat | code fullscreen"}', NULL, 1, 1, 50, 1920, 1, 1, 1, NOW()), +('Author', '[3,4]', '{"toolbar": "undo redo | blocks | bold italic underline | link image | align | numlist bullist | removeformat | code"}', '