Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发帖时没有编辑选项 #9701

Open
17gather opened this issue Jun 26, 2024 · 14 comments
Open

发帖时没有编辑选项 #9701

17gather opened this issue Jun 26, 2024 · 14 comments

Comments

@17gather
Copy link

1
2

Copy link

Thank you for the report, we will looking soon at the issue

@xillibit
Copy link
Member

So what is the issue ?

@17gather
Copy link
Author

17gather commented Jun 28, 2024 via email

@xillibit
Copy link
Member

xillibit commented Jul 3, 2024

Please provide more details : Kunena version used, kunena template used

In which case it doesn't load like you show ti on your second screenshot ?

@rich20
Copy link
Member

rich20 commented Jul 3, 2024

@17gather Please post the problem in the forum: https://www.kunena.org/forum/recent
Github is for development and not for support.

Copy link

github-actions bot commented Aug 5, 2024

This issue is stale because it has been open 30 days with no activity.

@c-schmitz
Copy link
Contributor

c-schmitz commented Sep 3, 2024

I can reproduce the issue. Correct title for this issue would be 'Message editor does not load'.
The reason is that if you use Kunena in a different language than English, the CKeditor (behind the MEssage editor) tries to load a language specific file from /media/kunena/core/js/lang .
So, for Spanish it would look for /media/kunena/core/js/lang/es.js.
However, these files are not provided, neither in the base package, nor in the language package.
Copying them from the standard CKeditor package resolves the issue.

I can only reproduce the issue in Chrome, not in Firefox, btw.

@rich20
Copy link
Member

rich20 commented Sep 3, 2024

I can only reproduce the issue in Chrome, not in Firefox, btw.

Maybe a cache problem.
I have tested it and cannot reproduce this problem. The language pack on our download page contains both the Spanish and the Chinese language of the topic author.
Both language scripts are installed, provided that this language is already installed in Joomla. Download and installation of the current language file, solves both language problems and so i close this ticket.

@rich20 rich20 closed this as completed Sep 3, 2024
@c-schmitz
Copy link
Contributor

Why was this closed? I can reproduce it right here. It is NOT a cache problem.

@c-schmitz
Copy link
Contributor

Firefox seems to be a bit more lenient, as it does not crash out on the following JS when the particualr language file cannot be loaded.
The files are definitely missing.

@rich20
Copy link
Member

rich20 commented Sep 4, 2024

Then I open the ticket again, although the error cannot be reproduced. I have tested it with Chromium, Firefox and Opera.
.
Bildschirmfoto vom 2024-09-04 13-15-15
.
image10

@c-schmitz
Copy link
Contributor

c-schmitz commented Sep 5, 2024

I did not write that the language pack is not installed. I wrote that there are missing files for CKeditor.
In the directory
/media/kunena/core/js/lang there is only en.js

The Kunena language pack does not add any .js files to that directory, but in my Kunena installation for a Spanish user the editor starts to look for a file /media/kunena/core/js/lang/es.js - which does not exist and causes the editor window not to load.

Why does it do that? I am trying to figure that out right now.

@c-schmitz
Copy link
Contributor

I might have a lead what is going on.
First of all, yes the Kunena language package contains the ckeditor JS file (I was wrong here), but I can see is that the package only installs the languages that are currently installed in Joomla. This was unexpected. It means whenever I install a new language I need to re-install the Kunena Language pack.

Anyway, in our particular configuration however we have es-MX as language saved as default in the user profile. The language does not exist in the site, anymore, and Joomla is handling this gracefully.

Kunena however tries to load the language file for the non-existing language, failing to do so, and so the editor does not appear.

This imho happens because in ckeditor_config.js just sets whatever is set as language in the user profile without checking if the language does even exist in Joomla.

	if (Joomla.getOptions('com_kunena.ckeditor_userdefaultlanguage') != 'default') {
		config.defaultLanguage = '' + Joomla.getOptions('com_kunena.ckeditor_userdefaultlanguage') + '';
	} else {
		var joomlaLanguage = Joomla.getOptions('com_kunena.ckeditor_joomladefaultlanguage');

		if (joomlaLanguage != 'en') {
			config.defaultLanguage = '' + joomlaLanguage + '';
		}
	}

See ckeditor.php

$user = Factory::getApplication()->getIdentity();
$userLanguage = $user->getParam('language', 'default'); // Needs a check here if the language is even installed
$joomlaLanguage = Factory::getApplication()->getLanguage()->getLocale();

@c-schmitz
Copy link
Contributor

c-schmitz commented Sep 6, 2024

Fix:

In the top of ckeditor.php add

use Joomla\CMS\Language\LanguageHelper

Following lines after the above code would imho fix this:

$user = Factory::getApplication()->getIdentity();
$userLanguage = $user->getParam('language', 'default'); // Needs a check here if the language is even installed
if (!LanguageHelper::exists($userLanguage)) { 
   $userLanguage = 'default';
}
$joomlaLanguage = Factory::getApplication()->getLanguage()->getLocale();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants