Forum Replies Created

Viewing 1 replies (of 1 total)
  • var ICONS;
    
    	var setIconShortcode = function(id) {
    		return '[wc_fa icon="' + id + '" margin_left="" margin_right=""][/wc_fa]';
    	}
    
    	var icon = function(id) {
    		return '<i class="fa fa-' + id + '"></i>';
    	}
    
    	function getHtml() {
    		var Html;
    
    		Html = '<div style="overflow-y: scroll;height:500px;width:200px"><table role="list" class="mce-grid">';
    
    		tinymce.each(ICONS, function( name ) {
    			Html += '<tr>';
    
    				Html += '<td style="width: 200px; height: 25px; padding: 3px;"><a href="#" data-mce-alt="' + name + '" tabindex="-1" ' +
    					'role="option" aria-label="' + name + '">' + icon(name) + " " + name +'</a></td>';
    			Html += '</tr>';
    		});
    
    		Html += '</table></div>';
    
    		return Html;
    	}
    
    	var wcShortcodeFA = function( editor, url ) {
    
    		editor.addButton('wpcfontAwesomeGlyphSelect', function() {
    
    			return {
    			type: 'panelbutton',
    			text: 'Icons',
    			icon: 'fa-puzzle-piece',
    			panel: {
    			role: 'application',
    			autohide: true,
    			html: getHtml,
    			onclick: function(e) {
    				var linkElm = editor.dom.getParent( e.target, 'a' );
    
    				if ( linkElm ) {
    					editor.insertContent(
    						' ' + setIconShortcode(linkElm.getAttribute('data-mce-alt')) + ' '
    					);
    
    					this.hide();
    				}
    			}
    		},
    			};
    		});
    	};
    	tinymce.PluginManager.add( 'wpc_font_awesome', wcShortcodeFA );
Viewing 1 replies (of 1 total)