Skip to content

Instantly share code, notes, and snippets.

@pratik60
Created October 7, 2014 18:35
Show Gist options
  • Select an option

  • Save pratik60/051ecb1677db97022169 to your computer and use it in GitHub Desktop.

Select an option

Save pratik60/051ecb1677db97022169 to your computer and use it in GitHub Desktop.
TinyMCE service
'use strict';
angular.module('mean.misc').factory('tinyMCE', function($rootScope) {
var tinymceOptions = {
menubar: true,
toolbar: 'undo redo | styleselect | fontselect fontsizeselect forecolor backcolor | bold italic underline separator strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist | indent outdent | link unlink image table | code fullscreen',
width: 900,
height: 600,
resize: false,
style_formats: [{
title: 'Headers',
items: [{
title: 'Header 1',
format: 'h1'
}, {
title: 'Header 2',
format: 'h2'
}, {
title: 'Header 3',
format: 'h3'
}, {
title: 'Header 4',
format: 'h4'
}, {
title: 'Header 5',
format: 'h5'
}, {
title: 'Header 6',
format: 'h6'
}]
}, {
title: 'Inline',
items: [{
title: 'Bold',
icon: 'bold',
format: 'bold'
}, {
title: 'Italic',
icon: 'italic',
format: 'italic'
}, {
title: 'Underline',
icon: 'underline',
format: 'underline'
}, {
title: 'Strikethrough',
icon: 'strikethrough',
format: 'strikethrough'
}, {
title: 'Superscript',
icon: 'superscript',
format: 'superscript'
}, {
title: 'Subscript',
icon: 'subscript',
format: 'subscript'
}, {
title: 'Code',
icon: 'code',
format: 'code'
}]
}, {
title: 'Blocks',
items: [{
title: 'Paragraph',
format: 'p'
}, {
title: 'Blockquote',
format: 'blockquote'
}, {
title: 'Div',
format: 'div'
}, {
title: 'Pre',
format: 'pre'
}]
}, {
title: 'Alignment',
items: [{
title: 'Left',
icon: 'alignleft',
format: 'alignleft'
}, {
title: 'Center',
icon: 'aligncenter',
format: 'aligncenter'
}, {
title: 'Right',
icon: 'alignright',
format: 'alignright'
}, {
title: 'Justify',
icon: 'alignjustify',
format: 'alignjustify'
}]
}, {
title: 'Image Left',
selector: 'img',
styles: {
'float': 'left',
'margin': '0 10px 0 10px'
}
}, {
title: 'Image Right',
selector: 'img',
styles: {
'float': 'right',
'margin': '0 0 10px 10px'
}
}],
plugins: ['autolink', 'code', 'colorpicker', 'fullscreen', 'image', 'link', 'lists', 'media', 'print', 'searchreplace', 'spellchecker', 'table', 'textcolor', 'wordcount'],
file_browser_callback: function(field_name, url, type, win) {
if (type === 'image') $('#my_form input').click();
}
};
return tinymceOptions;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment