#define EC_TAG_SIGNATURE_DEFAULT EC_TAG_DIV_DIR
#define EC_TAG_SIGNATURE_TEXT EC_TAG_DIV_DIR""EC_TAG_DIV_DIR""EC_TAG_DIV_DIR"<div dir='auto' style='font-size: 14px; color: rgba(%d, %d, %d, %d);'>%s"EC_TAG_DIV_F
#define EC_TAG_BODY_CSS_START "<body class='css-body'>\n"
-#define EC_TAG_BODY_ORIGINAL_MESSAGE_START "<body class='css-body-IncludeOriginalMessage'>\n"
#define EC_TAG_BODY_END "</body>\n"
#define EC_TAG_HTML_END "</html>\n"
"<div id='"EC_NAME_ORIGINAL_MESSAGE_BAR_CHECKBOX_ICON"' class='checkicon'>" \
EC_TAG_DIV_F""EC_TAG_DIV_F""EC_TAG_DIV_F""EC_TAG_DIV_F""EC_TAG_DIV_F
-#define EC_JS_ENABLE_EDITABLE_BODY "document.body.contentEditable='true'; void 0;"
-#define EC_JS_ENABLE_EDITABLE_DIVS \
- "document.getElementById('"EC_NAME_NEW_MESSAGE"').contentEditable=\"true\";" \
+#define EC_JS_ENABLE_EDITABLE_DIV "document.getElementById('"EC_NAME_NEW_MESSAGE"').contentEditable=\"true\";"
+#define EC_JS_ENABLE_EDITABLE_DIVS EC_JS_ENABLE_EDITABLE_DIV \
"document.getElementById('"EC_NAME_ORIGINAL_MESSAGE_BAR"').contentEditable=\"false\";" \
"document.getElementById('"EC_NAME_ORG_MESSAGE"').contentEditable=\"true\"; void 0;"
-#define EC_JS_SET_FOCUS "document.body.focus(); void 0;"
-#define EC_JS_SET_UNFOCUS "document.body.blur(); void 0;"
#define EC_JS_SET_FOCUS_NEW_MESSAGE "document.getElementById('"EC_NAME_NEW_MESSAGE"').focus(); void 0;"
#define EC_JS_SET_UNFOCUS_NEW_MESSAGE "document.getElementById('"EC_NAME_NEW_MESSAGE"').blur(); void 0;"
#define EC_JS_SET_FOCUS_ORG_MESSAGE "document.getElementById('"EC_NAME_ORG_MESSAGE"').focus(); void 0;"
#define EC_JS_UPDATE_TEXT_TO_ORIGINAL_MESSAGE_BAR "UpdateOriginalMessageText(\"%s\");"
#define EC_JS_INSERT_ORIGINAL_MAIL_INFO "InsertOriginalMailInfo(\"%s\");"
-#define EC_JS_INSERT_SIGNATURE "InsertSignature(\"%s\");"
#define EC_JS_INSERT_SIGNATURE_TO_NEW_MESSAGE "InsertSignatureTo(\""EC_NAME_NEW_MESSAGE"\", \"%s\");"
#define EC_JS_UPDATE_COLOR_OF_ORG_MESSAGE_BAR "UpdateBGColorTo(\""EC_NAME_ORIGINAL_MESSAGE_BAR"\", %d, %d, %d, %d);"
if (body_document) {
char *temp_body = body_document;
- body_document = g_strconcat(EC_TAG_BODY_CSS_START, temp_body, EC_TAG_BODY_END, NULL);
+ body_document = g_strconcat(EC_TAG_BODY_CSS_START, EC_TAG_NEW_MSG_START, temp_body, EC_TAG_NEW_MSG_END, EC_TAG_BODY_END, NULL);
g_free(temp_body);
}
}
if (view->new_mail_info->mail_data->file_path_plain) {
current_content = (char *)email_get_parse_plain_text(view->new_mail_info->mail_data->file_path_plain, STR_LEN(view->new_mail_info->mail_data->file_path_plain));
if (current_content) {
- body_document = g_strconcat(EC_TAG_BODY_CSS_START, current_content, EC_TAG_BODY_END, NULL);
+ body_document = g_strconcat(EC_TAG_BODY_CSS_START, EC_TAG_NEW_MSG_START, current_content, EC_TAG_NEW_MSG_END, EC_TAG_BODY_END, NULL);
}
free(view->new_mail_info->mail_data->file_path_plain);
view->new_mail_info->mail_data->file_path_plain = NULL;
original_message_bar = _initial_data_body_get_original_message_bar_tags(view);
if (parent_content) {
- body_document = g_strconcat(EC_TAG_BODY_ORIGINAL_MESSAGE_START, EC_TAG_NEW_MSG_START, EC_TAG_NEW_MSG_END, original_message_bar, EC_TAG_ORG_MSG_START, parent_content, EC_TAG_ORG_MSG_END, EC_TAG_BODY_END, NULL);
+ body_document = g_strconcat(EC_TAG_BODY_CSS_START, EC_TAG_NEW_MSG_START, EC_TAG_NEW_MSG_END, original_message_bar, EC_TAG_ORG_MSG_START, parent_content, EC_TAG_ORG_MSG_END, EC_TAG_BODY_END, NULL);
}
}
}
if (!body_document) {
/* html_document will be freed on the place that this functions returned. */
- body_document = g_strconcat(EC_TAG_BODY_CSS_START, EC_TAG_BODY_END, NULL);
+ body_document = g_strconcat(EC_TAG_BODY_CSS_START, EC_TAG_NEW_MSG_START, EC_TAG_NEW_MSG_END, EC_TAG_BODY_END, NULL);
}
char html_meta_info[EC_HTML_META_INFO_SIZE];
debug_error("EC_JS_ENABLE_EDITABLE_DIVS failed!");
}
} else {
- if (!ewk_view_script_execute(ewk_view, EC_JS_ENABLE_EDITABLE_BODY, _webkit_js_execute_set_focus_cb, (void *)view)) {
- debug_error("EC_JS_ENABLE_EDITABLE_BODY failed!");
+ if (!ewk_view_script_execute(ewk_view, EC_JS_ENABLE_EDITABLE_DIV, _webkit_js_execute_set_focus_cb, (void *)view)) {
+ debug_error("EC_JS_ENABLE_EDITABLE_DIV failed!");
}
}
char *to_be_inserted_signature = NULL;
char *signature = composer_initial_data_body_make_signature_markup(view);
- if (((view->composer_type == RUN_COMPOSER_REPLY || view->composer_type == RUN_COMPOSER_REPLY_ALL) && view->account_info->original_account->options.reply_with_body) ||
- (view->composer_type == RUN_COMPOSER_FORWARD) || (view->composer_type == RUN_COMPOSER_FORWARD_ALL)) {
- to_be_inserted_signature = g_strdup_printf(EC_JS_INSERT_SIGNATURE_TO_NEW_MESSAGE, signature);
- } else {
- to_be_inserted_signature = g_strdup_printf(EC_JS_INSERT_SIGNATURE, signature);
- }
+ to_be_inserted_signature = g_strdup_printf(EC_JS_INSERT_SIGNATURE_TO_NEW_MESSAGE, signature);
if (!ewk_view_script_execute(obj, to_be_inserted_signature, _webkit_js_execute_insert_signature_cb, (void *)view)) {
debug_warning("EC_JS_INSERT_SIGNATURE failed.");
if (!ewk_view_script_execute(view->ewk_view, buf, NULL, (void *)view)) {
debug_error("EC_JS_UPDATE_COLOR_OF_CHECKBOX failed.");
}
- /* Not to move the focus to new meesage div when focused ui is enabled. */
- if (!elm_win_focus_highlight_enabled_get(view->base.module->win) && !view->is_focus_on_new_message_div) {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_NEW_MESSAGE, NULL, view) == EINA_FALSE) {
- debug_error("EC_JS_SET_FOCUS_NEW_MESSAGE is failed!");
- }
+ if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_NEW_MESSAGE, NULL, view) == EINA_FALSE) {
+ debug_error("EC_JS_SET_FOCUS_NEW_MESSAGE is failed!");
}
edje_object_signal_emit(_EDJ(view->composer_layout), "ec,action,clicked,layout", "");
} else if (g_str_has_prefix(event, COMPOSER_EVENT_NEW_MESSAGE_DIV_FOCUSED)) {
EmailComposerView *view = (EmailComposerView *)data;
- if (view->with_original_message) {
- if (view->is_focus_on_new_message_div) {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_UNFOCUS_NEW_MESSAGE, NULL, view) == EINA_FALSE) {
- debug_error("EC_JS_SET_UNFOCUS_NEW_MESSAGE is failed!");
- }
- } else {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_UNFOCUS_ORG_MESSAGE, NULL, view) == EINA_FALSE) {
- debug_error("EC_JS_SET_UNFOCUS_ORG_MESSAGE is failed!");
- }
+ if (view->is_focus_on_new_message_div) {
+ if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_UNFOCUS_NEW_MESSAGE, NULL, view) == EINA_FALSE) {
+ debug_error("EC_JS_SET_UNFOCUS_NEW_MESSAGE is failed!");
}
} else {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_UNFOCUS, NULL, view) == EINA_FALSE) {
- debug_error("EC_JS_SET_UNFOCUS is failed!");
+ if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_UNFOCUS_ORG_MESSAGE, NULL, view) == EINA_FALSE) {
+ debug_error("EC_JS_SET_UNFOCUS_ORG_MESSAGE is failed!");
}
}
EmailComposerView *view = (EmailComposerView *)data;
- if (view->with_original_message) {
- if (view->is_focus_on_new_message_div) {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_NEW_MESSAGE, NULL, NULL) == EINA_FALSE) {
- debug_error("EC_JS_SET_FOCUS_NEW_MESSAGE is failed!");
- }
- } else {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_ORG_MESSAGE, NULL, NULL) == EINA_FALSE) {
- debug_error("EC_JS_SET_FOCUS_ORG_MESSAGE is failed!");
- }
+ if (view->is_focus_on_new_message_div) {
+ if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_NEW_MESSAGE, NULL, NULL) == EINA_FALSE) {
+ debug_error("EC_JS_SET_FOCUS_NEW_MESSAGE is failed!");
}
} else {
- if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS, NULL, NULL) == EINA_FALSE) {
- debug_error("EC_JS_SET_FOCUS is failed!");
+ if (ewk_view_script_execute(view->ewk_view, EC_JS_SET_FOCUS_ORG_MESSAGE, NULL, NULL) == EINA_FALSE) {
+ debug_error("EC_JS_SET_FOCUS_ORG_MESSAGE is failed!");
}
}
}
.css-body {
- margin-top:8px !important;
- margin-bottom:8px !important;
- margin-left:10px !important;
- margin-right:10px !important;
- width: auto !important;
- height: auto !important;
- font-size: 16px !important; /* 16px is default font-size in webkit */
- font-family:Tizen !important;
- font-weight: 400 !important;
- text-align: initial !important; /* initial: For LTR, left. For RTL, right */
- background-color:#ffffff !important;
- overflow-x: auto;
- overflow-y: hidden;
- word-wrap: break-word;
-}
-
-.css-body-IncludeOriginalMessage {
margin-top:0px !important;
margin-bottom:0px !important;
margin-left:0px !important;
function initialize() {
element_ = document.createElement("DIV");
element_.style.cssText = "position: absolute; pointer-events: none; display: none;";
- element_.className = "email-composer-image-layer";
document.body.appendChild(element_);
var overlay = document.createElement("DIV");
if (originalMessageBarCheckbox) {
originalMessageBarCheckbox.addEventListener('keydown', function () { OnkeyDown_Checkbox(this, event); }, false);
}
+ }
- var newMessage = document.getElementById(G_NAME_NEW_MESSAGE);
- if (newMessage) {
- newMessage.addEventListener('focus', function () { OnFocus_NewMessageDIV(event); }, false);
- newMessage.addEventListener('paste', function () { OnPaste(this, event); }, false);
- newMessage.addEventListener('keydown', function () { OnKeyDown(this, event); }, false);
- }
+ var newMessage = document.getElementById(G_NAME_NEW_MESSAGE);
+ if (newMessage) {
+ newMessage.addEventListener('focus', function () { OnFocus_NewMessageDIV(event); }, false);
+ newMessage.addEventListener('paste', function () { OnPaste(this, event); }, false);
+ newMessage.addEventListener('keydown', function () { OnKeyDown(this, event); }, false);
+ }
- var originalMessage = document.getElementById(G_NAME_ORG_MESSAGE);
- if (originalMessage) {
- originalMessage.addEventListener('focus', function () { OnFocus_OrgMessageDIV(event); }, false);
- originalMessage.addEventListener('paste', function () { OnPaste(this, event); }, false);
- originalMessage.addEventListener('keydown', function () { OnKeyDown(this, event); }, false);
- }
- } else {
- document.body.addEventListener('paste', function () { OnPaste(this, event); }, false);
- document.body.addEventListener('keydown', function () { OnKeyDown(this, event); }, false);
+ var originalMessage = document.getElementById(G_NAME_ORG_MESSAGE);
+ if (originalMessage) {
+ originalMessage.addEventListener('focus', function () { OnFocus_OrgMessageDIV(event); }, false);
+ originalMessage.addEventListener('paste', function () { OnPaste(this, event); }, false);
+ originalMessage.addEventListener('keydown', function () { OnKeyDown(this, event); }, false);
}
g_imageLayer = new ImageLayer();
orgMessageDiv.insertBefore(mailInfoDiv, orgMessageDiv.firstChild);
}
-function InsertSignature(signature) {
- utils.log(arguments.callee.name + "()");
- var signatureDiv = document.createElement("div");
- signatureDiv.innerHTML = signature;
- document.body.appendChild(signatureDiv);
-}
-
function InsertSignatureTo(div_id, signature) {
utils.log(arguments.callee.name + "()");
var signatureDiv = document.createElement("div");
utils.log(arguments.callee.name + "()");
var srcNewMsg = document.getElementById(G_NAME_NEW_MESSAGE);
- var srcOrgMsg = srcNewMsg && document.getElementById(G_NAME_ORG_MESSAGE);
+ if (!srcNewMsg) {
+ return "";
+ }
+
+ var srcOrgMsg = document.getElementById(G_NAME_ORG_MESSAGE);
var dstContent = document.createElement("html");
var dstBody;
if (!srcOrgMsg || (IsCheckboxChecked() != "true")) {
- if (!srcNewMsg) {
- dstBody = document.body.cloneNode(true);
- // TODO Temp code. Remove when replace body with DIV.
- var imgLayers = dstBody.getElementsByClassName("email-composer-image-layer");
- if (imgLayers.length > 0) {
- imgLayers[0].parentElement.removeChild(imgLayers[0]);
- }
- } else {
- dstBody = srcNewMsg.cloneNode(true);
- dstBody.removeAttribute("id");
- dstBody.removeAttribute("class");
- }
+ dstBody = srcNewMsg.cloneNode(true);
+ dstBody.removeAttribute("id");
+ dstBody.removeAttribute("class");
dstBody.removeAttribute("contenteditable");
} else {
dstBody = document.createElement("body");