diff --git a/packages/notus/lib/src/document/attributes.dart b/packages/notus/lib/src/document/attributes.dart index cf008b2af..ed4e6a9d7 100644 --- a/packages/notus/lib/src/document/attributes.dart +++ b/packages/notus/lib/src/document/attributes.dart @@ -137,12 +137,9 @@ class NotusAttribute implements NotusAttributeBuilder { /// Direction attribute static const direction = DirectionAttributeBuilder._(); - /// Alias for [NotusAttribute.direction.ltr]. + /// Alias for [NotusAttribute.direction.rtl]. static NotusAttribute get rtl => direction.rtl; - /// Alias for [NotusAttribute.direction.ltr]. - static NotusAttribute get ltr => direction.ltr; - static NotusAttribute _fromKeyValue(String key, dynamic value) { if (!_registry.containsKey(key)) { throw ArgumentError.value( @@ -418,6 +415,4 @@ class DirectionAttributeBuilder extends NotusAttributeBuilder { : super._(_kDirection, NotusAttributeScope.line); NotusAttribute get rtl => NotusAttribute._(key, scope, 'rtl'); - - NotusAttribute get ltr => NotusAttribute._(key, scope, 'ltr'); } diff --git a/packages/zefyr/lib/src/widgets/editable_text_block.dart b/packages/zefyr/lib/src/widgets/editable_text_block.dart index e446b472b..45436e59d 100644 --- a/packages/zefyr/lib/src/widgets/editable_text_block.dart +++ b/packages/zefyr/lib/src/widgets/editable_text_block.dart @@ -53,10 +53,8 @@ class EditableTextBlock extends StatelessWidget { final preferredDirection = node.style.get(NotusAttribute.direction); if (preferredDirection == NotusAttribute.rtl) { return TextDirection.rtl; - } else if (preferredDirection == NotusAttribute.ltr) { - return TextDirection.ltr; } - return Directionality.of(context); + return TextDirection.ltr; } List _buildChildren(BuildContext context) { @@ -68,23 +66,26 @@ class EditableTextBlock extends StatelessWidget { index++; final nodeTextDirection = getTextDirectionForNode(context, line as LineNode); - children.add(EditableTextLine( - node: line, + children.add(Directionality( textDirection: nodeTextDirection, - spacing: _getSpacingForLine(line, index, count, theme), - leading: _buildLeading(context, line, index, count), - indentWidth: _getIndentWidth(), - devicePixelRatio: MediaQuery.of(context).devicePixelRatio, - body: TextLine( + child: EditableTextLine( node: line, - embedBuilder: embedBuilder, textDirection: nodeTextDirection, + spacing: _getSpacingForLine(line, index, count, theme), + leading: _buildLeading(context, line, index, count), + indentWidth: _getIndentWidth(), + devicePixelRatio: MediaQuery.of(context).devicePixelRatio, + body: TextLine( + node: line, + embedBuilder: embedBuilder, + textDirection: nodeTextDirection, + ), + cursorController: cursorController, + selection: selection, + selectionColor: selectionColor, + enableInteractiveSelection: enableInteractiveSelection, + hasFocus: hasFocus, ), - cursorController: cursorController, - selection: selection, - selectionColor: selectionColor, - enableInteractiveSelection: enableInteractiveSelection, - hasFocus: hasFocus, )); } return children.toList(growable: false); diff --git a/packages/zefyr/lib/src/widgets/editor.dart b/packages/zefyr/lib/src/widgets/editor.dart index ca48b35bd..8ac0fe75e 100644 --- a/packages/zefyr/lib/src/widgets/editor.dart +++ b/packages/zefyr/lib/src/widgets/editor.dart @@ -1155,14 +1155,12 @@ class RawEditorState extends EditorState ); } - TextDirection getTextDirectionForStyledNode(StyledNode node){ + TextDirection getTextDirectionForStyledNode(StyledNode node) { final preferredDirection = node.style.get(NotusAttribute.direction); if (preferredDirection == NotusAttribute.rtl) { return TextDirection.rtl; - } else if (preferredDirection == NotusAttribute.ltr) { - return TextDirection.ltr; } - return _textDirection; + return TextDirection.ltr; } List _buildChildren(BuildContext context) { diff --git a/packages/zefyr/lib/src/widgets/editor_toolbar.dart b/packages/zefyr/lib/src/widgets/editor_toolbar.dart index c828d52b0..3b2f080d2 100644 --- a/packages/zefyr/lib/src/widgets/editor_toolbar.dart +++ b/packages/zefyr/lib/src/widgets/editor_toolbar.dart @@ -442,15 +442,6 @@ class ZefyrToolbar extends StatefulWidget implements PreferredSizeWidget { visible: !hideDirection, child: VerticalDivider( indent: 16, endIndent: 16, color: Colors.grey.shade400)), - Visibility( - visible: !hideDirection, - child: ToggleStyleButton( - attribute: NotusAttribute.ltr, - icon: Icons.format_textdirection_l_to_r, - controller: controller, - ), - ), - SizedBox(width: 1), Visibility( visible: !hideDirection, child: ToggleStyleButton(