|
@@ -30,6 +30,7 @@ export default class FontFamilyEditing extends Plugin {
|
|
|
// Define default configuration using named presets
|
|
// Define default configuration using named presets
|
|
|
editor.config.define( 'fontFamily', {
|
|
editor.config.define( 'fontFamily', {
|
|
|
items: [
|
|
items: [
|
|
|
|
|
+ 'default',
|
|
|
'Arial, Helvetica, sans-serif',
|
|
'Arial, Helvetica, sans-serif',
|
|
|
'Courier New, Courier, monospace',
|
|
'Courier New, Courier, monospace',
|
|
|
'Georgia, serif',
|
|
'Georgia, serif',
|
|
@@ -46,12 +47,14 @@ export default class FontFamilyEditing extends Plugin {
|
|
|
const editing = editor.editing;
|
|
const editing = editor.editing;
|
|
|
|
|
|
|
|
// Add converters from view to model.
|
|
// Add converters from view to model.
|
|
|
- for ( const item of this.configuredItems ) {
|
|
|
|
|
|
|
+ const items = this.configuredItems.filter( item => item.model !== 'default' );
|
|
|
|
|
+
|
|
|
|
|
+ for ( const item of items ) {
|
|
|
viewToModelAttribute( 'fontFamily', item, [ data.viewToModel ] );
|
|
viewToModelAttribute( 'fontFamily', item, [ data.viewToModel ] );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Covert from model to view.
|
|
// Covert from model to view.
|
|
|
- modelAttributeToViewAttributeElement( 'fontFamily', this.configuredItems, [ data.modelToView, editing.modelToView ] );
|
|
|
|
|
|
|
+ modelAttributeToViewAttributeElement( 'fontFamily', items, [ data.modelToView, editing.modelToView ] );
|
|
|
|
|
|
|
|
// Add FontSize command.
|
|
// Add FontSize command.
|
|
|
editor.commands.add( 'fontFamily', new FontFamilyCommand( editor ) );
|
|
editor.commands.add( 'fontFamily', new FontFamilyCommand( editor ) );
|
|
@@ -100,6 +103,13 @@ function getItemDefinition( item ) {
|
|
|
return item;
|
|
return item;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ( item === 'default' ) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ title: 'Default', // TODO localize us
|
|
|
|
|
+ model: 'default'
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Ignore falsy values
|
|
// Ignore falsy values
|
|
|
if ( typeof item !== 'string' ) {
|
|
if ( typeof item !== 'string' ) {
|
|
|
return;
|
|
return;
|