Confluence User-Macro renders in preview but not in page

Deleted user May 13, 2014

I have a usermaro which renders in the preview of the macro, but not after savig.

It has links to external scripts and stylesheets. Is that the problem? Or is there an other reason?

Once again: in the preview pane of the macro, i works perfectly fine!

2 answers

0 votes
Marco Vogel September 15, 2017

Hello Andrew,

i had the exact same Problem. The Javascript part of my Plugin was renderd in Preview Mode just fine but not once it was save to the Site.

There is a workaround for that issue.

In my .vm file i included

#if ($req.getRequestURI().contains("tinymce"))
         <script>update();</script>
    #elseif ($req.getRequestURI().contains("rendercontent.action"))
        <script>update();</script>
    #else
        <script>update();</script>
    #end

I just call my update function everytime the Macro URI changes from preview to saved state etc.

I hope this will help you

 

Greetings

Marco

0 votes
Rodrigo Girardi Adami
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2014

Hello Andrew,

This is an interesting behavior. Was this tested in the latest confluence version? Do it works on other confluence instance or just this one? Is there any error appearing in the page after saving it?

Maybe you could provide an example of the custom macro code so we can perform some tests?

Cheers,

Rodrigo

Deleted user May 13, 2014

Hi Rodrigo,

It's on Confluence 4.3

I haven't checked on other instances.

there were some minor errors, but nothing alarming.

the scripts for the example is scattered among internal servers, which is quite some work to assemble.

What happens is that we link to javascript from outside sources, and it seems that those work in the preview, but not "normally"

Sorry it's vague. I'll try to create a more simple example.

Deleted user May 13, 2014

body {

margin: 20px 20px 20px 20px;

text-align: center;

font-size: 13px;

font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;

}

#calendar {

width: 100%;

}

.fc-weekend {

color: grey;

}

.fc-weekend-column {

background-color: silver;

}

.greenEvent {

background-color: green !important;

color: grey;

}

.timeline {

position: absolute;

left: 59px;

border: none;

border-top: 1px solid red;

width: 100%;

margin: 0;

padding: 0;

z-index: 999;

}

.OOF {

background-color: silver;

color : black;

}

.concentratie {

background-color: #ABBDDC;

color : black !important;

}

.tentative {

color : white;

background-image: repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(255,255,255,.2) 10px, rgba(255,255,255,.2) 20px);

}

.thuis {

background-color: #DDDDDD;

color : black;

}

$body

</style>

<p><div id='calupdate' style="text-align: left !important; color: silver;"></div></p>

<div id='calendar'></div>

<div id='contextMenuContainer' style='background-color:#f0f0f0;width:100px;height:100px;display:none;z-index:999;border-radius:5px;border:1px solid black;position:absolute;'></div>]]></ac:plain-text-body>

</ac:macro>

Deleted user May 13, 2014

Maybe this helps?

It's in the user macro.

## Macro title: Exchange Agenda

## Macro has a body: Y

## Body processing: Rendered

## Output: HTML

##

## @paramurl:title=URL|type=string|required=true|desc=URL of API|default=.

## @paramuser:title=Gebruiker|type=string|required=true|desc=korte naam|default=NOUSER

#set( $user = $userAccessor.getUser($paramuser) )

#set( $user_src = "&g=" + $paramuser )

#set( $url = $paramurl )

<ac:macro ac:name="html">

<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>

<ac:plain-text-body><![CDATA[

<link href="$paramurl/fullcalendar/fullcalendar.css" rel="stylesheet" />

<link href="$paramurl/fullcalendar/fullcalendar.print.css" rel="stylesheet" media="print" />

<link href="$paramurl/jquery/jquery.qtip.min.css" rel="stylesheet" />

<script src="$paramurl/jquery/jquery-1.9.1.min.js"></script>

<script src="$paramurl/jquery/jquery.qtip.min.js"></script>

<script src="$paramurl/jquery/jquery-ui-1.10.2.custom.min.js"></script>

<script src="$paramurl/fullcalendar/fullcalendar.js"></script>

<script type="text/javascript" src="$paramurl/index2.php?js$user_src"></script>

<style>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events