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

Ensure Quill correctly detects selections and renders HTML #5511

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

philippjfr
Copy link
Member

Some fixes for Quill rendering inside the shadow DOM.

@philippjfr philippjfr force-pushed the quill_range_and_paste_fixes branch from 9e4140a to 0e9cc57 Compare September 14, 2023 15:13
@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #5511 (0e9cc57) into main (1b88afa) will decrease coverage by 0.87%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #5511      +/-   ##
==========================================
- Coverage   83.60%   82.74%   -0.87%     
==========================================
  Files         276      276              
  Lines       40162    40162              
==========================================
- Hits        33579    33231     -348     
- Misses       6583     6931     +348     
Flag Coverage Δ
ui-tests 39.67% <ø> (-1.73%) ⬇️
unitexamples-tests 72.54% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
panel/models/quill.py 90.47% <ø> (ø)

... and 20 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@maximlt
Copy link
Member

maximlt commented Sep 14, 2023

This PR was motivated by a few issues. The first one being that in some situations, re-rendering the widget would affect its content (not the model though). This can be reproduced with the following code, adding a bullet list in the editor, switching to the next view and back to the editor, where you should see the bullet lists are gone.

import panel as pn

pn.extension('texteditor')

contents = [pn.widgets.TextEditor(), pn.pane.HTML('<h1>Bob</h1>')]
contents = [pn.Column(c) for c in contents]
w_radio = pn.widgets.RadioButtonGroup(options=[0, 1])

placeholder = pn.Column(contents[0])


@pn.depends(w_radio, watch=True)
def update_view(i):
    placeholder[:] = [contents[i]]


pn.Column(w_radio, placeholder).servable()

As it currently stands, this PR fixes that issue.

The other issue I saw with the editor was that clicking on one of the tools, like B(old), the cursor would always move up to the first position in the editor. This is fixed too. However, there is still an issue with the tools. When I click on one of them like B(old), and type something, the text isn't in bold. The tool doesn't get activated (or it does but very shortly). I can set some bit of text in bold if I select it and then hit on tool.

@philippjfr
Copy link
Member Author

Unfortunately I wasn't able to find a fix for the last issue yet (and no one on StackOverflow or the Quill issue tracker seems to have done so either). I'll merge for now so I can cut a dev release.

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.

2 participants