Would someone else than me want a possibility to manipulate the parameters for the Tinymce editor?
I want other settings for another component than com_content primarily in frontend. The 3 textareas are for authors and not designers ;). I can force the use of Tinymce in the form. (editor="tinymce")
I have a suggestion but it might be other smarter ways available to override part of, or the whole method "onDisplay in tinymce.php"
I allow override for a component but still allow a override in the template.
if (!$declaredJs)
{
$app = JFactory::getApplication();
// Include override
$override1 = JPATH_THEMES . '/'.$app->getTemplate(). '/html/plg_editors_tinymce/tinymce.php';
$override2 = JPATH_COMPONENT_ADMINISTRATOR . '/helpers/tinymce.php';
if (JFile::exists($override1))
{
include $override1;
}
elseif (JFile::exists($override2))
{
include $override2;
}
else
{
This does not belong to the suggesttion but might be of interest. I added inline editing with Tinymce to my component. I added it to com_content article view only to show the effect in the screenshot. A real inline editing for articles is not in general possible. There are "read more" and other plug ins that are in the way. With my component I can save it directly with an ajax call.
I would make a PR if there is interest. I tried to fork the plug in but had some trouble with the toggle button and it would be easier to hang on the standard plug in.
You are right, if I'm alone finding the need for a 3.p extension annoying, when you only want to set a couple of parameters TO REDUCE functionality. My own plug in would not be availible for others. As I wrote, I would probably loose the toggle button; but that's not importanbt since there is a popup with the raw text.
There is a better way to override the options, it is use addScriptOptions
Of course for this is required changes in tinyMCE to work with it
What would be a real improvement is the ability to define access levels not only in Extended mode but between Simple, Extended and Advanced.
I now have a working fork of the tinymce.php ( a new plugin ) where i'm completely rewriting the "onDisplay" method. I'm still using the tinymce media folder. It takes some time to find out which plugins I need to keep (or even add)
@infograf768
As a first step I think you are right but the code has to be reworked. It's hardcoded. A "designer", in smaller projects a Siuper User, could log in as a second user to get the authors rnenu/toolbar. I think, I wouid preferr only two different settings for frontend and backend where you can set all settings as now for the Extended mode (maybe some more) . Only the defaults would be different.
B/C problem?
I'm not trying to replace the 3.p Tinymce extension only some improvement for the standard installations and component developers. Remember the goal of "horizontal" extensions? That I agree with,
It came to me
Wouldn¨t it be possible to add a few parameters to the Extended mode to make it possible to generate what now is Advanced and Simple? This should be B/C and what @infograf768 suggested?
to change a library type
no need to change the library , I meant change tinyMCE plugin code
see staging...Fedik:tinymce-scriptoptions I tried something,
in result you can change the default options at runtime (after onDisplay
was called, and before Document will be rendered):
$editorOptions = $doc->getSriptOptions('plg_editor_tinymce');
$editorOptions['tinyMCE']['toolbar1'] = 'bla bla';
$editorOptions['tinyMCE']['plugins'] = 'foo bar';
$doc->addScriptOptions('plg_editor_tinymce', $editorOptions);
@Fedik
Great! As I understand it, you added a js ini in front of tinyMCE. I'm a js foo , without the bar.
Is it possible to add a toolbar2? It's the second row in the tinyMCE's toolbar and to control the menubar? e.g. I set the menubar to "menubar: false,:" if I don't need it. i.e.I try to come out with a single toolbar if possible.
How can I test it? Hack the files?
Is it possible to add a toolbar2?
you can modify any options
How can I test it? Hack the files?
well, yes, hack them
and can try to make a changes for tinyMCE options in plugin, at onBeforeRender event
public function onBeforeRender()
{
$doc = JFactory::getDocument();
$editorOptions = $doc->getScriptOptions('plg_editor_tinymce');
$editorOptions['tinyMCE']['menubar'] = false;
$editorOptions['tinyMCE']['toolbar1'] = 'bold italic underline strikethrough';
$doc->addScriptOptions('plg_editor_tinymce', $editorOptions);
}
But it was just a test
OK thanks! I'll test and come back. It can take some time though.
@Fedik
I ran article creation in backend with the changes made to the files.
First it faild with Error
Call to undefined method JDocumentHtml::addScriptOptions()
The method was missing in my J3.5.1 installation. Found it on Github.
Now it runs through but without editor.
The js code in the header is missing.
"tinymce.init({
directionality: "ltr",
..."
The 2 js files are loaded.
If I activate my plugin, I find the data in the doc ready to override.
Something more missing?
sorry, I forgot to mention that it will work only on 3.6 (or latest staging) with patch staging...Fedik:tinymce-scriptoptions
The js code in the header is missing.
yes because it moved to ..init.js file
So there is something more needed from 3.6? I have created the ..ini.js from your patch and it is loaded into the HTML header.
there also some changes in tinymce.php onDisplay
I have implemented all the code from your patch
then it is all
@Fedik
I installed a new Joomla instance from staging and implemented the patch + the override-plugin.
Maybe I overlook that the editor was loaded since it now starts in toggled mood. ( bug?! ), Clicking the toggle button shows the editor but not overridden. I get the standard layout. I use your example code. I also checked that the code runs and this line executes.
$doc->addScriptOptions('plg_editor_tinymce', $editorOptions);
The array is modified, I chacked that.!
then all should work, or my test patch not as good as I thought
@Fedik
I guess my problem is, that I used the modified 3.5.1 modified plugin code in the staging instance. I've seen that there are other changes made to the plugin that might be important for it to work. I'll test it more in a few days. I've bin working om my fork of the tinymce editor plugin. Now I have everything I wanted and more. I have three levels (as Joomla), single toolbar, normal and advanced. I can control who is to use wich level in frontend and backend with only 4 settings. User group multiselects.
It makes real fun to modify the tinyMce parameter and add a few js plugins. One of the reasons for my idea was to at least remove all image and videobuttons used in the editor. I have that separated, table controlled. But now I got interested in integrating elFinder with tinyMce. elFinder is a media manager I use in parallel anyway. (K2 is using it) What I have done, should also be possible with your onBeforeRender plugin. And less update problems.
@Fedik
I do not know exactly what the problem was. Only that there is a bug in the ini.js An infinite loop as variable i stays at 0. (i++)
Now I have the full toolbar set and see this without system plugin.
And this with activated override through the system plugin.
I hope you propose this for Joomla core. Let me know if you make a PR. I'll be glad to test it.
It will definitely be interesting to see a method in core to configure
tinymce differently for different users
@brianteeman
If Fediks code comes to a PR, I'll try to write an understandable doc how to achive different toolbar(s)/menubar for tinyMCE on usergroup level (I think user is to fine graded.). I used to be a fan of parameter settings but this interest has bin reduced lately. To allow to set all possible combinations for tinyMCE, the settings list would be long and complicated. It's of course also possible to make it component/view dependent with e.g. specific buttons/tinyMCE plug ins. It's up to the site implementor, SuperUser and developer.
I suppose a change to the tinyMCE plugin, to allow settings for users/user groups, is to complex for the J 3.x series. It should though be an issue for 4.x
I close this as we have a PR and this issue is referenced there.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-07-17 19:48:39 |
Closed_By | ⇒ | schnuti |
I think is far easier to create your own editor instead of trying to put more functionality into Joomla's distributed tinyMCE.
Pros: you put whatever makes sense for you
Against: you have to keep manually updating it, if bugs found
The idea is to keep the javascript files from the distributed files from Joomla, so all you have to do is create a plugin (an xml and a php file).