
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@studysync/draft-js-modifiers
Advanced tools
Modular state modifiers for Draft.js
yarn add @studysync/draft-js-modifiers draft-js
# or
npm i @studysync/draft-js-modifiers draft-js
This package ships with immutable@3.8.3, the patched 3.x line for the prototype-pollution advisory described in the GitHub advisory for immutable.
When your app also uses other legacy Draft.js packages, force a single patched immutable 3.x version at the app root:
{
"overrides": {
"immutable": "3.8.3",
"draft-js": {
"immutable": "3.8.3"
}
},
"resolutions": {
"immutable": "3.8.3"
}
}
import * as Modifiers from '@studysync/draft-js-modifiers'
const newEditorState = Modifiers.mergeBlockData(currentEditorState, { foo: 1 })
import adjustBlockDepth from '@studysync/draft-js-modifiers/adjustBlockDepth'
// Support Tree Shaking for webpack, rollup.js
import { insertText } from '@studysync/draft-js-modifiers'
addBlockaddBlock(
editorState: EditorState,
selection,
type: string,
data: { [id: string]: any },
entityType: string,
text?: ?string = ' '
adjustBlockDepthadjustBlockDepth(editorState: EditorState, adjustment: number, maxDepth: number)
getCurrentBlockgetCurrentBlock(editorState): EditorState
insertAtomicBlockinsertAtomicBlock(
editorState: EditorState,
entityType: string,
mutability: 'IMMUTABLE' | 'MUTABLE' | 'SEGMENTED',
data?: { [id: string]: any },
character?: ?string = ' '
)
insertEmptyBlockinsertEmptyBlock(editorState: EditorState, blockType?: DraftBlockType = 'unstyled')
insertNewBlockinsertNewBlock(
editorState: EditorState,
blockType?: DraftBlockType = 'unstyled',
text?: string = '',
data?: { [id: string]: any } = {}
)
insertTextinsertText(editorState: EditorState, text: string, entity?: ?string = null)
mergeBlockDatamergeBlockData(editorState: EditorState, data: { [id: string]: any })
mergeBlockDataByKeymergeBlockDataByKey(editorState: EditorState, blockKey: string, data: { [id: string]: any })
mergeEntityDatamergeEntityData(editorState: EditorState, entityKey: string, data: { [id: string]: any })
modifyBlockmodifyBlock(editorState: EditorState, blockData: ContentBlock)
modifyBlockByKeymodifyBlockByKey(editorState: EditorState, blockKey: string, blockData: ContentBlock)
moveCaretAfterBlockmoveCaretAfterBlock(editorState: EditorState, block: ContentBlock)
removeBlockremoveBlock(contentState, blockKey)
removeBlockStyleremoveBlockStyle(editorState: EditorState)
removeInlineStylesremoveInlineStyles(editorState: EditorState, inlineStyles: Array<string> = [])
resetBlockresetBlock(editorState: EditorState, block: ContentBlock)
selectBlockByKeyselectBlockByKey(editorState: EditorState, key: string)
toggleBlockStyletoggleBlockStyle(editorState, { type: blockStyle, data })
toggleBlockTypetoggleBlockType(editorState: EditorState, blockType: string)
toggleEntitytoggleEntity(editorState: EditorState, entityKey: ?string)
toggleInlineStyletoggleInlineStyle(editorState: EditorState, inlineStyle: string)
yarn run add -- moduleName
# or
npm run add -- moduleName
© sugarshin
FAQs
Modular state modifiers for Draft.js
We found that @studysync/draft-js-modifiers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.