New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(editor): support direction and text align in toolbar #6817
base: main
Are you sure you want to change the base?
feat(editor): support direction and text align in toolbar #6817
Conversation
Hey there! It looks like you didn't provide much information here. Please consider adding more details about the issue / pr or it will be automatically closed. Thanks for helping us maintain the project! |
…irection-and-text-align
Hi @bahmannejati thanks for your suggestion. We won't be able to merge a PR as it stands for a number of reasons.
One improvement that would potentially be mergable would be to have the LTR/RTL detection remain automatic, but on a paragraph-by-paragraph basis. This could be achieved without any additional controls or data storage and provide the 90% solution with a tiny amount of code change. |
Hi @tommoor, thank you for your response, Auto-direction detection is not practical, setting direction & text-align manually is the solution that editors like Google Docs use. Many Persian companies can use Outline for their technical documentation instead of Confluence (as you probably know, Attlasian is going to stop support for server products in 2024), still, they must be able to write in RTL & LTR simultaneously. I have a suggestion:
|
Adding direction & text-align buttons to the editor toolbar
Users can select a specific paragraph or any groups of Nodes and set writing direction & text alignment using 5 buttons added to the toolbar
Issue
Currently despite the RTL documents being supported user cannot change the direction or text-align of paragraphs or other Nodes, so when the document starts with LTR characters, the whole document will be forced to be written in LTR:
Features
$from
node, we can improve it laterBackward compatibility
Old documents will work without any issues.
Supported nodes
Direction & text alignment only applies to nodes, not marks.
Almost all nodes that need to be aligned or set direction, are supported, including:
<quote>
<ul>
<h1...h6>
<li>
<ol>
<p>
<table>
<td>
<th>
<tr>
Side fixes
Mobile toolbar:
Comment editor toolbar:
It's better to use a thin visible scrollbar, later we can update it
.rtl
has been removed from theshared/editor/components/Styles.ts
file, usedborder-inline-start|end
,margin-inline-start|end
,padding-inline-start|end
,inset-inline-start|end
&border-start|end-start|end-radius
to change properties dynamically, these CSS properties are supported in browsers listed in outline project, exceptSafari For IOS 12.2-12.5 (0.260%)
, its up to outline team whether to support or not this browserTechnical notes
outline-icons
doesn't have any icon for "RTL" or "LTR"SelectionToolbar
component calledisCommentEditor
, to restrict formatting buttons like text alignments, note that the direction button is visible in the comment editor, so if the user changes the direction, the alignment will be automatically applied according to the selected directionsetAttrOnSelection
, which can set attributes like direction & text-align for the whole selection, it will set the attribute to the target value, for nodes between$from
and$end
, and also check the parent of$from
and applies to it too if all its children have been selectedFuture checklist
Enter
is pressed (currently the direction detected by the first character is used as the default direction)