Currently, i'm buiding my rich text editor with quill and i need to create an embed for images. Before quill, i used to use redactor and i try to move to redactor. But, i already have 2 version of data from redactor before where the users is already uploaded images.
Version 1:
<p>
<img src="http://lorempixel.com/400/200/" data-image="5bb71bdc65465e0675ba" class="img-fluid img-responsive">
</p>
Version 2:
<figure>
<img src="http://lorempixel.com/400/200/" data-image="1bdc65465e0675ba1b2b" class="img-fluid img-responsive">
</figure>
Expected behavior:
I expect to replace the p with figure on initial parsing in quill. So, all the images have same parent figure
Actual behavior
figure is always deleted by default
I tried to register figure with blots/block/embed but i can't check and add the figure if the image doesn't have figure on its parent
Thank you
I would like to show when a file is selected, in the input. Why isn't it showing? My code:
<input type="file" id="logo" name="logo" ng-model="service.logo" required="required">
<img ng-src="{{service.logo}}">
Here is a JSFiddle.
Because in this you are just taking the input from the user. You need to write code to open the file, read it and display on to the view. As you want to show the image when the user browses and selects it, you need to trigger the fileSelect.
Also, look into this, I think this is what you want. How to read a file in AngularJS?
Because the only thing that gets passed to value and thus ng-model of a file input is the file name
If you want a preview (before upload) you need to use FileReader API to read the file and parse it into a data url and pass that to an image element
I am trying to find Submit element. My HTML structure is as below.
<div>
<span class="combutton">Submit</span>
</div>
<div>
<span class="combutton">Cancel</span>
</div>
In browser using firebug I tried
$('div .combutton')[0].click()
which clicks on submit perfectly. But using selenium driver this element is not found. Please tell me how to do this using
driver.findElement(By.css("CSSSELECTORSTRING"))
What you did in Firebug shouldn't have any effect since it's clicking on a span and not the a inside it.
This should work, unless you omitted certain parts of your markup that would otherwise prevent it:
driver.findElement(By.cssSelector("div:first-child .combutton a")).click();
try that :
driver.findElement(By.xpath("//div span.combutton a[contains(.,'Submit')]")).click();
or
driver.findElement(By.xpath("//div span.combutton[0] a")).click();
We've used for some years a home-grown file uploader for our classic ASP website. It works like this:
ASP page sets some specific constants and #includes an ASP library called Browse-Files.asp.
Browse-Files.asp displays, inside the #including page, a file explorer-like view of the directories and files in a directory. It also shows various HTML links to allow file modification functions - create a directory, upload a file, move, rename and delete existing files.
Each of these links calls a Javascript function that generates a simple HTML page in a popup window. These popups contain the required HTML form for the requested file modification activity. The HTML source for the popup pages is generated on the fly by Javascipt, rather than loading a static .htm or .asp file (this is purely so that all of the functionality of Browse-Files.asp is located in 1 file).
The user fills in the popup form and submits. The form submits back to the parent page (form target attribute) and closes itself (Javascript timer, window.close).
The parent page refreshes due to the form submit, showing the change the user requested.
Issue is: this has worked fine for some years on various browsers, IE 6 to 8, Firefox and Opera. However, in IE9, the file upload does not work. The other popup-based tasks such as file renaming and directory creation continue to work.
Code - the file rename popup (works in IE9 and all before):
<html>
<head>
<title>Rename</title>
<link rel="stylesheet" href="/Common/CSS/screen.css" type="text/css" media="screen" />
</head>
<body>
<h1>Rename</h1>
<p>Enter the new name for "Config Mgmt Text.txt" in the folder "General/Share-Files/":</p>
<form name="form" method="post" action="/General/Share-Files.asp" encType="multipart/form-data" target="Browse-Files" onSubmit="self.setTimeout('window.close()', 500)">
<input name="task" type="hidden" value="T03" />
<input name="path" type="hidden" value="General/Share-Files/" />
<input name="target" type="hidden" value="Config Mgmt Text.txt" />
<input name="name" type="text" tabindex="1" size="40" value="Config Mgmt Text.txt"></input>
<input name="submit" type="submit" value="Rename" tabindex="2" />
</form>
</body>
</html>
Code - the file upload popup (broken in IE9, works in all before):
<html>
<head>
<title>Add Files</title>
<link rel="stylesheet" href="/Common/CSS/screen.css" type="text/css" media="screen" />
</head>
<body>
<h1>Add Files</h1>
<p>Browse for files to add to the folder "General/Share-Files/":</p>
<form name="form" method="post" action="/General/Share-Files.asp" encType="multipart/form-data" target="Browse-Files" onSubmit="self.setTimeout('window.close()', 500)">
<input name="task" type="hidden" value="T01" />
<input name="path" type="hidden" value="General/Share-Files/" />
<input name="file1" type="file" tabindex="1" size="40"></input><br />
<input name="file2" type="file" tabindex="2" size="40"></input><br />
<input name="file3" type="file" tabindex="3" size="40"></input><br />
<input name="file4" type="file" tabindex="4" size="40"></input><br />
<input name="file5" type="file" tabindex="5" size="40"></input><br />
<input name="submit" type="submit" value="Upload Files" tabindex="6" />
</form>
<p>Note that upload speed depends on your internet connection speed.</p>
</body>
</html>
All the forms are encType="multipart/form-data" to accomodate the file upload, and the ASP on the main page does a Request.BinaryRead(Request.TotalBytes) first thing with the form data. It then parses the data by delimiter, splitting it out into binary data (uploaded files) and text data (regular form fields). One of these regular form fields, <input name="task" type="hidden" value="T01" />, is how it knows what to do with the submitted data (rename a file, upload a file, etc).
So, why does uploading, and only uploading, not work in IE9?
As above, the form submit method is the same for uploading and other (working) form actions, as is the server-side parsing of HTTP POST.
Debugging has shown that the file upload popup never even submits data back to the parent page (or to itself), i.e.the form data is never submitted to the server in the first place. But, all the other forms work the same way and do submit.....
Could this be something completely unrelated to code, like an IE9 security setting?
Have even tried forcing IE8 compatability mode on IE9 (<meta http-equiv="X-UA-Compatible" content="IE=8" >), no change.
Any assistance greatly appreciated.
Thanks
Lukas
Update:
1) "Doesn't work" means that the upload popup dissapears on submit (as it should), but nothing is ever submitted to the parent page. If I disable the auto-close on the popup: after clicking submit the text fields containing the path(s) to the file(s) to be uploaded are cleared, but nothing else happens. This suggests that it is submitting to the popup page rather than the parent page, but that doesn't really make sense, as the other (working under IE9) popup pages still correctly submit to the parent page. I'll try replacing the JS-generated popup page with a conventional ASP page that can show any HTTP POST data, and go from there.
2) If I force compatability mode on the client side (IE9 compatability view button), it does work exactly as it should. This is more workaround than fix though. I suppose it does rule out browser settings though, as compatability mode would only affect page rendering?
I was able to solve this issue in Windows7 & IE9 (worked in all other browsers and versions I could test) by making sure the first attribute of the initiating window.open() call had a viable url in it.
I was actually write()'ing to the opened window to stick the code in it that I wanted, which included the file upload form. So I didn't have a url I needed to declare on the opened window. It said "about:blank" in the address bar. Further, by hitting F12 in the window, I could see I was getting a "SCRIPT5: Access is denied" error when I tried to submit the form.
I was calling the popup window like this:
var popup_window = window.open("","upload_popup_window_name","menubar=1,resizable=1,scrollbars=1,width=630,height=400");
By changing the above to:
var popup_window = window.open("/blank.html","upload_popup_window_name","menubar=1,resizable=1,scrollbars=1,width=630,height=400");
Where /blank.html was an actual file that the web server returned a 200 code upon the request(although it could actually be the source of the url you wanted to call, I'm assuming if you had already done it this way, it would work).
I still overwrote the contents of the window by by document.write()'ing all my own code into the window they way I was previously doing anyways.
By making this small modification, IE9 then allowed file uploads to be INITIATED by the popup window and I no longer received the "SCRIPT5: Access is denied" error. And files began to be successfully uploaded again.
Hope that helps
Is ie 9 case sensitive to your form attributes?
try changing:
encType="multipart/form-data"
to:
enctype="multipart/form-data"
and clear your cache.
I'm new to Drupal theming and am attempting to create a custom theme template for a specific content type I have.
I am attempting the following:
<div<?php print $content_attributes; ?>>
<?php print render($content['field_property_media']); ?>
<div class="field-label-above property-information">
<div class="field-label">Property Information</div>
<?php print render($content['address']); ?>
</div>
</div>
However, when the content actually render the address portion gets booted out of its parent div and looks like this:
<div class="field-label-above property-information">
<div class="field-label">Property Information</div>
</div>
<div class="field field-name-field-property-address field-type-addressfield field-label-inline clearfix"><div class="field-label">Address: </div><div class="field-items"><div class="field-item even"><div class="street-block"><div class="thoroughfare">55 Duchess Ave</div></div><div class="addressfield-container-inline locality-block"><span class="locality">London</span> <span class="state">Ontario</span> <span class="postal-code">N6C 1N3</span></div><span class="country">Canada</span></div></div></div>
I can't figure out why this is happening or what the solution is to keep the address within the div I manually created.
Thoughts?
The only possible way this could happen is if you've got a custom or contributed module intercepting your template file and changing it, or if you have some javascript enabled that's moving the <div> out of it's container. Drupal does absolutely no re-ordering of content when it processes a template file so it can't be anything in Drupal core that's causing the problem.
If the <div> is just displaying outside the container (i.e. it's inside when you inspect the source code) then you're probably just facing a floating issue; just add the clearfix class to the containing element.
EDIT
Just a thought, have you cleared your cache since you added the template file? If not, do that, it won't be picked up until the caches are cleared.
Also if this is a custom node template (i.e. node--page.tpl.php), make sure you've also copied node.tpl.php to your theme's folder. Then clear your cache again.