mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More actions for comments editor on EM page
This commit is contained in:
parent
8d0f8ba765
commit
dddc916082
13
imgsrc/srv/indent.svg
Normal file
13
imgsrc/srv/indent.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<svg viewBox="0 0 128 128" height="128" width="128">
|
||||
<g transform="translate(0,-924.36216)">
|
||||
<g>
|
||||
<path d="m 127,1022.1122 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -121.5,0 q -0.91406,0 -1.58203,-0.668 Q 1,1036.5263 1,1035.6122 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 121.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z"/>
|
||||
<path d="m 1,961.59431 0,53.35729 q 0,1.2042 0.85111,2.0841 0.85111,0.8801 2.01577,0.8801 1.25426,0 2.06057,-0.8337 l 25.801956,-26.67863 q 0.806308,-0.8337 0.806308,-2.13061 0,-1.2969 -0.806308,-2.13059 L 5.92745,959.46371 q -0.80631,-0.83369 -2.06057,-0.83369 -1.16466,0 -2.01577,0.88007 Q 1,960.39002 1,961.59431 Z" />
|
||||
<g>
|
||||
<path d="m 127,995.11216 0,13.50004 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -76.5,0 q -0.91406,0 -1.58203,-0.668 Q 46,1009.5263 46,1008.6122 l 0,-13.50004 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 76.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z" />
|
||||
<path d="m 127,968.11216 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -76.5,0 q -0.91406,0 -1.58203,-0.668 Q 46,982.52626 46,981.61216 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 76.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z" />
|
||||
</g>
|
||||
<path d="m 127,941.11216 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -121.5,0 q -0.91406,0 -1.58203,-0.668 Q 1,955.52626 1,954.61216 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 121.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
17
imgsrc/srv/ol.svg
Normal file
17
imgsrc/srv/ol.svg
Normal file
@ -0,0 +1,17 @@
|
||||
<svg viewBox="0 0 128 128" height="128" width="128">
|
||||
<g transform="translate(0,-924.36216)" >
|
||||
<g>
|
||||
<g>
|
||||
<path d="m 28.258393,1037.5797 q 0,5.4724 -3.728101,8.619 -3.728102,3.1466 -9.26888,3.1466 -7.2509858,0 -11.7656771,-4.5147 l 3.899039,-6.0196 q 3.3518541,3.0782 7.2509851,3.0782 1.983707,0 3.454417,-0.9919 1.47071,-0.9919 1.47071,-2.9072 0,-4.3779 -7.182518,-3.8307 l -1.77849,-3.8307 q 0.547185,-0.6841 2.223112,-2.9756 1.675927,-2.2916 2.907232,-3.6939 1.231304,-1.4023 2.530984,-2.6336 l 0,-0.068 q -1.094462,0 -3.317667,0.068 -2.223112,0.068 -3.317666,0.068 l 0,3.6254 -7.2508934,0 0,-10.3976 22.7788594,0 0,6.0197 -6.498491,7.8665 q 3.488696,0.8209 5.540871,3.3519 2.052174,2.531 2.052174,6.0197 z"/>
|
||||
<path d="m 28.395143,994.68968 0,10.87642 -24.7626581,0 q -0.4104349,-2.4626 -0.4104349,-3.6939 0,-3.48869 1.607552,-6.36165 1.6075521,-2.87304 3.8648515,-4.65153 2.2573915,-1.77858 4.5147835,-3.24929 2.257392,-1.47071 3.864852,-2.97561 1.607552,-1.50489 1.607552,-3.07826 0,-1.71011 -0.9919,-2.63355 -0.991807,-0.92352 -2.702014,-0.92352 -3.146637,0 -5.5407787,3.96751 l -5.8144634,-4.03589 q 1.6417395,-3.48869 4.8910311,-5.43821 3.249199,-1.94952 7.216706,-1.94952 4.993593,0 8.413822,2.83876 3.420229,2.83886 3.420229,7.69561 0,3.42023 -2.325766,6.25909 -2.325767,2.83876 -5.130344,4.41213 -2.804669,1.57327 -5.164624,3.45441 -2.359954,1.88115 -2.428329,3.59126 l 8.687415,0 0,-4.10426 7.182518,0 z"/>
|
||||
<path d="m 28.463611,955.01471 0,6.77209 -22.9157941,0 0,-6.77209 7.3193601,0 q 0,-2.80457 0.03419,-8.34545 0.03419,-5.54077 0.03419,-8.27698 l 0,-0.82087 -0.136842,0 q -0.547277,1.16284 -3.4202291,3.69392 l -4.8567512,-5.19881 9.3030673,-8.68751 7.250893,0 0,27.6357 7.387828,0 z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path
|
||||
d="m 124.77795,1016.5109 0,13.1337 q 0,0.8893 -0.64984,1.5392 -0.64984,0.6499 -1.53908,0.6499 l -83.180612,0 q -0.889337,0 -1.539177,-0.6499 -0.64984,-0.6499 -0.64984,-1.5392 l 0,-13.1337 q 0,-0.9577 0.615652,-1.5734 0.615653,-0.6156 1.573365,-0.6156 l 83.180612,0 q 0.88924,0 1.53908,0.6498 0.64984,0.6499 0.64984,1.5392 z"/>
|
||||
<path d="m 124.77795,981.48749 0,13.13382 q 0,0.88924 -0.64984,1.53908 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53908 l 0,-13.13382 q 0,-0.95772 0.615652,-1.57337 0.615653,-0.61556 1.573365,-0.61556 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
<path d="m 124.77795,946.46405 0,13.13382 q 0,0.88925 -0.64984,1.53909 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53909 l 0,-13.13382 q 0,-0.88925 0.64984,-1.53909 0.64984,-0.64984 1.539177,-0.64984 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
13
imgsrc/srv/outdent.svg
Normal file
13
imgsrc/srv/outdent.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<svg viewBox="0 0 128 128" height="128" width="128">
|
||||
<g transform="translate(0,-924.36216)">
|
||||
<g>
|
||||
<path d="m 127,1022.1122 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -121.5,0 q -0.91406,0 -1.58203,-0.668 Q 1,1036.5263 1,1035.6122 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 121.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z"/>
|
||||
<path d="m 127,961.59431 0,53.35729 q 0,1.2042 -0.85111,2.0841 -0.85111,0.8801 -2.01577,0.8801 -1.25426,0 -2.06057,-0.8337 L 96.270594,990.40347 q -0.806308,-0.8337 -0.806308,-2.13061 0,-1.2969 0.806308,-2.13059 l 25.801956,-26.67856 q 0.80631,-0.83369 2.06057,-0.83369 1.16466,0 2.01577,0.88007 Q 127,960.39002 127,961.59431 Z"/>
|
||||
<g transform="translate(-45,0)">
|
||||
<path d="m 127,995.11216 0,13.50004 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -76.5,0 q -0.91406,0 -1.58203,-0.668 Q 46,1009.5263 46,1008.6122 l 0,-13.50004 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 76.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z" />
|
||||
<path d="m 127,968.11216 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -76.5,0 q -0.91406,0 -1.58203,-0.668 Q 46,982.52626 46,981.61216 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 76.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z" />
|
||||
</g>
|
||||
<path d="m 127,941.11216 0,13.5 q 0,0.9141 -0.66797,1.582 -0.66797,0.668 -1.58203,0.668 l -121.5,0 q -0.91406,0 -1.58203,-0.668 Q 1,955.52626 1,954.61216 l 0,-13.5 q 0,-0.9141 0.66797,-1.582 0.66797,-0.668 1.58203,-0.668 l 121.5,0 q 0.91406,0 1.58203,0.668 0.66797,0.6679 0.66797,1.582 z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
14
imgsrc/srv/ul.svg
Normal file
14
imgsrc/srv/ul.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<svg viewBox="0 0 128 128" height="128" width="128">
|
||||
<g transform="translate(0,-924.36216)">
|
||||
<g>
|
||||
<path d="m 124.77795,1016.5109 0,13.1337 q 0,0.8893 -0.64984,1.5392 -0.64984,0.6499 -1.53908,0.6499 l -83.180612,0 q -0.889337,0 -1.539177,-0.6499 -0.64984,-0.6499 -0.64984,-1.5392 l 0,-13.1337 q 0,-0.9577 0.615652,-1.5734 0.615653,-0.6156 1.573365,-0.6156 l 83.180612,0 q 0.88924,0 1.53908,0.6498 0.64984,0.6499 0.64984,1.5392 z"/>
|
||||
<path d="m 124.77795,981.48749 0,13.13382 q 0,0.88924 -0.64984,1.53908 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53908 l 0,-13.13382 q 0,-0.95772 0.615652,-1.57337 0.615653,-0.61556 1.573365,-0.61556 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
<path d="m 124.77795,946.46405 0,13.13382 q 0,0.88925 -0.64984,1.53909 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53909 l 0,-13.13382 q 0,-0.88925 0.64984,-1.53909 0.64984,-0.64984 1.539177,-0.64984 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
<path d="m 124.77795,946.46405 0,13.13382 q 0,0.88925 -0.64984,1.53909 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53909 l 0,-13.13382 q 0,-0.88925 0.64984,-1.53909 0.64984,-0.64984 1.539177,-0.64984 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
<path d="m 124.77795,946.46405 0,13.13382 q 0,0.88925 -0.64984,1.53909 -0.64984,0.64984 -1.53908,0.64984 l -83.180612,0 q -0.889337,0 -1.539177,-0.64984 -0.64984,-0.64984 -0.64984,-1.53909 l 0,-13.13382 q 0,-0.88925 0.64984,-1.53909 0.64984,-0.64984 1.539177,-0.64984 l 83.180612,0 q 0.88924,0 1.53908,0.64984 0.64984,0.64984 0.64984,1.53909 z"/>
|
||||
<circle cx="16.484426" cy="953.03094" r="11.092738" />
|
||||
<circle r="11.092738" cy="988.05438" cx="16.484426" />
|
||||
<circle cx="16.484426" cy="1023.0778" r="11.092738" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
@ -130,10 +130,33 @@ def all_editor_actions(): # {{{
|
||||
choose_block_style(def(cmd):
|
||||
if cmd:
|
||||
editor.exec_command('formatBlock', f'<{cmd}>')
|
||||
editor.focus()
|
||||
editor.focus()
|
||||
)
|
||||
},
|
||||
|
||||
'ul': {
|
||||
'icon': 'ul',
|
||||
'title': _('Unordered list'),
|
||||
'execute': def (editor, activated):
|
||||
editor.exec_command('insertUnorderedList')
|
||||
},
|
||||
'ol': {
|
||||
'icon': 'ol',
|
||||
'title': _('Ordered list'),
|
||||
'execute': def (editor, activated):
|
||||
editor.exec_command('insertOrderedList')
|
||||
},
|
||||
'indent': {
|
||||
'icon': 'indent',
|
||||
'title': _('Increase indentation'),
|
||||
'execute': def (editor, activated):
|
||||
editor.exec_command('indent')
|
||||
},
|
||||
'outdent': {
|
||||
'icon': 'outdent',
|
||||
'title': _('Decrease indentation'),
|
||||
'execute': def (editor, activated):
|
||||
editor.exec_command('outdent')
|
||||
},
|
||||
}
|
||||
return all_editor_actions.ans
|
||||
# }}}
|
||||
@ -308,13 +331,21 @@ def create_comments_editor(container):
|
||||
iframe, editor = create_editor()
|
||||
toolbars = E.div(style='flex-grow: 0')
|
||||
toolbar1 = E.div(class_=TOOLBAR_CLASS)
|
||||
toolbars.appendChild(toolbar1)
|
||||
toolbar2 = E.div(class_=TOOLBAR_CLASS)
|
||||
toolbars.appendChild(toolbar1), toolbars.appendChild(toolbar2)
|
||||
acmap = all_editor_actions()
|
||||
for ac_name in 'undo redo select-all remove-format | bold italic underline strikethrough | hr superscript subscript format-block'.split(' '):
|
||||
|
||||
def add(toolbar, ac_name):
|
||||
if acmap[ac_name]:
|
||||
add_action(toolbar1, ac_name, acmap[ac_name], editor.id)
|
||||
add_action(toolbar, ac_name, acmap[ac_name], editor.id)
|
||||
else:
|
||||
toolbar1.appendChild(E.div(class_='sep'))
|
||||
toolbar.appendChild(E.div(class_='sep'))
|
||||
|
||||
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(' '):
|
||||
add(toolbar2, ac_name)
|
||||
|
||||
container.setAttribute('style', (container.getAttribute('style') or '') + ';display: flex; flex-direction: column; align-items: stretch')
|
||||
container.appendChild(toolbars)
|
||||
|
Loading…
x
Reference in New Issue
Block a user