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

Commit e942ee9

Browse files
Claudio Procidafacebook-github-bot
Claudio Procida
authored andcommitted
Fixes lint warnings in convertFromHTMLToContentBlocks2 tests
Summary: Fixes lint warnings in convertFromHTMLToContentBlocks2 tests and initializes with defaults from the `clear` method. Reviewed By: j-nolan Differential Revision: D13711386 fbshipit-source-id: e5562b69c4388b75ea5a0b5abfb4508ad9096a87
1 parent a3a3585 commit e942ee9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/model/encoding/convertFromHTMLToContentBlocks2.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const ContentBlock = require('ContentBlock');
2121
const ContentBlockNode = require('ContentBlockNode');
2222
const DefaultDraftBlockRenderMap = require('DefaultDraftBlockRenderMap');
2323
const DraftEntity = require('DraftEntity');
24-
const {List, Map, OrderedSet} = require('immutable');
2524
const URI = require('URI');
2625

2726
const cx = require('cx');
2827
const generateRandomKey = require('generateRandomKey');
2928
const getSafeBodyFromHTML = require('getSafeBodyFromHTML');
3029
const gkx = require('gkx');
30+
const {List, Map, OrderedSet} = require('immutable');
3131

3232
const experimentalTreeDataSupport = gkx('draft_tree_data_support');
3333

@@ -205,22 +205,22 @@ class ContentBlocksBuilder {
205205

206206
// The following attributes are used to accumulate text and styles
207207
// as we are walking the HTML node tree.
208-
characterList: List<CharacterMetadata>;
209-
currentBlockType: string;
210-
currentDepth: number;
211-
currentEntity: ?string;
212-
currentStyle: DraftInlineStyle;
213-
currentText: string;
214-
wrapper: string;
208+
characterList: List<CharacterMetadata> = List();
209+
currentBlockType: string = 'unstyled';
210+
currentDepth: number = -1;
211+
currentEntity: ?string = null;
212+
currentStyle: DraftInlineStyle = OrderedSet();
213+
currentText: string = '';
214+
wrapper: string = 'ul';
215215

216216
// Describes the future ContentState as a tree of content blocks
217-
blockConfigs: Array<ContentBlockConfig>;
217+
blockConfigs: Array<ContentBlockConfig> = [];
218218

219219
// The content blocks generated from the blockConfigs
220-
contentBlocks: Array<BlockNodeRecord>;
220+
contentBlocks: Array<BlockNodeRecord> = [];
221221

222222
// Entity map use to store links and images found in the HTML nodes
223-
entityMap: EntityMap;
223+
entityMap: EntityMap = DraftEntity;
224224

225225
// Map HTML tags to draftjs block types and disambiguation function
226226
blockTypeMap: BlockTypeMap;

0 commit comments

Comments
 (0)