I am working with an asp.net website where we have implemented shortcuts in our page master, but these don't seem to work when the tinymce editor has focus. is there any way to solve this issue? it doesn't matter if it's at master page level or tinymce-level.
I have tried to create custom methods via the addShortcut method but this causes my javascript to error.
page.ClientScript.RegisterStartupScript(page.GetType(), new Guid().ToString(), "ShortCutModule();", true);
string enableShortcuts = #"function enableShortcuts(){"+
#"tinyMCE.get('"+"myKey2"+this.ID+#"').addShortcut(""Ctrl+Shift+f12"",""nix"",""jourcut"");";
page.ClientScript.RegisterStartupScript(page.GetType(), new Guid().ToString(), enableShortcuts, true);
page.ClientScript.RegisterStartupScript(
page.GetType(),
"MyKey2" + this.ID, #"<script type=""text/javascript"" >" +
#"tinyMCE.init({" +
#"oninit : ""enableShortcuts"","+
#"mode: ""exact""," +
#"elements: """ + this.ID + #"""," +
#"theme: ""advanced""," +
#"plugins: ""spellchecker,advhr,insertdatetime,preview""," +
#"theme_advanced_buttons1: ""bold,italic,underline,|,outdent,indent,|,cut,copy,paste,|,undo,redo""," +
#"theme_advanced_toolbar_location: ""top""," +
#"theme_advanced_toolbar_align: ""left""," +
#"theme_advanced_statusbar_location: ""bottom""," +
"custom_shortcuts : false," +
"theme_advanced_path : false," +
"setup : function(ed) {" +
"ed.addCommand('jourcut', function() {CutFromJournal();});" +
"}" +
"});" +
"</script>",
false);
Related
I attached an email message to a new message before sending it. But, the received attachment is editable on Outlook Desktop and is not on Outlook web. It means that when I try to open the attachment, it appears in compose mode in Outlook desktop. I used createItem to create and send the message, and ItemAttachment to put the attachment. I don't understand why it works on the web and not on the desktop.
Here is the part of code which make the attachment:
var soap = '<m:CreateItem MessageDisposition="SendAndSaveCopy">'+
' <m:Items>' +
' <t:Message>' +
' <t:Subject>' + subject + '</t:Subject>' +
' <t:Body BodyType="HTML">' + body + '</t:Body>' +
' <t:Attachments>' +
' <t:ItemAttachment>' +
' <t:Name>' + attachmentName + '</t:Name>' +
' <t:IsInline>false</t:IsInline>' +
' <t:Message>' +
' <t:MimeContent CharacterSet="UTF-8">' + attachmentMime + '</t:MimeContent>' +
' </t:Message>' +
' </t:ItemAttachment>' +
' </t:Attachments>' +
' <t:ToRecipients><t:Mailbox><t:EmailAddress>' + to + '</t:EmailAddress></t:Mailbox></t:ToRecipients>' +
' </t:Message>' +
' </m:Items>' +
'</m:CreateItem>';
Thank you.
You need to set the PR_MessageFlags extended property https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx on the attachment to make it appear sent eg
<t:Message>
<t:ItemClass>IPM.Note</t:ItemClass>
<t:Subject>subject</t:Subject>
<t:Body BodyType="HTML">body</t:Body>
<t:IsRead>false</t:IsRead>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="3591" PropertyType="Integer" />
<t:Value>1</t:Value>
</t:ExtendedProperty>
</t:Message>
I took the code below from a wider document, and tried to include it between 2 script tags, but for some reason it's not working (nothing happens).
Do I need to add some document ready syntax or something like this?
Thanks,
<script>
function sendAnnotatedMailTo(name, company, domain, subject, body) {
locationstring = 'mai' + 'lto:' + name + '#' + company + '.' + domain + "?subject=" + escape(subject) + "&body=" + escape(body);
window.location.replace(locationstring);
}
</script>
You only defined a function but didn't call it.
You have to call your function like this:
Send mail
This will open your mail client and prepare an email to name#democompany.domain.tld with the subject "Subject of mail" and the bodytext "Body of mail".
Btw: You shouldn't use the deprecated JS function "escape" anymore. Use encodeURI instead:
<script>
function sendAnnotatedMailTo(name, company, domain, subject, body) {
locationstring = 'mai' + 'lto:' + name + '#' + company + '.' + domain + "?subject=" + encodeURI(subject) + "&body=" + encodeURI(body);
window.location.replace(locationstring);
}
</script>
I need to pass the Id of a object into a html element (razor part), but it doesn't recognize it. Look like the Id is not in its scope, or something. Is there a way to pass the value into the razor part of my html element in the append function?
$.ajax({
data: data,
url: url + "?searchTerm=" + data
}).success(function (response) {
console.log(response);
var table = $('#companyTable');
var tBody = table.children('tbody');
tBody.html("");
var textbox = document.getElementById("searchBar");
textbox.value = "";
tBody.append(
"<tr><td>" +response.CompanyName + " </td><td>" +
response.CompanyIdNumber + "</td><td>" +
response.CompanyTaxNumber + "</td><td>" +
"<p><button onclick=\"location.href='#Url.Action("Edit", "Company", new { #id = response.CompanyId })'\"> Edit</button></p>" +
"</td></tr>"
);
table.removeClass("hidden");
var originalTable = $('#originalTable');
originalTable.remove();
}).error(function (response) {
console.log(response);
});
}
Thank you.
I do those things this way:
+ "<p><button onclick=\"location.href='#(Url.Action("Edit", "Company"))?id=" + response.CompanyId + "'\">Edit</button>"
You are totally missing the concept of server-side rendering and browser execution. Consider this example, your server renders your js code, and just leaves all work to browser, then browser stars to execute Ajax request somehow(button click), when Ajax completed - you have a response value, but this value exists only inside browser context, so it doesn't make sense to pass value into razor, as it already done its work while rendering your file
Now, what to do? The simplest solution would be to hardcore Url of company edit by yourself, as razor simply doesn't know anything what's happening client-side, example:
location.href="/company/1/edit" //where 1 is id from Ajax request
The easiest complete solution is
public ActionResult WhateverMethod()
{
// ....
var urlHelper = new UrlHelper(this.ControllerContext.RequestContext);
response.Url = Url.Action("Edit", "Company", new { #id = response.CompanyId });
// ....
}
And
tBody.append(
"<tr><td>" +response.CompanyName + " </td><td>"
+ response.CompanyIdNumber + "</td><td>"
+ response.CompanyTaxNumber + "</td><td>"
+ "<p><button onclick=\"location.href='" + response.Url + "'\"> Edit</button></p>"
+ "</td></tr>");
Calling a Razor methods in JavaScript is going to cause you nothing but grief.
response.CompanyId is considered as string , so try by concatenating it as below
var a="location.href='#Url.Action("Edit", "Company", new{#id='"+response.CompanyId+"'})'"
response.CompanyId ( "<tr><td>" +response.CompanyName + " </td><td>" +
response.CompanyIdNumber + "</td><td>" +
response.CompanyTaxNumber + "</td><td>" +
"<p><button onclick=\""+a +"\"> Edit</button></p>" + "</td></tr>")
How can i see javascript errors from within a Phonegap App?
Currently I am trying to use this:
window.onerror = function(msg, url, linenumber) {
console.error('Type: ' + typeof msg + '\nError message: ' + msg + '\nURL: ' + url + '\nLine Number: ' + linenumber);
return true;
};
But nothing shows up on screen or in weinre I am using.
I am facing one issue "Sorry we could not fetch the image" when I am clicking on pin it button:
below is the parameters I am passing
I am not getting what the this is missing :
1) ?url=
2) &media=
3) &description
This is the link which is creating in dailogbox :
http://www.pinterest.com/pin/create/button/?url=https://www.elivatefitness.com/lifestrength-ion-wristbands&media=https://www.elivatefitness.com/medias/LFE102-PureSeriesBlackGray.jpg-Default-WorkingFormat-479Wx479H?context=bWFzdGVyfHJvb3R8MTUxOTV8aW1hZ2UvanBlZ3xoNTUvaDFhLzg3OTk2MTg2NjI0MzAuanBnfDViZmIwMzM4ZTQ0NGQyYjQ1NWY2YmJkZTAxMjdjYjhmNjA3ZDk3ZDUwYTI2M2FmNzA1YjBlMTQyNDAyNzI1MTE&description=Combining%20comfort%20and%20improved%20performance%20the%20LifeStrength%20Ion%20Wellness%20Wristbands%20play%20an%20important%20part%20in%20boosting%20energy%20and%20fighting%20the%20negative%20effects%20of%20the%20environment%20around%20us%20to%20bring%20better%20health,%20relieve%20painful%20joints%20and%20encourage%20a%20deeper%20and%20more%20restful%20sleep.%20LifeStrength%20Ion%20Wellness%20Wristbands%20uses%20a%20proven%20method%20that%20combines%207%20natural%20minerals%20and%20gemstones%20into%20a%20slim%20Far-Infared%20infused%20silicon%20wristband%20you%20can%20wear%2024%20hours%20a%20day,%207%20days%20a%20week.%20Together%20the%20powerful%20mixture%20creates%20a%20unique%20band%20that%20emits%20more%20health-producing%20negative%20ions%20into%20your%20environment%20which%20in%20turn%20increases%20the%20flow%20of%20oxygen%20to%20the%20brain%20resulting%20in%20greater%20energy,%20alertness%20and%20an%20overall%20feeling%20of%20well-being.
Please help me out.
function pinIt()
{
var mediaURL = location.protocol + "//" + location.host
+ '${imgURL}' + "&description=" + "${description}";
window.open("//pinterest.com/pin/create/button/?url="+ document.URL + "&media=" + mediaURL,"",'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
}