ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Junk MS Word formatting and TinyMCE solution of sorts

March 01, 2009 3:49am

Subscribe [6]
  • #1 / Mar 01, 2009 3:49am

    scottmoa

    19 posts

    As you might know, LOTS of junk formatting gets brought over if a user cuts and pastes straight from Word into a field that’s modified by TinyMCE on some browsers on some platforms. This junk causes real problems for some older versions of IE. The “paste from word” button has mixed results at best and chasing down javascript issues was not something I wanted to spend my life doing. The folks working on TinyMCE are struggling enough with this. Users have resorted to first pasting content into plain text editor first. This is obviously less than ideal if your site is being used by less savvy users.

    My solution was to use something far more reliable: php. I wrote a tiny plug-in that strips out any comments.

    The function is super simple…

    /** ----------------------------------------
        /**  Comment stripper
        /** ----------------------------------------*/
    
        function Comment_strip()
        {
            global $TMPL;
            $dog= $TMPL->tagdata;
            $dog = preg_replace('@<![\s\S]*?--[ \t\n\r]*>@', "", $dog);
                     
            $this->return_data = $dog;
        }
        /* END */
  • #2 / Mar 01, 2009 5:37pm

    grrramps

    2219 posts

    There’s not an easy solution to this age old problem. Web pages (hence EE entry fields) like clean text. Editors, whether online like TinyMCE or Microsoft Word, all have their own idea of how text should be formatted.

    I’ve never met an editor, such as TinyMCE and crowd, which didn’t butcher text or code or both at one time or another. The same goes for word processors, which many users employ to create the text they want in the web page.

    What to do?

    Two words: Tough Love.

    First, I avoid the inline/online editors, such as TinyMCE. They’re good for billable hours when you’re called back in to fix something that really went haywire, but come with lots of headaches. Cleaning many entries of text is not much fun, even when billing by the hour.

    Second, I use EE’s built in HTML buttons but customized for each client’s needs.

    Finally, the client gets trained on using the HTML buttons appropriately within text, and within set parameters, with plenty of examples. Also, I specify which PC/Mac editors provide for clean text, assuming they do not want to edit text ‘live’ online in an EE entry field.

    That’s tough love, but oh so valuable when things go wrong. It’s usually the same things so problems are easier to track down and repair.

  • #3 / Mar 01, 2009 10:29pm

    scottmoa

    19 posts

    HAH

    The right answer is to make the tool work for the user, not make the user work for the tool (pun intended).

    But then I should add that the site is a news oriented site. ALL of the content is coming from Word documents which are destined for print in a full color magazine. Asking editors to mince their way through EE’s clunky, craptastic and counter-intuitive buttons (to people who’ve long used every other application under the sun) was never an option.

  • #4 / Mar 02, 2009 12:30am

    grrramps

    2219 posts

    The right answer is to make the tool work for the user, not make the user work for the tool (pun intended).

    Actually, users have to learn to use the tools appropriately. A saw, hammer, or screwdriver does not adapt to fit the inadequacies of the user.

    ALL of the content is coming from Word documents which are destined for print in a full color magazine. Asking editors to mince their way through EE’s clunky, craptastic and counter-intuitive buttons (to people who’ve long used every other application under the sun) was never an option.

    So, they mince through TinyMCE or some other clunky, craptastic, and counter-intuitive editor instead. Sure, that works.

  • #5 / Mar 02, 2009 8:37am

    scottmoa

    19 posts

    TinyMCE works quite well for our users with the exception of the one issue the solution I provided addresses. TinyMCE is simple to use, follows the flow of use and presentation that essentially every application and every other CMS/blog uses. If you don’t want to use the simple solution I provided, that is proving to work quite well, feel free to ignore it.

    And, yes, a hammer is adapted to the human hand, not the requirements or failures of the hammer maker.

  • #6 / Mar 02, 2009 10:41am

    e-man

    1816 posts

    Interesting discussion this…
    As a middle solution I’ve used Markitup with either Textile or Markdown on a few sites recently.
    Properly set up I argue that few users will see the difference between a textarea with Markitup and one with Tiny.

    I recently did a site for a school where the 2 secretaries (who had only worked with Word in their entire career) were up and running with Markitup (with a Textile seup) after only 1 training session of a scant 2 hours.

    There’s even an EE Markitup extension by Ryan Masuga.

    But, to each his own of course, although I agree with Ronnie that no wysiwyg editor is quite “there” yet.

  • #7 / Mar 02, 2009 11:56am

    grrramps

    2219 posts


    And, yes, a hammer is adapted to the human hand, not the requirements or failures of the hammer maker.

    Totally agreed that the hammer is a tool created for (not adapted; which is ridiculous), repeat, for the human hand, not for the foot. Yet, interestingly, the owner of the hand must be taught how to use the tool properly.

  • #8 / Mar 02, 2009 3:29pm

    scottmoa

    19 posts

    Chip meet shoulder. Shoulder meet chip.
    -snort-

    I can only surmise that your time must be worth less than mine and that you consider your client’s time worthless. With scant minutes of training, people are up and running with a WYSIWYG editor. With upwards of dozens of people editing a site, I will not and can not demand that they jump additional hoops.

    If anyone wants an *easy* solution. Enjoy.

    If anyone else wants to get all pouty at the thought that EE isn’t perfect, go right ahead.

  • #9 / Mar 02, 2009 3:49pm

    grrramps

    2219 posts

    Dude, you’re copping an attitude. Or two.

    Chip meet shoulder. Shoulder meet chip.
    -snort-

    Clever. For 4th graders.

    I can only surmise that your time must be worth less than mine and that you consider your client’s time worthless.

    Your summation is also clever. For 4th graders. My time is important. As is my client’s time. What works for me and for my clients may not work for you. Leave it at that and advance to the 5th grade.

    With scant minutes of training, people are up and running with a WYSIWYG editor. With upwards of dozens of people editing a site, I will not and can not demand that they jump additional hoops.

    Why bother to insult someone with a mere difference of opinion? Obviously, WYSIWYG editors work, but, just as obviously not for everyone, and certainly not perfectly, client or online. Ditto for TinyMCE and other look alikes. Sure, they work. But are they the right tool for every user, every developer? Hardly. And they’re hardly perfect.

    Amazingly, with scant minutes of training I’ve had hundreds of customers (also people) up and running using the elegant simplicity of EE’s XHTML buttons. They’re there for a reason and they work just fine.

    If anyone wants an *easy* solution. Enjoy.

    EE’s XHTML buttons are customizable, they work well, users are easily trained within minutes. Perfect for every situation? No, but easy enough to be more than effective.

    If anyone else wants to get all pouty at the thought that EE isn’t perfect, go right ahead.

    Pouty? Dude, lighten up a little. Recess is over…

  • #10 / Mar 02, 2009 4:04pm

    scottmoa

    19 posts

    Lighten up? LOL
    That was kind of my point. Duh.

    Attitude? Sure. I offered a solution to a problem. You don’t need the fix so why did you even post in this thread? It’s as though you wandered into a motorcycle forum to tell people with engine issues that they should start pedaling. If you don’t use TinyMCE, why do you care? -scratching head-

    p.s. this is clearly the 6th grade.

  • #11 / Mar 02, 2009 4:09pm

    Ingmar

    29245 posts

    Please consider this a call to moderation, everybody. Clearly, WYSIWYG editors are not for every one; that’s fine. If you want or have to use them, every function that cuts down on the junk formatting is a plus in my book.

  • #12 / Mar 02, 2009 4:29pm

    grrramps

    2219 posts

    Attitude? Sure. I offered a solution to a problem.


    As did I. Did I do something wrong? Should I not post related information in your threads? Sorry if you were offended by ideas, perspectives, and solutions other than your own.

    You don’t need the fix so why did you even post in this thread?

    I don’t see how that’s related to the topic, but, clearly, I’m not a 6th grader.

    It’s as though you wandered into a motorcycle forum to tell people with engine issues that they should start pedaling. If you don’t use TinyMCE, why do you care?

    I care about effective solutions. Forums can often be a good place of exchange for what works and what doesn’t. Sorry. I apologize. Obviously I wandered into the wrong playground at the wrong time.

  • #13 / Mar 02, 2009 5:09pm

    Lisa Wess

    20502 posts

    Scott, thank you for posting your solution.  You might consider adding it to our wiki; posts on the forums scroll by pretty quickly these days, and putting it on the wiki in some cases makes it more “findable” for folks. =)

  • #14 / Mar 02, 2009 5:13pm

    scottmoa

    19 posts

    Will do. I can also post the plugin if anyone wants it. It’s so simple it hardly seems to qualify as such. 😊

  • #15 / Mar 02, 2009 5:15pm

    Leslie Camacho

    1340 posts

    Ronnie, scottmoa is simply providing a solution to what he sees as an issue. He did it in a positive light for the benefit of the community. If you disagree, that’s fine but don’t pick an argument or take this thread off tangent. Your initial response was off topic and then you got combative. As a veteran of the community (1800+ posts) responding to someone who is new to the community (20+ posts), you should be encouraging contributions from new people, not getting on an anti-WYSIWYG soapbox.

    And scottmoa, next time please ignore negative responses like that and instead contact one of the moderators privately. Our preference is to keep discussions positive, on topic, at a professional level. Our moderators will always help people accomplish that so you don’t have to.

    Also, thank you for posting a solution that you found useful, its appreciated. For the record, Ronnie is a nice guy, a long time member of the EE Community, and helps people frequently. Consider this an unusual response from someone who is helpful more often than not.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases