
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@wooritech/draft-js-plus
Advanced tools
import React from 'react';
import './App.css';
import DraftEditor, { EditorState } from '@wooritech/draft-js-plus'
// Simple Use
function App() {
const [editorState, setEditorState] = React.useState(
EditorState.createEmpty(),
);
return (
// .App 에 CSS로 전체 레이아웃 설정가능
<div className="App">
<button onClick={_onBold}>Bold</button>
<button onClick={click}>스테이트</button>
<DraftEditor
editorState={editorState}
onChange={setEditorState}
placeholder="Something Text"
/>
</div>
);
}
export default App;
import { convertToRaw, RichUtils } from '@wooritech/draft-js-plus'
// RichUtils 예시
const _onHeaderOne = () => { // <h1> 태그
setEditorState(RichUtils.toggleBlockType(editorState, 'header-one'))
}
const _onHeaderTwo = () => { // <h2> 태그
setEditorState(RichUtils.toggleBlockType(editorState, 'header-two'))
}
const _onHeaderThree = () => { // <h3> 태그
setEditorState(RichUtils.toggleBlockType(editorState, 'header-three'))
}
const _onHeaderFour = () => { // <h4> 태그
setEditorState(RichUtils.toggleBlockType(editorState, 'header-four'))
}
const _onHeaderFive = () => { // <h5> 태그
setEditorState(RichUtils.toggleBlockType(editorState, 'header-five'))
}
const _onBold = () => { // <strong> 태그
setEditorState(RichUtils.toggleInlineStyle(editorState, 'BOLD'));
}
const _onUnderlineClick = () => { // <underline> 태그
setEditorState(RichUtils.toggleInlineStyle(editorState, 'UNDERLINE'));
}
const _onToggleCode = () => { // <code> 태그
setEditorState(RichUtils.toggleCode(editorState));
}
const convertRawObject = () => {
const rawData = convertToRaw(editorState.getCurrentContent())
// rawData 내용
console.log(rawData);
}
// Editor -> 선택 행 굵게
<button onClick={_onBold}>굵게</button>
// Editor -> 내용을 RawObject 변환
<button onClick={convertRawObject}>RawObject</button>
FAQs
draftjs to plus
We found that @wooritech/draft-js-plus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.