Studio Developer Manual / Version 2310
Table Of ContentsWhen 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 4 plugin named
cmsymbolfontmapper
. So you may completely disable the
behavior by removing this plugin. The plugin depends on CKEditor 4 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.
Config(RichTextArea, { ...ConfigUtils.append({ plugins: [ Config(CustomizeCKEditorPlugin, { ckConfig: { symbolCharacterReplacementMap: { mode: 'add', 37:'&permil;', 64:'&#x1F4E7;', 65:'<b>A</b>' } } }), ], }), }),
Example 10.38. Configuring the rich text symbol mapping
Example 10.38, “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 a TypeScript
class, you also need to ensure that you do proper XML encoding. That is
why the configuration example contains the ampersand encoded as XML
entity &
.
Furthermore, the example shows that the character
'@'
(64) is replaced by a Unicode entity that 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 an own mapping.