close

Filter

loading table of contents...

Studio Developer Manual / Version 2010

Table Of Contents

7.4.5.4 Customizing the Symbol Mapping

When pasting rich text from Microsoft Word into CoreMedia Studio, some characters of the pasted text might originate from the Word symbol font. CoreMedia Studio maps such characters to their named entities or Unicode equivalents using a mapping table.

The replacement is done by a CKEditor plugin named cmsymbolfontmapper. So you may completely disable the behavior by removing this plugin. The plugin depends on CKEditor plugin Paste from Word and registers a listener to the event afterPasteFromWord with priority 10.

You can modify the behavior by either adding a listener to the event or by configuring the replacement map. You have the option either to add or replace existing mappings or to provide your very own mapping.

<ui:RichTextArea>
  <ui:plugins exml:mode="append">
    <ui:CustomizeCKEditorPlugin>
      <ui:ckConfig>
        <fx:Object symbolCharacterReplacementMap="{{
          mode: 'add',
          37:'&amp;permil;',
          64:'&amp;#x1F4E7;',
          65:'<b>A</b>'
          }}"
        />
      </ui:ckConfig>
    </ui:CustomizeCKEditorPlugin>
  </ui:plugins>
</ui:RichTextArea>

Example 7.27. Configuring the rich text symbol mapping


The example Example 7.27, “Configuring the rich text symbol mapping” demonstrates how to add and override additional mappings for the symbol font. The map consists of key-value pairs where the keys are the character codes to replace and the values are their HTML replacement, which is most likely an entity but you may also specify any HTML code. In the example the character 'A' (65) is replaced by itself and wrapped by a bold tag.

It is important to note that the resulting HTML code must be properly encoded. If you are configuring the replacement map within MXML, you also need to ensure that you do proper XML encoding. That is why the configuration example contains the ampersand encoded as XML entity &amp;.

Furthermore, the example shows that the character '@' (64) is replaced by a Unicode entity which represents an email symbol and the character '%' (37) which is replaced by a named entity for the per mile sign.

The mode is either add or replace, where add is the default and fallback for unknown modes. add will add or override symbol mappings while replace will create a very own mapping.

Search Results

Table Of Contents