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

empty() does not work properly #1329

Closed
philippehenri opened this issue Sep 26, 2022 · 5 comments
Closed

empty() does not work properly #1329

philippehenri opened this issue Sep 26, 2022 · 5 comments
Assignees
Labels
bug:core Bug in core (trumbowyg.js) todo

Comments

@philippehenri
Copy link

When pasting a colored text copied from Word, and deleting it immediately, any new char typed has the font and color of the pasted text (even after calling empty() ??

Description

on MAC, Chrome

How to reproduce?

As explained above:

1/ select some red text copied from word for example
2/ paste it (here for example : https://alex-d.github.io/Trumbowyg/demos/ )
3/ delete it
4/ type some chars... -> they are red ??

@Alex-D
Copy link
Owner

Alex-D commented Sep 27, 2022

It is a browser-level issue I think :/
Can't do much here, sorry

@Alex-D Alex-D closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2022
@philippehenri
Copy link
Author

thanks.
ps: I just found an easy fix that you might want to add to your empty() function. I have added this line after calling empty():

            document.execCommand('insertHTML', false, ''); 

it works with chrome, safari, opera and firefox on MAC (not tested on windows). it resets all font, color, etc...

@Alex-D
Copy link
Owner

Alex-D commented Sep 28, 2022

I see that, Maybe it could be added in a next version since we do not have to support IE these days

@Alex-D Alex-D reopened this Sep 28, 2022
@Alex-D
Copy link
Owner

Alex-D commented Sep 28, 2022

Maybe I can add this to the next version since we do not have to support IE these days :)
Thank you for the tip!

@Alex-D Alex-D added the bug:core Bug in core (trumbowyg.js) label Sep 28, 2022
@Alex-D Alex-D self-assigned this Sep 28, 2022
@philippehenri
Copy link
Author

you are welcome, thank you for the great product.

ps: fyi, there is another working solution as I read that execcommand is or will soon be deprecated:

            $('.trumbowyg-editor').html(' ');
            setTimeout(function () {
              $('.trumbowyg-editor').html('');
            },100);

note: $('.trumbowyg-editor').html('') alone does not work for some reason...

@Alex-D Alex-D added the todo label Nov 14, 2022
@Alex-D Alex-D closed this as completed in bdda00f Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:core Bug in core (trumbowyg.js) todo
Projects
None yet
Development

No branches or pull requests

2 participants