[evolution/wip/webkit2] Remove the 'Blockquote' block format



commit fbab1bd7200b67a562e83614e27bf56e40b0ab6d
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jun 6 13:19:55 2016 +0200

    Remove the 'Blockquote' block format

 e-util/e-content-editor-enums.h                    |    1 -
 e-util/e-html-editor-actions.c                     |    7 --
 .../web-extension/e-html-editor-history-event.h    |    1 -
 .../e-html-editor-selection-dom-functions.c        |  111 ++------------------
 .../e-html-editor-undo-redo-manager.c              |   46 --------
 5 files changed, 10 insertions(+), 156 deletions(-)
---
diff --git a/e-util/e-content-editor-enums.h b/e-util/e-content-editor-enums.h
index 1c9eb62..8286040 100644
--- a/e-util/e-content-editor-enums.h
+++ b/e-util/e-content-editor-enums.h
@@ -65,7 +65,6 @@ typedef enum {
        E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH,
        E_CONTENT_EDITOR_BLOCK_FORMAT_PRE,
        E_CONTENT_EDITOR_BLOCK_FORMAT_ADDRESS,
-       E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE,
        E_CONTENT_EDITOR_BLOCK_FORMAT_H1,
        E_CONTENT_EDITOR_BLOCK_FORMAT_H2,
        E_CONTENT_EDITOR_BLOCK_FORMAT_H3,
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index f42f134..91b9e97 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -1099,13 +1099,6 @@ static GtkRadioActionEntry core_style_entries[] = {
          NULL,
          E_CONTENT_EDITOR_BLOCK_FORMAT_ADDRESS },
 
-        { "style-blockquote",
-          NULL,
-          N_("_Blockquote"),
-          "<Control>9",
-          NULL,
-          E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE },
-
        { "style-list-bullet",
          NULL,
          N_("_Bulleted List"),
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-history-event.h 
b/modules/webkit-content-editor/web-extension/e-html-editor-history-event.h
index 393c95a..165b08c 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-history-event.h
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-history-event.h
@@ -25,7 +25,6 @@ enum EHTMLEditorHistoryEventType {
        HISTORY_ALIGNMENT,
        HISTORY_AND,
        HISTORY_BLOCK_FORMAT,
-       HISTORY_BLOCKQUOTE,
        HISTORY_BOLD,
        HISTORY_CELL_DIALOG,
        HISTORY_DELETE, /* BackSpace, Delete, with and without selection */
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c 
b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
index 3e97ded..df2f37b 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-selection-dom-functions.c
@@ -5250,22 +5250,7 @@ dom_selection_get_block_format (WebKitDOMDocument *document,
        } else if (dom_node_find_parent_element (node, "H6")) {
                result = E_CONTENT_EDITOR_BLOCK_FORMAT_H6;
        } else if ((element = dom_node_find_parent_element (node, "BLOCKQUOTE")) != NULL) {
-               if (element_has_class (element, "-x-evo-indented"))
-                       result = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
-               else {
-                       WebKitDOMNode *block = get_block_node (range);
-
-                       if (WEBKIT_DOM_IS_HTML_PARAGRAPH_ELEMENT (block) ||
-                           webkit_dom_element_has_attribute (WEBKIT_DOM_ELEMENT (block), 
"data-evo-paragraph"))
-                               result = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
-                       else {
-                               /* Paragraphs inside quote */
-                               if ((element = dom_node_find_parent_element (node, "P")) != NULL)
-                                       result = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
-                               else
-                                       result = E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE;
-                       }
-               }
+               result = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
        } else if (dom_node_find_parent_element (node, "P")) {
                result = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
        } else {
@@ -5424,8 +5409,7 @@ process_block_to_block (WebKitDOMDocument *document,
                        continue;
                }
 
-               if (format == E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH ||
-                   format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE)
+               if (format == E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH)
                        element = dom_get_paragraph_element (document, extension, -1, 0);
                else
                        element = webkit_dom_document_create_element (
@@ -5477,15 +5461,10 @@ process_block_to_block (WebKitDOMDocument *document,
 
                block = next_block;
 
-               if (!html_mode &&
-                   (format == E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH ||
-                    format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE)) {
+               if (!html_mode && format == E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH) {
                        gint citation_level;
 
-                       if (format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE)
-                               citation_level = 1;
-                       else
-                               citation_level = selection_get_citation_level (WEBKIT_DOM_NODE (element));
+                       citation_level = selection_get_citation_level (WEBKIT_DOM_NODE (element));
 
                        if (citation_level > 0) {
                                gint quote, word_wrap_length;
@@ -5500,12 +5479,7 @@ process_block_to_block (WebKitDOMDocument *document,
                        }
                }
 
-               if (blockquote && format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE) {
-                       webkit_dom_node_append_child (
-                               blockquote, WEBKIT_DOM_NODE (element), NULL);
-                       if (!html_mode)
-                               dom_quote_plain_text_element_after_wrapping (document, element, 1);
-               } else if (!html_mode && quoted)
+               if (!html_mode && quoted)
                        dom_quote_plain_text_element (document, element);
        }
 
@@ -5547,21 +5521,6 @@ format_change_block_to_block (WebKitDOMDocument *document,
 
        html_mode = e_html_editor_web_extension_get_html_mode (extension);
 
-       if (format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE) {
-               blockquote = WEBKIT_DOM_NODE (
-                       webkit_dom_document_create_element (document, "BLOCKQUOTE", NULL));
-
-               webkit_dom_element_set_attribute (WEBKIT_DOM_ELEMENT (blockquote), "type", "cite", NULL);
-               if (!html_mode)
-                       webkit_dom_element_set_attribute (
-                               WEBKIT_DOM_ELEMENT (blockquote), "class", "-x-evo-plaintext-quoted", NULL);
-               webkit_dom_node_insert_before (
-                       webkit_dom_node_get_parent_node (block),
-                       blockquote,
-                       block,
-                       NULL);
-       }
-
        end_block = get_parent_block_node_from_child (
                WEBKIT_DOM_NODE (selection_end_marker));
 
@@ -6071,9 +6030,6 @@ dom_selection_set_block_format (WebKitDOMDocument *document,
                return;
 
        switch (format) {
-               case E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE:
-                       value = "BLOCKQUOTE";
-                       break;
                case E_CONTENT_EDITOR_BLOCK_FORMAT_H1:
                        value = "H1";
                        break;
@@ -6133,10 +6089,7 @@ dom_selection_set_block_format (WebKitDOMDocument *document,
        manager = e_html_editor_web_extension_get_undo_redo_manager (extension);
        if (!e_html_editor_undo_redo_manager_is_operation_in_progress (manager)) {
                ev = g_new0 (EHTMLEditorHistoryEvent, 1);
-               if (format != E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE)
-                       ev->type = HISTORY_BLOCK_FORMAT;
-               else
-                       ev->type = HISTORY_BLOCKQUOTE;
+               ev->type = HISTORY_BLOCK_FORMAT;
 
                dom_selection_get_coordinates (
                        document,
@@ -6145,47 +6098,9 @@ dom_selection_set_block_format (WebKitDOMDocument *document,
                        &ev->before.end.x,
                        &ev->before.end.y);
 
-               if (format != E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE) {
-                       ev->data.style.from = current_format;
-                       ev->data.style.to = format;
-               } else {
-                       WebKitDOMDocumentFragment *fragment;
-                       WebKitDOMElement *selection_start_marker, *selection_end_marker;
-                       WebKitDOMNode *block, *end_block;
-
-                       selection_start_marker = webkit_dom_document_get_element_by_id (
-                               document, "-x-evo-selection-start-marker");
-                       selection_end_marker = webkit_dom_document_get_element_by_id (
-                               document, "-x-evo-selection-end-marker");
-                       block = get_parent_block_node_from_child (
-                               WEBKIT_DOM_NODE (selection_start_marker));
-                       end_block = get_parent_block_node_from_child (
-                               WEBKIT_DOM_NODE (selection_end_marker));
-                       if (webkit_dom_range_get_collapsed (range, NULL) ||
-                           webkit_dom_node_is_same_node (block, end_block)) {
-                               fragment = webkit_dom_document_create_document_fragment (document);
-
-                               webkit_dom_node_append_child (
-                                       WEBKIT_DOM_NODE (fragment),
-                                       webkit_dom_node_clone_node_with_error (block, TRUE, NULL),
-                                       NULL);
-                       } else {
-                               fragment = webkit_dom_range_clone_contents (range, NULL);
-                               webkit_dom_node_replace_child (
-                                       WEBKIT_DOM_NODE (fragment),
-                                       webkit_dom_node_clone_node_with_error (block, TRUE, NULL),
-                                       webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (fragment)),
-                                       NULL);
-
-                               webkit_dom_node_replace_child (
-                                       WEBKIT_DOM_NODE (fragment),
-                                       webkit_dom_node_clone_node_with_error (end_block, TRUE, NULL),
-                                       webkit_dom_node_get_last_child (WEBKIT_DOM_NODE (fragment)),
-                                       NULL);
-                       }
-                       ev->data.fragment = fragment;
-               }
-        }
+               ev->data.style.from = current_format;
+               ev->data.style.to = format;
+       }
 
        g_object_unref (range);
 
@@ -6208,15 +6123,9 @@ dom_selection_set_block_format (WebKitDOMDocument *document,
        if (!from_list && !to_list)
                format_change_block_to_block (document, extension, format, value);
 
-       if (from_list && !to_list) {
+       if (from_list && !to_list)
                format_change_list_to_block (document, extension, format, value);
 
-               if (format == E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE) {
-                       dom_selection_restore (document);
-                       format_change_block_to_block (document, extension, format, value);
-               }
-       }
-
        if (!from_list && to_list)
                format_change_block_to_list (document, extension, format);
 
diff --git a/modules/webkit-content-editor/web-extension/e-html-editor-undo-redo-manager.c 
b/modules/webkit-content-editor/web-extension/e-html-editor-undo-redo-manager.c
index 9f1ada4..c9693b5 100644
--- a/modules/webkit-content-editor/web-extension/e-html-editor-undo-redo-manager.c
+++ b/modules/webkit-content-editor/web-extension/e-html-editor-undo-redo-manager.c
@@ -214,7 +214,6 @@ print_history_event (EHTMLEditorHistoryEvent *event)
                case HISTORY_SMILEY:
                case HISTORY_IMAGE:
                case HISTORY_CITATION_SPLIT:
-               case HISTORY_BLOCKQUOTE:
                        print_node_inner_html (WEBKIT_DOM_NODE (event->data.fragment));
                        break;
                case HISTORY_ALIGNMENT:
@@ -2018,44 +2017,6 @@ undo_redo_citation_split (WebKitDOMDocument *document,
 }
 
 static void
-undo_redo_blockquote (WebKitDOMDocument *document,
-                      EHTMLEditorWebExtension *extension,
-                      EHTMLEditorHistoryEvent *event,
-                      gboolean undo)
-{
-       WebKitDOMElement *element;
-
-       if (undo)
-               restore_selection_to_history_event_state (document, event->after);
-
-       dom_selection_save (document);
-       element = webkit_dom_document_get_element_by_id (
-               document, "-x-evo-selection-start-marker");
-
-       if (undo) {
-               WebKitDOMNode *node;
-               WebKitDOMElement *parent;
-
-               parent = get_parent_block_element (WEBKIT_DOM_NODE (element));
-               node = webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (parent));
-
-               webkit_dom_node_replace_child (
-                       webkit_dom_node_get_parent_node (node),
-                       WEBKIT_DOM_NODE (event->data.fragment),
-                       node,
-                       NULL);
-       } else {
-               dom_selection_set_block_format (
-                       document, extension, E_CONTENT_EDITOR_BLOCK_FORMAT_BLOCKQUOTE);
-       }
-
-       if (undo)
-               restore_selection_to_history_event_state (document, event->before);
-       else
-               dom_selection_restore (document);
-}
-
-static void
 undo_redo_unquote (WebKitDOMDocument *document,
                   EHTMLEditorWebExtension *extension,
                   EHTMLEditorHistoryEvent *event,
@@ -2141,7 +2102,6 @@ free_history_event_content (EHTMLEditorHistoryEvent *event)
                case HISTORY_IMAGE:
                case HISTORY_SMILEY:
                case HISTORY_REMOVE_LINK:
-               case HISTORY_BLOCKQUOTE:
                        if (event->data.fragment != NULL)
                                g_clear_object (&event->data.fragment);
                        break;
@@ -2449,9 +2409,6 @@ e_html_editor_undo_redo_manager_undo (EHTMLEditorUndoRedoManager *manager)
                case HISTORY_REPLACE_ALL:
                        undo_redo_replace_all (manager, document, extension, event, TRUE);
                        break;
-               case HISTORY_BLOCKQUOTE:
-                       undo_redo_blockquote (document, extension, event, TRUE);
-                       break;
                case HISTORY_UNQUOTE:
                        undo_redo_unquote (document, extension, event, TRUE);
                        break;
@@ -2597,9 +2554,6 @@ e_html_editor_undo_redo_manager_redo (EHTMLEditorUndoRedoManager *manager)
                case HISTORY_REPLACE_ALL:
                        undo_redo_replace_all (manager, document, extension, event, FALSE);
                        break;
-               case HISTORY_BLOCKQUOTE:
-                       undo_redo_blockquote (document, extension, event, FALSE);
-                       break;
                case HISTORY_UNQUOTE:
                        undo_redo_unquote (document, extension, event, FALSE);
                        break;


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