Skip to content

Unexpected behavior when adding link to image #3286

@helloagain-dev

Description

@helloagain-dev

Summary

Unexpected behavior when adding link to image
This issue describes a problem encountered while using ToastUI Editor (v3.2.2) to insert links into images. When a link is added to an image, the editor inserts a span element with the class "image-link" between the image and the link elements. This structure causes issues when the resulting HTML is parsed by React Native, as the image becomes clickable but opens a preview instead of following the intended link.

Desired behavior:

  • Option to disable span insertion: Allow users to configure the editor to directly apply links to image elements without the intermediary span.
  • Improved compatibility with React Native: Ensure that the generated HTML is more easily parsed and rendered correctly by React Native.

Question
Is a pull request proposing the described behavior change a suitable course of action?

Version

3.2.2

Additional context

We are currently attempting to manage this issue on the React Native side of our stack. However, it would be beneficial if ToastUI Editor could provide an additional option during initialization to disable the insertion of the "image-link" span when linking images. This would streamline the integration process and prevent potential compatibility issues.

The bit of code that results in this behaviour is within the createElement function of the ImageView class:
tui.editor/apps/editor/src/wysiwyg/nodeview
/imageView.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions