From 2d2d66113d1a106e31597287c223fe2c16cc3a8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 21 Mar 2018 08:34:34 +0530 Subject: [PATCH] A few more actions for the EM page comments editor --- imgsrc/srv/eraser.svg | 1 + imgsrc/srv/redo.svg | 6 ++++++ imgsrc/srv/select-all.svg | 5 +++++ imgsrc/srv/undo.svg | 7 +++++++ src/pyj/book_list/comments_editor.pyj | 26 +++++++++++++++++++++++++- 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 imgsrc/srv/eraser.svg create mode 100644 imgsrc/srv/redo.svg create mode 100644 imgsrc/srv/select-all.svg create mode 100644 imgsrc/srv/undo.svg diff --git a/imgsrc/srv/eraser.svg b/imgsrc/srv/eraser.svg new file mode 100644 index 0000000000..492aeb669f --- /dev/null +++ b/imgsrc/srv/eraser.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/imgsrc/srv/redo.svg b/imgsrc/srv/redo.svg new file mode 100644 index 0000000000..e9f0c492a8 --- /dev/null +++ b/imgsrc/srv/redo.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/imgsrc/srv/select-all.svg b/imgsrc/srv/select-all.svg new file mode 100644 index 0000000000..0506a50d60 --- /dev/null +++ b/imgsrc/srv/select-all.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/imgsrc/srv/undo.svg b/imgsrc/srv/undo.svg new file mode 100644 index 0000000000..eba4bbcaaf --- /dev/null +++ b/imgsrc/srv/undo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/pyj/book_list/comments_editor.pyj b/src/pyj/book_list/comments_editor.pyj index 0de0950e2e..24688e0bcd 100644 --- a/src/pyj/book_list/comments_editor.pyj +++ b/src/pyj/book_list/comments_editor.pyj @@ -30,6 +30,30 @@ add_extra_css(def(): def all_editor_actions(): if not 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': { 'icon': 'bold', 'title': _('Bold'), @@ -230,7 +254,7 @@ def create_comments_editor(container): toolbar1 = E.div(class_=TOOLBAR_CLASS) toolbars.appendChild(toolbar1) 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]: add_action(toolbar1, ac_name, acmap[ac_name], editor.id) else: