added augment buttons (full functionality pending)
This commit is contained in:
parent
27b1ce69a5
commit
b03d939a11
@ -368,9 +368,11 @@ class _EmailViewState extends State<EmailView> {
|
||||
}
|
||||
|
||||
void _scrollToNumber(String spanId) {
|
||||
AugmentClasses.handleJump(viewTypeId, spanId);
|
||||
AugmentClasses.handleJump(viewTypeId);
|
||||
}
|
||||
|
||||
// void _invisibility(String )
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// print(currentContent);
|
||||
|
@ -120,6 +120,13 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
||||
Stack(children: [
|
||||
Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () => AugmentClasses.JumpButton(context),
|
||||
child: Text('JumpItem:'),
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 8,
|
||||
// ),
|
||||
Container(
|
||||
width: 150,
|
||||
height: 30,
|
||||
@ -225,39 +232,7 @@ class AugmentClasses {
|
||||
print("Stop button pressed");
|
||||
}
|
||||
|
||||
static void handleJump(String viewTypeId, String spanId) {
|
||||
print(spanId);
|
||||
// final jsCode = '''
|
||||
// var iframe = document.getElementById("iframe#$viewTypeId").contentWindow;
|
||||
// var element = iframe.document.getElementById('$spanId');
|
||||
// if (element) {
|
||||
// element.scrollIntoView({behavior: "smooth", block: "start"});
|
||||
// }
|
||||
// ''';
|
||||
// final jsCode = '''
|
||||
// var iframe = document.getElementById("$viewTypeId");
|
||||
// if (iframe) {
|
||||
// var iframeWindow = iframe.contentWindow;
|
||||
// if (iframeWindow && iframeWindow.document) {
|
||||
// var element = iframeWindow.document.getElementById('$spanId');
|
||||
// if (element) {
|
||||
// element.scrollIntoView({behavior: "smooth", block: "start"});
|
||||
// console.log("Scrolling to element with ID: $spanId");
|
||||
// } else {
|
||||
// console.error("Element with ID $spanId not found in iframe.");
|
||||
// }
|
||||
// } else {
|
||||
// console.error("Iframe contentWindow or document is not accessible.");
|
||||
// }
|
||||
// } else {
|
||||
// console.error("Iframe with ID $viewTypeId not found.");
|
||||
// }
|
||||
// ''';
|
||||
// print('jumped'); // For debugging in Dart
|
||||
|
||||
// // Execute the JavaScript code
|
||||
// js.context.callMethod('eval', [jsCode]);
|
||||
// Select the first iframe on the page
|
||||
static void handleJump(String spanId) {
|
||||
String js_code = '''
|
||||
var iframe = document.getElementsByTagName('iframe')[0]; // 0 for the first iframe, 1 for the second, etc.
|
||||
|
||||
@ -280,6 +255,34 @@ class AugmentClasses {
|
||||
console.log('Iframe not found or not loaded.');
|
||||
}
|
||||
''';
|
||||
js.context.callMethod('eval', [js_code]);
|
||||
js.context.callMethod('eval', [js_code]);
|
||||
}
|
||||
|
||||
static void invisibility(String htmlClass) {}
|
||||
static JumpButton(context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Jump Item:'),
|
||||
content: Column(
|
||||
children: [
|
||||
Text('Jump (to) Item (at)'),
|
||||
TextField(),
|
||||
// ElevatedButton(
|
||||
// onPressed: AugmentClasses.ViewSpecsButton(context),
|
||||
// child: Text('ViewSpecs'),
|
||||
// ),
|
||||
]
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
static ViewSpecsButton(context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder:(context) => AlertDialog(
|
||||
title: Text('Viewspecs(short)') ,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user