Owen Leonard
374f59f3cd
This patch updates the TinyMCE editor to the latest version (5.0.16) and adds a translatable include file which will allow the TinyMCE interface to show the same translation as Koha. The configuration of the editor has been updated according to the new version's requirements, keeping all the tools available we had before and adding emoji support. To test, apply the patch and enable the UseWYSIWYGinSystemPreferences system preference. TESTING THE UPGRADED EDITOR - Go to Administration -> System preferences -> OPAC. - Multiple instances of the TinyMCE editor should appear on the page: opaccredits, OpacCustomSearch, OpacLoginInstructions, etc. - Test adding and editing content to one or more of these editors. Confirm that the various editor tools work correctly. - Verify that changing the contents of any editor (including via paste) enables the corresponding "Save all X preferences" button. - Test the news editor under Tools -> News. - Test the library "OPAC info" editor in libraries administration: Administration -> Libraries -> Edit library -> OPAC info. TESTING TRANSLATABILITY - Update a translation: > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for the staff client, e.g. misc/translator/po/fr-FR-staff-prog.po - Locate strings pulled from includes/str/tinymce_i18n.inc for translation, e.g.: #. SCRIPT #: intranet-tmpl/prog/en/includes/str/tinymce_i18n.inc:1 #, fuzzy msgid "File" msgstr "Fichier :" - Edit the "msgstr" string however you want (it's just for testing) and remove the "fuzzy" line. - Install the updated translation: > perl translate install fr-FR - Go to Administration -> System preferences -> OPAC. - In each instance of the TinyMCE editor, the first menu item should have as its label the translation "msgstr" string you edited. - Check that the "About" page shows updated information about the TinyMCE version, 5.0.16. Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% #Enable tinymce for system preferences %]
|
|
[% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
|
|
[% INCLUDE 'str/tinymce_i18n.inc' %]
|
|
|
|
<script>
|
|
// Save TinyMCE content and trigger an event on the original element
|
|
function wysiwyg_change (ed){
|
|
ed.save();
|
|
var original_textarea = ed.getElement();
|
|
$(original_textarea).trigger("input");
|
|
}
|
|
|
|
tinyMCE.init({
|
|
branding : false,
|
|
content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
|
|
editor_selector : "mce",
|
|
menubar : "file edit view insert format tools table",
|
|
mode : "specific_textareas",
|
|
plugins : "autoresize table hr link image charmap lists code emoticons",
|
|
toolbar : [
|
|
"formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
|
|
"table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
|
|
],
|
|
init_instance_callback: function (editor) {
|
|
editor.on('Dirty', function (e) {
|
|
// When a change has been made to the contents of an editor,
|
|
// enable the corresponding preference Save button
|
|
wysiwyg_change( editor );
|
|
});
|
|
}
|
|
});
|
|
</script>
|