From e942ee9205da89354a366d05f90645736988d38d Mon Sep 17 00:00:00 2001 From: Claudio Procida Date: Tue, 22 Jan 2019 07:44:08 -0800 Subject: [PATCH] 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 --- .../convertFromHTMLToContentBlocks2.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/model/encoding/convertFromHTMLToContentBlocks2.js b/src/model/encoding/convertFromHTMLToContentBlocks2.js index d96bcf4291..6f403134b6 100644 --- a/src/model/encoding/convertFromHTMLToContentBlocks2.js +++ b/src/model/encoding/convertFromHTMLToContentBlocks2.js @@ -21,13 +21,13 @@ const ContentBlock = require('ContentBlock'); const ContentBlockNode = require('ContentBlockNode'); const DefaultDraftBlockRenderMap = require('DefaultDraftBlockRenderMap'); const DraftEntity = require('DraftEntity'); -const {List, Map, OrderedSet} = require('immutable'); const URI = require('URI'); const cx = require('cx'); const generateRandomKey = require('generateRandomKey'); const getSafeBodyFromHTML = require('getSafeBodyFromHTML'); const gkx = require('gkx'); +const {List, Map, OrderedSet} = require('immutable'); const experimentalTreeDataSupport = gkx('draft_tree_data_support'); @@ -205,22 +205,22 @@ class ContentBlocksBuilder { // The following attributes are used to accumulate text and styles // as we are walking the HTML node tree. - characterList: List; - currentBlockType: string; - currentDepth: number; - currentEntity: ?string; - currentStyle: DraftInlineStyle; - currentText: string; - wrapper: string; + characterList: List = List(); + currentBlockType: string = 'unstyled'; + currentDepth: number = -1; + currentEntity: ?string = null; + currentStyle: DraftInlineStyle = OrderedSet(); + currentText: string = ''; + wrapper: string = 'ul'; // Describes the future ContentState as a tree of content blocks - blockConfigs: Array; + blockConfigs: Array = []; // The content blocks generated from the blockConfigs - contentBlocks: Array; + contentBlocks: Array = []; // Entity map use to store links and images found in the HTML nodes - entityMap: EntityMap; + entityMap: EntityMap = DraftEntity; // Map HTML tags to draftjs block types and disambiguation function blockTypeMap: BlockTypeMap;