Copy and paste text formatting like Word’s format painter.
Select styled text, copy its format, then apply to other text - all in two clicks.
How it works
Select text with formatting you want to copy
Click Format Painter (format is now stored)
Select target text
Click Format Painter again to apply
Use case
Consistency - Apply the same styling across multiple sections
Speed - Faster than manually applying multiple formats
Cleanup - Use Clear Format to remove unwanted styling
Commands
Clear all formatting (nodes and marks)
Removes all marks and resets nodes to default paragraph
Example:
editor . commands . clearFormat ()
import { SuperDoc } from 'superdoc' ;
import 'superdoc/style.css' ;
const superdoc = new SuperDoc ({
selector: '#editor' ,
document: yourFile ,
onReady : ( superdoc ) => {
const editor = superdoc . activeEditor ;
editor . commands . clearFormat ()
},
});
Clear only mark formatting
Removes bold, italic, underline, colors, etc. but preserves block structure
Example:
editor . commands . clearMarksFormat ()
import { SuperDoc } from 'superdoc' ;
import 'superdoc/style.css' ;
const superdoc = new SuperDoc ({
selector: '#editor' ,
document: yourFile ,
onReady : ( superdoc ) => {
const editor = superdoc . activeEditor ;
editor . commands . clearMarksFormat ()
},
});
Clear only node formatting
Converts headings, lists, etc. to paragraphs but preserves text marks
Example:
editor . commands . clearNodesFormat ()
import { SuperDoc } from 'superdoc' ;
import 'superdoc/style.css' ;
const superdoc = new SuperDoc ({
selector: '#editor' ,
document: yourFile ,
onReady : ( superdoc ) => {
const editor = superdoc . activeEditor ;
editor . commands . clearNodesFormat ()
},
});
Copy format from selection or apply copied format
Works like format painter - first click copies, second click applies
Example:
editor . commands . copyFormat ()
import { SuperDoc } from 'superdoc' ;
import 'superdoc/style.css' ;
const superdoc = new SuperDoc ({
selector: '#editor' ,
document: yourFile ,
onReady : ( superdoc ) => {
const editor = superdoc . activeEditor ;
editor . commands . copyFormat ()
},
});
toggleMarkCascade
Toggle a mark type with cascade behavior, handling nested marks and negation attributes. Used internally by formatting extensions (bold, italic, etc.) but can be called directly for custom mark toggling.
Example:
editor . commands . toggleMarkCascade ( 'bold' )
editor . commands . toggleMarkCascade ( 'italic' , { extendEmptyMarkRange: true })
import { SuperDoc } from 'superdoc' ;
import 'superdoc/style.css' ;
const superdoc = new SuperDoc ({
selector: '#editor' ,
document: yourFile ,
onReady : ( superdoc ) => {
const editor = superdoc . activeEditor ;
editor . commands . toggleMarkCascade ( 'bold' )
editor . commands . toggleMarkCascade ( 'italic' , { extendEmptyMarkRange: true })
},
});
Parameters:
Name of the mark type to toggle
Options with negationAttrs, isNegation, styleDetector, and extendEmptyMarkRange
Keyboard shortcuts
Command Shortcut Description clearFormat() ⌘/Ctrl-Alt-cClear all formatting
Types
StoredStyle
Stored format style
Source code