Is it possible to create the autocomplete value of class attribute for the html comment in PhpStorm?
That is, after updating the new value of class, it would automatically add this value in the commentary? In emmet and in the live template I could only once, at start create this comment but after update it doesn't work..
For example:
<tag class="class1 class2 class3">...</tag>< !-- /.class1 class2 class2
Related
When user clicks on "blockquote" button (that is on toolbar) to insert blockquote element:
then TinyMCE will insert <blockquote> HTML element without any class. I want to change this so that it always inserts <blockquote> with class myClass (but only when blockquote is inserted by clicking on "toolbar" button, not when loaded):
<blockquote class="myClass">
...
</p>
</blockquote>
Do you know how this can be done/achieved?
I'm using TinyMCE 5.
Fiddle: http://fiddle.tinymce.com/Guhaab
UPDATE:
Sorry, my question wasn't precise enough: I want this class to be added just for elements added via the button, not when loaded.
Updated Answer:
The querent added:
I want this class to be added just for elements added via the button, not when loaded.
In that case:
Blockquotes are added to content by applying a predefined, default format called (you guessed it) "blockquote". You can override that default style to include a class when it is applied to content:
formats: {
// Changes the default format for blockquote to have a class of 'foo'
blockquote: { block: 'blockquote', classes: 'foo' }
},
Here is a Tiny Fiddle demonstration:
http://fiddle.tinymce.com/svhaab/1
Here's information about formats in TinyMCE:
https://www.tiny.cloud/docs/configure/content-formatting/
Original Answer:
One option would be to use a node filter to add this class to all <blockquote> elements:
https://www.tiny.cloud/docs/api/tinymce.dom/tinymce.dom.serializer/#addnodefilter
https://www.tiny.cloud/docs/api/tinymce.html/tinymce.html.domparser/#addnodefilter
Here is a Tiny Fiddle example:
http://fiddle.tinymce.com/hvhaab/1
(ETA correct Fiddle link)
Note: As seen in the Fiddle, this approach will also add the class to <blockquote> elements that are loaded or pasted in to the editor as existing content - not just <blockquote> elements added via the button.
Also, if a <blockquote> element already has a (different) class, this will add your custom class to the attribute.
TYPO3 8.7.4
news 6.0.0
Is it possible to extend news in a news_extend extension with a second container? (like contentElements)
The goal is to place this second container in the related content of the detail page.
Is there an example?
Yes, it's easy. You need to add field to database, configure it in TCA, extend the news model and adjust the detail template.
in news_extend/ext_tables.sql add:
CREATE TABLE tx_news_domain_model_news (
tx_newsextend_content_elements_second text
);
in news_extend/Configuration/TCA/Overrides/tx_news_domain_model_news.php:
$newNewsColumns = [
'tx_newsextend_content_elements_second' => [
// .... here copy the original 'content_elements' field's config from ext news' TCA. update the label to yours.
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news', $newNewsColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_news_domain_model_news', 'tx_newsextend_content_elements_second', '', 'after:content_elements');
in news_extend/Resources/Private/Language/locallang_db.xlf add:
...
<trans-unit id="tx_news_domain_model_news.tx_newsextend_content_elements_second">
<source>Additional content elements</source>
</trans-unit>
news_extend/Classes/Domain/Model/News.php:
namespace [my vendor]\NewsExtend\Domain\Model;
class News extends \GeorgRinger\News\Domain\Model\News {
// here copy all uses of contentElement field from original model, only name it txNewsextendContentElementsSecond.
// watch whether it's only declared property and getter/setter (simple fields), or something more is done in the model and do it the same way as there.
// tip: see getContentElementIdList() method
}
register your extension as provider of news' model extending class:
in news_extend/ext_localconf.php add:
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Domain/Model/News'][] = 'news_extend';
now you can use this in your template:
<f:if condition="{newsItem.txNewsExtendContentElementsSecond}">
<!-- content elements second -->
<f:cObject typoscriptObjectPath="lib.tx_news.contentElementRendering">{newsItem.txNewsExtendContentElementsSecondIdList}</f:cObject>
</f:if>
Above may not just work if you copy-paste it, I'm writing it from my notes. But it will help you to get the idea. Good luck
This should work. Just extend the news tca and model as described in the documentation
Is there a built in TinyMCE command to change the class name of its outer-most div? I have a div which is populated with either a PHP version of TinyMCE or the jQuery version, but the TinyMCE editor's outermost div classes are different.
I would preferably like to avoid having to use jQuery.
jQuery
class="mce-tinymce mce-container mce-panel"
PHP
class="wp-core-ui wp-editor-wrap tmce-active"
I don't mind if I can only change one, although it would be nice to know how to change both. I have tried
tinymce.inti({
body_class:"classname";
});
From docs
// Add a class to an element by id in the page
tinymce.DOM.addClass('someid', 'someclass');
// Add a class to an element by id inside the editor
tinyMCE.activeEditor.dom.addClass('someid', 'someclass');
From doc: https://www.tiny.cloud/docs-3x/reference/Configuration3x/Configuration3x#body_class/
Here you can also add a body_class option like;
tinyMCE.init({
...
body_class : "some_class_name"
});
I am trying to use a dynamic id in an editable field. The text is visible but the id is not getting set properly. Here is the code snippet.
<section-iterate name="xyz" entry="demo" list="user">
<widgets>
<editable type="pre" id="${demo}" text="${demo}" transition="." />
</widgets>
</section-iterate>
The browser is showing following page source:
<pre id="${demo}">Harry</pre>
In previous releases the editable.#id attribute was not an expanded string, but it is now. The section-iterate also populates a field that will be automatically appended to each ID, so with the latest code in the GitHub repository just use something like id="DemoEditable" and a numeric suffix to make it unique will be added automatically.
I'm working on a new extension and my model has the attribute 'type' which can get different strings from the TCA form. Strings only!
The name of the partial that my template should load is inside the 'type' attribute from my model. So here comes my problem. Since TYPO3 4.7.x the .html file names for fluid have to start with an uppercase letter. Inside the 'type' attribute the name of the partial that should be loaded is always lowercase. For that, I wrote a simple view helper that contains only this method:
public function render($string) {
return ucfirst($string);
}
Inside my template I tried to use this view helper for the path to the partial:
{namespace vh=Tx_MyExtension_ViewHelpers}
<f:for each="{obj.subObjects}" as="sub">
<f:render partial="OtherObject/{vh:String.UpperFirstCharacter(string:'{sub.type}')}" arguments="{sub:sub}" />
</f:for>
If I try to load this in the fontend, nothing from my extension will be rendered and there are no error messages anywhere. The problem depends on my view helper, 'cause even if I try to load only this:
{vh:String.UpperFirstCharacter(string:'test')}
{vh:String.UpperFirstCharacter(string:'{sub.type}')}
There is nothing comming back. If I only output {sub.type} it shows me the string that I want, but in lowercase.
Obviously your problem is that you're ViewHelper doesn't do what you want it to do.
First of all, ViewHelper names are to be written in lowerCamelCase.
Second, you don't need to place sub.type in curly braces:
This syntax...
{vh:string.upperFirstCharacter(string:sub.type)}
... should be sufficient.
Fluid will then look for a ViewHelper named
Tx_MyExtension_ViewHelpers_String_UpperFirstCharacter
or namespaced
\My\Extension\ViewHelpers\String\UpperFirstCharacter
Please check that this is the case.
So I found the issue. Fluid can't handle namespaces. So first my ViewHelper looked like this:
<php
namespace TYPO3\MyExtension\ViewHelpers\String;
class UpperFirstCharacterViewHelper ...
Now I changed the name of my class and removed the namespace:
<php
class Tx_MyExtension_ViewHelpers_String_UpperFirstCharacterViewHelper ...
This is how it works. At the moment I work with TYPO3 6.1.6.
Thank you anyway lorenz for your help!
EDIT:
I went fully retarded! Fluid CAN handle namespaces. I just had to set the namespace the right way.
That's how you set the namespace inside the template:
{namespace vh=TYPO3\MyExtension\ViewHelpers}
On top of this comment you can see how my ViewHelper looks like with a namespace.