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

Html tags are not removed when the block type is changed. #6284

Open
gbdesign2023 opened this issue Feb 21, 2024 · 3 comments
Open

Html tags are not removed when the block type is changed. #6284

gbdesign2023 opened this issue Feb 21, 2024 · 3 comments
Labels
type: bug 🐛 Is a bug; fixes a bug

Comments

@gbdesign2023
Copy link

If I change the block type in the block editor, e.g. from "Text" to "Heading", the <p> tag is retained:

<h1><p>I used to be a text block</p></h1>

If the block type is created directly as a heading, the formatting is correct.

[Tested with Kirby 4.1]

@afbora afbora added the type: bug 🐛 Is a bug; fixes a bug label Mar 16, 2024
@afbora
Copy link
Member

afbora commented Mar 16, 2024

I can reproduce the issue but I have no idea how we can fix the issue. May be we need callbacks for the each types, not sure.

@distantnative
Copy link
Member

I don't think it will feasible to add callbacks/methods for the conversion. Just too many options also with custom blocks. Ideally, the old content would be handed over to the new block type (as is happening now) but then the writer-based blocks would update the content once more from what the writer input output should be (as e.g. the heading writer input should probably strip paragraph tags). But no good idea yet how to make this happen.

@afbora
Copy link
Member

afbora commented May 22, 2024

@distantnative It seems that the convert operation is generic. It's an automated process according to the block blueprints. It cannot be specific operation for any type.

https://github.com/getkirby/kirby/blob/4.2.0/panel/src/components/Forms/Blocks/Blocks.vue#L274-L326

We cannot process data in block type views. Because they are only triggered by input (@input), not by a type change. When the type changes, the block data is automatically changed and saved.

I couldn't find a solution yet either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants