mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add c/cpp/auto options in code langauges
This commit is contained in:
parent
62be81395d
commit
70963a55f1
@ -123,7 +123,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
||||
'BASIC',
|
||||
'C',
|
||||
'C#',
|
||||
'C++',
|
||||
'CPP',
|
||||
'Clojure',
|
||||
'CSS',
|
||||
'Dart',
|
||||
@ -167,7 +167,10 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
||||
.map((e) => e.toLowerCase())
|
||||
.toSet()
|
||||
.intersection(allLanguages.keys.toSet())
|
||||
.toList();
|
||||
.toList()
|
||||
..add('auto')
|
||||
..add('c')
|
||||
..sort();
|
||||
|
||||
late final editorState = context.read<EditorState>();
|
||||
|
||||
@ -253,7 +256,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: FlowyTextButton(
|
||||
'${language?.capitalize() ?? 'auto'} ',
|
||||
'${language?.capitalize() ?? 'Auto'} ',
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0,
|
||||
vertical: 4.0,
|
||||
@ -281,7 +284,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
||||
Future<void> updateLanguage(String language) async {
|
||||
final transaction = editorState.transaction
|
||||
..updateNode(node, {
|
||||
CodeBlockKeys.language: language,
|
||||
CodeBlockKeys.language: language == 'auto' ? null : language,
|
||||
})
|
||||
..afterSelection = Selection.collapse(
|
||||
node.path,
|
||||
|
Loading…
Reference in New Issue
Block a user