Mercurial > libervia-web
comparison libervia/web/pages/_browser/popup.py @ 1635:332822ceae85
browser (chat): Add rich editor, forward and extra recipients:
A new "extra" menu is now available next to input field, allowing to toggle to rich
editor. Rich editors allows message styling using bold, italic, underline, (un)numbered
list and link. Other features will probably follow with time.
An extra menu item allows to add recipients, with `to`, `cc` or `bcc` flag like for
emails.
Messages can now be forwarded to any entity with a new item in the 3 dots menu.
rel 461
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 04 Jul 2025 17:47:37 +0200 |
parents | a2cd4222c702 |
children |
comparison
equal
deleted
inserted
replaced
1634:6c6ab1a96b34 | 1635:332822ceae85 |
---|---|
9 def create_popup( | 9 def create_popup( |
10 target, | 10 target, |
11 content_elt, | 11 content_elt, |
12 focus_class="has-popup-focus", | 12 focus_class="has-popup-focus", |
13 focus_elt=None, | 13 focus_elt=None, |
14 placement="bottom", | |
14 **kwargs | 15 **kwargs |
15 ): | 16 ): |
16 """Create a popup and show a popup below a target | 17 """Create a popup and show a popup next to a target |
17 | 18 |
18 The popup is created and destroyed on each call, this can be used for dynamic content. | 19 The popup is created and destroyed on each call, this can be used for dynamic content. |
19 @param target: element where the popup will appear, or a selector | 20 @param target: element where the popup will appear, or a selector |
20 @param content_elt: HTML element to show in the popup | 21 @param content_elt: HTML element to show in the popup |
21 @param focus_class: class added to target element when popup is shown | 22 @param focus_class: class added to target element when popup is shown |
22 @param focus_elt: element where focus_class is added. If None, target will be used. | 23 @param focus_elt: element where focus_class is added. If None, target will be used. |
24 @param placement: where the popup must be located. | |
23 @param kwargs: arguments used to override tippy options | 25 @param kwargs: arguments used to override tippy options |
24 """ | 26 """ |
25 if focus_elt is None: | 27 if focus_elt is None: |
26 focus_elt = target | 28 focus_elt = target |
27 def on_hide(__): | 29 def on_hide(__): |
29 timer.set_timeout(tippy_instance.destroy, 0) | 31 timer.set_timeout(tippy_instance.destroy, 0) |
30 tippy_opts = { | 32 tippy_opts = { |
31 "trigger": "click", | 33 "trigger": "click", |
32 "content": content_elt, | 34 "content": content_elt, |
33 "appendTo": document.body, | 35 "appendTo": document.body, |
34 "placement": "bottom", | 36 "placement": placement, |
35 "interactive": True, | 37 "interactive": True, |
36 "trigger": "manual", | 38 "trigger": "manual", |
37 "theme": "light", | 39 "theme": "light", |
38 "onShow": lambda __: focus_elt.classList.add(focus_class), | 40 "onShow": lambda __: focus_elt.classList.add(focus_class), |
39 "onHide": on_hide | 41 "onHide": on_hide |