How do you show an ampersand in TdxBarButton text - devexpress

I have a TdxBarButton that has text that contains an ampersand and I need to display the ampersand. I do not need to have a hotkey, in fact I must not have a hotkey.
How do I disable the hotkey and display the ampersand?
Also, if anyone could give me a link to the TdxBarButton documentation it would be great.

Adding "& amp;" should do the work.(Do not add the quotes and space)
So this is how ur text would look like - 'Test && Test Again'

Related

Render page breaks in DevExpress RichTextEdit

I want to be able to add and remove page-breaks to a RichEditControl element.
I understand that it's possible to add the page break by pressing Ctrl + Enter, but it's impossible for the user to see the page break and remove it, as it currently looks like it's a simple new line.
I tried to use the DXRichEditFormattingMarkVisibilityOptions to display a separator, thinking it would display the page break, without luck:
<d:RichEditControl ActiveViewType="Simple"
ShowBorder="False" Background="{x:Null}"
AutoSizeMode="Vertical" LayoutUnit="Document"
CommandBarStyle="Empty" BarManager="{TemplateBinding BarManager}">
<d:RichEditControl.FormattingMarkVisibilityOptions>
<d:DXRichEditFormattingMarkVisibilityOptions Separator="Visible"/>
</d:RichEditControl.FormattingMarkVisibilityOptions>
</d:RichEditControl>
Is there any way to render the page break in the RichEditControl and let it be easy to be removed by the user?
To display the Page Break character, you need to execute a command that display all hidden characters (such as paragraphs, spaces and tabs) and force these other characters to be hidden back, letting just the page break being displayed.
var command = new ToggleShowWhitespaceCommand(_richEditControl);
command.Execute();
Then you can apply this to the style of the control or alter directly via code:
<d:RichEditControl.FormattingMarkVisibilityOptions>
<d:DXRichEditFormattingMarkVisibilityOptions HiddenText="Hidden"
ParagraphMark="Hidden" Space="Hidden" TabCharacter="Hidden"/>
</d:RichEditControl.FormattingMarkVisibilityOptions>

How to save a text with tabs and new lines in Firestore and get it back intact?

Realtime database used to add \n, \t, etc but it doesn't seem to be the case for Firestore. this might be something basic I'm missing. Either way, how can I save something like this and get it back with new lines and tabs intact:
value: "test
newline
another line"
currently, I get it back like this:
value: "test newline another line"
From my simple tests, Firestore does preserve new lines and tabs. How are you displaying the value? If it's HTML, wrapping the value in a <p> tag will crush the spacing. If you use a <pre> tag, you should see the spacing.
Pre is not working with firestore seems there is not possible ways for now to save preformatted text in firestore

Label html string being read by screen reader

I've got some dynamically generated html building a drop down menu using the Dojo library. I need to make my code Accessibility compliant and right now the screenreader looks at the menu item and reads it as plain html:
menu.addChild(new MenuItem({
label: "<a onclick=window.location.href='sampleurl.com'
href="sampleurl.com">Sample Link</a> ...
Excuse the onclick, it's for a different issue, but what I'm getting is basically:
Tab down to first menu item
Screenreader: "Less than a onclick equals window dot location dot href equals sampleurl"... etc
I've tried using aria-hidden, but the screen reader just reads that as text, I'm using voice over on Mac OS, but I need it compliant for JAWS as well. Any tips or advice? Thanks!
label is used for the label (which can be in HTML), not for putting the full link html tag.
See on the following page how to use the Dojo library to generate menu items:
https://dojotoolkit.org/reference-guide/1.10/dijit/Menu.html
Example:
menu.addChild(new MenuItem({
label: "Sample Link",
onclick: function() {window.location.href='sampleurl.com';}}));
This would be easier to debug with a working example along with something stating what screen reader / browser combo you are using. At the bare minimum, show us the HTML output of your script, considering it is writing HTML for the screen reader to parse.
That being said, I suspect the missing / inconsistent quotes. Note that you start a string with double quotes, then go into the onclick attribute with no quotes around, then single quotes around its value, and then use double quotes around the href.
Alternatively, you are writing the entire string into the page and somehow HTML encoding it.
I suggest using a linting tool to check your JS.

vs2010 - shortcut for surrounding a String by double quotes

I used to work with a developer who, selects a text in aspx page and applies a keyboard shortcut to enclose it in double quotes.
Eg: runat=server. when i select server and press ctrl+somekey, it should be runat="server"
Could someone tell me what is the keyboard shortcut, i tried googling a lot, but couldnt find one..
Currently we are overhauling a page, and need this badly...
Thanks in advance.
As far as I know this is a setting in Visual Studio which enables you to immediatelly place quotes when you type attribute and press equals sign or if you type a few letter and press CTRL+Space. This will autocomplete the attribute and place quotes. In order to enable the quotes click on Tools then Options. If it is not checked, check Show all settings. Expand Text Editor, then HTML and click on Formatting. On the right side enable Insert attribute values quote when typing and Insert attribute value quotes when formatting
Format selection: ctrl+k, ctrl+f
I also have Tools > Options > HTML > Formatting > Insert attribute value quotes when formatting checked.
I think you should try this with the replace function
search : runat=server
replace: runat="server"
The developer may have been using a refactoring tool such as CodeRush or Resharper. Have a look at this link for how you may be able to do something similar without extra tools.

Input Validation When Using a Rich Text Editor

I have an ASP.NET MVC application and I'm using CKEditor for text entry. I have turned off input validation so the HTML created from CKEditor can be passed into the controller action. I am then showing the entered HTML on a web page.
I only have certain buttons on CKEditor enabled, but obviously someone could send whatever text they want down. I want to be able to show the HTML on the page after the user has entered it. How can I validate the input, but still be able to show the few things that are enabled in the editor?
So basically I want to sanitize everything except for a few key things like bold, italics, lists and links. This needs to be done server side.
How about AntiXSS?
See my full answer here from similar question:
I have found that replacing the angel
brackets with encoded angel brackets
solves most problems
You could create a "whitelist" of sorts for the html tags you'd like to allow. You could start by HTML encoding the whole thing. Then, replace a series of "allowed" sequences, such as:
"<strong>" and "</strong>" back to "<strong>" and "</strong>"
"<em>" and "</em>" back to "<em>" and "</em>"
"<li>" and "</li>" back to ... etc. etc.
For things like the A tag, you could resort to a regular expression (since you'd want the href attribute to be allowed too). You would still want to be careful about XSS; someone else already recommended AntiXSS.
Sample Regexp to replace the A tags:
<a href="([^"]+)">
Then replace as
<a href="$1">
Good luck!

Resources