TinyMCE4 custom self closing tag - tinymce-4

I have some custom XML tags which I want to use in my TinyMCE 4 editor.
One of it, is self closing.
For example this 'html' is valid:
<include type="module" name="MyModule">
<param name="myParam" value="myValue" />
</include>
According to allow these custom tags, i've added the following things to my init:
extended_valid_elements: "include[type|name],param[type|name|value]",
valid_children: "+p[include], +include[param]",
After inserting the code snippet, TinyMCE converts it into:
<include type="module" name="MyModule">
<param name="myParam" value="myValue">
</include>
Now the param tag isn't closed anymore.
After searching, I found the variable self_closing_elements. Adding my custom tags to it, unfortunately didn't work. I also 'played' with short_ended_elements and whitespace_elements, without any success.
So, how can I allow these custom tags to be self closing in TinyMCE 4 (I can find allow about version 3, not about v4...).

Was a bug in the version I used. After updating to the latest TinyMCE4 version, it worked like a charm

Related

Custom type not showing up in rule config

Trying to add a folder rule which should specialize cm:content to our custom type my:content (which inherits from cm:content).
We have configured the following in share-config-custom.xml:
<type name="cm:content">
<subtype name="my:content"/>
</type>
Our type shows up correctly in the specialize type action in the document library, but when trying to specify a rule the listbox that should contain our type remains empty. :(
What could we be missing?
You need to add to web-client-config-custom.xml in alfresco/extension
<config evaluator="string-compare" condition="Action Wizards"
replace="true">
<subtypes>
<type name="my:content" />
</subtypes>
<specialise-types>
<type name="my:content" />
</specialise-types>
</config>
And then the trick is to provide title & description for the types in the content model or via messages/properties; otherwise they will not be there.
Wrote about similar issues here: http://experiencewithalfresco.blogspot.dk/2012/08/remember-to-define-title-and.html
For adding custom messages you need to create custom-message-context.xml
<beans>
<bean id="mycompany.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.custom</value>
</list>
</property>
Then create custom.properties file and place it in /shared/classes/alfresco/message folder.
And for adding custom type to rule your config should be working only thing to make sure is config inside which you have put sub-type related config is proper.
Disclaimer: This answer is for Alfresco 6.2.2+.
Answering an old thread. For me, I tried this thread all vague answers on Alfresco Hub and nothing worked out.
I have been through this nightmare. Its frustrating and I don't know why Alfresco team relies on "Display Label" instead of "Name".
As shown in the screenshot, I was missing Display Label. As soon as I edited my custom type and provided Display Label, all worked as expected.
If I would have designed it, I would include, Name and Display Label both in the drop down in my rule window.
Hope it helps someone like me.

diazo ignores the JavaScript for web statistics

I have a plone 4.2.1 site and I am using various diazo themes. I also use Piwik for web statistics. Unfortunately the javascript for web statistics is being utterly ignored when one of the diazo themes is installed.
I have tried to edit the rules.xml file as suggested in https://groups.google.com/forum/?fromgroups=#!topic/plone-users/VM4b51ergFA, but adding
<!-- Google Analytics JavaScript -->
<after theme-children="/html/body"
content="/html/body/div[#id='visual-portal-wrapper']/div/script" />
does not work for me.
Is there any other option which I can use to fix this issue?
Thanks,
Julian
The viewlet plone.analytics is rendered in the footer viewlet manager:
<browser:viewlet
name="plone.analytics"
manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
class=".view.AnalyticsViewlet"
permission="zope2.View"
/>
The snippet is rendered as it is, so you can identify your script tag in the way you want.
You shoud try
<script id="plone-analytics" ...>YOUR SCRIPT...</script>
And modify the rules.xml to put #plone-analytics in your footer
In Plone 4.2 at least the plone.analytics is not in the visual-portal-wrapper so the rule you try will not work.

magento appends a querystring parameter to CSS and JS

How Can I appends a querystring parameter to each CSS and JavaScript include in the HTML to clear CSS and JavaScript cache.
I have tried
<action
method="addCss"><stylesheet>css/style.css?123</stylesheet></action>
and
<action
method="addItem"><type>skin_css</type><name>css/styles.css?123</name><params/></action>
.
But each time it returns a the base package like
http://www.example.com/skin/frontend/base/default/styles.css?123
not my custom theme directory .
How to solve this ?
This free extension should do what you want - works perfectly for me:
https://github.com/jreinke/magento-suffix-static-files
When you're adding a css file through xml layout updates, the addCss action (which realy just calls the addItem action with the type set to skin_css) is looking for a file path, not a url. While query strings are valid in urls, they aren't in file names. Magento sees that as an invalid parameter, gets confused and falls back to base/default.
I can think of 2 solutions for this. Unfortunately both are kind of hackey.
Move the css file to the base default theme. This works but it depends on fallbacks that might not stay the same in other versions of magento.
instead of directly inserting the css file, create a phtml template file with the html code to insert a css file. Then insert a core/template block with that new template file as its template in the layout xml. I've used this method on the sites i develop for to work around this problem.
Here's what we do:
<reference name="head">
<block type="core/text" name="link.tags">
<action method="setText">
<text>
<![CDATA[<link rel="stylesheet" href="/css/style.css?v=2">]]>
</text>
</action>
</block>
</reference>
Got this idea along with some other useful stuff from 5 Useful Tricks For Your Magento local.xml.
As an alternative, you can always just rename the file from style_v1.css to style_v2.css etc. whenever you make a change -- it has the same effect as changing style.css?v=1 to style.css?v=2.
as a follow up answer to this question i found the following (paid) magento extension which does what you require:
http://www.magentocommerce.com/magento-connect/clear-css-and-javascript-cache.html

Diazo add unwanted html header into json response

I have a blank Plone 4.1 site with only collective.quickupload installed. The upload portlet worked fine until I install plone.app.theming and apply my theme. The files were still uploaded, but the web client got "Failed" status.
Inspecting the ajax response from server I found that they were wrapped by html header.
The old response (before install diazo & apply my theme) was simply
{"success":true}
The new response (after install diazo and apply my theme) was being wrapped by a html tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><body><p>{"success":true}</p></body></html>
I've pasted my rule.xml file here (nothing special, there is only one rule conditioned by css:if-content="#visual-portal-wrapper"): http://pastebin.com/SaK13Fni
What should I do to work around this ?
Thanks
To avoid this behavior you have to add an exception in your rules.xml that specify to not apply your theme to your specific view , like this:
<notheme if-path="myjson_view"/>
edit:
I've tried with one of my diazo themes and a json view and I didn't have your issue. So I think the problem is either in your rules.xml or in your json view. You should try one of these two way:
change your rules.xml this way:
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Prevent theme usage in zmi-->
<rules css:if-content="#visual-portal-wrapper">
<theme href="index.html" />
</rules>
have you already specified the "Content-type" of the output in
your json view? Like this:
self.request.response.setHeader("Content-type","application/json")
return json_data
If not, that's probably the problem.
Watch out for using Chrome inspector... it adds the html head and pre tags around your json when you inspect it...it's not actually there if you look at view:source of the page (old school)...

Is it possible to remove base and Content-Type + alter HTML attributes in Diazo?

I am trying to make a HTML5/CSS3 theme with Diazo from a Plone site, using plone.app.theming 1.0b8. It is working like a charm in the BODY part. But the HTML tag and HEAD part are more difficult. To me at least :)
I have tried to:
remove xmlns and xml:lang attributes in the HTML tag
<drop attributes="xmlns xml:lang" theme="/html/" />
remove base tag
<drop theme="/html/head/base/" />
remove meta tag where http-equiv="Content-Type"
<drop theme="/html/head/meta[#http-equiv='Content-Type']" />
I am wondering if plone.app.theming or Diazo is forcing these things into the output, or if it's my xpath which is buggy? I have searched around but found no answers.
BR
Your xpaths probably should not end with a trailing '/', though I don't think this is the problem here.
It won't be possible to remove the xmlns attribute as that is added by XMLSerializer in XHTML mode (at least under common circumstances). You could set an HTML serialization instead with <xsl:output method="html"/> inside your root rules tag.
In XHTML mode, the XMLSerializer will add an xml:lang to match the lang attribute. Again, try setting the html serialization.
Normally the base tag gets copied from the content into the theme - there ought to be no reason to have a base tag in a theme html file. If you don't copy it over, it won't end up in the output. However it is advisable to always include a base tag in output from Zope as the same page will be rendered at both http://localhost/some_url and http://localhost/some_url/, which will lead to differences with any relative urls.
The content-type header is added by libxslt is unconditionally added by libxslt and is impossible to suppress.

Resources