Don't linkify image links for outgoing html
This commit is contained in:
parent
206f5494c8
commit
d2938f8730
8
TODO.md
8
TODO.md
|
@ -1,5 +1,4 @@
|
|||
- Refactoring
|
||||
- Use HInterfaceBox for EditAccount Profile and Encryption
|
||||
- Banners
|
||||
|
||||
- Theming
|
||||
|
@ -21,10 +20,8 @@
|
|||
- Run import in thread and AsyncClient.olm functions, they block async loop
|
||||
- Handle import keys errors
|
||||
|
||||
- Don't linkify images for outgoing html
|
||||
- Keyboard flicking against top/bottom edge
|
||||
- Don't strip user spacing in html
|
||||
|
||||
- Keyboard flicking against top/bottom edge
|
||||
- Do something when access token is invalid
|
||||
- Message position after daybreak delegate (fixed by commit 57b1313 ?)
|
||||
- [hr not working](https://bugreports.qt.io/browse/QTBUG-74342)
|
||||
|
@ -33,6 +30,7 @@
|
|||
- UI
|
||||
- Make HListView scrollbars visible
|
||||
- Remove first html lists left margin
|
||||
- Adapt UI for small heights
|
||||
|
||||
- Popup:
|
||||
- label size
|
||||
|
@ -77,7 +75,6 @@
|
|||
- Conversation breaks: show time of first new msg after break instead of big
|
||||
blank space
|
||||
- Replies
|
||||
- `pyotherside.atexit()`
|
||||
- Sidepane
|
||||
- Header back button when reduced
|
||||
- Better look for arrows and option button when collapsed
|
||||
|
@ -129,6 +126,7 @@
|
|||
- Links preview
|
||||
|
||||
- Client improvements
|
||||
- `pyotherside.atexit()`
|
||||
- Logout previous session if adding an account that's already connected
|
||||
- Image provider: on failed conversion, way to show a "broken image" thumb?
|
||||
- Config file format
|
||||
|
|
|
@ -51,16 +51,20 @@ class HtmlFilter:
|
|||
def filter_inline(self, html: str, outgoing: bool = False) -> str:
|
||||
text = self._inline_sanitizer.sanitize(html).strip("\n")
|
||||
|
||||
if not outgoing:
|
||||
text = re.sub(
|
||||
r"(^\s*>.*)", r'<span class="greentext">\1</span>', text,
|
||||
)
|
||||
if outgoing:
|
||||
return text
|
||||
|
||||
return text
|
||||
return re.sub(
|
||||
r"(^\s*>.*)", r'<span class="greentext">\1</span>', text,
|
||||
)
|
||||
|
||||
|
||||
def filter(self, html: str, outgoing: bool = False) -> str:
|
||||
html = self._sanitizer.sanitize(html)
|
||||
|
||||
if outgoing:
|
||||
return html
|
||||
|
||||
tree = etree.fromstring(html, parser=etree.HTMLParser())
|
||||
|
||||
if tree is None:
|
||||
|
@ -77,14 +81,11 @@ class HtmlFilter:
|
|||
|
||||
text = str(result, "utf-8").strip("\n")
|
||||
|
||||
if not outgoing:
|
||||
text = re.sub(
|
||||
r"<(p|br/?)>(\s*>.*)(!?</?(?:br|p)/?>)",
|
||||
r'<\1><span class="greentext">\2</span>\3',
|
||||
text,
|
||||
)
|
||||
|
||||
return text
|
||||
return re.sub(
|
||||
r"<(p|br/?)>(\s*>.*)(!?</?(?:br|p)/?>)",
|
||||
r'<\1><span class="greentext">\2</span>\3',
|
||||
text,
|
||||
)
|
||||
|
||||
|
||||
def sanitize_settings(self, inline: bool = False) -> dict:
|
||||
|
|
Loading…
Reference in New Issue
Block a user