My source code keeps getting reformatted

User 335241 Photo


Registered User
5 posts

Hi everybody,

I'm using HTML Editor 2008. As an example of my problem, in the Code Editor tab I have 3 source lines ..

<div id="left_column_box"></div>
<!-- HEADER -->
<!-- Background -->

If I go into the Visual Editor tab and change any of the page text and then go back to the Code Editor tab the source lines are now one continuous line ..

<div id="spacer1"></div><!-- HEADER --><!-- Background -->

Is there any way I can stop this as I like to keep my code formatted as I have set it?

Thanks for your help,

David


User 37670 Photo


Registered User
2,138 posts

Hi. The problem is the steps you are taking. Doesn't the editor warn you that the code will be changed and ask you to save a copy before proceding? The visual editor part of the probram will format your code every time. It has no way of knowing what code you want to use (even if you coded it yourself). It tries to write the best code it can to produce what you drag and drop to your page.
If you want to preview your work without having your code changed, use the preview tab, not the visual site designer tab. Your other option is to preview the page in your browser. In the options, you can set a number of browsers to preview in.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 335241 Photo


Registered User
5 posts

Thanks for the reply Cliff. I do get the warning but even if I save it the code still reverts from 3 lines to one line (in fact every comment changes) when I do the following ...

Start CoffeeCup
Open index.html in Code Editor
Swap to Visual Editor - save as requested
Change any character/word on the page.
Swap back to Code Editor and every single comment line in my index.html has moved up to the end of the previous line.

I wouldn't have thought the software should be changing my code formatting in this way. I'm just changing page text. This means I cant use Visual Editor as a "visual editor". Seems to defeat its purpose.

Cheers,

David
User 447551 Photo


Ambassador
139 posts

I've just done a copy and paste of your three lines of code and put them into a page, went to visual editor, then to preview and back to code editor, saved it to disk, closed all files, pulled it back in and the formatting was still 3 lines.

I've tried to reproduce your problem and everything I try fails.
User 37670 Photo


Registered User
2,138 posts

davidhh wrote:
This means I cant use Visual Editor as a "visual editor". Seems to defeat its purpose.


The visual editor is an editor that you can use if you don't know how to code. It takes what you build in a visual output and converts it for you into html code that will display your web page as close to your layout as it can. You can certainly use it as a "visual editor", for a single page or a complete website. It simply is not capable of figuring out which code you wrote, and which code it should create.

In the help file of CoffeeCup html editor, you will find this about the visual tab:
help file wrote:
The Visual Editor tab is one of the best features added to CoffeeCup HTML Editor. This feature allows you to drag and drop everything onto your Webpage; there is no need to know HTML. This tab is not for previewing a page, switching from Code Editor to Visual Editor may alter the code.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 335241 Photo


Registered User
5 posts

Thanks Bill and Cliff.

As the help file says It truly is a case of "switching from Code Editor to Visual Editor may alter the code". Just frustrating to see all my nicely formatted code get scrunched up.

Cheers guys,

David
User 549879 Photo


Registered User
6 posts

I would love to see an user option that would tell Visual Editor to not change any of the existing code other than the code you add or edit during the Visual Editor session. I can't see any reason why it must "optimize" all the code.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.