Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Apr 16, 2018
1 parent 8d4298e commit 3d22077
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/highlightediting.js
Expand Up @@ -8,6 +8,7 @@
*/

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import AttributeElement from '@ckeditor/ckeditor5-engine/src/view/attributeelement';

import HighlightCommand from './highlightcommand';

Expand Down Expand Up @@ -107,9 +108,14 @@ function _buildDefinition( options ) {

for ( const option of options ) {
definition.model.values.push( option.model );
definition.view[ option.model ] = {
name: 'mark',
classes: option.class
definition.view[ option.model ] = ( modelAttributeValue, viewWriter ) => {
if ( modelAttributeValue !== option.model ) {
return null;
}

const attributes = { priority: AttributeElement.DEFAULT_PRIORITY + 5 };

return viewWriter.createAttributeElement( 'mark', { class: option.class }, attributes );
};
}

Expand Down

0 comments on commit 3d22077

Please sign in to comment.