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

Prevent Trumbowyg from converting div to p element #12050

Merged
merged 2 commits into from
Aug 7, 2022

Conversation

MikeAlhayek
Copy link
Member

@MikeAlhayek MikeAlhayek commented Jul 20, 2022

Fix #12049

From the semantic section in Trumbowyg docx

Since 2.12.0 you can also put an object to customize the semantic tag mapping for each one of these tags: <b>, <i>, <s>, <strike>, <div>.

The semantic option is set to true by default which is equivalent to:

$('.trumbowyg').trumbowyg({
    semantic: {
        'b': 'strong',
        'i': 'em',
        's': 'del',
        'strike': 'del',
        'div': 'p'
    }
});

To prevent the div from being converted into p we should set the semantic settings like this

$('.trumbowyg').trumbowyg({
    semantic: {
        'b': 'strong',
        'i': 'em',
        's': 'del',
        'strike': 'del'
    }
});

@Skrypt
Copy link
Contributor

Skrypt commented Jul 20, 2022

I don't agree to add these semantic options if they are already applied.
The idea is that the "Wysiwyg" editor option should not alter the "Tryumbowyg" editor default behavior.
This is why we have the "Trumbowyg" editor option that allows changing its behavior for your own needs.

@sebastienros
Copy link
Member

semantic: false on Wysiwyg templates
Don't change anything on Trumbowyg templates

@MikeAlhayek
Copy link
Member Author

Updated

@Skrypt Skrypt merged commit c02fedd into OrchardCMS:main Aug 7, 2022
@MikeAlhayek MikeAlhayek deleted the FixWYSIWYGEditor branch September 2, 2022 04:37
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

Successfully merging this pull request may close these issues.

WYSIWYG/Trumbowyg editors are changing div element to p
4 participants