CKEDITOR.plugins.pastetools.filters.common.rtf
Filtering
Methods
-
since 4.16.0 private
extractGroupContent( group ) → String
CKEDITOR.plugins.pastetools.filters.common.rtf#extractGroupContent
Get group content.
The content starts with the first character that is not a part of control word or subgroup.
var group = '{\\group{\\subgroup subgroupcontent} group content}', groupContent = CKEDITOR.plugins.pastetools.filters.common.rtf.extractGroupContent( group ); console.log( groupContent ); // "group content"
Parameters
group : String
Whole group string.
Returns
String
Extracted group content.
-
since 4.16.0 private
getGroup( content, groupName, options ) → GroupInfo
CKEDITOR.plugins.pastetools.filters.common.rtf#getGroup
Get the group from the RTF content with the given name.
Groups are recognized thanks to being in
{\<name>}
format.var rtfContent = '{\\rtf1\\some\\control\\words{\\group content1}{\\group content2}{\\whatever {\\subgroup content}}}', firstGroup = CKEDITOR.plugins.pastetools.filters.common.rtf.getGroup( rtfContent, '(group|whatever)' ), lastGroup = CKEDITOR.plugins.pastetools.filters.common.rtf.getGroup( rtfContent, '(group|whatever)', { start: 50 } ); console.log( firstGroup ); // {"start":25,"end":42,"content":"{\\group content1}"} console.log( lastGroup ); // {"start":59,"end":90,"content":"{\\whatever {\\subgroup content}}"}
Parameters
content : String
RTF content.
groupName : String
Group name to find. It can be a regex-like string.
options : Object
Additional options.
Returns
GroupInfo
-
since 4.16.0 private
getGroups( rtfContent, groupName ) → GroupInfo[]
CKEDITOR.plugins.pastetools.filters.common.rtf#getGroups
Get all groups from the RTF content with the given name.
var rtfContent = '{\\rtf1\\some\\control\\words{\\group content}{\\group content}{\\whatever {\\subgroup content}}}', groups = CKEDITOR.plugins.pastetools.filters.common.rtf.getGroups( rtfContent, '(group|whatever)' ); console.log( groups ); // Result of the console.log: // [ // {"start":25,"end":41,"content":"{\\group content}"}, // {"start":41,"end":57,"content":"{\\group content}"}, // {"start":57,"end":88,"content":"{\\whatever {\\subgroup content}}"} // ]
Parameters
rtfContent : String
groupName : String
Group name to find. It can be a regex-like string.
Returns
GroupInfo[]
-
since 4.16.0 private
removeGroups( rtfContent, groupName ) → String
CKEDITOR.plugins.pastetools.filters.common.rtf#removeGroups
Remove all groups from the RTF content with the given name.
var rtfContent = '{\\rtf1\\some\\control\\words{\\group content}{\\group content}{\\whatever {\\subgroup content}}}', rtfWithoutGroups = CKEDITOR.plugins.pastetools.filters.common.rtf.removeGroups( rtfContent, '(group|whatever)' ); console.log( rtfWithoutGroups ); // {\rtf1\some\control\words}
Parameters
rtfContent : String
groupName : String
Group name to find. It can be a regex-like string.
Returns
String
RTF content without the removed groups.