User tests: Successful: Unsuccessful:
when creating a child template it is incorrectly creating the html directory as a subdirectory of media - it should be /templates/childname/html - you can verify that by creating a template override and observing where the files are created.
the templateDetails.xml is also incorrect for the same reason
Create a child template.
You will see the child template has no template subdirectories and has a media/html subdirectoy
Check the templateDetails.xml and you will see
<filename>templateDetails.xml</filename>
<folder>html</folder>
</files>
<media destination="templates/site/cassiopeia" folder="media">
<folder>js</folder>
<folder>css</folder>
<folder>scss</folder>
<folder>images</folder>
</media>
You will see the child template has a template/html subdirectory and no media/html subdirectoy
Check the templateDetails.xml and you will see
<files>
<filename>templateDetails.xml</filename>
<folder>html</folder>
</files>
<media folder="media" destination="templates/site/cassiopeia_after_pr">
<folder>css</folder>
<folder>js</folder>
<folder>images</folder>
<folder>scss</folder>
</media>
![image](https://user-images.githubusercontent.com/1296369/196300773-4496ca7f-f5bc-4520-ab88-310941a2b310.png)
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Administration com_templates |
Nope, you're wrong. As the contents of this folder SHOUD be publicly accessible the HTML folder was moved to the media folder, so once someone is hardening their security/access to their site the contents could be fetched from tinyMCE.
The HTML folder is where the content overrides belong - they are still present in the standard installs as they are PHP Files https://github.com/joomla/joomla-cms/tree/4.2-dev/templates/cassiopeia/html
TinyMCE HTML as html files might need to be some sort of special case admittedly - but either way the majority of the files do belong in the templates dir and they indeed do not belong in the media subtree in the xml file.
The HTML folder is where the content overrides belong
True and that exposes the real problem: the implementation of this feature is subpar. Let me explain:
Eg:
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="editors" method="upgrade">
<name>plg_editors_tinymce</name>
<version>5.10.3</version>
<creationDate>2005-08</creationDate>
<author>Tiny Technologies, Inc</author>
<authorEmail>N/A</authorEmail>
<authorUrl>https://www.tiny.cloud</authorUrl>
<copyright>Tiny Technologies, Inc</copyright>
<license>LGPL</license>
<description>PLG_TINY_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Editors\TinyMCE</namespace>
<files>
<folder plugin="tinymce">forms</folder>
<folder>src</folder>
<folder>services</folder>
</files>
<media destination="editors" folder="media">
<folder>tinymce</folder>
</media>
<languages>
<language tag="en-GB">language/en-GB/plg_editors_tinymce.ini</language>
<language tag="en-GB">language/en-GB/plg_editors_tinymce.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic" addfieldprefix="Joomla\Plugin\Editors\TinyMCE\Field">
<field
name="configuration"
type="tinymcebuilder"
label="PLG_TINY_BUILDER"
hiddenLabel="true"
/>
</fieldset>
<fieldset name="advanced" label="PLG_TINY_FIELD_LABEL_ADVANCEDPARAMS">
<field
name="sets_amount"
type="number"
label="PLG_TINY_FIELD_NUMBER_OF_SETS_LABEL"
filter="int"
validate="number"
min="3"
default="3"
/>
<field
name="html_height"
type="text"
label="PLG_TINY_FIELD_HTMLHEIGHT_LABEL"
default="550px"
/>
<field
name="html_width"
type="text"
label="PLG_TINY_FIELD_HTMLWIDTH_LABEL"
default=""
/>
</fieldset>
</fields>
</config>
</extension>
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors.tinymce
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\Plugin\Editors\TinyMCE\PluginTraits\DisplayTrait;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* TinyMCE Editor Plugin
*
* @since 1.5
*/
class PlgEditorTinymce extends CMSPlugin
{
use DisplayTrait;
/**
* Base path for editor files
*
* @since 3.5
*
* @deprecated 5.0
*/
protected $_basePath = 'media/vendor/tinymce';
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Loads the application object
*
* @var \Joomla\CMS\Application\CMSApplication
* @since 3.2
*/
protected $app = null;
/**
* Initialises the Editor.
*
* @return void
*
* @since 1.5
*/
public function onInit()
{
}
}
class PlgEditorsTinymce extends PlgEditorTinymce
{
/**
* Helper function to get the active Site template style.
*
* @return object
*
* @since 4.3.0
*/
public function onAjaxTinymce()
{
// @todo collect the templates properly
// Template
// $templates = [];
// if (!empty($allButtons['template'])) {
// // Do we have a custom content_template_path
// $template_path = $levelParams->get('content_template_path');
// $template_path = $template_path ? '/templates/' . $template_path : '/media/vendor/tinymce/templates';
// $filepaths = Folder::exists(JPATH_ROOT . $template_path)
// ? Folder::files(JPATH_ROOT . $template_path, '\.(html|txt)$', false, true)
// : [];
// foreach ($filepaths as $filepath) {
// $fileinfo = pathinfo($filepath);
// $filename = $fileinfo['filename'];
// $full_filename = $fileinfo['basename'];
// if ($filename === 'index') {
// continue;
// }
// $title = $filename;
// $title_upper = strtoupper($filename);
// $description = ' ';
// if ($language->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE')) {
// $title = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE');
// }
// if ($language->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC')) {
// $description = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC');
// }
// $templates[] = [
// 'title' => $title,
// 'description' => $description,
// 'url' => Uri::root(true) . $template_path . '/' . $full_filename,
// ];
// }
// }
header('Content-type:application/json;charset=utf-8');
@ob_end_clean();
if (!Session::checkToken('request') || !(Factory::getUser())->authorise('core.edit', 'com_plugins')) {
throw new \Exception('Not Allowed');
}
echo (json_encode([
[
'title' => 'Success',
'description' => 'A success alert',
'content' => '<div class="alert alert-success">My content</div>'
]
]));
flush();
Factory::getApplication()->close();
}
}
And 'templates' => Uri::base(false) . 'index.php?option=com_ajax&type=plugin&plugin=tinymce&group=editors&format=json&' . Session::getFormToken() . '=1', //$templates,
@
@wilsonge what is extremely awkward is that the editors plugin due to this line
joomla-cms/libraries/src/Editor/Editor.php
Line 302 in 1aa03e5
$name = 'PlgEditors' . $this->_name;
Editors not Editor) don't follow the API convention and thus the com_ajax events are not fired. Joomla disagrees with it's own API...
@dgrammatiko create a template override in a child template and see where the file is created
@brianteeman my bad I thought you were fixing #38911 and my comments are totally valid for that issue. If Layout overrides end up in the media folder then it's an obvious bug (will try to test later today)
I can't replicate the issue:
I can't replicate the issue:
Your video shows the problem that this PR resolves
I have tested this item
Tested successfully in Joomla 4.2.4-dev of 24 October in Wampserver using PHP 8.1.10
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-12-29 18:30:12 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
Nope, you're wrong. As the contents of this folder SHOUD be publicly accessible the HTML folder was moved to the media folder, so once someone is hardening their security/access to their site the contents could be fetched from tinyMCE.