ckeditor5 fontSize pt examples

This commit is contained in:
Sahatsawat Kanpai 2025-01-07 09:47:55 +07:00
parent e98f74f169
commit c51b8d419e

View File

@ -30,7 +30,8 @@ import {
FontFamily,
FontColor,
FontSize,
FontBackgroundColor
FontBackgroundColor,
Alignment
} from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
@ -67,7 +68,8 @@ ClassicEditor
FontFamily,
FontColor,
FontSize,
FontBackgroundColor
FontBackgroundColor,
Alignment
],
toolbar: [
'undo',
@ -77,6 +79,8 @@ ClassicEditor
'|',
'heading',
'|',
'alignment',
'|',
'bold',
'italic',
'link',
@ -113,6 +117,14 @@ ClassicEditor
'tableRow',
'mergeTableCells'
]
},
fontSize: {
options: [
generatePtSetting( 14 ),
generatePtSetting( 16 ),
generatePtSetting( 18 ),
generatePtSetting( 20 )
]
}
} )
.then( editor => {
@ -123,3 +135,16 @@ ClassicEditor
.catch( err => {
window.console.error( err.stack );
} );
function generatePtSetting( size: number ): any {
return {
model: size,
title: `${ size }pt`,
view: {
name: 'span',
styles: {
'font-size': `${ size }pt`
}
}
};
}