first commit
This commit is contained in:
96
components/com_jce/editor/tiny_mce/plugins/joomla/config.php
vendored
Normal file
96
components/com_jce/editor/tiny_mce/plugins/joomla/config.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
class WFJoomlaPluginConfig
|
||||
{
|
||||
public static function getConfig(&$settings)
|
||||
{
|
||||
// already set by editor display
|
||||
if (isset($settings['joomla_xtd_buttons'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$plugins = JPluginHelper::getPlugin('editors-xtd');
|
||||
|
||||
$list = array();
|
||||
$editor = JEditor::getInstance('jce');
|
||||
|
||||
$excluded = array('readmore', 'pagebreak', 'image');
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($plugins as $plugin) {
|
||||
// skip buttons better implemented by editor
|
||||
if (in_array($plugin->name, $excluded)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// fully load plugin instance
|
||||
JPluginHelper::importPlugin('editors-xtd', $plugin->name, true);
|
||||
|
||||
// create the button class name
|
||||
$className = 'PlgEditorsXtd' . $plugin->name;
|
||||
|
||||
// or an alternative
|
||||
if (!class_exists($className)) {
|
||||
$className = 'PlgButton' . $plugin->name;
|
||||
}
|
||||
|
||||
$instance = null;
|
||||
|
||||
if (class_exists($className)) {
|
||||
$dispatcher = is_subclass_of($editor, 'Joomla\Event\DispatcherAwareInterface', false) ? $editor->getDispatcher() : $editor;
|
||||
$instance = new $className($dispatcher, (array) $plugin);
|
||||
}
|
||||
|
||||
// check that the button is valid
|
||||
if (!$instance || !method_exists($instance, 'onDisplay')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$button = $instance->onDisplay('__jce__', null, null);
|
||||
|
||||
if (empty($button) || !is_object($button)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// should be a CMSObject
|
||||
if (!($button instanceof Joomla\CMS\Object\CMSObject)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
$name = 'button-' . $i . '-' . str_replace(' ', '-', $button->get('text'));
|
||||
$title = $button->get('text');
|
||||
$onclick = $button->get('onclick', '');
|
||||
$icon = $button->get('name');
|
||||
|
||||
if ($button->get('link') !== '#') {
|
||||
$href = JUri::base() . $button->get('link');
|
||||
} else {
|
||||
$href = '';
|
||||
}
|
||||
|
||||
$icon = 'none icon-' . $icon;
|
||||
|
||||
$list[] = array(
|
||||
'name' => $name,
|
||||
'title' => $title,
|
||||
'icon' => $icon,
|
||||
'href' => $href,
|
||||
'onclick' => $onclick,
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$settings['joomla_xtd_buttons'] = json_encode($list);
|
||||
}
|
||||
}
|
||||
2
components/com_jce/editor/tiny_mce/plugins/joomla/editor_plugin.js
vendored
Normal file
2
components/com_jce/editor/tiny_mce/plugins/joomla/editor_plugin.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
!function(){var each=tinymce.each;tinymce.create("tinymce.plugins.JoomlaPlugin",{init:function(ed,url){var self=this;self.editor=ed},createControl:function(n,cm){var ed=this.editor;if("joomla"!==n)return null;var plugins=ed.settings.joomla_xtd_buttons||[];if(!plugins.length)return null;var ctrl=cm.createSplitButton("joomla",{title:"joomla.buttons",icon:"joomla"});return ctrl.onRenderMenu.add(function(ctrl,menu){var ed=ctrl.editor,vp=ed.dom.getViewPort();each(plugins,function(plg){var href=plg.href||"";href&&(href=ed.dom.decode(href),href=href.replace(/(__jce__)/gi,ed.id),href=href.replace(/(e_name|editor)=([\w_]+)/gi,"$1="+ed.id));var item=menu.add({id:ed.dom.uniqueId(),title:plg.title,icon:plg.icon,onclick:function(e){return ed.lastSelectionBookmark=ed.selection.getBookmark(1),href&&(ed.windowManager.open({file:href,title:plg.title,width:Math.max(vp.w-40,896),height:Math.max(vp.h-40,707),size:"mce-modal-landscape-full",addver:!1}),window.Joomla&&window.Joomla.Modal&&window.Joomla.Modal.setCurrent(ed.windowManager)),plg.onclick&&new Function(plg.onclick).apply(),item.setSelected(!1),!1}})});var jModalCloseCore=function(){};window.jModalClose&&(jModalCloseCore=window.jModalClose),window.jModalClose=function(){var wm=ed.windowManager;return wm.count?wm.close():jModalCloseCore()};var SBoxClose=function(){};window.SqueezeBox?SBoxClose=window.SqueezeBox.close:window.SqueezeBox={},window.SqueezeBox.close=function(){var wm=ed.windowManager;return wm.count?wm.close():SBoxClose()}}),ed.onRemove.add(function(){ctrl.destroy()}),ctrl}}),tinymce.PluginManager.add("joomla",tinymce.plugins.JoomlaPlugin)}();
|
||||
1
components/com_jce/editor/tiny_mce/plugins/joomla/index.html
vendored
Normal file
1
components/com_jce/editor/tiny_mce/plugins/joomla/index.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
Reference in New Issue
Block a user