Puedes utilizar el componente ckEditor de de PrimeFaces y personalizar la configuración de esta forma.
Componente de PrimeFaces:
<pe:ckEditor id="editorPlantilla" widgetVar="wEditorPlantilla" value="#{plantillaControl.plantillaSelected.texto}" width="100%" height="500px" skin="kama"
toolbar="[['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'Undo', 'Redo'],
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'],
['NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote', 'CreateDiv'], ['HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Font', 'FontSize'], ['Table'], ['Maximize']]"
contentsCss="#{resource['/css/plantillaContrato.css']}" customConfig="#{resource['/js/config.js']}"
required="true" requiredMessage="Escriba el contenido de la plantilla" />
Este es el archivo config.js que yo he personalizado:
CKEDITOR.editorConfig = function (config) {
config.language = 'es';
config.height = 300;
config.toolbarCanCollapse = true;
config.allowedContent = true;
config.extraAllowedContent = 'span(*)';
config.enterMode = CKEDITOR.ENTER_BR;
config.fontSize_sizes = '8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt';
};
CKEDITOR.on('dialogDefinition', function (ev) {
// Take the dialog window name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName === 'table' || dialogName === 'tableProperties') {
// Estilo propio
var advTab = dialogDefinition.getContents('advanced');
// Width por defecto
var stylesField = advTab.get('advStyles');
stylesField ['default'] = 'width: 100%';
// Clase por defecto
var styleClassesField = advTab.get('advCSSClasses');
styleClassesField ['default'] = 'tabla';
//styleClassesField ['hidden'] = true;
var info = dialogDefinition.getContents('info');
var defAncho = info.get('txtWidth');
defAncho['default'] = '100%';
//defAncho['hidden'] = true;
var defHeader = info.get('selHeaders');
defHeader['default'] = 'row';
//defHeader['hidden'] = true;
}
});
CKEDITOR.on('instanceReady', function (ev) {
var blockTags = ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'li', 'blockquote', 'ul', 'ol',
'table', 'thead', 'tbody', 'tfoot', 'td', 'th', 'tr'];
for (var i = 0; i < blockTags.length; i++) {
ev.editor.dataProcessor.writer.setRules(blockTags[i], {
indent: false,
breakBeforeOpen: true,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: true
});
}
});
Es solo un ejemplo.