[evolution/wip/mcrha/webkit-jsc-api: 234/292] Remember temporary style flags



commit 8d5d78eda855586744210639a526478e5e5264f1
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 12 16:07:19 2019 +0100

    Remember temporary style flags

 src/modules/webkit-editor/e-webkit-editor.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index a0e7ec65f4..8f20d0f264 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -93,6 +93,7 @@ struct _EWebKitEditorPrivate {
        gboolean suppress_color_changes;
 
        guint32 style_flags;
+       guint32 temporary_style_flags; /* that's for collapsed selection, format changes only after something 
is typed */
        gboolean is_indented;
 
        GdkRGBA *background_color;
@@ -574,6 +575,8 @@ formatting_changed_cb (WebKitUserContentManager *manager,
        }
        g_clear_object (&jsc_value);
 
+       wk_editor->priv->temporary_style_flags = wk_editor->priv->style_flags;
+
        #undef update_style_flag
 
        changed = FALSE;
@@ -3824,7 +3827,7 @@ webkit_editor_set_style_flag (EWebKitEditor *wk_editor,
 {
        g_return_if_fail (E_IS_WEBKIT_EDITOR (wk_editor));
 
-       if (((wk_editor->priv->style_flags & flag) != 0 ? 1 : 0) == (do_set ? 1 : 0))
+       if (((wk_editor->priv->temporary_style_flags & flag) != 0 ? 1 : 0) == (do_set ? 1 : 0))
                return;
 
        switch (flag) {
@@ -3852,6 +3855,8 @@ webkit_editor_set_style_flag (EWebKitEditor *wk_editor,
                webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (wk_editor), "Superscript");
                break;
        }
+
+       wk_editor->priv->temporary_style_flags = (wk_editor->priv->temporary_style_flags & (~flag)) | (do_set 
? flag : 0);
 }
 
 static gboolean


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