CSS control to open profiling dialog!

mu258770
Posts: 150
Joined: Mon Aug 18, 2014 4:11 pm

CSS control to open profiling dialog!

Post by mu258770 » Tue Jun 29, 2021 6:10 pm

Hi team,

We are using Oxygen Eclipse 23.1 and Web Author 23.0. We would like to know whether it would it be technically feasible to have a button in the Oxygen Author CSS that would open the "Edit Profiling Attributes" dialog and allow to define the conditional attributes? Currently the "Edit Profiling Attributes" option is used as a context menu item, but we need to provide this new option as well.

Regards.
Shabeer

Gabriel Titerlea
Site Admin
Posts: 63
Joined: Thu Jun 09, 2016 2:01 pm

Re: CSS control to open profiling dialog!

Post by Gabriel Titerlea » Wed Jun 30, 2021 11:50 am

Hello,

The "Edit Profiling Attributes" action cannot be used from Oxygen XML Web Author at the moment.
I've added your +1 to an existing feature request and we will update this forum post when it will be available.

Meanwhile you can implement your own "Edit Profiling Attributes" action in a plugin [1] and you can add a button in the document that will invoke it. Here's how:

1. Implement a javascript action [2] that shows a dialog [3] where you will present the profiling attributes for an element & when the user submits their choice you can invoke "ro.sync.ecss.extensions.commons.operations.ChangeAttributesOperation" to change the attribute values.
2. Add an oxy_button [4] in your CSS, the button should invoke the action you created at step 1.
3. Force the oxy_button to be shown only in Web Author [5].

Best,
Gabriel

[1] https://www.oxygenxml.com/doc/versions/ ... lugin.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ction.html
[3] https://www.oxygenxml.com/maven/com/oxy ... ialog.html
[4] https://www.oxygenxml.com/doc/versions/ ... ditor.html
[5] https://www.oxygenxml.com/doc/versions/ ... ation_tips

mu258770
Posts: 150
Joined: Mon Aug 18, 2014 4:11 pm

Re: CSS control to open profiling dialog!

Post by mu258770 » Wed Jun 30, 2021 12:01 pm

Hi Gabriel,

Thank you for the update.

Is it possible in Eclipse Oxygen 23.0? That is is would it be technically feasible to have a button in the Oxygen Eclipse Author CSS that would open the "Edit Profiling Attributes" dialog and allow to define the conditional attributes

Regards,
Shabeer

alex_jitianu
Posts: 852
Joined: Wed Nov 16, 2005 11:11 am

Re: CSS control to open profiling dialog!

Post by alex_jitianu » Thu Jul 01, 2021 9:52 am

Hi Shabeer,

Yes, it can be done. You can do it with a JSOperation that invokes our Java-based API. Here's how I did it:
1. In the framework directory I've created a commons.js file and I've put this function in it:

Code: Select all

function editAttributes() {
    var allActions = authorAccess.getEditorAccess().getActionsProvider().getAuthorCommonActions();
    var action = allActions.get("Author/Edit_Profiling_Attributes");
    
	if (typeof action.actionPerformed === "function") {
		action.actionPerformed(null);
	} else if (typeof action.run === "function") {
		action.run();
	}
}
2. In one of the framework CSSs I've added a button form control that invokes the previously defined function, like this:

Code: Select all

*[class~='topic/p']:after {
  content: oxy_action(
          name, 'Edit profiling attributes', 
          operation, 'JSOperation', 
          arg-script, 'function doOperation() { editAttributes();}'
		) 
}
Best regards,
Alex

Post Reply