Disallow "justify" with HTML-Filter - html

On my Plone (4.2) Site, I have several users who regularly paste in texts from Word or OpenOffice. These texts are sometimes aligned as "justify", whereas I would not like to allow justified text blocks on the site (because it looks ugly).
Under the "HTML Filter settings" of the Plone Control Center, it does not seem to be possible to disallow a certain html attribute setting -- one can allow match and tag attributes. I would like to disallow all <xxx align="justify"> while still allowing elements to be right-aligned with <xxx align="right">.
Is there any way to do HTML filtering based on attributes' values in Plone?

You could disallow the attribute align in Plone's html filter. Then the default align is used which is "left".
Nowadays the most common way to align a text is to use css: . The css property "text-align" could also be disallowed in that html filter. Please don't forget to remove "justify" button from the tinyMCE toolbar.

Related

Anchor points have different positions on different browsers

I am trying to create a link that goes directly to a certain section of a different page. Here is what I'm doing.
I create an anchor point using the name attribute:
<a name="fish"></a>
<p>some content....</p>
I create a link with the # added to the end
"http://example.com#fish"
***note I have also tried the id method instead of name which still gives me the same issue.
example: <div id="fish"></div>
The functionality works fine and it takes me to the specific part on the page, the only issue is that it looks different on different browsers. What firefox displays is about 5 inches higher than what chrome displays.
It's probably because the a tag is taking up some space.
Easiest solution, use an id instead.
<p id="fish">some content....</p>
Make sure there's enough content below so it can scroll
Most browsers have the same css default value for common html elements, however it is possible that some elements have different attribute values for padding and margin.
One way to avoid these differences is explicitly applying the values in the css statements.
p {margin: 10px 0px}
If you do not want to do this, I recommend you put link exactly in the position where text is located.
<p><a name="fish"></a>some content....</p>
You can locate the link anywhere since the anchor element will not be visible in the viewport

HTML Textarea with specific line colors

I've got a <textarea>, but I need to color specific lines different colors. Apparently, I can't do this.
I could perhaps use a <div>, but I like the look and scrollbar of a <textarea>.
Is there any sort of database of HTML elements somewhere that I can check? It's rather annoying having to burden the posters of StackOverflow whenever I can't place the name of an element.
Textareas can only contain plain text. No possibility to format via CSS. You need something like a WYSIWYG Editor (CKEditor or TinyMCE)
Or if readonly, filled by javascript:
Use a simple div which can contain HTML markup inside for your line colors. Then style it with CSS to look like a textarea (scrollbar maybe)

Selectbox: Using html elements in options values

Please see the picture
The Andrede option have red * , that is indicating mandatory field.
I've tried Andrede<span class=required>*</span> as option value , but its not working its showing the full html tags
Option elements can contain only text.
If you want to include markup, then you need to replace the entire select element with a JavaScript widget.
I recommend changing the design so that you have a real <label> instead of using a placeholder or default value (both of which come with serious implications for accessibility). It is a webpage, so scrollbars are available. There is no need to have a cramped design.
If you are talking the given picture then they have their own select box which is build of elements other than option element

Where do these <em> elements are coming from in my HTML code?

For some reason elements are added to my html code and the text is rendered as italic.
http://109.72.95.174/astudio/sites/lancelmaat/performanceinstallation?tid=22(see bottom lines, or content of menu "Contact")
I'm using CKEditor in Drupal for the input of some text areas.
But it is strange, because the elements are added only for specific pages...
Also, I cannot see the elements in Safari Developer bar (I only see style: italic), but I think this is a smaller detail.
thanks
One of your nodes ("a live library") has on unclosed <em> in the message body, near the sentence that says "Voorjaar 1998 werd ik uitgenodigd doo..."
This is (accidentally) incorrect HTML, but different browsers react differently -- some add extra <em>s to straighten things out and italicize the rest of the page, some ignore the error, etc.
Diagnosis and Solutions:
This is happening because the node has HTML, and the maximum length in your display happens to break inside of an italic block for that node.
This is could be caused by one or more of the following. (Tough to tell witch without knowing how you set up the page, but all should be easy for you to check)
1) The node's HTML is incorrectly written. (Solution: fix the code so that all tags are correctly closed)
2) The "Preview" of the node is left to be determined automatically. If you're using Full HTML in a node, you should always set the teaser manually so you don't get orphaned tags in the preview.
3) In Views, you have the "Trim this field to a maximum length" checked. If so, you should also use the "Field can contain HTML" option, since this forces Drupal's built-in HTML corrector to run
4) You have another module that's doing something similar to the options described above. That module might have it's own HTML correction options, or you can use Drupal's built-in corrector (admin/settings/filters/%your-filter)

Tags inside textarea

I have an administrative area with some elements (2 fields text and ID and sort field) and each elements can be manage by create/edit/delete actions
And I think that I can make it easier by using textarea, where administrator can operates items as a text
<textarea>
<item1:1>
<item2:3>
</textarea>
where each item is included into < and > and it have the identifier after colon, so administrator can easily sort elements and rename them.
I just tested it one user and he said that numbers are confuse him.
May be put the numbers with colon into span tag and make it in different color....
what do you think? does textarea allowed tags? Is it more simple than working with items?
The content model for textarea is #PCDATA (processed character data). This means elements inside will not be accepted.
Anyone who comes across this might want to use a "content editable div" e.g.
<div contenteditable="true"></div>
here's an example http://jsfiddle.net/mekwall/XNkDx/
thanks to https://stackoverflow.com/a/4705882/194309