Remove keys from replacers (#539)

This commit is contained in:
mrdrogdrog 2020-09-05 10:34:43 +02:00 committed by GitHub
parent 63b24fa5bf
commit e58e53a116
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 77 additions and 78 deletions

View file

@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import { ReactElement } from 'react'
import { ComponentReplacer, NativeRenderer, SubNodeTransform } from '../ComponentReplacer'
import { ComponentReplacer } from '../ComponentReplacer'
const isColorExtraElement = (node: DomElement | undefined): boolean => {
if (!node || !node.attribs || !node.attribs.class || !node.attribs['data-color']) {
@ -19,7 +19,7 @@ const findQuoteOptionsParent = (nodes: DomElement[]): DomElement | undefined =>
}
export class QuoteOptionsReplacer extends ComponentReplacer {
public getReplacement (node: DomElement, index: number, subNodeTransform: SubNodeTransform, nativeRenderer: NativeRenderer):ReactElement|undefined {
public getReplacement (node: DomElement):ReactElement|undefined {
if (node.name !== 'blockquote' || !node.children || node.children.length < 1) {
return
}
@ -38,6 +38,5 @@ export class QuoteOptionsReplacer extends ComponentReplacer {
return
}
node.attribs = Object.assign(node.attribs || {}, { style: `border-left-color: ${attributes['data-color']};` })
return nativeRenderer(node, index)
}
}