mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
Refactor replacers and line id mapping
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
3591c90f9f
commit
ec77e672f6
58 changed files with 899 additions and 750 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
import type { Element } from 'domhandler'
|
||||
import React from 'react'
|
||||
import { ComponentReplacer } from '../ComponentReplacer'
|
||||
import { ComponentReplacer } from '../component-replacer'
|
||||
import { ProxyImageFrame } from './proxy-image-frame'
|
||||
|
||||
export type ImageClickHandler = (event: React.MouseEvent<HTMLImageElement, MouseEvent>) => void
|
||||
|
@ -22,8 +22,8 @@ export class ImageReplacer extends ComponentReplacer {
|
|||
this.clickHandler = clickHandler
|
||||
}
|
||||
|
||||
public getReplacement(node: Element): React.ReactElement | undefined {
|
||||
if (node.name === 'img' && node.attribs) {
|
||||
public replace(node: Element): React.ReactElement | undefined {
|
||||
if (node.name === 'img') {
|
||||
return (
|
||||
<ProxyImageFrame
|
||||
id={node.attribs.id}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue