Skip to content

Instantly share code, notes, and snippets.

@anakadote
Last active March 8, 2017 22:46
Show Gist options
  • Save anakadote/d2e6cba41305fa98d25b3a057ecb1b59 to your computer and use it in GitHub Desktop.
Save anakadote/d2e6cba41305fa98d25b3a057ecb1b59 to your computer and use it in GitHub Desktop.
A TinyMCE 4.* plugin to add support for Fonts.com fonts - place in a new folder at tinymce/plugins/fontsdotcom/ and replace src URL. Don't forget to add "fontsdotcom" to your TinyMCE "plugins" config array.
tinymce.PluginManager.add('fontsdotcom', function(editor) {
editor.on('init', function() {
// Get the DOM document object for the IFRAME
var doc = this.getDoc();
// Create a script element and insert the Fonts.com URL into it
var script = doc.createElement("script");
script.type = "text/javascript";
script.src = "//fast.fonts.net/jsapi/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.js";
// Add the script to the header
doc.getElementsByTagName('head')[0].appendChild(script);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment