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

Form text interpreted as code #19

Closed
silmer opened this issue Mar 7, 2018 · 10 comments
Closed

Form text interpreted as code #19

silmer opened this issue Mar 7, 2018 · 10 comments
Labels
Milestone

Comments

@silmer
Copy link

silmer commented Mar 7, 2018

The following example was used in a task description form in Trix:

char [][] ordene ={{'H','A','B','D'}, {'M','V','Q','K'}, {'P','L','U','G'}, {'A','S','R','D'}};

Even with code tags, this leads to a parse error, see here.

Elthan added a commit to Elthan/trix2 that referenced this issue Jul 23, 2018
Added ng-non-bindable to assignment text in assignments.django.html
which prevents it from being interpreted by AngularJS.
AceMarkdown needs to be fixed as well.
Removed bleach as it was not in use.
@Elthan
Copy link
Contributor

Elthan commented Jul 23, 2018

This is an issue with AngularJS not ignoring expressions as it should. It is fixed by using ng-non-bindable. This can be added to the user pages that shows the assignments, but adding it to the admin pages where assignments are created might be a bit more difficult. I've raised an issue in cradmin-legacy about this which will hopefully solve the issue at its core rather than doing a big workaround.

@Elthan Elthan mentioned this issue Jul 25, 2018
torgeirl added a commit that referenced this issue Jul 26, 2018
@torgeirl torgeirl added the bug label Aug 21, 2018
@torgeirl
Copy link
Contributor

torgeirl commented May 14, 2020

This issue should be solved when cradmin_legacy is upgraded to v4.1 as part of upgrading to Django 3.2 (issue #102).

@torgeirl torgeirl added this to the Trix 4.0 milestone May 14, 2020
@torgeirl torgeirl modified the milestones: Trix 4.0, Trix 3.0 Dec 1, 2022
@Levijatan
Copy link
Collaborator

Is this still happening after the Django3.2 update?

@torgeirl
Copy link
Contributor

torgeirl commented Dec 7, 2022

Is this still happening after the Django3.2 update?

As far as I can tell there isn't any parse error, and saving an assignment with that as an assignment description renders the assignment correctly. However, the preview function seems to discard the text so I guess it still isn't fully fixed.

Levijatan pushed a commit that referenced this issue Dec 13, 2022
@Levijatan
Copy link
Collaborator

Ended up with replacing the AceMarkdownWidget with a copy of DevilryCommentEditor. The bug is so ingrained inn how the AceMarkdownWidget is implemented inn cradmin that it is not easily fixable. Created a b14 release.

@torgeirl
Copy link
Contributor

torgeirl commented Dec 15, 2022

@Levijatan: the create new assignment function (/a/N/assignments/create) broke with b14. There is an AttributeError at line 159 in trix/trix_admin/views/assignments.py: 'NoneType' object has no attribute 'id'.

@Levijatan
Copy link
Collaborator

Found that the AssignmentPreviewView expected an Assignment to already be saved to the db. So after fixing the AssignmentPreviewView not loading at all it started to crash the AssignmentCreateView and not actualy previewing the unsaved changes on the AssignmentUpdateView. So updated it use serialization and session storage to store the data for the preview instead of fetching it from the database. So now it actually previews changes and does not crash the create view. Created a b15 release.

@torgeirl
Copy link
Contributor

@Levijatan: the error is fixed, but there seems to be a rendering issue with the editor.

Neither the assignment text or solution text are shown on the edit page. I'm however able to find their content among the elements (<devilry-comment-editor id="id_devilry_comment_editor" name="text" value="assignment text is here" (...) and <devilry-comment-editor id="id_devilry_comment_editor" name="solution" value="and solution text is here" (...)).

It doesn't render at all:
Screenshot from 2022-12-15 15-39-58

@Levijatan
Copy link
Collaborator

@torgeirl it was missing the .js files. setup.py just didn't include them. Released b16 with the missing files.

@torgeirl
Copy link
Contributor

That solved it! 🎉

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

No branches or pull requests

4 participants