Burp Suite User Forum

Create new post

[MontoyaAPI][RawEditor][DocumentListener] Support or Workaround?

Alexandre | Last updated: Aug 12, 2024 11:11PM UTC

I’m trying to access the DocumentListener for a RawEditor component. It appears that the method rawEditor.uiComponent().getDocument() is not accessible. I attempted the following workaround: rawEditor.uiComponent().addPropertyChangeListener("text", evt -> clearLogButton.setEnabled(rawEditor.getContents().length() > 0)); However, this approach does not seem to work. Is there a specific property or method within RawEditor that allows me to listen for changes to its content? Thank you in advance for your help! Alex

Hannah, PortSwigger Agent | Last updated: Aug 14, 2024 04:02PM UTC

Hi Alex This isn't something that we expose on this component. If you'd like to use a listener in this way, we'd recommend you use a native Java component or RSyntaxTextArea rather than RawEditor. Currently, the way these components work is heavily based on user actions. We can raise a feature request to change this, but this is not something that we would implement in the short term.

Alexandre | Last updated: Aug 14, 2024 04:12PM UTC

Alternatively, is there another listener available for detecting content changes in the RawEditor? Also, is there a way to add a "Clear" button similar to the one found under "Extensions -> Output/Errors"?

Hannah, PortSwigger Agent | Last updated: Aug 15, 2024 03:21PM UTC

There is the "isModified()" method. There's no built-in component for a clear button - this is functionality you would need to implement yourself. Hope this helps!

Alexandre | Last updated: Aug 15, 2024 06:27PM UTC

Implementing this feature would be straightforward if there were a listener for content updates. Without such a listener, enabling a Clear button only when content is present in the RawEditor is not feasible.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.