It would be very useful
Agreed. Trying to add this myself via an Extension and it's a PITA. I don't really know what I'm doing here and cannot figure out how to write an extension.
rtl is not alignment. It's direction. The text can be rtl, but left aligned, and vice-versa.
any news on this?
Ye, can't find this buttons in plugin, but label "ready" is here =\
You can do this already using MediumButton and execCommand. See https://developer.mozilla.org/en-US/docs/Web/API/document.execCommand for more information. This simple example doesn't alter the button state depending on whether the selection is already aligned.
var alignright = new MediumButton(
{
label:'R',
start:'',
end:'',
action: function (html, mark) {
document.execCommand('justifyRight', false);
return html;
}
}
);
It works! thanks a lot!)
justifyLeft justifyCenter justifyRight and justifyFull are now built-in buttons you can use.
Awesome. thanks!
Please set a shortcut key for alignment
@evazzadeh which one should we use ?
@j0k3r Common editor like mce use below shortcut key for alignments
Also for other function like set heading, create a list, insert a quote or link , ... can set shortcut for better usability.
and another note for remove alignment style on 2nd click on button. For example after set align center if we want to remove this align, we must add remove formatting button on toolbar. You can set 2nd click on align button to remove style of it.
For the moment, shortcuts are only available with one letter. I mean CTRL+B for bold. I see that Medium use the CTRL+E to align center.
We can think about adding complex shortcuts in the future to handle alignement.
@j0k3r One letter shortcut reserved for browsers, for example Ctrl+R for redirect or Ctrl+E in chrome and IE inserts a question mark at the start of the address and in Firefox set focus to search box.
I suggest that using 2nd click on the same alignment item for removing style of it like a bold style or heading
Has anyone ever found a way to get 2nd click on a justify item to remove the style?
Is there any reason why, 6 years later, there's still no freaking way to align text in Medium - outside the smelly document.execCommand JS hack?
Is there any reason why a professional blogging platform like Medium believes that text alignment is not a key feature of a text editor?
Is there any reason why there's no official workaround and no official answer?
It sucks really badly. I'm not sure if the developers at Medium have yet realized it.
@BlackLight this repository isn't for a package actually used in Medium, it is just an editor based off of Medium's own proprietary editor.
Most helpful comment
Has anyone ever found a way to get 2nd click on a justify item to remove the style?