Remove tag if when paste x-elementary-markup type of text
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / ClipboardHelper.cpp
index f649f65..e23264a 100755 (executable)
@@ -603,7 +603,8 @@ bool ClipboardHelper::setClipboardItem(Ecore_X_Atom dataType,const String& data)
 
 void ClipboardHelper::openClipboardWindow(bool isContentRichlyEditable)
 {
-    clearClipboardSelectionHandler();
+    if (!isClipboardWindowOpened())
+        clearClipboardSelectionHandler();
 
     initializeAtomList();
     if (isContentRichlyEditable)
@@ -750,6 +751,9 @@ bool ClipboardHelper::retrieveClipboardItem(int index, int* format, String* pDat
     else
         return false;
 
+    if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
+        *pData = String::fromUTF8(evas_textblock_text_markup_to_utf8(NULL, pData->utf8().data()));
+
     return true;
 }
 
@@ -778,10 +782,10 @@ void ClipboardHelper::pasteClipboardLastItem(bool isContentEditable)
 
     switch(format) {
     case ELM_SEL_FORMAT_TEXT:
+    case ELM_SEL_FORMAT_MARKUP:
         page()->didSelectPasteMenuFromContextMenu(clipboardData, String("PlainText"));
         break;
     case ELM_SEL_FORMAT_HTML:
-    case ELM_SEL_FORMAT_MARKUP:
         page()->didSelectPasteMenuFromContextMenu(clipboardData, String("Markup"));
         break;
     case ELM_SEL_FORMAT_IMAGE:
@@ -795,7 +799,6 @@ void ClipboardHelper::pasteClipboardLastItem(bool isContentEditable)
 
 void ClipboardHelper::updateClipboardWindowState(Ecore_X_Event_Window_Property* ev)
 {
-    Ecore_X_Window zone = ecore_x_e_illume_zone_get(ev->win);
     Ecore_X_Illume_Clipboard_State state = ecore_x_e_illume_clipboard_state_get(ev->win);
 
     if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN)
@@ -806,7 +809,6 @@ void ClipboardHelper::updateClipboardWindowState(Ecore_X_Event_Window_Property*
     else if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
         m_clipboardWindowOpened = true;
 }
-
 #endif // TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD
 }// namespace WebKit