Skip to content

Commit

Permalink
working on #287
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandarancio committed Nov 6, 2019
1 parent aeaeedc commit 408ab3c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
29 changes: 16 additions & 13 deletions src/marker-preview.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,17 @@ decide_policy_cb (WebKitWebView *web_view,
{
switch (type) {
case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
return navigate(decision);
default:
/* Making no decision results in webkit_policy_decision_use(). */
return FALSE;
return navigate(decision);
case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
webkit_policy_decision_use (decision);
break;
case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
return navigate(decision);
default:
/* Making no decision results in webkit_policy_decision_use(). */
return FALSE;
}
return FALSE;
return TRUE;
}


Expand Down Expand Up @@ -354,7 +359,7 @@ marker_preview_render_markdown(MarkerPreview* preview,
const char* markdown,
const char* css_theme,
const char* base_uri,
int cursros)
int cursor)
{
MarkerMathJSMode katex_mode = MATHJS_OFF;
if (marker_prefs_get_use_mathjs()) {
Expand All @@ -380,7 +385,7 @@ marker_preview_render_markdown(MarkerPreview* preview,
highlight_mode,
mermaid_mode,
css_theme,
cursros);
cursor);

WebKitWebView* web_view = WEBKIT_WEB_VIEW(preview);

Expand All @@ -397,14 +402,12 @@ marker_preview_render_markdown(MarkerPreview* preview,
if (base_uri) {
uri = g_filename_to_uri (g_locale_from_utf8(base_uri, strlen(base_uri), NULL, NULL, NULL), NULL, NULL);
}else {
uri = g_strdup("file://internal.md");
uri = g_strdup("file:///internal.html");
}

GBytes *bhtml = g_string_free_to_bytes(g_string_new(html));
webkit_web_view_load_bytes(web_view, bhtml, "text/html", "UTF-8", uri);

webkit_web_view_load_html(web_view
,html
,uri);
g_free(uri);
// g_free(shtml);
free(html);
}

Expand Down
5 changes: 3 additions & 2 deletions src/marker-preview.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ void marker_preview_render_markdown (MarkerPreview
const char *markdown,
const char *css_theme,
const char *base_uri,
int cursor);
WebKitPrintOperationResponse
int cursor);

WebKitPrintOperationResponse
marker_preview_run_print_dialog (MarkerPreview *preview,
GtkWindow *parent);
void marker_preview_print_pdf (MarkerPreview* preview,
Expand Down

0 comments on commit 408ab3c

Please sign in to comment.