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

Commit

Permalink
Finish modernizing convertFromHTMLToContentBlocks - upgrade draft-js …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
NoamELB authored and facebook-github-bot committed May 2, 2018
1 parent 49bdd85 commit d24b802
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const SomeCodeMirror = require('SomeCodeMirror.react');
const SomeButton = require('SomeButton.react');
const SomeSelector = require('SomeSelector.react');
const SomeSelectorOption = require('SomeSelectorOption.react');
const convertFromHTML = require('convertFromHTMLToContentBlocks');
const convertFromRaw = require('convertFromRawToDraftState');
const gkx = require('gkx');

const convertFromHTML = gkx('draft_refactored_html_importer')
? require('convertFromHTMLToContentBlocks2')
: require('convertFromHTMLToContentBlocks');

type Props = any;
type State = any;
Expand Down Expand Up @@ -123,9 +127,7 @@ class DraftJsPlaygroundContainer extends Component<Props, State> {
<div className={cx('DraftJsPlaygroundContainer/container')}>
<div className={cx('DraftJsPlaygroundContainer/column')}>
<div className={cx('DraftJsPlaygroundContainer/controls')}>
<SomeSelector
onChange={this.onSelectChange}
value={mode}>
<SomeSelector onChange={this.onSelectChange} value={mode}>
<SomeSelectorOption value="rawContent">
Raw Content
</SomeSelectorOption>
Expand Down
8 changes: 6 additions & 2 deletions src/Draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ const RichTextEditorUtil = require('RichTextEditorUtil');
const SelectionState = require('SelectionState');

const convertFromDraftStateToRaw = require('convertFromDraftStateToRaw');
const convertFromHTMLToContentBlocks = require('convertFromHTMLToContentBlocks');
const convertFromRawToDraftState = require('convertFromRawToDraftState');
const generateRandomKey = require('generateRandomKey');
const getDefaultKeyBinding = require('getDefaultKeyBinding');
const getVisibleSelectionRect = require('getVisibleSelectionRect');
const gkx = require('gkx');

const convertFromHTML = gkx('draft_refactored_html_importer')
? require('convertFromHTMLToContentBlocks2')
: require('convertFromHTMLToContentBlocks');

const DraftPublic = {
Editor: DraftEditor,
Expand All @@ -60,7 +64,7 @@ const DraftPublic = {
DefaultDraftBlockRenderMap,
DefaultDraftInlineStyle,

convertFromHTML: convertFromHTMLToContentBlocks,
convertFromHTML,
convertFromRaw: convertFromRawToDraftState,
convertToRaw: convertFromDraftStateToRaw,
genKey: generateRandomKey,
Expand Down

0 comments on commit d24b802

Please sign in to comment.