/dev/qulogic/ckeditor: 4aab4158d6a0: Fix HTML append in new edit...
Elliott Sales de Andrade
qulogic at pidgin.im
Fri Aug 9 03:13:29 EDT 2013
Changeset: 4aab4158d6a0716ee6d5e61f6eee88b1badfe0c9
Author: Elliott Sales de Andrade <qulogic at pidgin.im>
Date: 2013-08-06 05:54 -0400
Branch: default
URL: https://hg.pidgin.im/dev/qulogic/ckeditor/rev/4aab4158d6a0
Description:
Fix HTML append in new editable webview.
diffstat:
pidgin/gtkwebview.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (49 lines):
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -122,6 +122,7 @@ typedef struct _GtkWebViewPriv {
/* Format options */
GtkWebViewButtons format_functions;
struct {
+ gboolean enabled:1;
gboolean wbfo:1; /* Whole buffer formatting only. */
gboolean block_changed:1;
} edit;
@@ -1348,6 +1349,7 @@ GtkWidget *
gtk_webview_new(gboolean editable)
{
GtkWidget *result;
+ GtkWebViewPriv *priv;
WebKitWebView *webview;
WebKitWebSettings *settings;
@@ -1380,6 +1382,9 @@ gtk_webview_new(gboolean editable)
g_free(ck);
}
+ priv = GTK_WEBVIEW_GET_PRIVATE(webview);
+ priv->edit.enabled = TRUE;
+
return result;
}
@@ -1629,8 +1634,17 @@ gtk_webview_append_html(GtkWebView *webv
g_return_if_fail(webview != NULL);
priv = GTK_WEBVIEW_GET_PRIVATE(webview);
- g_queue_push_tail(priv->load_queue, GINT_TO_POINTER(LOAD_HTML));
- g_queue_push_tail(priv->load_queue, g_strdup(html));
+ if (priv->edit.enabled) {
+ char *quoted = gtk_webview_quote_js_string(html);
+ char *tmp = g_strdup_printf("CKEDITOR.instances.input.insertHtml(%s);", quoted);
+ g_free(quoted);
+
+ g_queue_push_tail(priv->load_queue, GINT_TO_POINTER(LOAD_JS));
+ g_queue_push_tail(priv->load_queue, tmp);
+ } else {
+ g_queue_push_tail(priv->load_queue, GINT_TO_POINTER(LOAD_HTML));
+ g_queue_push_tail(priv->load_queue, g_strdup(html));
+ }
if (!priv->is_loading && priv->loader == 0)
priv->loader = g_idle_add((GSourceFunc)process_load_queue, webview);
}
More information about the Commits
mailing list