add tooltips
This commit is contained in:
parent
579b4e1d5d
commit
cd1f7a3be3
|
@ -351,5 +351,65 @@
|
||||||
"no_communities_found": "No communities found",
|
"no_communities_found": "No communities found",
|
||||||
"@no_communities_found": {},
|
"@no_communities_found": {},
|
||||||
"network_error": "Network error",
|
"network_error": "Network error",
|
||||||
"@network_error": {}
|
"@network_error": {},
|
||||||
|
"editor_bold": "bold",
|
||||||
|
"@editor_bold": {
|
||||||
|
"description": "tooltip for button making text bold in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_italics": "italics",
|
||||||
|
"@editor_italics": {
|
||||||
|
"description": "tooltip for button making text italics in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_link": "insert link",
|
||||||
|
"@editor_link": {
|
||||||
|
"description": "tooltip for button that inserts link in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_image": "insert image",
|
||||||
|
"@editor_image": {
|
||||||
|
"description": "tooltip for button that inserts image in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_user": "link user",
|
||||||
|
"@editor_user": {
|
||||||
|
"description": "tooltip for button that opens a popup to select user to be linked in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_community": "link community",
|
||||||
|
"@editor_community": {
|
||||||
|
"description": "tooltip for button that opens a popup to select community to be linked in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_header": "insert header",
|
||||||
|
"@editor_header": {
|
||||||
|
"description": "tooltip for button that inserts header in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_strikethrough": "strikethrough",
|
||||||
|
"@editor_strikethrough": {
|
||||||
|
"description": "tooltip for button that makes text strikethrough in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_quote": "quote",
|
||||||
|
"@editor_quote": {
|
||||||
|
"description": "tooltip for button that makes selected text into quote blocks in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_list": "list",
|
||||||
|
"@editor_list": {
|
||||||
|
"description": "tooltip for button that makes selected text into list in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_code": "code",
|
||||||
|
"@editor_code": {
|
||||||
|
"description": "tooltip for button that makes text into code in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_subscript": "subscript",
|
||||||
|
"@editor_subscript": {
|
||||||
|
"description": "tooltip for button that makes text into subscript in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_superscript": "superscript",
|
||||||
|
"@editor_superscript": {
|
||||||
|
"description": "tooltip for button that makes text into superscript in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_spoiler": "spoiler",
|
||||||
|
"@editor_spoiler": {
|
||||||
|
"description": "tooltip for button that inserts spoiler in markdown editor toolbar"
|
||||||
|
},
|
||||||
|
"editor_help": "markdown guide",
|
||||||
|
"@editor_help": {
|
||||||
|
"description": "tooltip for button that goes to page containing a guide for markdown"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:logging/logging.dart';
|
||||||
|
|
||||||
import '../../formatter.dart';
|
import '../../formatter.dart';
|
||||||
import '../../hooks/logged_in_action.dart';
|
import '../../hooks/logged_in_action.dart';
|
||||||
|
import '../../l10n/l10n.dart';
|
||||||
import '../../resources/links.dart';
|
import '../../resources/links.dart';
|
||||||
import '../../url_launcher.dart';
|
import '../../url_launcher.dart';
|
||||||
import '../../util/async_store_listener.dart';
|
import '../../util/async_store_listener.dart';
|
||||||
|
@ -203,10 +204,12 @@ class _ToolbarBody extends HookWidget {
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('**'),
|
onPressed: () => controller.surround('**'),
|
||||||
icon: const Icon(Icons.format_bold),
|
icon: const Icon(Icons.format_bold),
|
||||||
|
tooltip: L10n.of(context).editor_bold,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('*'),
|
onPressed: () => controller.surround('*'),
|
||||||
icon: const Icon(Icons.format_italic),
|
icon: const Icon(Icons.format_italic),
|
||||||
|
tooltip: L10n.of(context).editor_italics,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -215,6 +218,7 @@ class _ToolbarBody extends HookWidget {
|
||||||
if (r != null) controller.reformat((_) => r);
|
if (r != null) controller.reformat((_) => r);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.link),
|
icon: const Icon(Icons.link),
|
||||||
|
tooltip: L10n.of(context).editor_link,
|
||||||
),
|
),
|
||||||
// Insert image
|
// Insert image
|
||||||
ObserverBuilder<EditorToolbarStore>(
|
ObserverBuilder<EditorToolbarStore>(
|
||||||
|
@ -246,6 +250,7 @@ class _ToolbarBody extends HookWidget {
|
||||||
icon: store.imageUploadState.isLoading
|
icon: store.imageUploadState.isLoading
|
||||||
? const CircularProgressIndicator.adaptive()
|
? const CircularProgressIndicator.adaptive()
|
||||||
: const Icon(Icons.image),
|
: const Icon(Icons.image),
|
||||||
|
tooltip: L10n.of(context).editor_image,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -262,6 +267,7 @@ class _ToolbarBody extends HookWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.person),
|
icon: const Icon(Icons.person),
|
||||||
|
tooltip: L10n.of(context).editor_user,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -275,6 +281,7 @@ class _ToolbarBody extends HookWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.home),
|
icon: const Icon(Icons.home),
|
||||||
|
tooltip: L10n.of(context).editor_community,
|
||||||
),
|
),
|
||||||
PopupMenuButton<HeaderLevel>(
|
PopupMenuButton<HeaderLevel>(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
|
@ -291,63 +298,74 @@ class _ToolbarBody extends HookWidget {
|
||||||
controller.insertAtBeginningOfFirstSelectedLine(header);
|
controller.insertAtBeginningOfFirstSelectedLine(header);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
tooltip: L10n.of(context).editor_header,
|
||||||
child: const Icon(Icons.h_mobiledata),
|
child: const Icon(Icons.h_mobiledata),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('~~'),
|
onPressed: () => controller.surround('~~'),
|
||||||
icon: const Icon(Icons.format_strikethrough),
|
icon: const Icon(Icons.format_strikethrough),
|
||||||
|
tooltip: L10n.of(context).editor_strikethrough,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.insertAtBeginningOfEverySelectedLine('> ');
|
controller.insertAtBeginningOfEverySelectedLine('> ');
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.format_quote),
|
icon: const Icon(Icons.format_quote),
|
||||||
|
tooltip: L10n.of(context).editor_quote,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final line = controller.firstSelectedLine;
|
final line = controller.firstSelectedLine;
|
||||||
|
|
||||||
if (line.startsWith(RegExp.escape('* '))) {
|
if (line.startsWith(RegExp.escape('* '))) {
|
||||||
controller.removeAtBeginningOfEverySelectedLine('* ');
|
controller.removeAtBeginningOfEverySelectedLine('* ');
|
||||||
} else if (line.startsWith('- ')) {
|
} else if (line.startsWith('- ')) {
|
||||||
controller.removeAtBeginningOfEverySelectedLine('- ');
|
controller.removeAtBeginningOfEverySelectedLine('- ');
|
||||||
} else {
|
} else {
|
||||||
controller.insertAtBeginningOfEverySelectedLine('- ');
|
controller.insertAtBeginningOfEverySelectedLine('- ');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.format_list_bulleted)),
|
icon: const Icon(Icons.format_list_bulleted),
|
||||||
|
tooltip: L10n.of(context).editor_list,
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('`'),
|
onPressed: () => controller.surround('`'),
|
||||||
icon: const Icon(Icons.code),
|
icon: const Icon(Icons.code),
|
||||||
|
tooltip: L10n.of(context).editor_code,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('~'),
|
onPressed: () => controller.surround('~'),
|
||||||
icon: const Icon(Icons.subscript),
|
icon: const Icon(Icons.subscript),
|
||||||
|
tooltip: L10n.of(context).editor_subscript,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => controller.surround('^'),
|
onPressed: () => controller.surround('^'),
|
||||||
icon: const Icon(Icons.superscript),
|
icon: const Icon(Icons.superscript),
|
||||||
|
tooltip: L10n.of(context).editor_superscript,
|
||||||
),
|
),
|
||||||
//spoiler
|
//spoiler
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.reformat((selection) {
|
controller.reformat((selection) {
|
||||||
final insides = selection.isNotEmpty ? selection : '___';
|
final insides = selection.isNotEmpty ? selection : '___';
|
||||||
Logger.root
|
Logger.root
|
||||||
.info([21, 21 + insides.length, insides, insides.length]);
|
.info([21, 21 + insides.length, insides, insides.length]);
|
||||||
return Reformat(
|
return Reformat(
|
||||||
text: '\n::: spoiler spoiler\n$insides\n:::\n',
|
text: '\n::: spoiler spoiler\n$insides\n:::\n',
|
||||||
selectionBeginningShift: 21,
|
selectionBeginningShift: 21,
|
||||||
selectionEndingShift: 21 + insides.length - selection.length,
|
selectionEndingShift: 21 + insides.length - selection.length,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.warning)),
|
icon: const Icon(Icons.warning),
|
||||||
|
tooltip: L10n.of(context).editor_spoiler,
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
launchLink(link: markdownGuide, context: context);
|
launchLink(link: markdownGuide, context: context);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.question_mark),
|
icon: const Icon(Icons.question_mark),
|
||||||
|
tooltip: L10n.of(context).editor_help,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue