How to enter text in AJAX HTML Editor using watin - ajaxcontroltoolkit

I could not figure out how to enter text into HTML Editor using Watin.
I tried //ie.TextField(Find.ById("htmlDetail_ctl06_ctl04")).TypeText("ABCD");
But got error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
Can you give some example how to enter text into AJAX HTML Editor using watin please? I am not sure what to plug in frameSrc and java script from this solution - Unit testing the MS AJAX Toolkit HTML editor
Here is html from Develper tool when click the text box:
<textarea class="ajax__htmleditor_htmlpanel_default" id="htmlDetail_ctl06_ctl04" style="width: 100%; display: none; height: 100%;" control="[object Object]"/>

You can remove css or class using jQuery ( jquery-1.4.2.min.js ). like:
TextField notetext = iepopup.TextField(Find.ById("notetext"));
iepopup.Eval("$('#notetext').removeClass('note'); ");
iepopup.Eval("$('#notetext').css('display', 'block'); ");
notetext.Click();
notetext.TypeText(sNote);

Hope, it helps.
Link lnk = ie.Link(Find.ById("edButtonHTML"));
ie.WaitForComplete();
lnk.Click();
ie.WaitForComplete();
ie.TextField(Find.ByName("content")).TypeText("I am Amit chadha");
ie.WaitForComplete();

Related

TinyMCE HTML Editor Disable Image Insert Source Textbox

I'm using the TinyMCE HTML Editor with the insert image function. The application I'm working on isn't allowed to use images from external URLs. So they should only be able to use the Upload option. Is there a way to disable the Source textbox shown below? Is there an initialisation property that can be used?
Here is an example of the TinyMCE editor in question. https://www.tiny.cloud/docs/demo/local-upload/
I couldn't find an official way to do this so I just targeted all the associated HTML elements and hid them using CSS.
.tox-dialog .tox-dialog__content-js .tox-dialog__body .tox-form__controls-h-stack input[type=url].tox-textfield {
display: none;
}
.tox-dialog .tox-dialog__content-js .tox-dialog__body div.tox-form__group:first-child label {
display: none;
}
.tox-dialog .tox-dialog__content-js .tox-dialog__body .tox-form__controls-h-stack div.tox-form__group:first-child label {
display: block;
}

Unable to create an image hyperlink with xhtml2pdf

Consider the following code:
from xhtml2pdf import pisa
if __name__=="__main__":
source_HTML = """<html>
<body>
<a href="http://www.stackoverflow.com">
<img src="http://i.stack.imgur.com/uQFNA.png"/>
</a>
<a href="http://www.stackoverflow.com">
<p>Stackoverflow</p>
</a>
</body>
</html>"""
output_filename = "output.pdf"
# open output file for writing (truncated binary)
result_file = open(output_filename, "w+b")
# convert HTML to PDF
pisa.CreatePDF(
source_HTML,
dest=result_file)
result_file.close()
The html should render both an hyperlink image and a hyperlink text, but xhtml2pdf renders the image without the hyperlink and the text with the hyperlink. Is this an issue with the code above or a limitation/bug with the library? Thanks in advance for any help with the above issue.
I found a way to get this too work but it is not very good.
You can add a before and after the img inside the A tag. And then set the font-size on the A tag to be the height of the image and then also set text-decoration to none.
So like I said this works but is not a great solution. I searched issues on xhtml2pdf's github page and cannot find anyone else with this issue.

How to include iframe coding in joomla

How to include iframe coding in joomla
Joomla has TinyMCE as default Editor. It don't allow iframe tag.
You can enable iframe tag in Editor.
Go to > Extensions > Plugins > TinyMCE
Paste iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder]
in Extended Valid Elements
Now go back to your editor, open html view and paste your iframe code. It will save it.
Edit HTML in the editor and add the <iframe> tag there.
I needed to paste an image in a frame, so after i understood that i can't use frames i paste this code, cause i needed scroller.
<p style="overflow:scroll;width:700px;"><img style="border: 1px solid #000000;" src="/images/img.png" alt="img"></p>
If you need to paste a video from youtube it is better to hide the video under a image (screensho for example) giving the link to video. not iframe nor embed doesn't work in joomla.
hope that help)

Render the presence of a <script> tag in TinyMCE

I managed to get TinyMCE to keep my <script> tag in the source, so it is no longer stripped as an invalid tag. However, in edit mode, it doesn't render anything. The script tag is there in the html view, but it's just a blank line in edit mode.
Instead, I want tinyMCE to render anything instead of nothing. Even if it is just simple text like [here lies a script]. Is this possible? How? I can't get it working for the life of me. Thanks!
You can use stylesheets to style script elements, I would advise trying that in TinyMCE, here's a fiddle so you can see what I mean:
https://jsfiddle.net/plenuM/m9zr1dqw/
script {
display:block;
height:20px;
width:100%;
background:red;
text-align:center;
color:#fff;
overflow:hidden;
}
script:before {
content:"(SCRIPT)";
}
You will want to only import the CSS when TinyMCE is active though, the TinyMCE documentation can assist you with that.
The script tag should act as if on a regular html page.

mvc renderpartial dialog difficulty

I have a view in which I have the following code:
<div id="DivPassword" >
<%Html.RenderPartial("PasswordDetails"); %>
I want to display the div as a dialog, in which I am successful. When I click on a link the dialog opens.
However, I can see that the partial view is also being displayed in the View, when the page loads. Why is it so? How can I correct that?
It displays because your code generates markup like:
<div id="DivPassword" ><!-- contents of partial view here --></div>
When a browser sees this markup, id displays stuff. :)
In order to not display the dialog until you run some JavaScript to make it display, you need to hide it. You can do this with a CSS rule:
div#DivPassword
{
visibility: hidden;
}
Pretty much all JS dialog libraries will change the visibility when you pop up the dialog.