Hi,

What is the issue exactly?
I see no problem for this (assuming you use modern browser that supports
all used JS APIs).

There is no Wicket involved so I don't expect any problems caused by Wicket.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 7, 2015 at 8:58 AM, Christopher Auth <[email protected]> wrote:

> Hi,
>
> I have a problem, that I need to load a html element during submit, that
> have not a 'wicket:id' attribute.
>
> It is possible to do that?
>
> In the html tree in the browser I add a new 'img' element with
> javascript to a div. This element has not a wicket:id. But I need the
> base64 encoded file in the img-tag.
>
>
>
> The HTML that Wicket used:
>
> <div class="editablediv" id="editablediv" contenteditable></div>
> <script type="text/javascript">
>     if (document.addEventListener) {
>         document.addEventListener('paste', onPasteTriggered, false);
>     }
>
>     /*Called whenever a paste event has occured*/
>     function onPasteTriggered(e) {
>         if (typeof e.clipboardData != 'undefined') {
>             var copiedData = e.clipboardData.items[0]; //Get the
> clipboard data
>
>             /*If the clipboard data is of type image, read the data*/
>             if (copiedData.type.indexOf("image") == 0) {
>                 var imageFile = copiedData.getAsFile();
>
>                 /*We will use HTML5 FileReader API to read the image file*/
>                 var reader = new FileReader();
>
>                 reader.onload = function (evt) {
>                     var result = evt.target.result; //base64 encoded image
>
>                     /*Create an image element and append it to the
> content editable div*/
>                     var img = document.createElement("img");
>                     img.src = result;
>
> document.getElementById("editablediv").appendChild(img);
>                 };
>
>                 /*Read the image file*/
>                 reader.readAsDataURL(imageFile);
>             }
>         }
>     }
> </script>
>
>
> The HTML from Browser after paste the image:
>
> <div contenteditable="" id="editablediv" class="editablediv"><img alt=""
>
> src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAt0AAAJSCAYAAAAf0Xn.../fic+YIIIAAAggggAAC3RH4f57viSsFn9zlAAAAAElFTkSuQmCC"></div>
>
>
>
> Thanks
>
> Christopher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to