Consider the following:
<MuiThemeProvider
muiTheme={getMuiTheme(darkBaseTheme)}><Button>Stuff!</Button><MyComponent><AnotherComponent>Content</AnotherComponent>
</MuiThemeProvider>);
For whatever reason, all components defined are treated as inlines, which means WebStorm's formatting doesn't break lines & indent them by default.
Specifying the component name in Settings | Editor | Code Style | HTML | Other | Insert new line before doesn't do a thing.
Please tell me how to make WebStorm insert a newline and indent properly all custom JSX components.
You can add line breaks manually and ensure that Keep line breaks in text is enabled in Settings | Editor | Code Style | HTML, Other.
Please check/vote for WEB-37966
Related
I'm currently writing in R Studio an R Markdown document. Since I am not using English, I want to change the name of the # References header to "Referencias". My output is HTML.
I went thru the pandoc documentation and tried reference-section-title: Referencias in my YALM header, with no luck.
The easiest way is to set the metadata field reference-section-title in the YAML header:
---
reference-section-title: Referencias
---
Alternatively, you could write the section title directly into the document, then use a special fenced div with id #refs to place the bibliography anywhere you need it:
# Referencias
::: #refs
:::
I'm using tinymce as rich text editor and separate excerpt from content via pagebreak button that insert a <!-- pagebreak --> tag . I'm wondering what is the best way to extract excerpt from database.
I know i can use preg_math as well as preg_split , but is it realy best and optimized solution?
wouldn't it be better and faster to save excerpt in a separate column?
This should work, without using any regex functions:
$pagebreak = '<!-- pagebreak -->';
$content = 'I am the excerpt<!-- pagebreak -->I am the rest of the content';
$excerpt = substr($content, 0, strpos($content, $pagebreak));
$restOfTheContent = substr($content, strpos($content, $pagebreak) + strlen($pagebreak));
var_dump($excerpt); // string(16) "I am the excerpt"
var_dump($restOfTheContent); // string(28) "I am the rest of the content"
Please note that this is really only designed to work with a single page break. It wouldn't be too difficult to modify it to generate an array of $pages based off of the string $content should multiple page breaks be necessary.
I just created a new live template group with a couple templates like:
<!--- $VALUE$ Field --->
<div class="form-group">
{!! Form::label('$NAME$', '$VALUE$') !!}
{!! Form::text('$NAME$', null, ['class' => 'form-control', 'placeholder' => $NAME$]) !!}
</div>
I defined the template to be used by PHP since this is for a Blade template, but that didn't work, and there was no type for Blade templates (can this even be defined?). Typing textfield I get <textfield></textfield> due to Emmet.
How do I get these live templates to work for my custom live templates?
I cannot recreate the issue. The custom template in Blade works fine for me.
Please make sure that you're trying to expand template with the proper shortcut (check File | Settings | Editor | Live Templates | By default expand with and File | Settings | Editor | Live Templates | Options | Expand with). If everything is correct please file an issue at https://youtrack.jetbrains.com with additional details: content of blade-file where you're trying to expand template and IDE settings (File | Export settings).
I had to choose the defined type to be HTML not PHP, which I only figured out by selecting Everywhere and seeing if it works. Would be nice to have a way to alias HTML as Blade etc to avoid confusion.
i have implemented a custom file browing dialog with the help of
QListView
QTreeView
QFileSystemModel
What i want !
a browsing dialog which use to browse xml file only. So i want to show dirs and xml files only in QListView
if a dir has xml file then xml file will list under that dir
otherwise just display dir as empty ( no matter how many it holds except xml )
like in most of cases where you are browsing a specific type of file. as in MSWord ( show only .doc and .docx to browse)
What i have done
m_ptrModelForTree = new QFileSystemModel(this);
m_ptrModelForTree->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
m_ptrModelForTree->setRootPath("");
ui->treeView->setModel(m_ptrModelForTree);
ui->treeView->hideColumn(1);
ui->treeView->hideColumn(2);
ui->treeView->hideColumn(3);
ui->treeView->header()->hide();
m_ptrModelForList = new QFileSystemModel(this);
m_ptrModelForList->setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
m_ptrModelForList->setRootPath("");
ui->listView->setModel(m_ptrModelForList);
ui->listView->setRootIndex(m_ptrModelForList->index("c:\\"));
What i got
dialog which showing all dirs and all file ( but i need only xml file to display )
What i tried
m_ptrModelForList->setNameFilters(QStringList()<<".xml");
but it showing xml file only, not dirs.
please give me suggestion what to do.
Actually it's a solution suggested by #Andreas in comments to the question.
My contribution is pointing to another mistake in the name filter.
Solution: how to show all dirs + files filtered by extension
Use flag QDir::AllDirs. According to docs this flag is intented to avoid applying the filter to folders.
setFilter(QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
Use setNameFilters to set a filter for files. The filters are wildcards.
Your mistake that use set it to ".xml" which means that a file shouldn't have its name but extension only to match your filter. The right filter is:
setNameFilters(QStringList() << "*.xml")
Consider aligning properties in a CSS file using the Tabular plugin in Vim. Suppose we have the following CSS ruleset:
body {
margin: 0;
padding: 0;
font-family: arial, verdana;
}
With the cursor inside the rule, vi{ followed by :Tab /:\zs results in
body {
margin: 0;
padding: 0;
font-family: arial, verdana;
}
However, I would like to align all the property values in all rulesets in the file at once, not just in one ruleset.
Running the same Tabular command for all lines (:%Tab /:\zs) does achieve the desired effect, as rule names needlessly affect the width of the left column. Besides, some CSS rules contain several : characters.
How to ignore lines containing curly braces when running such Tabular command?
To work around the issue, one can eliminate the problematic lines from
affecting the width of the first column by prepending the column
separator at the start of each of those lines. When the alignment is
done, this extra prefix can be easily removed. Following this approach
we will have three commands, like so:
:%g/:.*{/ s/^/:/ | exe '%Tab/^[^:]*:\zs' | %s/^:\s*//
You can map this command to a shortcut, or even run it automatically
when a CSS file is saved:
:autocmd BufWrite *.css %g/:.*{/ s/^/:/ | exe '%Tab/^[^:]*:\zs' | %s/^:\s*//
The global command could be used here. I don't have Tabular, so my version just indents all CSS blocks:
:%g/^.*{/+ | .,/}/->
The last command after | is the Ex-mode command to indent the block from the current position (one line below each opening brace) to line above the closing brace. Based on what you've said, I'd expect this to work, but I haven't tried it:
:%g/^.*{/+ | Tab /:\zs