Commit f84c2997 authored by Tomas Popela's avatar Tomas Popela

Bug 746349 - Pasting '\n' into composer produces critical runtime warning

parent 4357544d
......@@ -5977,7 +5977,9 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
WEBKIT_DOM_ELEMENT (child),
"-x-evo-last-br");
}
}
} else
create_and_append_new_paragraph (
selection, document, blockquote, block, "<br>");
g_free (truncated);
goto end;
}
......@@ -6511,7 +6513,6 @@ fix_structure_after_pasting_multiline_content (WebKitDOMNode *node)
NULL);
first_child = next_child;
}
remove_node (parent);
}
static void
......@@ -6561,7 +6562,6 @@ html_editor_view_insert_converted_html_into_selection (EHTMLEditorView *view,
inner_html = webkit_dom_html_element_get_inner_html (
WEBKIT_DOM_HTML_ELEMENT (element));
parse_html_into_paragraphs (view, document, element, current_block, inner_html);
g_free (inner_html);
has_selection = !e_html_editor_selection_is_collapsed (selection);
......@@ -6735,14 +6735,10 @@ html_editor_view_insert_converted_html_into_selection (EHTMLEditorView *view,
WEBKIT_DOM_HTML_ELEMENT (element));
e_html_editor_view_exec_command (
view, E_HTML_EDITOR_VIEW_COMMAND_INSERT_HTML, inner_html);
g_free (inner_html);
inner_html = webkit_dom_html_element_get_inner_text (
WEBKIT_DOM_HTML_ELEMENT (element));
if (g_str_has_suffix (inner_html, " ")) {
if (g_str_has_suffix (inner_html, " "))
e_html_editor_view_exec_command (
view, E_HTML_EDITOR_VIEW_COMMAND_INSERT_TEXT, " ");
}
g_free (inner_html);
g_object_unref (element);
......@@ -6817,8 +6813,10 @@ html_editor_view_insert_converted_html_into_selection (EHTMLEditorView *view,
node = parent;
} else {
node = webkit_dom_node_get_next_sibling (parent);
if (!node)
if (!node) {
fix_structure_after_pasting_multiline_content (parent);
remove_node (parent);
}
}
if (node) {
......@@ -6862,8 +6860,17 @@ html_editor_view_insert_converted_html_into_selection (EHTMLEditorView *view,
/* Check if WebKit created wrong structure */
clone1 = webkit_dom_node_clone_node (WEBKIT_DOM_NODE (paragraph), FALSE);
clone2 = webkit_dom_node_clone_node (WEBKIT_DOM_NODE (parent), FALSE);
if (webkit_dom_node_is_equal_node (clone1, clone2))
if (webkit_dom_node_is_equal_node (clone1, clone2)) {
fix_structure_after_pasting_multiline_content (paragraph);
if (*html != '\n')
remove_node (parent);
webkit_dom_node_insert_before (
parent,
WEBKIT_DOM_NODE (selection_start_marker),
webkit_dom_node_get_last_child (parent),
NULL);
}
g_object_unref (clone1);
g_object_unref (clone2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment