Tinymce-4 with custom buttons that work fine in Chrome and Firefox. But does not work in Safari. Why?

OK .. I'm currently working on custom editorusing tinymce. I used several button control methods to execute this control from the site tinymce toolbar. and maybe I did this and it works fine in Chrome and Firefox.

But when I turned my head to Safari... I was exhausted, because what I did .. is 2 days of work, and I can’t believe that it does not work in Safari.

I am using the latest version of TinyMce with a built-in editor.

PLEASE CHECK THIS FIDDLE

[UPDATED]

Here is my code:

CSS

<style>
    .buttons { float:left;margin:10px;border:1px solid black;padding:4px 7px; }
</style>

Javascript

<script type="text/javascript">

tinymce.PluginManager.add('example', function(e) {
        function customfunction() {
                    e.focus(true);
                    alert('Hello TinyMce');
            }


    e.addButton('testButton', {
        id: "testButton",
        text: 'Example',
        icon: false,
        onclick: function() {
                customfunction();
            }
        });
}
);
tinymce.init({
        selector: "#textareasDiv",
        inline: true,
        plugins: "example",
        toolbar: "testButton",
        menubar: false,
        fixed_toolbar_container: "#toolbarCon",     
        inline_styles : true,

    });

function customfunction()
{

    document.getElementById("testButton").click();
}

</script>

HTML

<div id="textareasDiv" style="width:200px;height:100px;border:1px solid black">Please select the text and click any of these buttons.</div>
<div id="toolbarCon" style="display:none;"></div>

<a href="#" onclick="tinyMCE.execCommand('Bold');return false;"><div class="bold buttons">B</div></a>
<a href="#" onclick="tinyMCE.execCommand('Italic');return false;"><div class="italic buttons"><em>I</em></div></a>
<a href="#" onclick="tinyMCE.execCommand('Underline');return false;"><div class="underline buttons">U</div></a>
<a href="#" onclick="tinyMCE.execCommand('FontName',false,'Andale Mono');return false;"><div class="jLeft buttons" >Andale Mono</div></a>
<a href="#" onclick="tinyMCE.execCommand('FontName',false,'Courier New');return false;"><div class="jCenter buttons" >Courier New</div></a>
<a href="#" onclick="tinyMCE.execCommand('FontName',false,'Tahoma');return false;"><div class="jRight buttons" >Tahoma</div></a>
<a href="#" onclick="tinyMCE.execCommand('FontName',false,'Impact');return false;"><div class="jRight buttons" >Impact</div></a>
<a href="#" onclick="customfunction();return false;"><div class="jRight buttons" >Custom Button</div></a>

There are some problems when I run this script on Safarias well as my own file.

  • - " ", . ?

  • , "", , , . ?

  • - , . .

, tinymce demo page , Safari, Bold,Italic,Underline.

Chrome and FireFox. Safari. tinymce? - ?

+4
1

check done small changes this http://fiddle.tinymce.com/ngdaab/535

 $("#testButton2").children("button").click();
+2

Source: https://habr.com/ru/post/1542756/


All Articles