Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-01-12 02:19:37

NateW
New member
Registered: 2006-01-12
Posts: 5

Using Xinha with no Font options or interference

Hi,

I prefer to use CSS and not the Font tag for all my text formatting (with the exception of bold, italics, etc.). I used HTMLarea with DynamicCSS in my last project, but still HTMLarea had a habit of throwing in random Font tags that would throw off the CSS. In addition, all copying/pasting into the textarea would create Font tags.

Is there any way to load Xinha without any Font features, and so that it would not ever write any font tags into the text? I would be willing to forget about a lot of advanced features if I could get an editor that would handle point and click editing with CSS styles for <p>, <div>, <h*>, <hr>, <a>, <blockquote>, <ul>, <li>, and other basic HTML.

I need something that is moron-proof, as I tend to deal with people who think it's cool to write titles in 5 different fonts or sizes and different colors for every single letter. I need something that will allow me to set the boundaries of text layout and design choices, and I want something that will allow future content porting to different site designs.

Is this possible with Xinha? With HTMLarea I was never able to get the font tags to stay away.

Offline

#2 2006-01-12 09:42:12

mharrisonline
Xinha Administrator
From: Denver, Colorado
Registered: 2005-04-11
Posts: 110
Website

Re: Using Xinha with no Font options or interference

Nate,

This isn't very elegant, but it would work:

Remove the font face and size dropdowns from the toolbar. You should probably keep the format dropdown, but you might edit to only contain what your CSS defines.

Add this to the end of HTMLArea.getHTMLWrapper in htmlarea.js just before return html;

// Prevent fonts from being specified:
  html = html.replace(/<\/?\s*FONT[^>]*>/gi, "" );
  html = html.replace(/face="[^"]*"/gi, '');
  html = html.replace(/font-family:[^;}"']+;?/gi, '');
  html = html.replace(/size="[^"]*"/gi, '');
  html = html.replace(/font-size:[^;}"']+;?/gi, '');
  html = html.replace(/color="[^"]*"/gi, '');
  html = html.replace(/([^-])color:[^;}"']+;?/gi, '$1');
  // html = html.replace(/<\/?\s*SPAN[^>]*>/gi, "" ); // remove all span tags, which may be created by Word

If you are using the GetHtml plugin you will need to change the end of HTMLArea.getHTML in get-html.js to:

        if (outputRoot) {
            html += "</" + root_tag + ">";
        }
        html = HTMLArea.indent(html);
        html = html.replace(/<\/?\s*FONT[^>]*>/gi, "" );
        html = html.replace(/face="[^"]*"/gi, '');
        html = html.replace(/font-family:[^;}"']+;?/gi, '');
        html = html.replace(/size="[^"]*"/gi, '');
        html = html.replace(/font-size:[^;}"']+;?/gi, '');
        html = html.replace(/color="[^"]*"/gi, '');
        html = html.replace(/([^-])color:[^;}"']+;?/gi, '$1');
        // html = html.replace(/<\/?\s*SPAN[^>]*>/gi, "" ); // remove all span tags, which may be created by Word
    };
//    html = HTMLArea.htmlEncode(html);

    return html;
};

Last edited by mharrisonline (2006-01-12 09:42:41)

Offline

#3 2006-01-12 17:58:13

NateW
New member
Registered: 2006-01-12
Posts: 5

Re: Using Xinha with no Font options or interference

Thanks so much! I'll try it out!

Offline

#4 2006-01-13 02:44:41

NateW
New member
Registered: 2006-01-12
Posts: 5

Re: Using Xinha with no Font options or interference

It's working well, thank you! I can't seem to get the GetHTML modification functioning right, but that's not a big priority for me.

Thanks again, I'm just north of you up here in Fort Collins.

Offline

Board footer

Powered by FluxBB