Correctly Hide Edit Mode Elements in Preview Mode

Hello,
I wanted to know how I should modify the code below to correctly show content in the correct mode?  The code below works, but when switching to preview mode, I have to manually refresh the page to get the "Preview/Publish mode text" to disappear.  I'm aware I could modify the sidekick to force a refresh, but I'd prefer to do it similarly to how CQ does it (eliminate all edit mode components immediately without refreshing the page).  Thoughts?
import="com.day.cq.wcm.api.WCMMode"
<% 
    if ((WCMMode.fromRequest(request) == WCMMode.EDIT) || (WCMMode.fromRequest(request) == WCMMode.DESIGN)) {   
        %><div>Edit mode only text</div><%
    } else {
        %><div>Preview/Publish mode text</div><%
%>

Hi,
As the above code is evaluated server side and edit/preview is triggered client side this approach will not work for you.
You could use the fact that CQ is adding "cq-wcm-edit" class to page body in edit mode and "cq-wcm-preview" in preview and hide your divs by CSS.
Br

Similar Messages

  • Different display page layout in Display Layout mode and in Preview mode

    Hi everyone,
    can anybody help me to understand why it is different display page layout in
    Display Layout mode:
    I have 2 collumns
    and in Preview mode:
    I have only one column
    is there some option that I didn"t check in layout page properties?

    The only thing you can try, is to have a defined number of lines, where the last line only consists of a few words. That may(!) give enough room for different browser rendering. But there is definitely no guarantee.
    You may as well force the text frame to be converted to an image (Place one single character – point, space – out of a system font. This will force Muse to convert the text into an image – thus preventing txt reflow)

  • Footer extends longer in Preview Mode then in Design Mode

    I have attached two JPEGS that show my footer in "Design" mode and in "Preview" mode. 
    In "Design" mode the footer is perfect.  It is the size and distance it needs to be at.  However, when viewing it in "Preview Mode", the footer extends downward farther then it should.  I've looked all over the page to see if there was something from another graphic or image or shape that could be extending downward and I don't see anything. 
    Take a look at both images and tell me why this is happening?  I did have a lightbox gallary on this page.  I thought that the gallery was extending it downward so I removed it to test my theory.  Even after removing it, it still does not work the way it should.
    Craig
    Message was edited by: MUSE Worker

    Like Vikas said:
    Check if you have Sticky Footer enabled:
    File > Site Properties
    Page > Page Properties (for master and child pages)
    Let me know if neither of those work, it could be that you just need to preview in browser to see what the true height will be in the footer.
    Hope this helps!
    Julia

  • Two pages look gray in preview mode, wont' export

    Two pages in my document (a science text for kids) suddenly "went gray."  They look fine in normal mode, but in preview mode the pages look gray like the background, except for the imported images which still have a white background.  When I try to export and make a PDF file, those two pages come out as blank pages.  I tried to delete the pages but they won't delete.  When I click on the first page in the PAGES side bar, it takes me to the first page of the document and when I click on the second one, it takes me to the last page.  I have no idea what keys I might have accidentally pressed.  I don't even know the correct terms for the problem.  Does anyone know what is going on?  (This is a really important document for my business and is 250 pages long.)

    See both Remove minor corruption by exporting and Replace Your Preferences and try rebooting your system.

  • Jumbled elements in preview

    pages look correct in plan view, but in preview mode elements are jumbled once I start to navigate

    Hi - I just started working on this website so I haven't published yet. But this is still happening. Seems to become jumbled if I make changes to the master page and preview.  The initial page looks fine, then as I navigate other pages are jumbled.  They correct after I close out and come back into the file.
    Marianne Hales
    Marianne Hales Design
    [email protected]
    714.734.9064 office
    714.726.4280 cell

  • Preview mode showing some elements shifted vertical ;(

    One of my pages if showing some elements shifted vertically when viewing in preview mode. Its rather annoying as only one page is showing this. The design section shows all elements as they should be. Please help!!
    Image showing design mode as intended with Event title bar and featured events image in correct place.
    Preview mode below showing feature event image shifted vertically with event title bar.
    Any helpers got a fix for this?

    I also have a similar issue with a page on my site.
    I have a vertical scroll page with anchored links on the page.
    Each section of the page I have denoted by a vertical solid color rectangular bar.
    In design mode these bars are the correct lenght and position, however in preview I had issues where they were either shifting vertically or after trying out some fixes, which I will list, they now start (I think) at their designated start points but their end point is not that which i have specified.
    Fixes I tried:
    I put the anchors at numbers below 0 - no change
    I changed from one continous text box to segmenting the text boxes into section which correspond to the different colored rectangular bars - this, once grouped with corresponding bar and text box, solved the issue of the bars starting in the wrong location but did not fix their their over run at the end as in picture.
    I then put the grouped bars inside their respective text box and wrapped text with a margin of 20 - no change
    I then grouped all simialr grouped items together - no change
    I would greatly appreciate your help and I will forward the site with a link to this thread to muse support.
    yours faithfully.

  • Preview mode doesn't display correctly

    Lately I have had many problems in preview mode. I had to restart the program to see preview mode correctly. I waste time (on restart, then run the program, and test again the preview mode) each time is not doing correctly. It will be great if someone can help me!
    In design mode:
    Preview mode:

    No, they just display on your browser, when you close your browser the files are deleted.
    I personally like to use preview in browser, I can preview a designed page in Chrome, Firefox and Explorer by just coping the address.

  • Elements in Design Mode and Preview Mode are Different

    I've encountered an irritating problem in Muse. The elements arranged in design mode are shifting erratically in preview mode. I'm trying to set up "buy" links for my client's CDs using amazon, cdbaby, itunes icons. The buy buttons are place below the audio player widget from MuseGrid. Right now they are just pics - no hyperlinks attributed. If anyone has advice, I'd be grateful as this problem is driving me nuts and costing me hours!!! I am using the
    Design Mode                                                                                                Preview Mode

    Hi,
    Please try grouping the objects on the page. It resolved such issues in most cases.
    Regards,
    Aish

  • Newly created form field does not appear in Preview mode, only edit.

    Created two fields on this page. Only this first one shows in Preview mode. I saved the doc before hitting preview.

    What happens if you exit forms editing mode? Is the field set to hidden?

  • I am creating webpages with frontpage and trying to make collapsible lists. The lists collapse and work correctly in "preview" mode, but do not work when accessed through firefox or explorer 8. Does anyone know what I am doing wrong?

    I am creating webpages with frontpage and trying to make collapsible lists. The lists collapse and work correctly in "preview" mode, but do not work when accessed through firefox or explorer 8. Does anyone know what I am doing wrong?

    Welcome to the 'wonderful' world of HTML5 e-learning.
    In my view, from the issues I am seeing everywhere, HTML5 output from rapid e-learning tools such as Captivate is not ready for the kind of mobile device e-learning you want to develop.
    Sorry to be pessimistic, but you may need to consider going back to the drawing board and coding it from the ground up.

  • After duplicating LAYER, I go to EDIT    FILL LAYER and can't find NORMAL mode  Elements 9

    after duplicating LAYER, I go to EDIT    FILL LAYER and can't find NORMAL mode

    I go to the menu and NORMAL does not appear
    Date: Mon, 14 Jan 2013 10:28:01 -0700
    From: [email protected]
    To: [email protected]
    Subject: after duplicating LAYER, I go to EDIT    FILL LAYER and can't find NORMAL mode  Elements 9
        Re: after duplicating LAYER, I go to EDIT    FILL LAYER and can't find NORMAL mode  Elements 9
        created by 99jon in Photoshop Elements - View the full discussion
      Try from the layers pallet after highlighting your background copy layer. You should have dropdown menus for blend modes and opacity.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4992506#4992506
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4992506#4992506
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4992506#4992506. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Elements by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How to Hide "Edit in Browser" option in View Mode of SharePoint2013 with WebApps2013

    Hhow to Hide >> "Edit in Browser" in Sharepoint2013 with WebApps2013 screen

    Try and use jQuery to find the respective element and hide it.
    Sairam Avacorp Technologies

  • How to export photos with editing from preview mode to hard drive and external hard drive?

    I have applied changes to the photos in the preview mode. Unfortunately, I can't export them from preview mode to hard drive and external drives. Whenever the external drive is plugged, the changes I made are not applied to the photos on the both hard drives.

    Sorry what do you mean Preview Mode? There is no Preview mode or module in LR. There is a Library and Develop module in LR. The Library module does have the ability to do some adjustments and the Develop module has all the image adjustments.
    In any event to export an image you can either right click on it and select Export or when in the Library module you click the button that says Export.

  • Edit code while in debug mode in CC

    Hi,
    I have just upgraded to Flash CC, and can no longer edit code while in debug mode. It appears the code window becomes read only while debugging. This is problematic because I often find it very useful to copy in variable names from data visible in the variables display portion of the call stack. This is very helpful if I have made a typo in my variable names, or if I am reading out data from a network request and I don't know the variable names ahead of time. Is there a way to unlock the code window so it does not become read only during debugging?
    -David

    Hi Amy,
    I appreciate that you are trying to help, and from a purely coding standpoint see the advantages to Flash Builder IDE over the Flash Professional IDE. Although personally I am a Visual Studio kinda guy... However I am working with a fairly large code base, (we are a small game studio that has been working with flash cs4, 5, and 5.5 for the past 5 years) and while nobody that works for me is crazy enough to put code on the timeline, we do have a significant amount of UI elements, dialogs, and layouts that are designed in the Flash editor with logic in classes that extend those elements. Now correct me if I am wrong, but it is my understanding that you cannot build FLA files from flash builder let alone have them link with the classes that are set to extend them in Flash Professional. The move to CC actually gives us access to Flash Builder - something that previously was an additional $500 a seat. While it may make sense for us to use in the future, for now I am faced with the issue of the new Flash CC has removed the ability to edit the code while debugging. I was hoping there was a setting or a hidden option to turn this very unnecessary change off, I wasn't really asking for a critique of my IDE choice.
    -David

  • No images in preview mode.

    For no apart reason, this one time when I was editing my website for the first time that day, the preview mode no longer shows images, backgrounds or text in the correct don't. This however does all work correctly in design and in browser after exporting. Any ideas as to what's happened and how to fix it?

    Hi
    is it possible to attach few screenshot showing the muse preview, that will help.
    Thanks

Maybe you are looking for

  • New Tab Data need to be Saved in Me22n

    Hi All, I ading a new Tab in Me22n T-code in the Item level and the tab name is Date. The scenario is like that in the date I created 4 fields there are 1) Expected Production Date 2)Expected Shipping Date Remaning 3)Actual Production Date  and 4)Act

  • Mac Pro Kernel Panic w/Ethernet

    I have a Mac Pro hooked up to "Linksys 10/100 5 Port Workgroup Switch". Hooked up to this is a Macbook (off and on, I only connect the Macbook when transferring large files to get the 100base-T speed) and an Apple Airport Express set up as a WDS remo

  • Is there a 'system restore' type feature?

    My (not so) DD has managed to delete all my bookmarks, passwords and settings off my macbook. Its also asking me if I want to change the keychain - whatever that means!! Is there anyway I can get them back? I've lost my e-mail folders - I know how to

  • Unseen Unread email in outlook inbox

    Ok i've got a couple inboxes when I delete all the emails within the inbox it still says that i've still got unread email in the inbox. I've since this pass but can't remember how to fix this. Cheers, Brett

  • Connect OBIEE to Essbase

    Is the connection from OBIEE to Hyperion / Essbase supported out of the box? Thank you.