Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing URLs does not work with inline images #3267

Open
rdrezner opened this issue Jun 11, 2024 · 0 comments
Open

Editing URLs does not work with inline images #3267

rdrezner opened this issue Jun 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rdrezner
Copy link

rdrezner commented Jun 11, 2024

Description

In our app, we use the image plugin with the isInline: true setting. With this configuration, editing URLs through the floating media input does not work correctly; it updates (adds) the URL property of a parent node (p).

I worked around this issue by patching the submitFloatingMedia function. Instead of updating the selection, I update the element passed through the function parameter. This code works regardless of whether the image is an inline or a block node:

setNodes<TMediaElement>(
    editor,
    {
      url,
    },
    {
      at: findNodePath(editor, element),
    }
);

Maybe you should consider applying this code to upstream as it seems more reliable.

Reproduction URL

No response

Reproduction steps

1. Configure the image plugin to use inline images `createImagePlugin({isInline: true})`.
2. Paste an image to the editor.
3. Select the image and click "Edit url".
4. Edit the url and hit the "enter" key.

Result: the image does not get updated.
Expected result: the image should be updated with given url.

Plate version

34.0.0

Slate React version

0.103.0

Screenshots

No response

Logs

No response

Browsers

No response

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@rdrezner rdrezner added the bug Something isn't working label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant