[evolution/wip/webkit2] EHTMLEditorView - Redoing a delete operation in a PRE element could wrap the content in SPAN element
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Redoing a delete operation in a PRE element could wrap the content in SPAN element
- Date: Wed, 29 Jun 2016 15:04:53 +0000 (UTC)
commit 8c850aa7edf9da46dd431f182c913b7c5be7df94
Author: Tomas Popela <tpopela redhat com>
Date: Wed Jun 29 15:46:42 2016 +0200
EHTMLEditorView - Redoing a delete operation in a PRE element could wrap the content in SPAN element
There was one case unhandled in commit b962cc71.
.../web-extension/e-editor-dom-functions.c | 19 +++++++++++--------
.../web-extension/e-editor-dom-functions.h | 3 +++
.../web-extension/e-editor-undo-redo-manager.c | 13 ++++++++++++-
3 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index d60d55f..7a5cff6 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -2833,9 +2833,9 @@ body_keypress_event_cb (WebKitDOMElement *element,
insert_delete_event (editor_page, range);
}
-static void
-set_monospace_font_family_on_body (WebKitDOMElement *body,
- gboolean html_mode)
+void
+e_editor_dom_set_monospace_font_family_on_body (WebKitDOMElement *body,
+ gboolean html_mode)
{
/* If copying some content in view, WebKit adds various information about
* the content's style (such as color, font size, ..) to the resulting HTML
@@ -2929,7 +2929,7 @@ body_keydown_event_cb (WebKitDOMElement *element,
if (e_editor_dom_key_press_event_process_delete_or_backspace_key (editor_page, key_code,
control_key, delete_key))
webkit_dom_event_prevent_default (WEBKIT_DOM_EVENT (event));
else if (!e_editor_page_get_html_mode (editor_page))
- set_monospace_font_family_on_body (element, TRUE);
+ e_editor_dom_set_monospace_font_family_on_body (element, TRUE);
goto out;
}
@@ -3942,7 +3942,7 @@ body_keyup_event_cb (WebKitDOMElement *element,
body = webkit_dom_document_get_body (document);
- set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), FALSE);
+ e_editor_dom_set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), FALSE);
}
e_editor_dom_body_key_up_event_process_backspace_or_delete (editor_page, key_code ==
HTML_KEY_CODE_DELETE);
@@ -6169,7 +6169,8 @@ e_editor_dom_convert_content (EEditorPage *editor_page,
editor_page);
register_html_events_handlers (editor_page, body);
- set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), e_editor_page_get_html_mode
(editor_page));
+ e_editor_dom_set_monospace_font_family_on_body (
+ WEBKIT_DOM_ELEMENT (body), e_editor_page_get_html_mode (editor_page));
g_free (inner_html);
}
@@ -8586,7 +8587,8 @@ e_editor_dom_process_content_after_load (EEditorPage *editor_page)
else
e_editor_dom_turn_spell_check_off (editor_page);
- set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), e_editor_page_get_html_mode
(editor_page));
+ e_editor_dom_set_monospace_font_family_on_body (
+ WEBKIT_DOM_ELEMENT (body), e_editor_page_get_html_mode (editor_page));
dom_window = webkit_dom_document_get_default_view (document);
@@ -10545,7 +10547,8 @@ e_editor_dom_process_content_after_mode_change (EEditorPage *editor_page)
g_free (plain);
}
- set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (webkit_dom_document_get_body (document)),
html_mode);
+ e_editor_dom_set_monospace_font_family_on_body (
+ WEBKIT_DOM_ELEMENT (webkit_dom_document_get_body (document)), html_mode);
manager = e_editor_page_get_undo_redo_manager (editor_page);
e_editor_undo_redo_manager_clean_history (manager);
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.h
b/modules/webkit-editor/web-extension/e-editor-dom-functions.h
index 4aeacb5..29cd7b3 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.h
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.h
@@ -108,6 +108,9 @@ void e_editor_dom_insert_smiley_by_name
const gchar *name);
void e_editor_dom_check_magic_smileys
(EEditorPage *editor_page);
+void e_editor_dom_set_monospace_font_family_on_body
+ (WebKitDOMElement *body,
+ gboolean html_mode);
void e_editor_dom_convert_content (EEditorPage *editor_page,
const gchar *preferred_text);
void e_editor_dom_convert_and_insert_html_into_selection
diff --git a/modules/webkit-editor/web-extension/e-editor-undo-redo-manager.c
b/modules/webkit-editor/web-extension/e-editor-undo-redo-manager.c
index 42f97b0..2533ad7 100644
--- a/modules/webkit-editor/web-extension/e-editor-undo-redo-manager.c
+++ b/modules/webkit-editor/web-extension/e-editor-undo-redo-manager.c
@@ -884,18 +884,27 @@ redo_delete (EEditorPage *editor_page,
EEditorHistoryEvent *event)
{
EEditorUndoRedoManager *manager;
+ WebKitDOMDocument *document;
WebKitDOMDocumentFragment *fragment = event->data.fragment;
WebKitDOMNode *node;
- gboolean delete_key, control_key;
+ WebKitDOMHTMLElement *body;
+ gboolean delete_key, control_key, html_mode;
glong length = 1;
gint ii;
manager = e_editor_page_get_undo_redo_manager (editor_page);
+ document = e_editor_page_get_document (editor_page);
+ html_mode = e_editor_page_get_html_mode (editor_page);
restore_selection_to_history_event_state (editor_page, event->before);
delete_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event->data.fragment),
"history-delete-key"));
control_key = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (event->data.fragment),
"history-control-key"));
+ body = webkit_dom_document_get_body (document);
+
+ if (!html_mode)
+ e_editor_dom_set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), TRUE);
+
if (!delete_key && e_editor_dom_key_press_event_process_backspace_key (editor_page))
goto out;
@@ -972,6 +981,8 @@ redo_delete (EEditorPage *editor_page,
e_editor_page_set_renew_history_after_coordinates (editor_page, FALSE);
e_editor_dom_body_key_up_event_process_backspace_or_delete (editor_page, delete_key);
e_editor_page_set_renew_history_after_coordinates (editor_page, TRUE);
+ if (!html_mode)
+ e_editor_dom_set_monospace_font_family_on_body (WEBKIT_DOM_ELEMENT (body), FALSE);
restore_selection_to_history_event_state (editor_page, event->after);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]