A few more actions for the EM page comments editor

This commit is contained in:
Kovid Goyal 2018-03-21 08:34:34 +05:30
parent 88d4772ec8
commit 2d2d66113d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 44 additions and 1 deletions

1
imgsrc/srv/eraser.svg Normal file
View File

@ -0,0 +1 @@
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M832 1408l336-384h-768l-336 384h768zm1013-1077q15 34 9.5 71.5t-30.5 65.5l-896 1024q-38 44-96 44h-768q-38 0-69.5-20.5t-47.5-54.5q-15-34-9.5-71.5t30.5-65.5l896-1024q38-44 96-44h768q38 0 69.5 20.5t47.5 54.5z"/></svg>

After

Width:  |  Height:  |  Size: 313 B

6
imgsrc/srv/redo.svg Normal file
View File

@ -0,0 +1,6 @@
<svg width="48" height="48" viewBox="0 0 48 48">
<g transform="matrix(-3.7795276,0,0,3.7795276,48,-1074.0897)">
<g transform="matrix(-0.508,0,0,0.508,120.904,120.35622)"><path d="m 227,330 c 0,-0.945 0,-6 0,-6 l 11,9.5 -11,9.5 v -6 c -10,0 -14,9 -14,9 0,-8 6,-16 14,-16 z" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 305 B

View File

@ -0,0 +1,5 @@
<svg width="128" height="128" viewBox="0 0 128 128">
<g transform="translate(0,-924.36216)">
<path d="m 117,1018.6479 0,7.5714 q 0,1.5379 -1.12388,2.6618 -1.12389,1.1239 -2.66183,1.1239 l -98.428576,0 q -1.537946,0 -2.66183,-1.1239 Q 11,1027.7572 11,1026.2193 l 0,-7.5714 q 0,-1.538 1.123884,-2.6619 1.123884,-1.1239 2.66183,-1.1239 l 98.428576,0 q 1.53794,0 2.66183,1.1239 1.12388,1.1239 1.12388,2.6619 z m -22.714286,-22.71433 0,7.57143 q 0,1.5379 -1.123884,2.6618 -1.123884,1.1239 -2.66183,1.1239 l -53,0 q -1.537946,0 -2.66183,-1.1239 -1.123884,-1.1239 -1.123884,-2.6618 l 0,-7.57143 q 0,-1.53795 1.123884,-2.66183 1.123884,-1.12388 2.66183,-1.12388 l 53,0 q 1.537946,0 2.66183,1.12388 1.123884,1.12388 1.123884,2.66183 z m 15.142856,-22.71428 0,7.57142 q 0,1.53795 -1.12388,2.66183 -1.12389,1.12388 -2.66183,1.12388 l -83.285717,0 q -1.537947,0 -2.661831,-1.12388 -1.123883,-1.12388 -1.123883,-2.66183 l 0,-7.57142 q 0,-1.53796 1.123883,-2.66184 1.123884,-1.12388 2.661831,-1.12388 l 83.285717,0 q 1.53794,0 2.66183,1.12388 1.12388,1.12388 1.12388,2.66184 z m -22.714284,-22.7143 0,7.57143 q 0,1.53795 -1.123884,2.66183 -1.123884,1.12389 -2.661831,1.12389 l -37.857142,0 q -1.537947,0 -2.661831,-1.12389 -1.123884,-1.12388 -1.123884,-2.66183 l 0,-7.57143 q 0,-1.53794 1.123884,-2.66183 1.123884,-1.12387 2.661831,-1.12387 l 37.857142,0 q 1.537947,0 2.661831,1.12387 1.123884,1.12389 1.123884,2.66183 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

7
imgsrc/srv/undo.svg Normal file
View File

@ -0,0 +1,7 @@
<svg width="48" height="48" viewBox="0 0 48 48">
<g transform="matrix(3.7795276,0,0,3.7795276,-2.5999995e-7,-1074.0897)">
<g transform="matrix(-0.508,0,0,0.508,120.904,120.35622)">
<path d="m 227,330 c 0,-0.945 0,-6 0,-6 l 11,9.5 -11,9.5 v -6 c -10,0 -14,9 -14,9 0,-8 6,-16 14,-16 z" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 322 B

View File

@ -30,6 +30,30 @@ add_extra_css(def():
def all_editor_actions(): def all_editor_actions():
if not all_editor_actions.ans: if not all_editor_actions.ans:
all_editor_actions.ans = { all_editor_actions.ans = {
'select-all': {
'icon': 'select-all',
'title': _('Select all'),
'execute': def (editor, activated):
editor.exec_command('selectAll')
},
'remove-format': {
'icon': 'eraser',
'title': _('Remove formatting'),
'execute': def (editor, activated):
editor.exec_command('removeFormat')
},
'undo': {
'icon': 'undo',
'title': _('Undo'),
'execute': def (editor, activated):
editor.exec_command('undo')
},
'redo': {
'icon': 'redo',
'title': _('Redo'),
'execute': def (editor, activated):
editor.exec_command('redo')
},
'bold': { 'bold': {
'icon': 'bold', 'icon': 'bold',
'title': _('Bold'), 'title': _('Bold'),
@ -230,7 +254,7 @@ def create_comments_editor(container):
toolbar1 = E.div(class_=TOOLBAR_CLASS) toolbar1 = E.div(class_=TOOLBAR_CLASS)
toolbars.appendChild(toolbar1) toolbars.appendChild(toolbar1)
acmap = all_editor_actions() acmap = all_editor_actions()
for ac_name in 'bold italic underline strikethrough |'.split(' '): for ac_name in 'undo redo select-all remove-format | bold italic underline strikethrough |'.split(' '):
if acmap[ac_name]: if acmap[ac_name]:
add_action(toolbar1, ac_name, acmap[ac_name], editor.id) add_action(toolbar1, ac_name, acmap[ac_name], editor.id)
else: else: