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) {
|
void _scrollToNumber(String spanId) {
|
||||||
AugmentClasses.handleJump(viewTypeId, spanId);
|
AugmentClasses.handleJump(viewTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void _invisibility(String )
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// print(currentContent);
|
// print(currentContent);
|
||||||
|
@ -120,6 +120,13 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
Stack(children: [
|
Stack(children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => AugmentClasses.JumpButton(context),
|
||||||
|
child: Text('JumpItem:'),
|
||||||
|
),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 8,
|
||||||
|
// ),
|
||||||
Container(
|
Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
height: 30,
|
height: 30,
|
||||||
@ -225,39 +232,7 @@ class AugmentClasses {
|
|||||||
print("Stop button pressed");
|
print("Stop button pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleJump(String viewTypeId, String spanId) {
|
static void handleJump(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
|
|
||||||
String js_code = '''
|
String js_code = '''
|
||||||
var iframe = document.getElementsByTagName('iframe')[0]; // 0 for the first iframe, 1 for the second, etc.
|
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.');
|
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