Browse Source

Fix Draftail unit test failure

LB Johnston 2 years ago
parent
commit
70681ec2bb

+ 4 - 2
client/src/components/Draftail/CommentableEditor/CommentableEditor.tsx

@@ -19,7 +19,6 @@ import {
   RichUtils,
   SelectionState,
 } from 'draft-js';
-import type { DraftEditorLeaf } from 'draft-js/lib/DraftEditorLeaf.react';
 import { filterInlineStyles } from 'draftjs-filters';
 import React, {
   MutableRefObject,
@@ -37,6 +36,9 @@ import { gettext } from '../../../utils/gettext';
 
 import Icon from '../../Icon/Icon';
 
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const DraftEditorLeaf = require('draft-js/lib/DraftEditorLeaf.react');
+
 const { isOptionKeyCommand } = KeyBindingUtil;
 
 const COMMENT_STYLE_IDENTIFIER = 'COMMENT-';
@@ -452,7 +454,7 @@ export function findLeastCommonCommentId(block: ContentBlock, offset: number) {
 
 interface DecoratorProps {
   contentState: ContentState;
-  children?: Array<DraftEditorLeaf>;
+  children?: Array<typeof DraftEditorLeaf>;
 }
 
 function getCommentDecorator(commentApp: CommentApp) {