What is the exact event that gets thrown when this button in confluence is clicked and we land in the editor?

I am basically looking to capture the Java event, when the user is trying to create a page out of a user template and clicks this create button as shown below, please let me know :

There isn’t an event on the server side that maps 1:1 to client side events. That said - there is a page created event: https://docs.atlassian.com/atlassian-confluence/6.5.2/com/atlassian/confluence/event/events/content/page/PageCreateEvent.html which should be getting triggered whenever a new page is created.

1 Like

Please note, that the “PageCreateEvent” is not thrown, when the “Create” button in the screenshot is clicked, but when the “publish” button is pressed.

As @danielwester said, there is no such event.

But you can register a custom click listener that handles the click of the button in the screenshot

AJS.$("#create-dialog .create-dialog-create-button").click(function () { 
    console.log("Clicked 'Create' page button", this);
});

@ppasler, @danielwester, thanks for the quick replies.
Yes, I dont need PageCreateEvent. I need to catch the event when the “create” button I showed in my snapshot is clicked and the editor is opened. After that, I intend to go over the editor’s storage format and do some manipulation on that .

I can try the JS option @ppasler suggested, but I am very unsure, if I can get the handle of the editor’s storage format from the front end like that. Please advise.

Seems like you want to do something, when the editor finished loading, right? The manipulations should be done directly after editor loading or before saving the page?

@ppasler, yes, the manipulatons should be done directly after the editor loads.

Ok, then this should do the job

// wait for editor to be loaded
AJS.bind("rte-ready", function () {
	// do manipulations
});

Note that this event is also thrown if the editor for comments is loaded.
You might check for this classes to differ page edits and comments $(".contenteditor.edit")