def confirm(self):
        """Assign content to data if valid and finish editing.

        Triggered when users press the 'confirm' button
        to signal they finished editing the data.
        """
        ### retrieve text from cursor
        text = self.cursor.get_text()

        ### try validating text
        try:
            text_validates = self.validation_command(text)

        ### if an expected error occurs during validation, it is logged
        ### and user is notified

        except Exception as err:

            log_message = "An unexpected error ocurred during text validation."

            logger.exception(log_message)
            USER_LOGGER.exception(log_message)

            dialog_message = log_message + (
                " Check user log for more info (on the graph/canvas, press"
                " <Ctrl+Shift+j> or access the \"Help > Show user log\""
                " option on the menubar)."
            )

            create_and_show_dialog(dialog_message, level_name='error')

        ### otherwise...

        else:

            ### if the text validates it is assigned to the text
            ### attribute and we trigger the end of the looping by
            ### setting the running flag to False

            if text_validates:

                self.text = text
                self.running = False

            ### otherwise we notify the user

            else:

                create_and_show_dialog(
                    (
                        "Text doesn't validate. Please, check whether text"
                        " being typed must meet specific requirements and"
                        " ensure they are met."
                    ),
                    level_name='info',
                )
Assign content to data if valid and finish editing.

        Triggered when users press the 'confirm' button
        to signal they finished editing the data.
        
nodezator/textman/editor/main.py