client/src/HtmlSerializer.js
changeset 25 e04714a1d4eb
parent 21 284e866f55c7
child 157 5c3af4f10e92
equal deleted inserted replaced
24:3b3999550508 25:e04714a1d4eb
     8 // Add a dictionary of mark tags.
     8 // Add a dictionary of mark tags.
     9 const MARK_TAGS = {
     9 const MARK_TAGS = {
    10   em: 'italic',
    10   em: 'italic',
    11   strong: 'bold',
    11   strong: 'bold',
    12   u: 'underline',
    12   u: 'underline',
    13   annotation: 'span'
    13   category: 'span'
    14 }
    14 }
    15 
    15 
    16 const rules = [
    16 const rules = [
    17   // Block rules
    17   // Block rules
    18   {
    18   {
    49       if (object.kind !== 'mark') return
    49       if (object.kind !== 'mark') return
    50       switch (object.type) {
    50       switch (object.type) {
    51         case 'bold': return <strong>{children}</strong>
    51         case 'bold': return <strong>{children}</strong>
    52         case 'italic': return <em>{children}</em>
    52         case 'italic': return <em>{children}</em>
    53         case 'underline': return <u>{children}</u>
    53         case 'underline': return <u>{children}</u>
    54         case 'annotation': return <span style={{ backgroundColor: object.data.get('color') }}>{children}</span>
    54         case 'category': return <span style={{ backgroundColor: object.data.get('color') }}>{children}</span>
    55         default: return;
    55         default: return;
    56       }
    56       }
    57     }
    57     }
    58   }
    58   }
    59 ]
    59 ]