• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  Thumbnail insertion not working if editor name is not message

dmnkhhn

Active member
#1
Hi there!

A user has shown how to integrate the editor in a custom add-on. That's what I did plus I included the attachment upload.
I found out that the insertion of an uploaded attachment doesn't work when I use this code in my ViewPublic class:
PHP:
    public function renderHtml()
	{
        $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
			$this, 'description', $this->_params['car']['description']
		);
	}
However, this one works:
PHP:
    public function renderHtml()
	{
        $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
			$this, 'message', $this->_params['car']['description']
		);
	}
The only difference is the parameter that controls the name of the textarea.

The error message is:
498TypeError: Result of expression 'editor' [undefined] is not an object. in /xenforo1b1/js/xenforo/attachment_editor.js?_v=3b22d69d:498​
I am not sure if this is a real bug but this requires us to use a field name of 'message' even if the name of the database field that stores the text is called differently.

If I change that name to 'message', I can insert the attachment thumbnail but when I save it, I get: Please enter a value for the required field 'description'.