Skip to content

Allow theme changes for pl-file-editor - #6476

Merged
nwalters512 merged 18 commits into
PrairieLearn:masterfrom
louisunlimited:FileEditor
Oct 13, 2022
Merged

nwalters512 merged 18 commits into
PrairieLearn:masterfrom
louisunlimited:FileEditor

Conversation

@louisunlimited

Copy link
Copy Markdown
Contributor

Finally got modal working, now everything should work as desired. The themes are persisted through localStorage and will be loaded once a new FileEditor instance is created. I was wondering if I need to let jquery handle modal dismiss or is the current implementation okay (data-dismiss="modal").

@github-actions

github-actions Bot commented Oct 12, 2022 •

Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@louisunlimited

Copy link
Copy Markdown
Contributor Author

I have reviewed and hereby sign the CLA

nwalters512 added a commit to PrairieLearn/cla that referenced this pull request Oct 12, 2022
@louisunlimited
louisunlimited marked this pull request as ready for review October 12, 2022 13:32

@nwalters512 nwalters512 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you got the modal issue figured out! I gave this a spin and functionally it's looking nice.

One thought: it might be nice to update the theme in real-time as the user selects different options in the modal. That way, they can at least get a sense of what the theme they chose looks like, even if it's partly hidden behind the modal.

<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Editor Settings</h5>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an appropriate id for this modal. You should incorporate the uuid in case there are multiple file editors on the page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By uuid do you mean the uuid passed in when creating editor instance?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was thinking we should add id to line 32 instead. Shouldn't it be on the entire modal itself instead of on modal-title?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the ID should be on the title, and the modal itself should reference that ID via aria-labelledby="...". See https://getbootstrap.com/docs/4.6/components/modal/#accessibility for more details.

@louisunlimited

Copy link
Copy Markdown
Contributor Author

@nwalters512 I believe I have finished most of the desired features. This code might still need a bit of refactoring but should be functionally good.

@louisunlimited

Copy link
Copy Markdown
Contributor Author

@nwalters512 Hi! I have updated the 'sync settings' part, now every time the 'save' button is clicked, a custom event will be fired and can be listened to by other editors on the same page to update their theme. I might change the event name to settingsSync for readability purposes. However, when updating editor theme real-time when selecting themes(preview), should we make this sync across editors as well? Now only the selected editor changes theme on selection. Personally I don;t think this is much of an issue, but I would love to hear your thoughts!

@nwalters512 nwalters512 changed the title FileEditor Settings Initial Commit Allow theme changes for pl-file-editor Oct 13, 2022
@nwalters512

Copy link
Copy Markdown
Contributor

@louisunlimited Awesome! I think only changing the current editor as a sort of "preview" is fine. Let me review your latest changes.

@nwalters512 nwalters512 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! A few more small things and this will be good to go.

@louisunlimited

Copy link
Copy Markdown
Contributor Author

All done!

@nwalters512 nwalters512 linked an issue Oct 13, 2022 that may be closed by this pull request

@nwalters512 nwalters512 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - thanks for the contribution!

@nwalters512
nwalters512 merged commit c3a4dc2 into PrairieLearn:master Oct 13, 2022
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

Successfully merging this pull request may close these issues.

Feature Request: Customize PLFileEditor

2 participants