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',
|
'BASIC',
|
||||||
'C',
|
'C',
|
||||||
'C#',
|
'C#',
|
||||||
'C++',
|
'CPP',
|
||||||
'Clojure',
|
'Clojure',
|
||||||
'CSS',
|
'CSS',
|
||||||
'Dart',
|
'Dart',
|
||||||
@ -167,7 +167,10 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
|||||||
.map((e) => e.toLowerCase())
|
.map((e) => e.toLowerCase())
|
||||||
.toSet()
|
.toSet()
|
||||||
.intersection(allLanguages.keys.toSet())
|
.intersection(allLanguages.keys.toSet())
|
||||||
.toList();
|
.toList()
|
||||||
|
..add('auto')
|
||||||
|
..add('c')
|
||||||
|
..sort();
|
||||||
|
|
||||||
late final editorState = context.read<EditorState>();
|
late final editorState = context.read<EditorState>();
|
||||||
|
|
||||||
@ -253,7 +256,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
|||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: FlowyTextButton(
|
child: FlowyTextButton(
|
||||||
'${language?.capitalize() ?? 'auto'} ',
|
'${language?.capitalize() ?? 'Auto'} ',
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 12.0,
|
horizontal: 12.0,
|
||||||
vertical: 4.0,
|
vertical: 4.0,
|
||||||
@ -281,7 +284,7 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
|
|||||||
Future<void> updateLanguage(String language) async {
|
Future<void> updateLanguage(String language) async {
|
||||||
final transaction = editorState.transaction
|
final transaction = editorState.transaction
|
||||||
..updateNode(node, {
|
..updateNode(node, {
|
||||||
CodeBlockKeys.language: language,
|
CodeBlockKeys.language: language == 'auto' ? null : language,
|
||||||
})
|
})
|
||||||
..afterSelection = Selection.collapse(
|
..afterSelection = Selection.collapse(
|
||||||
node.path,
|
node.path,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user