Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit d24b802

Browse files
NoamELBfacebook-github-bot
authored andcommitted
Finish modernizing convertFromHTMLToContentBlocks - upgrade draft-js internals
Summary: Upgrade example and Draft.js entry file to use convertFromHTMLToContentBlocks v2 with a GK Reviewed By: flarnie Differential Revision: D7823689 fbshipit-source-id: ae55b232e3b40c9cd00445d7e1ca626783a4a34a
1 parent 49bdd85 commit d24b802

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

examples/draft-0-10-0/playground/src/DraftJsPlaygroundContainer.react.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ const SomeCodeMirror = require('SomeCodeMirror.react');
1818
const SomeButton = require('SomeButton.react');
1919
const SomeSelector = require('SomeSelector.react');
2020
const SomeSelectorOption = require('SomeSelectorOption.react');
21-
const convertFromHTML = require('convertFromHTMLToContentBlocks');
2221
const convertFromRaw = require('convertFromRawToDraftState');
22+
const gkx = require('gkx');
23+
24+
const convertFromHTML = gkx('draft_refactored_html_importer')
25+
? require('convertFromHTMLToContentBlocks2')
26+
: require('convertFromHTMLToContentBlocks');
2327

2428
type Props = any;
2529
type State = any;
@@ -123,9 +127,7 @@ class DraftJsPlaygroundContainer extends Component<Props, State> {
123127
<div className={cx('DraftJsPlaygroundContainer/container')}>
124128
<div className={cx('DraftJsPlaygroundContainer/column')}>
125129
<div className={cx('DraftJsPlaygroundContainer/controls')}>
126-
<SomeSelector
127-
onChange={this.onSelectChange}
128-
value={mode}>
130+
<SomeSelector onChange={this.onSelectChange} value={mode}>
129131
<SomeSelectorOption value="rawContent">
130132
Raw Content
131133
</SomeSelectorOption>

src/Draft.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ const RichTextEditorUtil = require('RichTextEditorUtil');
3131
const SelectionState = require('SelectionState');
3232

3333
const convertFromDraftStateToRaw = require('convertFromDraftStateToRaw');
34-
const convertFromHTMLToContentBlocks = require('convertFromHTMLToContentBlocks');
3534
const convertFromRawToDraftState = require('convertFromRawToDraftState');
3635
const generateRandomKey = require('generateRandomKey');
3736
const getDefaultKeyBinding = require('getDefaultKeyBinding');
3837
const getVisibleSelectionRect = require('getVisibleSelectionRect');
38+
const gkx = require('gkx');
39+
40+
const convertFromHTML = gkx('draft_refactored_html_importer')
41+
? require('convertFromHTMLToContentBlocks2')
42+
: require('convertFromHTMLToContentBlocks');
3943

4044
const DraftPublic = {
4145
Editor: DraftEditor,
@@ -60,7 +64,7 @@ const DraftPublic = {
6064
DefaultDraftBlockRenderMap,
6165
DefaultDraftInlineStyle,
6266

63-
convertFromHTML: convertFromHTMLToContentBlocks,
67+
convertFromHTML,
6468
convertFromRaw: convertFromRawToDraftState,
6569
convertToRaw: convertFromDraftStateToRaw,
6670
genKey: generateRandomKey,

0 commit comments

Comments
 (0)