Justification actions for comments editor on EM page

This commit is contained in:
Kovid Goyal 2018-03-22 09:31:17 +05:30
parent 9a838c0f93
commit c2a92ad678
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 51 additions and 5 deletions

View File

@ -0,0 +1,5 @@
<svg viewBox="0 0 128 128" height="128" width="128">
<g transform="translate(0,-924.36216)">
<path d="m 127,1024.3622 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1035.1903 1,1033.3622 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m -27,-27.00004 0,9.00004 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -63,0 q -1.82812,0 -3.16406,-1.3359 Q 28,1008.1903 28,1006.3622 l 0,-9.00004 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 63,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 18,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -99,0 q -1.82812,0 -3.16406,-1.3359 Q 10,981.19026 10,979.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 99,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m -27,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -45,0 q -1.82812,0 -3.16406,-1.3359 Q 37,954.19026 37,952.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 45,0 q 1.82813,0 3.16406,1.3359 Q 91,941.53406 91,943.36216 Z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,5 @@
<svg viewBox="0 0 128 128" height="128" width="128">
<g transform="translate(0,-924.36216)">
<path d="m 127,1024.3622 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1035.1903 1,1033.3622 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27.00004 0,9.00004 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1008.1903 1,1006.3622 l 0,-9.00004 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,981.19026 1,979.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,954.19026 1,952.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,5 @@
<svg viewBox="0 0 128 128" height="128" width="128">
<g transform="translate(0,-924.36216)">
<path d="m 127,1024.3622 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1035.1903 1,1033.3622 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m -27,-27.00004 0,9.00004 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -90,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1008.1903 1,1006.3622 l 0,-9.00004 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 90,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 18,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -108,0 q -1.82812,0 -3.16406,-1.3359 Q 1,981.19026 1,979.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 108,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m -27,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -81,0 q -1.82812,0 -3.16406,-1.3359 Q 1,954.19026 1,952.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 81,0 q 1.82813,0 3.16406,1.3359 Q 91,941.53406 91,943.36216 Z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,5 @@
<svg viewBox="0 0 128 128" height="128" width="128">
<g transform="translate(0,-924.36216)">
<path d="m 127,1024.3622 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -117,0 q -1.82812,0 -3.16406,-1.3359 Q 1,1035.1903 1,1033.3622 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 117,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27.00004 0,9.00004 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -90,0 q -1.82812,0 -3.16406,-1.3359 Q 28,1008.1903 28,1006.3622 l 0,-9.00004 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 90,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -108,0 q -1.82812,0 -3.16406,-1.3359 Q 10,981.19026 10,979.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 108,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z m 0,-27 0,9 q 0,1.8281 -1.33594,3.1641 -1.33593,1.3359 -3.16406,1.3359 l -81,0 q -1.82812,0 -3.16406,-1.3359 Q 37,954.19026 37,952.36216 l 0,-9 q 0,-1.8281 1.33594,-3.1641 1.33594,-1.3359 3.16406,-1.3359 l 81,0 q 1.82813,0 3.16406,1.3359 1.33594,1.336 1.33594,3.1641 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -157,6 +157,31 @@ def all_editor_actions(): # {{{
'execute': def (editor, activated):
editor.exec_command('outdent')
},
'justify-left': {
'icon': 'justify-left',
'title': _('Align left'),
'execute': def (editor, activated):
editor.exec_command('justifyLeft')
},
'justify-full': {
'icon': 'justify-full',
'title': _('Align justified'),
'execute': def (editor, activated):
editor.exec_command('justifyFull')
},
'justify-center': {
'icon': 'justify-center',
'title': _('Align center'),
'execute': def (editor, activated):
editor.exec_command('justifyCenter')
},
'justify-right': {
'icon': 'justify-right',
'title': _('Align right'),
'execute': def (editor, activated):
editor.exec_command('justifyRight')
},
}
return all_editor_actions.ans
# }}}
@ -336,6 +361,7 @@ def create_comments_editor(container):
acmap = all_editor_actions()
def add(toolbar, ac_name):
if ac_name:
if acmap[ac_name]:
add_action(toolbar, ac_name, acmap[ac_name], editor.id)
else:
@ -344,7 +370,7 @@ def create_comments_editor(container):
for ac_name in 'undo redo select-all remove-format | bold italic underline strikethrough | hr superscript subscript format-block'.split(' '):
add(toolbar1, ac_name)
for ac_name in 'ul ol indent outdent |'.split(' '):
for ac_name in 'ul ol indent outdent | justify-left justify-center justify-right justify-full |'.split(' '):
add(toolbar2, ac_name)
container.setAttribute('style', (container.getAttribute('style') or '') + ';display: flex; flex-direction: column; align-items: stretch')