[gnome-notes] Allow formatting if a block is empty



commit 85b78afaa534504b7b1a6d271371c6a4ffd4ec97
Author: Kévin Commaille <zecakeh pm me>
Date:   Sat Feb 27 14:04:43 2021 +0100

    Allow formatting if a block is empty
    
    Fixes #8

 src/libbiji/editor/biji-webkit-editor.c | 55 ++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c
index 1223d79..a4827dd 100644
--- a/src/libbiji/editor/biji-webkit-editor.c
+++ b/src/libbiji/editor/biji-webkit-editor.c
@@ -153,36 +153,33 @@ biji_webkit_editor_apply_format (BijiWebkitEditor *self, gint format)
 {
   BijiWebkitEditorPrivate *priv = self->priv;
 
-  if (priv->has_text)
+  switch (format)
   {
-    switch (format)
-    {
-      case BIJI_BOLD:
-        biji_toggle_format (priv->sel, e_editor_selection_get_bold,
-                                       e_editor_selection_set_bold);
-        break;
-
-      case BIJI_ITALIC:
-        biji_toggle_format (priv->sel, e_editor_selection_get_italic,
-                                       e_editor_selection_set_italic);
-        break;
-
-      case BIJI_STRIKE:
-        biji_toggle_format (priv->sel, e_editor_selection_get_strike_through,
-                                       e_editor_selection_set_strike_through);
-        break;
-
-      case BIJI_BULLET_LIST:
-        biji_toggle_block_format (self, BLOCK_FORMAT_UNORDERED_LIST);
-        break;
-
-      case BIJI_ORDER_LIST:
-        biji_toggle_block_format (self, BLOCK_FORMAT_ORDERED_LIST);
-        break;
-
-      default:
-        g_warning ("biji_webkit_editor_apply_format : Invalid format");
-    }
+    case BIJI_BOLD:
+      biji_toggle_format (priv->sel, e_editor_selection_get_bold,
+                                      e_editor_selection_set_bold);
+      break;
+
+    case BIJI_ITALIC:
+      biji_toggle_format (priv->sel, e_editor_selection_get_italic,
+                                      e_editor_selection_set_italic);
+      break;
+
+    case BIJI_STRIKE:
+      biji_toggle_format (priv->sel, e_editor_selection_get_strike_through,
+                                      e_editor_selection_set_strike_through);
+      break;
+
+    case BIJI_BULLET_LIST:
+      biji_toggle_block_format (self, BLOCK_FORMAT_UNORDERED_LIST);
+      break;
+
+    case BIJI_ORDER_LIST:
+      biji_toggle_block_format (self, BLOCK_FORMAT_ORDERED_LIST);
+      break;
+
+    default:
+      g_warning ("biji_webkit_editor_apply_format : Invalid format");
   }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]