0

Use Cordova/Phonegap to build an android app which contains the following simple html file index.html

<html>
<body>
<div contenteditable="true>
12<img src="1.jpg" />34<img src="2.jpg" />
</div>
</body>
</html>

Run this android apps using any android mobile phone, place the cursor at the end of the div(i.e. behind image 2.jpg), the soft keyboard will be opened automatically. Then, press the "BACKSPACE" button on the soft keyboard.

Expected Result: the image 2.jpg is removed.

Actual Result: the letter "4" is removed. AND, it is not possible to remove the 2 images inside the div.

If I run this simple html using any desktop browsers or any browsers in mobile phone, this result is as expected. The problem only appears when it is run inside a webview of an android apps.

I'm sorry that I created this new question; I asked an old one but no one response, may be my last question is too complicated, so I create this one which is easier to understand.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kenneth Li
  • 1,632
  • 1
  • 14
  • 19

1 Answers1

1

I try in a new cordova application and it works perfectly, i think that the problem is only releated to your html formatting, you miss two enclosing tags in the img and one single quotes in contenteditable="true, follow the correct html:

<html>
    <body>
        <div contenteditable="true">
            12 <img src="1.jpg"/> 34 <img src="2.jpg"/>
        </div>
    </body>
</html>

Maybe android chrome version that you have installed on phone have a more pedant management of the html formatting and not recognize the image tags.

phemt.latd
  • 1,775
  • 21
  • 33
  • hi phemt.latd, thanks for your sharing, sorry there is a typo, my actual code contains the /. After reading your comment I try it on different phones, a brand name called Nubia, which is made in China, with any IME, cannot remove images, this phone android version is 4.4.1. With Samsung Note 2, the last image can be removed, but the letter 4 cannot be removed, in order to remove the letter 4 after removing the image 2, I need to move the cursor somewhere else and move it back, then I can remove it. – Kenneth Li May 08 '15 at 08:41
  • What is the model of your phone? Now I at least confirm different phones behaves differently – Kenneth Li May 08 '15 at 08:44
  • i have a nexus 5, different phone use differente browser and different engin ( as webkit or webkit versions ) to work with cordova webView – phemt.latd May 08 '15 at 12:44