? ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
12 Mar 2017

Pull Request for Issue #14417.

Summary of Changes

This pull restore possibility to hide the ext-buttons per TinyMCE instance.

Testing Instructions

In the article form XML administrator/components/com_content/models/forms/article.xml add one more editor element (somewhere after line <fieldset name="basic" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">)

<field name="text2" type="editor" hide="menu,module,contact"
 label="Text2" description="" filter="JComponentHelper::filterText" buttons="true" />

Expected result

Now open the Article editing, you should got:

  • main editor contain all available ex-buttons
  • the additional editor do not have menu,module,contact buttons.

Actual result

Always displayed all buttons.

Documentation Changes Required

nope

avatar Fedik Fedik - open - 12 Mar 2017
avatar Fedik Fedik - change - 12 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Mar 2017
Category Administration com_content JavaScript External Library Front End Plugins
7efc54b 12 Mar 2017 avatar Fedik cs
avatar Fedik Fedik - change - 12 Mar 2017
Labels Added: ?
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 13 Mar 2017 - Tested unsuccessfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Mar 2017

I have tested this item ? unsuccessfully on 7efc54b

In none Tab a text2-Editor is shown.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 13 Mar 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Mar 2017

I have tested this item successfully on 7efc54b

On Tab Options Editor Text2 is shown (first changes in xml-File got not saved).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar Bakual
Bakual - comment - 29 Mar 2017

@Fedik Can you fix the conflicts in your PR please?

avatar Bakual Bakual - test_item - 29 Mar 2017 - Tested successfully
avatar Bakual
Bakual - comment - 29 Mar 2017

I have tested this item successfully on 7efc54b

This fixes the editor buttons for when they are set to hidden in the form xml. It also fixes the issue #14935 for that case.
However both issues remain for the case where the editor is added using a custom editor field.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar Fedik
Fedik - comment - 29 Mar 2017

@Bakual conflict fixed

avatar Bakual
Bakual - comment - 29 Mar 2017

Looks like it works now also for the custom fields. Either your conflict solving or me changing some settings in my testing site fixed it.
All good now as far as I see.

avatar Bakual Bakual - change - 29 Mar 2017
Status Pending Ready to Commit
avatar Bakual Bakual - test_item - 29 Mar 2017 - Tested successfully
avatar Bakual
Bakual - comment - 29 Mar 2017

I have tested this item successfully on 09b6ad3

Tested after conflict solving again.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar laoneo
laoneo - comment - 29 Mar 2017

I will test that pr tomorrow morning as well.

avatar Fedik
Fedik - comment - 29 Mar 2017

please remove RTC,
later I try to fis #14935 also, it is somehow related

avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Mar 2017
Status Ready to Commit Pending
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 29 Mar 2017

Remove RTC as wanted by @Fedik


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar PhilETaylor
PhilETaylor - comment - 30 Mar 2017

There are also merge conflicts now

avatar Bakual
Bakual - comment - 30 Mar 2017

There are also merge conflicts now

That's not true:

This branch has no conflicts with the base branch

avatar PhilETaylor
PhilETaylor - comment - 30 Mar 2017
avatar Fedik
Fedik - comment - 30 Mar 2017

There are also merge conflicts now

it is a last problem here ?

avatar Fedik
Fedik - comment - 30 Mar 2017

Please test now again.
+
Test these issues which also should be fixed: #14935 #14990

avatar Bakual Bakual - test_item - 30 Mar 2017 - Tested successfully
avatar Bakual
Bakual - comment - 30 Mar 2017

I have tested this item successfully on 96603d2

Tested both with my extension and a custom editor field.

  • Show Button setting is now respected both in form.xml and custom field parameter
  • Hide Button setting is now respected in both places as well and it also works when the parameter is empty
  • Buttons work as expected.
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.
avatar PhilETaylor
PhilETaylor - comment - 30 Mar 2017

This fixes #14935 #14990

BUT - incoming, another bug for you to fix - will log it now. This PR can be improved to fix that next bug.

avatar dgt41 dgt41 - test_item - 30 Mar 2017 - Tested successfully
avatar dgt41
dgt41 - comment - 30 Mar 2017

I have tested this item successfully on 96603d2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar dgt41 dgt41 - change - 30 Mar 2017
Status Pending Ready to Commit
avatar dgt41
dgt41 - comment - 30 Mar 2017

Thank you @Fedik

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14520.

avatar PhilETaylor PhilETaylor - comment - 30 Mar 2017
avatar PhilETaylor PhilETaylor - comment - 30 Mar 2017
avatar zero-24
zero-24 - comment - 30 Mar 2017

@PhilETaylor i think we can fix the other bug in a new PR. I'm merging this for now and we can fix the other bug with a new PR.

Thanks! ?

avatar zero-24 zero-24 - change - 30 Mar 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-03-30 20:16:33
Closed_By zero-24
Labels Added: ?
avatar zero-24 zero-24 - close - 30 Mar 2017
avatar zero-24 zero-24 - merge - 30 Mar 2017
avatar PhilETaylor PhilETaylor - comment - 30 Mar 2017
avatar dgt41
dgt41 - comment - 30 Mar 2017

``js
content = (new Function('return ' + options.editor))();

replace it with:
```js
if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) {
			content = window.parent.Joomla.editors.instances[editor].getContent()
		} else {
			content = (new Function('return ' + options.editor))();
		}

Simple fix

avatar laoneo
laoneo - comment - 31 Mar 2017

Good work!

avatar laoneo
laoneo - comment - 31 Mar 2017

Would that mean we can have now different editors on the same page? Then we can think about a setting in the editor custom field to define which editor should be loaded.

avatar Bakual
Bakual - comment - 31 Mar 2017

Would that mean we can have now different editors on the same page? Then we can think about a setting in the editor custom field to define which editor should be loaded.

As I understood @dgt41, different editors on the same page work if all editor-xtd plugins are rewritten to the new format. It doesn't work for those using the old format (which will be a lot 3rd party ones). So for now I wouldn't add the option to specify the editor type. With 4.0 we can add it.

avatar dgt41
dgt41 - comment - 1 Apr 2017

Would that mean we can have now different editors on the same page?

Not so soon :(
The problem is that all the existing editors (apart the core ones) are still using the old jInsertEditorText() which by design is not supporting multiple editors (different type).
On top of that as @Bakual wrote above all the XTDs are using as well the old method jInsertEditorText().

The only thing we could do is prepare all the plugins to use the new API if the editor supports it e.g.

if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) {
	content = window.parent.Joomla.editors.instances[editor].getContent()
} else {
	content = (new Function('return ' + options.editor))();
}

Also there is another instance that needs to follow the API in /administarator/components/com_fields/view/fields/tmpl/modal.php
instead of

fieldIns = function(id) {
	window.parent.jInsertEditorText("{field " + id + "}", "' . $editor . '");
	window.parent.jModalClose();
};
fieldgroupIns = function(id) {
	window.parent.jInsertEditorText("{fieldgroup " + id + "}", "' . $editor . '");
	window.parent.jModalClose();
};

we should use

fieldIns = function(id) {
if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) {
	window.parent.Joomla.editors.instances[editor].replaceSelection("{field " + id + "}")
} else {
	window.parent.jInsertEditorText("{field " + id + "}", "' . $editor . '");
}
	window.parent.jModalClose();
};
fieldgroupIns = function(id) {
if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) {
        window.parent.Joomla.editors.instances[editor].replaceSelection("{fieldgroup " + id + "}")
} else {
	window.parent.jInsertEditorText("{fieldgroup " + id + "}", "' . $editor . '");
}
	window.parent.jModalClose();
};
avatar PhilETaylor PhilETaylor - comment - 1 Apr 2017
avatar dgt41
dgt41 - comment - 1 Apr 2017

@PhilETaylor if we apply these changes to read more and fields modal view then all core components are supporting multiple (different types) editors per page.
But all 3rd PD editors and XTDs will not if they don't update their code to use the API

avatar PhilETaylor PhilETaylor - comment - 1 Apr 2017
avatar dgt41
dgt41 - comment - 1 Apr 2017

ok then, someone needs to copy paste those code snippets and create the PRs

Add a Comment

Login with GitHub to post a comment