devilry / trix2

Next generation Trix. Detailed task control and statistics app for better learning outcome.
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Form text interpreted as code #19

Closed silmer closed 1 year ago

silmer commented 6 years ago

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 commented 6 years ago

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.

torgeirl commented 4 years ago

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

Levijatan commented 1 year ago

Is this still happening after the Django3.2 update?

torgeirl commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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

torgeirl commented 1 year ago

That solved it! :tada: