Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE font_formats not updating list of fonts

I am trying to add the font "Noto Sans Arabic" to a TinyMCE editor, following the steps in the documentation.

However, the font does not seem to be added. I even tried to remove one of the default fonts using this method, but it seems the changes are not updated.

onload = function() {
        tinymce.init({
            selector: 'textarea',
            plugins: 'directionality anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount',
            toolbar: 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | addcomment showcomments | spellcheckdialog a11ycheck | align lineheight | checklist numlist bullist indent outdent | emoticons charmap | removeformat ltr rtl',
            tinycomments_mode: 'embedded',
            tinycomments_author: 'Admin',
            mergetags_list: [
                { value: 'First.Name', title: 'First Name' },
                { value: 'Email', title: 'Email' },
            ],
            font_formats: "Noto Sans Arabic=Noto Sans Arabic,sans-serif;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Oswald=oswald;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
            content_style: "@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800;900&display=swap'); body { font-family: 'Noto Sans Arabic', sans-serif; }",
            setup: function(editor) {
                editor.on('init', function(e) {
                    tinymce.activeEditor.execCommand('mceDirectionRTL');
                });
            },
        
        });
    }
<!-- TinyMCE -->
<script src="https://cdn.tiny.cloud/1/i0jjvygpcybj8iqjjpi4qxar5nmm0jxfaq0henyctlg38rld/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>


<textarea id="about_content">
  Some text here
</textarea>
like image 910
Anis R. Avatar asked Sep 21 '25 12:09

Anis R.


1 Answers

I'm assuming you are using TinyMCE6.

You are probably using the wrong keyword for that property.

Instead of using font_formats you should be using font_family_formats

You can find other updates here https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/

like image 59
José Antunes Avatar answered Sep 23 '25 02:09

José Antunes