var range = null;
var editor = CKEDITOR.replace('editor1', {
height: 600,
filebrowserBrowseUrl : '/elfinder/finder.html?CKEditorFuncNum=1',
filebrowserImageBrowseUrl : '/elfinder/finder.html?CKEditorFuncNum=2',
templates_replaceContent: 0,
templates: 'default',
extraPlugins: 'simplebox,bootstrapTabs,templates,magicline',
removePlugins: 'save',
removeButtons: 'templates',
baseHref: 'https://www.astrodata.com/',
contentsCss: '/Portals/0/HtmlEditor.css',
/*
pasteFromWordPromptCleanup: true,
allowedContent: '',
extraAllowedContent: 'u;span{color}',
disallowedContent: 'p{margin-bottom};span{font,font-size,font-family,line-height}',
allowedContent: {script: true, button: true,
$1: {
// This will set the default set of elements
elements: CKEDITOR.dtd,
attributes: true,
styles: true,
classes: true
} }
*/
extraAllowedContent: {script: true, button: true,
$1: {
// This will set the default set of elements
elements: CKEDITOR.dtd,
attributes: true,
styles: true,
classes: true
} }
});
CKEDITOR.addTemplates( 'default', {imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ), templates : [ {title: 'Horoskop', image: 'HoroskopStd.gif', description: 'Horoskop mit Vergrösserung', html: '
Horoskop
01.01.2000 12:00 LT, 11:00 GT
Zürich, CH (47N23, 08E32)
'}, {title: 'Bild und Text (Bild links)', image: 'TextPictureLeft.gif', description: 'Bild und Text (Bild links)', html: '
Type the text here
'}, {title: 'Bild und Text (Bild rechts)', image: 'TextPictureRight.gif', description: 'Bild und Text (Bild rechts)', html: 'Type the text here
'} ] }); editor.addCommand('cmdTemplatedefault', { exec: function(edt) { editor.config.templates = 'default'; editor.execCommand( 'templates' ) } }); editor.ui.addButton('btnTemplatedefault', { label: 'Templates default', command: 'cmdTemplatedefault', toolbar: 'doctools,20', icon: CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ) + 'defaultTemplateIcon.png' }); editor.on( 'afterPasteFromWord', function( evt ) { var filter = new CKEDITOR.filter( 'p b i u; a[!href]; p{text-align}' ), // Use custom new filter. fragment = CKEDITOR.htmlParser.fragment.fromHtml( evt.data.dataValue ), writer = new CKEDITOR.htmlParser.basicWriter(); filter.applyTo( fragment ); fragment.writeHtml( writer ); evt.data.dataValue = writer.getHtml(); }); CKEDITOR.on('instanceReady', function(){ setFocus(); }, null, null, 1000); function getContent(){ return editor.getData(); } function setContent(value) { editor.setData(value); // Check the active editing mode. if (editor.mode == 'wysiwyg') { editor.insertHtml(value); } else { //alert('You must be in WYSIWYG mode!'); editor.insertHtml(value); } } function setFocus(){ editor.on('afterSetData', function(){ setTimerFocus(); }, null, null, 1000); editor.focus(); range = editor.createRange(); if (range != null){ range.moveToElementEditablePosition( editor.editable(), false ); // bar.^ editor.getSelection().selectRanges( [ range ] ); } //editor.execCommand('maximize'); } function setTimerFocus(){ setTimeout(refreshFocus, 1000); } function refreshFocus(){ editor.focus(); range = editor.createRange(); if (range != null){ range.moveToElementEditablePosition( editor.editable(), false ); // bar.^ editor.getSelection().selectRanges( [ range ] ); } }