Sign in

The WYSIWYG editor is removing common white space and adding non breakable space

  • This topic has 2 replies, 2 voices, and was last updated 1 week, 2 days ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7776
    Dawn

    Hey there, The editor is removing my common white space and replacing it with non-breakable space, I can’t use that because my site has c programs as its content, I’m hosting a site to explain programming language. So if someone copies my code it won’t run in a compiler due to this issue. So is there a workaround for this?

    #7899
    Tomasz Dziuda

    Hi,

    I think that the only solution is to write custom helper in your theme which will remove all non-breaking spaces and replace them with white spaces.

    BTW did you tried to use block editor or markdown editor? The same issue occurs?

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #7901
    Dawn

    Thanks for your reply, But I did some tinkering and wrote a custom js function to replace the non-breaking white space written by the editor and replace it with common white space as it is being copied, for anyone looking for the code.

    <script>
    function copyCode() {
    var Text = document.getElementById(‘code-wrap’).innerText;
    var results = Text.replace(/ /gi,” “);
    navigator.clipboard.writeText(results);
    }
    </script>

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘The WYSIWYG editor is removing common white space and adding non breakable space’ is closed to new replies.