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

Pasting dark mode content becomes light mode #2870

Open
miku1958 opened this issue Nov 13, 2024 · 1 comment
Open

Pasting dark mode content becomes light mode #2870

miku1958 opened this issue Nov 13, 2024 · 1 comment

Comments

@miku1958
Copy link
Contributor

To Reproduce
Steps to reproduce the behavior:

  1. Use dark mode on Rooster and other editor like vscode
  2. Copy from vscode Image
  3. Paste on Rooster Demo Image

Expected behavior
Paste content keep dark mode

Device Information

  • OS: macOS 15.1
  • Browser edge, safari
@BryanValverdeU
Copy link
Contributor

Hello @miku1958,

This is by design, and this is more a copy issue than paste issue. The content that is wrote to the clipboard by vscode is already containing the background color as black. So, when that content is pasted in the editor, there is no way for us to identify whether the clipboard content is in Dark mode or not, so we just transform the content to the inverse colors.

For example:

Copying this:
Image

The HTML clipboard content looks like this, see that the parent div already contains the background color as black.

Version:0.9
StartHTML:0000000105
EndHTML:0000002289
StartFragment:0000000141
EndFragment:0000002253
<html>
<body>
<!--StartFragment--><div style="color: #ffffff;background-color: #000000;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #ffffff;">&#160; &#160; &#160; &#160; </span><span style="color: #dcdcaa;">parseFormat</span><span style="color: #ffffff;">(</span><span style="color: #9cdcfe;">doc</span><span style="color: #ffffff;">.</span><span style="color: #9cdcfe;">body</span><span style="color: #ffffff;">, </span><span style="color: #9cdcfe;">context</span><span style="color: #ffffff;">.</span><span style="color: #9cdcfe;">formatParsers</span><span style="color: #ffffff;">.</span><span style="color: #9cdcfe;">segmentOnBlock</span><span style="color: #ffffff;">, </span><span style="color: #9cdcfe;">context</span><span style="color: #ffffff;">.</span><span style="color: #9cdcfe;">segmentFormat</span><span style="color: #ffffff;">, </span><span style="color: #9cdcfe;">context</span><span style="color: #ffffff;">);</span></div><br><div><span style="color: #ffffff;">&#160; &#160; &#160; &#160; </span><span style="color: #c586c0;">return</span><span style="color: #ffffff;"> </span><span style="color: #dcdcaa;">domToContentModel</span><span style="color: #ffffff;">(</span><span style="color: #9cdcfe;">doc</span><span style="color: #ffffff;">.</span><span style="color: #9cdcfe;">body</span><span style="color: #ffffff;">, </span><span style="color: #9cdcfe;">context</span><span style="color: #ffffff;">);</span></div><div><span style="color: #ffffff;">&#160; &#160; } </span><span style="color: #c586c0;">else</span><span style="color: #ffffff;"> {</span></div><div><span style="color: #ffffff;">&#160; &#160; &#160; &#160; </span><span style="color: #c586c0;">return</span><span style="color: #ffffff;"> </span><span style="color: #dcdcaa;">createEmptyModel</span><span style="color: #ffffff;">(</span><span style="color: #9cdcfe;">defaultSegmentFormat</span><span style="color: #ffffff;">);</span></div><div><span style="color: #ffffff;">&#160; &#160; }</span></div><div><span style="color: #ffffff;">}</span></div><br></div><!--EndFragment-->
</body>
</html>

Pasting the clipboard content to a normal HTML file and opening it looks like this:

Image

And since the Rooster editor is already in Dark mode we inverse the colors that vscode wrote to the clipboard.

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

2 participants