feat: added javascript Insert element commands
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rich_editor/src/utils/constants.dart';
|
||||
import 'package:rich_editor/src/models/button.dart';
|
||||
import 'package:rich_editor/src/utils/constants.dart';
|
||||
import 'package:rich_editor/src/utils/javascript_executor_base.dart';
|
||||
import 'package:rich_editor/src/widgets/tab_button.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
@@ -9,8 +10,13 @@ class GroupedTab extends StatelessWidget {
|
||||
|
||||
GroupedTab({this.controller});
|
||||
|
||||
JavascriptExecutorBase javascriptExecutorBase = JavascriptExecutorBase();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (controller != null) {
|
||||
javascriptExecutorBase.init(controller!);
|
||||
}
|
||||
return Container(
|
||||
color: Color(0xff424242),
|
||||
height: 59.0,
|
||||
@@ -26,12 +32,24 @@ class GroupedTab extends StatelessWidget {
|
||||
icon: button.icon,
|
||||
onTap: () async {
|
||||
print('BOLDDD');
|
||||
// await controller?.evaluateJavascript('editor.undo()');
|
||||
await controller?.evaluateJavascript('editor.setBold()');
|
||||
String? html = await controller?.evaluateJavascript('editor.getEncodedHtml()');
|
||||
print(Uri.decodeFull(html!));
|
||||
javascriptExecutorBase.setBold();
|
||||
String? html = await javascriptExecutorBase.getHtml();
|
||||
print(html!);
|
||||
},
|
||||
)
|
||||
// TabButton(
|
||||
// icon: Icons.link,
|
||||
// onTap: () async {
|
||||
// javascriptExecutorBase.insertLink(
|
||||
// 'https://github.com/JideGuru/rich_editor', 'git');
|
||||
// },
|
||||
// ),
|
||||
// TabButton(
|
||||
// icon: Icons.format_bold,
|
||||
// onTap: () async {
|
||||
// javascriptExecutorBase.setBold();
|
||||
// },
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user