diff --git a/lib/src/utils/color.dart b/lib/src/utils/color.dart index dc3b5fa5..8ee1d1b0 100644 --- a/lib/src/utils/color.dart +++ b/lib/src/utils/color.dart @@ -112,6 +112,11 @@ Color stringToColor(String? s) { int.parse(arr[2]), double.parse(arr[3])); } + // TODO: take care of "color": "inherit" + if (s.startsWith('inherit')) { + return Colors.black; + } + if (!s.startsWith('#')) { throw 'Color code not supported'; } diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 8745ccde..c21f13e4 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -504,7 +504,12 @@ class RawEditorState extends EditorState Line line, DefaultStyles? defaultStyles) { final attrs = line.style.attributes; if (attrs.containsKey(Attribute.header.key)) { - final int? level = attrs[Attribute.header.key]!.value; + int level; + if (attrs[Attribute.header.key]!.value is double) { + level = attrs[Attribute.header.key]!.value.toInt(); + } else { + level = attrs[Attribute.header.key]!.value; + } switch (level) { case 1: return defaultStyles!.h1!.verticalSpacing;