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

When inline, image alignment buttons don't work #10

Open
mason-os opened this issue Jun 27, 2024 · 2 comments
Open

When inline, image alignment buttons don't work #10

mason-os opened this issue Jun 27, 2024 · 2 comments

Comments

@mason-os
Copy link

Hey again! It sounds like this extension doesn't support inline mode yet, which makes sense given how new it is. I just wanted to flag that the alignment buttons also don't work when inline is enabled on the extension.

I ended up forking the extension to work around this, using the text-align extension's commands for alignment instead, as that works with the paragraph node when the image is inserted inline.

To do this, I ended up swapping out the position controller event handlers to be:

        $leftController.addEventListener("click", () => {
          editor.chain().focus().setTextAlign("left").run();
          dispatchNodeView();
        });
        $centerController.addEventListener("click", () => {
          editor.chain().focus().setTextAlign("center").run();
          dispatchNodeView();
        });
        $rightController.addEventListener("click", () => {
          editor.chain().focus().setTextAlign("right").run();
          dispatchNodeView();
        });

An easier change to support this, if you're interested, would be to expose the paintPositionContoller method as an extension option that can be overridden. If that is a friendly change to you, I'd be happy to make a contribution!

@bae-sh
Copy link
Owner

bae-sh commented Jul 4, 2024

Hi @mason-os,

First, thank you for your interest in my extension! I've reviewed your issues and tested your code. Your solution is promising, but for this inline case, we need to consider potential side effects.

We are planning to refactor the entire logic to better support this inline feature. I apologize for any inconvenience and let you know when the feature is complete.

@bsHobbit
Copy link

How exactly can i overwrite the default behavior? i have an vanilla javascript code base and all i do is adding ImageResize to the tiptap extension array right now. I couldn't figure out how you used your own events for the buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants