diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 316dbd6d..ea3f1f49 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -7,6 +7,8 @@ set(ICON_FILES text-x-generic-symbolic.svg edit-symbolic.svg format-text-remove-symbolic.svg + format-ordered-list-symbolic.svg + format-unordered-list-symbolic.svg mail-drafts-symbolic.svg mail-drafts-symbolic-rtl.svg mail-forward-symbolic.svg diff --git a/icons/format-ordered-list-symbolic.svg b/icons/format-ordered-list-symbolic.svg new file mode 100644 index 00000000..eecef595 --- /dev/null +++ b/icons/format-ordered-list-symbolic.svg @@ -0,0 +1,208 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + + diff --git a/icons/format-unordered-list-symbolic.svg b/icons/format-unordered-list-symbolic.svg new file mode 100644 index 00000000..674ad715 --- /dev/null +++ b/icons/format-unordered-list-symbolic.svg @@ -0,0 +1,199 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/client/composer/composer-web-view.vala b/src/client/composer/composer-web-view.vala index 08972b21..d5b656b1 100644 --- a/src/client/composer/composer-web-view.vala +++ b/src/client/composer/composer-web-view.vala @@ -376,6 +376,14 @@ public class ComposerWebView : ClientWebView { this.call.begin(Geary.JS.callable("geary.indentLine"), null); } + public void insert_olist() { + this.call.begin(Geary.JS.callable("geary.insertOrderedList"), null); + } + + public void insert_ulist() { + this.call.begin(Geary.JS.callable("geary.insertUnorderedList"), null); + } + /** * Updates the signature block if it has not been deleted. */ diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index 44881f18..fbd9cff3 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -67,6 +67,8 @@ public class ComposerWidget : Gtk.EventBox { private const string ACTION_REMOVE_FORMAT = "remove-format"; private const string ACTION_INDENT = "indent"; private const string ACTION_OUTDENT = "outdent"; + private const string ACTION_OLIST = "olist"; + private const string ACTION_ULIST = "ulist"; private const string ACTION_JUSTIFY = "justify"; private const string ACTION_COLOR = "color"; private const string ACTION_INSERT_IMAGE = "insert-image"; @@ -88,7 +90,8 @@ public class ComposerWidget : Gtk.EventBox { private const string[] html_actions = { ACTION_BOLD, ACTION_ITALIC, ACTION_UNDERLINE, ACTION_STRIKETHROUGH, ACTION_FONT_SIZE, ACTION_FONT_FAMILY, ACTION_COLOR, ACTION_JUSTIFY, - ACTION_INSERT_IMAGE, ACTION_COPY_LINK, ACTION_PASTE_WITH_FORMATTING + ACTION_INSERT_IMAGE, ACTION_COPY_LINK, ACTION_PASTE_WITH_FORMATTING, + ACTION_OLIST, ACTION_ULIST }; private const ActionEntry[] action_entries = { @@ -109,6 +112,8 @@ public class ComposerWidget : Gtk.EventBox { {ACTION_FONT_FAMILY, on_font_family, "s", "'sans'" }, {ACTION_REMOVE_FORMAT, on_remove_format, null, "false" }, {ACTION_INDENT, on_indent }, + {ACTION_OLIST, on_olist }, + {ACTION_ULIST, on_ulist }, {ACTION_OUTDENT, on_action }, {ACTION_JUSTIFY, on_justify, "s", "'left'" }, {ACTION_COLOR, on_select_color }, @@ -310,6 +315,8 @@ public class ComposerWidget : Gtk.EventBox { [GtkChild] private Gtk.Box font_style_buttons; [GtkChild] + private Gtk.Box list_buttons; + [GtkChild] private Gtk.Button insert_link_button; [GtkChild] private Gtk.Button remove_format_button; @@ -1748,6 +1755,7 @@ public class ComposerWidget : Gtk.EventBox { this.insert_buttons.visible = compose_as_html; this.font_style_buttons.visible = compose_as_html; + this.list_buttons.visible = compose_as_html; this.remove_format_button.visible = compose_as_html; this.menu_button.menu_model = (compose_as_html) ? this.html_menu : this.plain_menu; @@ -1806,6 +1814,14 @@ public class ComposerWidget : Gtk.EventBox { this.editor.indent_line(); } + private void on_olist(SimpleAction action, Variant? param) { + this.editor.insert_olist(); + } + + private void on_ulist(SimpleAction action, Variant? param) { + this.editor.insert_ulist(); + } + private void on_mouse_target_changed(WebKit.WebView web_view, WebKit.HitTestResult hit_test, uint modifiers) { diff --git a/ui/composer-web-view.js b/ui/composer-web-view.js index 2a53b6e7..678ce929 100644 --- a/ui/composer-web-view.js +++ b/ui/composer-web-view.js @@ -212,6 +212,12 @@ ComposerPageState.prototype = { element.setAttribute("type", "cite"); } }, + insertOrderedList: function() { + document.execCommand("insertOrderedList", false, null); + }, + insertUnorderedList: function() { + document.execCommand("insertUnorderedList", false, null); + }, updateSignature: function(signature) { if (this.signaturePart != null) { console.log(signature); diff --git a/ui/composer-widget.ui b/ui/composer-widget.ui index 50fd22e1..a713eae9 100644 --- a/ui/composer-widget.ui +++ b/ui/composer-widget.ui @@ -506,6 +506,68 @@ 1 + + + True + False + + + True + True + False + False + Insert ordered list + cmp.olist + True + + + True + False + 16 + format-ordered-list-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Insert unordered list + cmp.ulist + True + + + True + False + 16 + format-unordered-list-symbolic + + + + + False + True + 1 + + + + + + False + True + 2 + + True @@ -565,7 +627,7 @@ False True - 2 + 3 @@ -627,7 +689,7 @@ False True - 3 + 4 @@ -651,7 +713,7 @@ False True - 4 + 5 @@ -675,7 +737,7 @@ False True - 5 + 6 @@ -692,7 +754,7 @@ False True end - 5 + 7 @@ -707,7 +769,7 @@ False True end - 6 + 8