HEX
Server: Apache/2
System: Linux server.cloudfly.vn 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64
User: root (0)
PHP: 7.4.29
Disabled: NONE
Upload Files
File: /home/dkhp464/public_html/wp-content/themes/DaKhoaHongPhat/assets/js/shortcode.js
/* jQuery(document).ready(function($) {
    tinymce.create('tinymce.plugins.wpse72394_plugin', {
        init : function(ed, url) {
                // Register command for when button is clicked
                ed.addCommand('wpse72394_insert_shortcode', function() {
                    //selected = tinyMCE.activeEditor.selection.getContent();

                    //if( selected ){
                        //If text is selected when button is clicked
                        //Wrap shortcode around it.
                        //content =  '[shortcode]'+selected+'[/shortcode]';
                    //}else{
                        //content =  '[shortcode]';
                    //}
					content = '[sdt]'

                    tinymce.execCommand('mceInsertContent', false, content);
                });

            // Register buttons - trigger above command when clicked
			//url = new URL('images', url);
            //ed.addButton('wpse72394_button', {title : 'Insert shortcode', cmd : 'wpse72394_insert_shortcode', image: url + '/x.png' });
			ed.addButton('wpse72394_button', {title : 'Insert shortcode', cmd : 'wpse72394_insert_shortcode', text: 'Phím tắt',  });
        },   
    });

    // Register our TinyMCE plugin
    // first parameter is the button ID1
    // second parameter must match the first parameter of the tinymce.create() function above
    tinymce.PluginManager.add('wpse72394_button', tinymce.plugins.wpse72394_plugin);
}); */

jQuery(document).ready(function($) {
    tinymce.create('tinymce.plugins.custom_mce_plugin', {
        init : function(editor, url) {
				
			editor.addButton('custom_mce_button', {
					text: 'Short Codes',
					icon: false,
					type: 'listbox',
					values: [
                       {
                        text: '[tuvan]',
                        onclick: function() {
                           editor.insertContent('[tuvan]');
                                  }
                        },
                       {
                        text: '[tuvantt]',
                        onclick: function() {
                           editor.insertContent('[tuvantt]');
                                 }
                       },
					   {
                        text: '[sdt]',
                        onclick: function() {
                           editor.insertContent('[sdt]');
                                  }
                        },
						{
                        text: '[diachi]',
                        onclick: function() {
                           editor.insertContent('[diachi]');
                                  }
                        },
                        {
                        text: '[bacsituvan]',
                        onclick: function() {
                           editor.insertContent('[bacsituvan]');
                                  }
                        },
                        {
                        text: '[open_time]',
                        onclick: function() {
                           editor.insertContent('[open_time]');
                                  }
                        },
						{
                        text: '[tenpk]',
                        onclick: function() {
                           editor.insertContent('[tenpk]');
                                  }
                        },
						{
                        text: '[khuvucpk]',
                        onclick: function() {
                           editor.insertContent('[khuvucpk]');
                                  }
                        },
						{
                        text: '[zalo]',
                        onclick: function() {
                           editor.insertContent('[zalo]');
                                  }
                        },
                         {
                        text: '[gif_uu_dai]',
                        onclick: function () {
                            editor.insertContent('[gif_uu_dai]');
                        }
                        },
                        {
                        text: '[form_test_nk]',
                        onclick: function () {
                            editor.insertContent('[form_test_nk]');
                        }
                    },
                       ]
			});
        },   
    });

    // Register our TinyMCE plugin
    // first parameter is the button ID1
    // second parameter must match the first parameter of the tinymce.create() function above
    tinymce.PluginManager.add('custom_mce_button', tinymce.plugins.custom_mce_plugin);
});