TF-4152 Fix tooltip stay out of screen in Email View

This commit is contained in:
dab246
2025-11-18 10:15:51 +07:00
committed by Dat H. Pham
parent 9ecf42989d
commit aba3cbbe4c
12 changed files with 291 additions and 93 deletions
+35
View File
@@ -419,4 +419,39 @@ class HtmlInteraction {
});
</script>
''';
static String scriptsHandleIframeLinkHoverListener(String viewId) => '''
<script type="text/javascript">
document.addEventListener("mouseover", function (e) {
const target = e.target;
if (target.tagName.toLowerCase() === "a") {
const rect = target.getBoundingClientRect();
const payload = {
view: '$viewId',
type: 'toDart: iframeLinkHover',
url: target.href,
rect: {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height
}
};
window.parent.postMessage(JSON.stringify(payload), "*");
}
});
document.addEventListener("mouseout", function (e) {
const target = e.target;
if (target.tagName.toLowerCase() === "a") {
const payload = {
view: '$viewId',
type: 'toDart: iframeLinkOut'
};
window.parent.postMessage(JSON.stringify(payload), "*");
}
});
</script>
''';
}
-21
View File
@@ -2,27 +2,6 @@
import 'package:flutter/material.dart';
class HtmlTemplate {
static const String nameClassToolTip = 'tmail-tooltip';
static const String tooltipLinkCss = '''
.$nameClassToolTip .tooltiptext {
visibility: hidden;
max-width: 400px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 8px 5px 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: absolute;
z-index: 1;
}
.$nameClassToolTip:hover .tooltiptext {
visibility: visible;
}
''';
static const String printDocumentCssStyle = '''
<style>
$fontFaceStyle