User tests: Successful: Unsuccessful:
This will enable TinyMCE to use skins
Right now in Joomla! is hard to customize the look of the tinyMCE editor (needs some core hacks).
This PR will enable the use of skins just by copying them in the respective folder.
There shouldn’t be any backward compatibility breaks here.
In the options of tinyMCE instead of having the default as the only option in drop down list, all the available skins will be listed by the respected names. Also the string that translates to default is useless but I didn’t deleted as I don’t know how language files are treated…
Line 102@ en-GB.plg_editors_tinymce.ini: PLG_TINY_FIELD_VALUE_DEFAULT="Default"
Need to set editor to tinymce:
1. Apply the patch with patchtester.
2. Edit an article. Everything should be ok.
3. Go to http://skin.tinymce.com and select the preset charcoal or tundra and download it. (lightgray is the one that ships with Joomla!)
4. Extract the skin in /media/editors/tinymce/skins
5. Go to plugins->tinyMCE and select the skin you just copied.
6. Edit an article with your new skin!
Labels |
Added:
?
|
oops in tinymce.xml change<fieldset name=“basic”>
to<fieldset name="basic" addfieldpath="/plugins/editors/tinymce”>
Easy | No | ⇒ | Yes |
Category | ⇒ | External Library |
Thanks @dgt41 now it work like a charm Also on xampp (windows 8.1; I have no "real" win sever here.) using com_patchtester
EDIT:
Can we have a "New Feature" label here?
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
Good to hear that. I didn’t expect to work out of the box in win env… Kudos to PHP
In order not to hard code the field path in XML maybe a slight modification in administrator/com_plugins/models/plugin.php
in line 74 we can add:
JForm::addFieldPath(JPATH_PLUGINS . '/' . $folder . '/' . $element);
So all the plugins can have custom fields in their root dir or we can specify (create) another like:
JForm::addFieldPath(JPATH_PLUGINS . '/' . $folder . '/' . $element . ‘/fields‘);
BUT that’s another PR I guess
Labels |
Added:
?
|
No problem.
BTW. Travis is better than me, it spot another CS things
FILE: ...home/travis/build/joomla/joomla-cms/plugins/editors/tinymce/tinymce.php
--------------------------------------------------------------------------------
FOUND 5 ERROR(S) AFFECTING 5 LINE(S)
--------------------------------------------------------------------------------
54 | ERROR | Please consider a blank line preceding your comment
55 | ERROR | Space found before comma in function call
56 | ERROR | Please consider a blank line preceding your comment
57 | ERROR | Cast statements must be followed by a single space; expected
| | "(int) $this" but found "(int)$this"
59 | ERROR | Cast statements must be followed by a single space; expected
| | "(int) $this" but found "(int)$this"
--------------------------------------------------------------------------------
Now (i think) he should be happy!
@test successful by using charcoal from http://skin.tinymce.com/ on xampp (win8.1)
Thanks @dgt41
Works fine here (MAMP Macintosh)
I propose, as it is a new feature, to let choose the skin depending on the site or admin.
in tinymce.php
public function onInit()
{
$language = JFactory::getLanguage();
$app = JFactory::getApplication();
$mode = (int) $this->params->get('mode', 1);
$theme = 'modern';
// List the skins
$skindirs = glob(JPATH_ROOT . '/media/editors/tinymce/skins' . '/*', GLOB_ONLYDIR);
// Set the selected site skin
if ($app->isSite())
{
if ((int) $this->params->get('skin', 0) < count($skindirs))
{
$skin = 'skin : "' . basename($skindirs[(int) $this->params->get('skin', 0)]) . '",';
}
else
{
$skin = 'skin : "' . basename($skindirs[0]) . '",';
}
}
// Set the selected administrator skin
elseif ($app->isAdmin())
{
if ((int) $this->params->get('skin_admin', 0) < count($skindirs))
{
$skin = 'skin : "' . basename($skindirs[(int) $this->params->get('skin_admin', 0)]) . '",';
}
else
{
$skin = 'skin : "' . basename($skindirs[0]) . '",';
}
}
[...]
in tinymmce.xml
<field name="skin" type="skins"
description="PLG_TINY_FIELD_SKIN_DESC"
label="PLG_TINY_FIELD_SKIN_LABEL"
>
</field>
<field name="skin_admin" type="skins"
description="PLG_TINY_FIELD_SKIN_ADMIN_DESC"
label="PLG_TINY_FIELD_SKIN_ADMIN_LABEL"
>
</field>
New lang strings and modified existing:
PLG_TINY_FIELD_SKIN_ADMIN_DESC="Select skin for the Administrator Backend interface" // new
PLG_TINY_FIELD_SKIN_ADMIN_LABEL="Administrator Skin" //new
PLG_TINY_FIELD_SKIN_DESC="Select skin for the Frontend interface" // modified
PLG_TINY_FIELD_SKIN_LABEL="Site Skin" // modified
Also, I suggest, to be consequent with the use of specific fields in core, to put skins.php in a sub-folder called fields
therefore we would have:
<fieldset name="basic" addfieldpath="/plugins/editors/tinymce/fields">
@infograf768 what about the lang string PLG_TINY_FIELD_VALUE_DEFAULT=“Default”?
Right now is useless shall we remove it?
Maybe we can add
<field name="note" type="note" label="PLG_TINY_FIELD_VALUE_TINYMCE_INFO" description="PLG_TINY_FIELD_VALUE_TINYMCE_INFO_DESC" />
with
PLG_TINY_FIELD_VALUE_TINYMCE_INFO = “For customizing the skin go to: skins.tinymce.com”
PLG_TINY_FIELD_VALUE_TINYMCE_INFO = “Copy your new skin at: /media/editors/tinymce/skins"
Latest commit introduces front end/back end option
Also added a note field for more info
Moved the field mode (functionality) after the skins
Added/ modified
PLG_TINY_FIELD_SKIN_ADMIN_DESC="Select skin for the Administrator Backend interface"
PLG_TINY_FIELD_SKIN_ADMIN_LABEL="Administrator Skin"
PLG_TINY_FIELD_SKIN_DESC="Select skin for the Frontend interface"
PLG_TINY_FIELD_SKIN_INFO_DESC="Copy your new skins at: /media/editors/tinymce/skins"
PLG_TINY_FIELD_SKIN_INFO_LABEL="For customized skins go to: skins.tinymce.com"
PLG_TINY_FIELD_SKIN_LABEL="Site Skin”
Issue is here:
https://github.com/joomla/joomla-cms/pull/4240/files#diff-fba22872aea9148404167671e76cc8c2R24
<field name="skins" type="note"
label="PLG_TINY_FIELD_SKIN_INFO_DESC"
description="PLG_TINY_FIELD_SKIN_INFO_DESC"
/>
Fix (see the label attribute ;))
<field name="skins" type="note"
label="PLG_TINY_FIELD_SKIN_INFO_LABEL"
description="PLG_TINY_FIELD_SKIN_INFO_DESC"
/>
@test apart from the things above the BE and FE thing works good here.
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
@zero-24 The second point you mention is quite tricky with this code. Let me explain how this work:
We scan the directory and get the available folders in an array (short them by name), then we compare the key with the one on the db (params) and set the skin. Actually this code cannot set something based on name because something like that, will have to store instead of an integer the actual name of each template. And this will get a lot more code and also some more changes in the db.
The drawback of this code is that every time you add or remove a skin will require to set again the preferred skin.
So you copy a skin -> you have to reset the preferred skin (the same might be the case in uninstalling, depends on the names of the skins)
One way to fallback always to lightgray is to rename it to _lightgray (haven’t tested but I think will work). But for me is better to leave it as is, because in every update of tinyMCE somebody will have to rename that folder :( .
The link is a good idea
Actually I am wrong about the fall back!
Lightgray will always be available so we can set it as a fallback!
I will provide the code, good catch
Labels |
Added:
?
|
Labels |
Added:
?
|
Labels |
Removed:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-09-25 14:33:08 |
Status | Closed | ⇒ | New |
This has been merged to 3.4-dev. Thanks!
Status | New | ⇒ | Closed |
Closed_Date | 2014-09-25 14:33:08 | ⇒ | 2014-09-26 13:09:34 |
@dgt41 looks cool i have comment on some CS things and going to test now