Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

columnname/atribute name post-trixField causes problems with JS #37

Open
smeetsh opened this issue Jun 11, 2020 · 1 comment
Open

columnname/atribute name post-trixField causes problems with JS #37

smeetsh opened this issue Jun 11, 2020 · 1 comment

Comments

@smeetsh
Copy link

smeetsh commented Jun 11, 2020

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:

**"

{{blog.post-trixFields}}

~~~~

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

{{blog.post-trixFields}}
**

Hope you can help !! Thanks Hans.

@amaelftah
Copy link
Owner

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants