columnname/atribute name post-trixField causes problems with JS
smeetsh opened this issue · 1 comments
HI Achmned as requested im am mentioning thos on github. The field created by the editor in the database is named: post-trixFields ( the same problem arises for the attachments) . Because a hypen (-) is used in the fieldname instead of "_" this causes havoc with JS (and thus angular and I assume reactJS as well), because a hypen is an operator so JS will try to deduct trixField from post, which of course wont work because it doesn't know those properties.
I have already tried escaping it with [ ] or ' ' .. etc but that doesn't work and even stack has drawn a blank so far.
Is it easy to change the name somewhere in the code? I assume it is defined somewhere within the files but i haven't been able to find it yet. I am expecting something along the lines of append controllerName with -trixFields?
Of course any other solutions are welcome. I am now using the basecamp version, which does not have this problem, but that means i have to code the whole xml upload myself, which is not something i'm experienced in, so id rather not do it.
The error in angular is:
**"
~~~~
src/app/blog/blog-detail/blog-detail.component.ts:20:16
20 templateUrl: './blog-detail.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component BlogDetailComponent.
src/app/blog/blog-detail/blog-detail.component.html:19:18 - error TS2339: Property 'trixFields' does not exist on type 'BlogDetailComponent'.
19
Hope you can help !! Thanks Hans.
@smeetsh thanks for reporting that out .
the -trixFields is appended in multiple places. AttachementInput Input
HasTrixRichText
for solutions, i have multiple ideas in my mind but not sure if that will help.
-
make accessor for post-trixFields
-
use a different syntax for accessing the property like this
{!! $post->trix('content') !!}
-
if it's an API call . you can map the property to a different name