Umbraco - Add spacing under element - umbraco

The question might seem stupid. but i really can't find what i should type on the "Add spacing under element" text box to achieve the spacing from the CMS and not hard-coded.
In an element properties you can see this window:
Umbraco version 7.2.5 assembly: 1.0.5610.18894
Free License for now but planning to get one this week.

Okay I got your point. You are using Grid Layout.
By default Umbraco Grid layout datatype have setting class and styling background image as below
This can be found in Developer -> Datatypes - > datatype you have created with "Grid Layout", You can find data type name in Setting->Document types -> Name of home doc type -> generic properties
You can change settings and styles by clicking edit, it contains json data as below. This is default value
For setting
[
{
"label": "Class",
"description": "Set a css class",
"key": "class",
"view": "textstring"
}
]
For Style
[
{
"label": "Set a background image",
"description": "Set a row background",
"key": "background-image",
"view": "imagepicker",
"modifier": "url({0})"
}
]
Get full details on link
Now your scenario.
I think according to description, you have used this to add padding-bottom or margin-bottom style on the element. So you must use values like "20px" or "10px". Try only numbers like "10" if this don't work

Related

Onchange update second subcomponent

I have a file that is used to store all my colour choice, I bring the colour choices that I need into a part file using the Subcomponents (Supersedings)
{
"internalId": "externalCubbyCoverColourRack",
"componentId": "racksystems_test:sub_mfccolours",
"numberInPartList": "0",
"active": "version=='Rack'",
"supersedings": [
{
"type": "parameter",
"key": "cubbyCoverColourRack"
}
]
}, {
"internalId": "externalCubbyColourRack",
"componentId": "racksystems_test:sub_mfccolours",
"numberInPartList": "0",
"active": "version=='Rack'",
"supersedings": [
{
"type": "parameter",
"key": "cubbyColourRack"
}
]
},
I have 2 colours that I bring in that are a Main Colour and a Cover Colour, when the main colour is selected it changes the Main Colour and I want it to change the Cover Colour too but if you change the Cover Colour only the cover colour changes. Is this possible to do with a KEY that's used from Subcomponents?
Normally, it is recommended to use parameter onValueChange script. However, this is intended to work in a scope of a single component.
From your code, I think it should be possible to supersede both of them from a single subComponent instance. Then you can link the two parameters somehow in the sub_mfccolours itself, using parameter onValueChange script.
It is important to know, that every subComponent instance is its own component with its own internal data. If you have a reason to have two subComponents like this, it might help to add assignment "cubbyColourRack": "cubbyColourRack" to the externalCubbyCoverColourRack subComponent.

UpdateTextStyle Request Clearing Bold When Setting fontFamily

I am trying to update the font of a range of text in a Google Docs document using the API. I am trying to change just the font and not the font size or style attributes like bold or italic. So if for example I have a document with just the text below as the content:
Hello world
I want to change just the font for the word Hello but leave it the same size and still bold and italic.
I tried to accomplish this with the following code documents.batchUpdate request
{
"requests": [
{
"updateTextStyle": {
"range": {
"startIndex": 1,
"endIndex": 6
},
"textStyle": {
"weightedFontFamily": {
"fontFamily": "Times New Roman"
}
},
"fields": "weightedFontFamily"
}
}
]
}
The result is a successful response from the server but when I check the document I see it changed the font keeping the size and italic attribute, but it didn't keep the bold attribute. I have also tried this using the Google API Explorer and can reproduce the same results.
My question is how do I change the font without loosing the bold? It seems like it should be possible as it kept the italic attribute in tact. Why is bold different? Is it a bug?
My goal is to just change the font leaving the other attributes as is so I do not want to set bold or other attributes explicitly. I also don't want to have to determine the attributes before hand and reset them. That is more work and will be slower and shouldn't be necessary if italic is maintained.
I am able to do something very similar without issue in Google Sheets using a repeatCell.cell.userEnteredFormat.textFormat.fontFamily request and it maintains the bold and italic.
Thanks in advance for any insight or help.
How do I change the font without loosing the bold?
Answer
You have to first save the font weight and bold settings for the range of text you want to modify. There may be more then one font setting for the range. To get the font weight and bold settings for the range you must first check textRun.textStyle. If not defined there you must lookup the paragraphs namedStyleType and check it for the weight and bold settings. If not defined there you must check the NORMAL_TEXT namedStyleType. If not defined there you must use the Google Docs editor default value which for weight is 400 and bold is false.
Once you have the font info for the range you make make a requests for each different font. The request would be like the one in the original question but would set the weightedFontFamily.weight and the bold attributes based on the saved font info.
{
"requests": [
{
"updateTextStyle": {
"range": {
"startIndex": 1,
"endIndex": 6
},
"textStyle": {
"weightedFontFamily": {
"fontFamily": "Times New Roman"
"weight": savedWeight
},
"bold": savedBold
},
"fields": "weightedFontFamily"
}
}
]
}
Why is bold different?
Answer
The Google Docs API uses weightedFontFamily where the weight sub-attribute defaults to 400 and not the current font weight. The bold setting just increases the weight, so bold and weight are linked. There is no current way in the API to set just the font leaving weight/bold alone.
Is it a bug?
Answer
Based on a reply from #Tanaike I have reported the issue to Google via the Google Issue Tracker (https://issuetracker.google.com/165029692). They informed me it was working as intended.

Customize color of text inside `backquotes` in VSCode

The only options I can find that deal with custom coloring inside Visual Studio Code are those:
"editor.tokenColorCustomizations": {
"[Atom One Dark]": {
"comments": "#FF0000" // only 6 color-customizable
},
"workbench.colorCustomizations": {
"statusBar.background": "#666666",
"panel.background": "#555555",
"sideBar.background": "#444444"
},
},
Is there a way to set a custom color for these types of things? One exists for comments, for strings (inside "string"). I believe something similar should be possible for other stuff using regexps. Thanks in advance.
Search for tokenColorCustomizations and textMateRules and you will find that you can do something like this (see colorizing with textmate):
"editor.tokenColorCustomizations": {
"textMateRules": [
{
// works for a language that recognizes backticks as string templates
"scope": "string.template",
"settings": {
"foreground": "#FF0000"
}
},
{
"scope": "punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end",
"settings": {
"foreground": "#F0F"
}
},
]
}
using the Inspect TM Scopes... command in the command palette. So I used that command to click inside a template literal and got the string.template.js.jsx scope. But that didn't change the ${someVar} so I inspected that scope and saw variable.other.readwrite.js.jsx plus additional scope parameters - still working on isolating that kind of a variable from other variables.
Edit: Should work in more file types by using only string.template, if the language treats backticks as a string template.
You can also change the fontStyle within a setting. There are a few answers here about using the TM Scopes command.

Inserting date command into snippet sublime text 3

I am trying to create a snippet for starting a LaTex document where the packages and everything is filled in, but I also want it to automatically fill in the date. I have the insertdate package, but I did not understand how to use it. I have the snippet code:
<snippet>
<content><![CDATA[
\documentclass{article}
\usepackage{amsmath}
\title{${1:title}}
\author{...}
\date{[Todays date here automatically]}
\begin{document}
\maketitle
$0
\end{document}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>document</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.tex.latex</scope> -->
</snippet>
It's not directly possible to expand a snippet in the traditional way (i.e. documentTab in this case) and have one or more of the fields in the snippet dynamically update; for that you would need extra glue plugin code.
The InsertDate package provides a variety of ways to insert a date into your document, but that extra glue is not provided. An example of a way to do that is outlined below.
All of the examples below assume the following snippet content in a file named Packages/User/NewLatexDocument.sublime-snippet; in the following examples, replace that path with the appropriate path and file name of your snippet.
<snippet>
<content><![CDATA[
\documentclass{article}
\usepackage{amsmath}
\title{${2:title}}
\author{...}
\date{${1:date}}
\begin{document}
\maketitle
$0
\end{document}
]]></content>
<description>Create new LaTeX Document</description>
<tabTrigger>document</tabTrigger>
<scope>text.tex.latex</scope>
</snippet>
This is a version of the one you provided in your question, but note that the version in your question is broken because the <tabTrigger> and <scope> lines are terminated with the --> comment sequence, which is not valid.
Of particular interest here is that the snippet fields have been re-ordered so that the date field is the first one and the title is the second one, for reasons we'll see in a moment.
It's also important to know where your User package is; if you're not sure, you can find the location by selecting Preferences > Browse Packages... from the menu. On MacOS, the menu location is Sublime Text > Preferences > Browse Packages... instead.
Method 1: Expanding the snippet via the tab trigger (no extra plugin)
It's possible to invoke the snippet with the tab trigger (here the word document), but as mentioned above there's no direct way to get the InsertDate package to insert the date for you.
What you can do however is use one of the default key bindings to trigger a manual date insertion. An example of that would be pressing F5, which displays a panel of date options and then inserts one. From there you can press Tab to continue on in the snippet.
See the documentation for the package for all of the various keys that you can use here or to get a feel for how you could make your own custom binding to insert in the format of your choice directly.
This isn't directly what you want to do, but it's also the method that requires the least amount of work to set up.
Method 2: Expanding the snippet via a macro
By using a Sublime macro, you can take a single action (key press, command palette entry, etc) and have both actions happen automatically; expand the snippet and insert the date.
To do that, you would save the following contents into a sublime-macro in your User package. The name doesn't matter so long as you remember what you used because you're going to need it in a moment. In my examples below, the filename is Packages/User/NewLatexDocument.sublime-macro.
[
{ "command": "insert_snippet", "args": {"name": "Packages/User/NewLatexDocument.sublime-snippet"} },
{ "command": "insert_date", "args": {"format": "%x"} },
{ "command": "next_field" },
]
Make sure that the filename in the insert_snippet argument matches the name of your snippet. You probably also want to change the date format to whatever format you prefer.
When you invoke the macro, it inserts the snippet, then triggers the insert_date function to insert the date (this is why the date field is first) and skips to the next field, at which point you can start manually filling out the rest of the snippet.
You can see this in action by selecting Tools > Macros > User > NewLatexDocument from the menu; the final item will be the name of your sublime-macro file.
Now you can create a key binding that triggers the macro for you so you don't have to select it from the menu. As above, remember to ensure that the file name of the sublime-macro is the file you created.
{
"keys": ["ctrl+alt+shift+d"],
"command": "run_macro_file",
"args": {
"file": "res://Packages/User/NewLatexDocument.sublime-macro"
}
},
Alternatively, you can create a sublime-commands file in your User package (for example, MyCustomCommands.sublime-commands) with the following contents, which will make the command available in the Command Palette:
[
{
"caption": "Create new Latex Document",
"command": "run_macro_file",
"args": {
"file": "res://Packages/User/NewLatexDocument.sublime-macro"
}
},
]
Method 3: Expanding the snippet via the tab trigger (w/extra plugin)
This example is the closest to what you want to do but it requires a little bit more work. Additionally note that it requires you to enter the full expansion text (e.g. document) and won't trigger on a partial match if that happens to be the best completion.
To start with, make sure you've created the macro from Method 2, as this method uses that same macro but triggers it in a different way.
Next, select Tools > Developer > New Plugin... from the menu and replace the text of the default plugin with the following code, then save it as a .py file; in my example I named the file new_latex_document.py:
import sublime
import sublime_plugin
class NewLatexDocumentCommand(sublime_plugin.TextCommand):
def run(self, edit):
# Get the last word of the line the cursor is on
point = self.view.sel()[0].b
line = self.view.substr(self.view.line(point))
word = line.split()[-1]
# Remove the trigger word
self.view.replace(edit, sublime.Region(point, point - len(word)), "")
# Run the macro
self.view.run_command("run_macro_file", {
"file": "res://Packages/User/NewLatexDocument.sublime-macro"
})
This creates a command named new_latex_document (named based on the name of the class, not the name of the file you save the plugin in) which, when you invoke it, will erase the last word on the line where the cursor is sitting and then run the macro from method 2 above.
Now you need to add the following key binding to your custom keys:
{
"keys": ["tab"],
"command": "new_latex_document",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
{ "key": "preceding_text", "operator": "regex_match", "operand": "^.*document$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "num_selections", "operator": "equal", "operand": 1},
{ "key": "selection_empty", "operator": "equal", "operand": "true", "match_all": true },
]
},
Broken down, this say that the Tab key should run our new command, but only in files of type text.tex.latex, where the text prior to the cursor location is the word document with no text following it, and when there is only a single cursor in the document with an empty selection.
Now when you enter the word document followed by Tab and these conditions are satisfied, the custom command runs, removing the trigger word document and then expanding the macro out to insert the snippet and the date.
Note that in this case, the tabTrigger and the scope in the sublime-snippet file are ignored, which is why the key binding needs to explicitly set them.
This plugin could be enhanced if desired; for example instead of running the run_macro_file command, it could just execute each of the commands from the macro directly, saving a step.
If you had many such expansions you wanted to do with a date, it's probably better to use an even more customized plugin; using an on_query_completions handler for example would allow the triggering to happen without requiring the key bindings.
That's a more advanced topic, however.

How to create a composite caption on Neo4j Grass style file?

For example,
"node.Person": {
"color": "#FF756E",
"border-color": "#E06760",
"text-color-internal": "#FFFFFF",
"caption": "{name}"
}
I want the "Person" to be displayed as the label of the node, and "name" and "age" to be displayed as the attributes of the node. Currently, only 'name' is displayed as the caption.
How to change the code above?
EDITED:
Neo4j people, how did you generate the graphs in the book? Thank you. This is one example below.
You can do it by editing the styles. Do this by typing ":style" to the neo browser UI, copy-paste the styles to text editor and just add the fields to the caption in curly brackets e.g.
"node.Person": {
"defaultCaption": "<id>",
"diameter": "50px",
"color": "#A5ABB6",
"border-color": "#9AA1AC",
"text-color-internal": "#FFFFFF",
"caption": "{name} {age}"
}
Would result in showing Person entities with name and age on them.
As I said in the comments of my answer its not possible. My anwser is as close as you can get. "node.MESSAGE": { "caption":"Message name:{NAME}" }. You can only write directly onto the node. I recommend to use different colours for different labels

Resources