[evolution/wip/webkit-composer: 920/966] Bug 726629 - [webkit-composer] Scroll to cursor after paste
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 920/966] Bug 726629 - [webkit-composer] Scroll to cursor after paste
- Date: Wed, 23 Apr 2014 11:10:47 +0000 (UTC)
commit 09f5676cfddbf864ba4a2b909b5412960b372429
Author: Tomas Popela <tpopela redhat com>
Date: Wed Mar 19 10:49:19 2014 +0100
Bug 726629 - [webkit-composer] Scroll to cursor after paste
composer/e-composer-private.c | 3 +++
e-util/e-editor-selection.c | 12 ++++++++++++
e-util/e-editor-selection.h | 3 ++-
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 0576d25..39733f8 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -492,6 +492,7 @@ e_composer_paste_html (EMsgComposer *composer,
e_editor_widget_check_magic_links (editor_widget, FALSE);
e_editor_widget_force_spell_check (editor_widget);
+ e_editor_selection_scroll_to_caret (editor_selection);
g_free (html);
return TRUE;
@@ -550,6 +551,7 @@ e_composer_paste_image (EMsgComposer *composer,
selection = e_editor_widget_get_selection (editor_widget);
e_editor_selection_insert_image (selection, uri);
+ e_editor_selection_scroll_to_caret (selection);
} else {
EAttachment *attachment;
@@ -600,6 +602,7 @@ e_composer_paste_text (EMsgComposer *composer,
e_editor_widget_check_magic_links (editor_widget, FALSE);
e_editor_widget_force_spell_check (editor_widget);
+ e_editor_selection_scroll_to_caret (editor_selection);
}
g_free (text);
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 9ddbf7a..c83f2bd 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -5072,3 +5072,15 @@ e_editor_selection_move (EEditorSelection *selection,
{
editor_selection_modify (selection, "move", forward, granularity);
}
+
+void
+e_editor_selection_scroll_to_caret (EEditorSelection *selection)
+{
+ WebKitDOMElement *caret;
+
+ caret = e_editor_selection_save_caret_position (selection);
+
+ webkit_dom_element_scroll_into_view (caret, TRUE);
+
+ e_editor_selection_clear_caret_position_marker (selection);
+}
diff --git a/e-util/e-editor-selection.h b/e-util/e-editor-selection.h
index 845bcfc..28c0974 100644
--- a/e-util/e-editor-selection.h
+++ b/e-util/e-editor-selection.h
@@ -223,7 +223,8 @@ void e_editor_selection_move (EEditorSelection *selection,
void e_editor_selection_extend (EEditorSelection *selection,
gboolean forward,
EEditorSelectionGranularity granularity);
-
+void e_editor_selection_scroll_to_caret
+ (EEditorSelection *selection);
G_END_DECLS
#endif /* E_EDITOR_SELECTION_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]