Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/web/ckeditor-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<forms>
       <dependencies>
        <!-- Include some extra assets -->
<js src="/modules/editors/ckeditor/ini.js" />
<js src="/modules/editors/ckeditor/ckeditor.js" />
<js src="/components/editors/ckeditor/ckeditorloader.js" />
       </dependencies>
</forms>
</config>
</alfresco-config>
</alfresco-config>
53 changes: 53 additions & 0 deletions source/web/components/editors/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,57 @@ CKEDITOR.editorConfig = function( config )
['Link','Unlink','Anchor'],
['Maximize','-','About']
];


CKEDITOR.on( 'instanceReady', function( ev )
{
var editor = ev.editor,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;

// Output properties as attributes, not styles.
htmlFilter.addRules(
{
elements :
{
$ : function( element )
{
// Output dimensions of images as width and height
if ( element.name == 'img' )
{
var style = element.attributes.style;

if ( style )
{
// Get the width from the style.
var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style ),
width = match && match[1];

// Get the height from the style.
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style );
var height = match && match[1];

if ( width )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width;
}

if ( height )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height;
}
}
}

if ( !element.attributes.style )
delete element.attributes.style;

return element;
}
}
});
});

};
4 changes: 4 additions & 0 deletions source/web/modules/editors/ckeditor/ini.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// Alfresco 4.x path rewrite :
var CKEDITOR_BASEPATH = '../../../res/modules/editors/ckeditor/';