We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28563
    • 35 Posts
    Hi everyone - why don’t the FCK or MCE editors format the HTML source? It’s very frustrating -- HTML code is simply outputted in one long, wrapped line; hence, it’s almost impossible to edit or work with source code in the editors asit is un-readable - is this normal? Is there a fix for this? Am I doing something wrong? I would absolutely freak out if some one could tell me how to get MCE or FCK to format html source code in some sort of readable manner...

    Steve
      • 2762
      • 1,198 Posts
      strange issue...have you tested with other browser?
        Free MODx Graphic resources and Templates www.tattoocms.it
        -----------------------------------------------------

        MODx IT  www.modx.it
        -----------------------------------------------------

        bubuna.com - Web & Multimedia Design
        • 28563
        • 35 Posts
        Yes- it fails to format in mozilla and IE - and not just on my computer, but on all my co-workers’ computers as well - if I am to understand your email correctly, you are saying that this is not normal behavior, that newlines and carriage returns are normall respected and displayed appropriately? Beacsue that is not my experience - no newlines, carriage returns display in the source. I can go into the source, create a nicely formatted html document, then return to the source, and lo and behold I have a big jumbled mess of html...


          • 10487 MODX Staff
          • 1,535 Posts
          I can sympathise with this ... FCK (I know this for sure) will condense any HTML strings down into a single line of HTML when using the ’view source’ option.

          And, yes, it is annoying ... perhaps one for the FCK/MCE bugtracker? wink

          (However, it seems to format fine when viewing source on the rendered page in FireFox - just not with the RTE editor)

            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 28563
            • 35 Posts
            Well, to be fair, MCE exhibits this trait as well. Are there any editor plugins for MODx that do not? Anyone? Also, I may have tracked down a fix for the FCK problem - however, fix needs to be applied to a file that I cannot find anywhere in the FCK distro in the MODx .91 that I curent use - the "fckcodeformatter.js" file - perhaps this file was not included in the MODx version? The lack of any source code formatting parsers would definitly give you a big blob of HTML..... See below:
            Comments

            Date: 2006-02-02 17:46
            Sender: unleaded
            Logged In: YES
            user_id=67318

            SF.net bugged up my comment and has added newlines..

            Anyway, the correct RegEx should be:

            /\<(BR|HR) [^\>]\>/gi ;


            Date: 2006-02-02 17:45
            Sender: unleaded
            Logged In: YES
            user_id=67318

            I found the bug.. A very simple one as well.

            In line 32 of fckcodeformatter.js, change:

            "FCKCodeFormatter.Regex.NewLineTags =
            /\<(BR|HR)[^\>]\>/gi ;"

            to

            "FCKCodeFormatter.Regex.NewLineTags = /\<(BR|HR)
            [^\>]\>/gi ;"

            Note: There’s a space now between "(BR|HR)" and
            "[^\>]", as
            there should be (eg,
            ).
              • 28563
              • 35 Posts
              One more note - and I hope the MODx support team responds -- it seems that this is a MODx issue, and not an editor problem - after perusing the tinyMCE and the FCKeditor websites, usage of their demo instances yielded the discovery that their instances formatted source when viewing or editing source in the respective editors. WHich begs the question, why does this extremely (to me, at least) function break when the editors are implemented in MODx? I’ve install Xinha, FCK and MCE now, and they **all** exhibit the same inability to provide formatted source code to the user when the user is using the HTML source option, but only in MODx.

              Steve
                • 4018
                • 1,131 Posts
                That’s interesting. Hmm...if I were to guess at the source of the problem, I would suspect that the textarea box that FCKEditor and TinyMCE is replacing is not setup as a proper textarea and thus would probably explain the problem. When I get a moment, I’ll look into the problem. But, if you can, please submit this issue into the bugtracker just in case I forget. wink
                  Jeff Whitfield

                  "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                  • 28563
                  • 35 Posts
                  Sure - I would be happy to do so....

                    • 8164
                    • 51 Posts
                    steveua...
                    In the TinyMCE source pop-up window, there’s a check box called "Word wrap" in the upper right corner. It creates line breaks in the source code and fits it within the window.

                    The formatting isn’t pretty, but at least it’s all visible.

                    Duane
                      • 28563
                      • 35 Posts
                      thanks duane - I tried that, but it was still just terrible to work with (in my opinion) - actually, in another part of the forum, somebody posted a manager fix that allows users to choose "none" as their editor - this replaces the chosen editor with a simple text box, and lo & behold, the code entered retains its formatting - I don’t have a link handy, but the 3 files I uploaded into the MODx manager were "mutate_content.dynamic.action.php
                      mutate_settings.dynamic.action.php
                      mutate_user.dynamic.action.php"

                      works great. I just wish MODx worked properly with the editors it use in terms of source code....