How to turn off vscode adding autocompletion "={}" after selecting a suggestion - reactjs

working on a react native project here using VSCode. It appears than when a suggestion is selected:
Selection
It adds this ={} after:
After selecting.
This gets annoying, as you would expect it to only populate key={innerIdx} instead of key={innerIdx={}}. I tried to turn off and on a bunch of stuff in the settings, but no luck.
Anyone knows how to solve this, without turning off the suggestion, just to kill the behaviour that adds that extra ={}?

To turn off specific suggestions follow the instruction below:
find your defaultSettings.json via Preferences: Open Default Settings (JSON).
with ctrl+f search this : "typescript.preferences.jsxAttributeCompletionStyle": "auto"
then change it from auto to none
here is the full reference for all attributes in vs code.
https://code.visualstudio.com/docs/getstarted/settings
// Preferred style for JSX attribute completions.
// - auto: Insert ={} or ="" after attribute names based on the prop type.
// - braces: Insert ={} after attribute names.
// - none: Only insert attribute names.
"typescript.preferences.jsxAttributeCompletionStyle": "auto",
you must change it to none.

Related

How to get the TipTap Editor to recognize updated external state values

This is likely an issue with my inexperience using React generally, but I'd still greatly appreciate any insights.
I've added a commenting plugin to the TipTap editor.
When I create a new comment, it creates a DB record for the comment and I store that new comment in a state value (React) which is an array of all comments.
Then I return the ID which I use in a setComment (Mark) command that wraps the selection in a span with a commentId on the data-comment attribute.
When I click on that span, I can get the ID value, but the editor selectionUpdate function doesn't see the updated value. The page can access it fine, but that function can't see it until the page is reloaded.
How do I convince the editor to recognize the updated value in that function?
A minimal app demo can be found here:
Once you make a comment, and click on it, you'll see that it doesn't find the newly added comment. That's what I'm try to fix. It should be able to find it.
I understanding the the useEffect isn't being updated because the dependency array does not include chapterComments - but if I add it, then selectionUpdate runs multiple times and only the last one is accurate. I don't know how to appropriate destroy or update the editor instance - though I assume that's what I need to do.
The TipTap editor hook, const editor = useEditor, has it's own dependency array. Instead of trying to use useEffect with an editor dependency, just use the built in one for any values the editor needs to keep track of.
/facepalm

Nav.navbar autocompletion not working in React

I am following this React tutorial. At 10:21, he uses the shortcut nav.navbar to create a nav with className "navbar." However, when I try to do this in my code editor (VS Code) it doesn't autocomplete.
Does anyone know how to fix this?
Coincidently I was following the same tutorial and got curious about that as well. It seems like VS Code comes with the command that expand Emmet abbreviations using tab disabled. You need to go into VS Code settings and enable this option.
You can do that by going into the settings file and adding the line "emmet.triggerExpansionOnTab": true. Another option is from the settings menu within VS Code (File>Preferences>Settings) and use the search box to look for Emmet: Show Suggestions As Snippets, then check the checkbox.
More information:
https://code.visualstudio.com/docs/getstarted/settings
https://code.visualstudio.com/docs/editor/emmet
Emmet expand abbreviation doesn't work in Visual Studio Code with the attributes
on VScode settings search "emmet", look for "Emmet: Include Languages"
add item:
item: javascript
value: javascriptreact

Adding a edit field in a custom dialog in Installshield

I have a setup project with Installshield Premium 2016.
I created a custom dialog that has a edit field. I created a property name which was named "CustomFields" and In my appconfig there is a key
<add key="customFields" value="Test"></add>
So while installing the app, I want to it to change the value of customFields by user. My property value has a default name that is Test and in the installation dialog I can see this name
When I change this text by manually for example "Hello", after installation completed, in my appconfig i see "Test" value. It seems that it saves the default value. But as can be seen, the text field has referenced by this property thats why I can see the default value in my text field in the dialog.
I do not know where is the problem? I could not find also any documentation about custom edit fields.
I followed here a bit https://www.iwasdot.com/adding-a-custom-dialog-to-and-installshield-basic-msi-project/
but its a bit different and it did not work to me
Private properties are not passed from the UI sequence to the execute sequence. If you want this to work, at a minumum you will have to rename your property to use only upper-case letters and underscores. (For example, change CustomFields to CUSTOM_FIELDS.) You may also have to include its name in the SecureCustomProperties property.
I followed #Michae's answer but still not worked. So I changed next pushbutton property and it worked finally..

CakePHP - Remove asterisk from required inputs

I'm building a CakePHP application that involves forms, and I'm looking for a way to remove the asterisk from required fields. I have several input fields that are required, but I do not want the asterisk to show.
I've tried using 'required'=>false, but that makes the field optional as well as removing the asterisk. I just want to remove the asterisk; the field needs to remain required.
You could modify the css that adds that. I've made changes in my css, so I'm not sure if it's the one that comes out of the box anymore (for that matter, I don't know if you are using the one that comes out of the box), but the css that adds those asterisk(s?) on my form is
label.required:after {
color: #EE3322;
content: "*";
display: inline;
}
And you should just replace that content:"*" with
content: "";
Now, if your css isn't the same as mine, inspect the label element, and look for a similar line (it's probably using a content: "*", so you know what you have to look for).
If you want to delete the asterisks for a single view, add an inline style in the view. If it is for the whole application, delete the line in the css file.

with HTMLpurifier, how to add a couple attributes to the default whitelist, e.g. 'onclick'

Two questions:
I have been reading docs and SO posts.. and know how to do it the long way (defining each and every element and attribute myself), but all I want to do is add 2 or 3 attributes to the default whitelist.. so that I do not have to constantly find and add more elements/attributes to, e.g., HTML.AllowedElements and/or HTML.AllowedAttributes.
Specifically, now, (for internal trusted users) I need to allow javascript attributes (input from tinymce). Question #1.) Is there a way to just add an attribute (to what HTMLpurifier allows) without causing the whole default sets of allowed elements/attributes to be effectively wiped out (overwritten by ONLY what is explicitly written in HTML.AllowedElements or HTML.AllowedAttributes)?
For what I need right now (the javascript attributes), I got excited when I saw in this thread:
Whitelist Forms in HTML Purifier Configuration
...where Edward Z. Yang says, "... [$config->set('HTML.Trusted', true);] allows JavaScript."
...but even after setting this: $config->set('HTML.Trusted', true);, HTMLpurifier 4.4.0 is still stripping e.g. any input onclick="dostuff();" attribute. Why? Question #2.) Is there a quick way to add just the javascript attributes to the allowed list?
You're losing onclick because HTML Purifier doesn't know about that attribute, and if HTML Purifier passed everything through when you turned on %HTML.Trusted you might as well just not use HTML Purifier at all.
HTML Purifier has attribute collections for just this case; 'Common' is probably the right one to insert them into.
But... why? The real name of %HTML.Trusted really should be %HTML.UnsafeMakeMyApplicationVulnerable
HTMLPurifier does not support onClick and similar java script related attributes to any HTML element as a default behaviour.So if you wish to allow such attribute any way, you may add such attribute to specific element in following way.
$config = HTMLPurifier_Config::createDefault();
$def = $config->maybeGetRawHTMLDefinition()
$def->addAttribute('a', 'onclick', 'Text');
But be careful, this may lead to xss attack as you are allowing any java script code to be there in that attribute.

Resources