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

Multi-line compliments #1405

Merged
merged 5 commits into from
Sep 25, 2018
Merged

Conversation

ubertao
Copy link
Contributor

@ubertao ubertao commented Sep 16, 2018

Allows multi-line compliments by supporting \n (newline) character in compliment text.

For example, in your config.js:

{
    module: "compliments",
    position: "lower_third",
    config: {
        compliments: {
            anytime: [ 'Blackbird singing in the dead of night\nTake these broken wings and learn to fly.' ]
        }
    }
}

Will be shown in two lines:

Blackbird singing in the dead of night
Take these broken wings and learn to fly.

This is ideal for lyrics or poems.

@MichMich
Copy link
Collaborator

Thanks for your contribution. Using innerHTML isn't preferred since this could be used to fire malicious code. (IE when an external compliments file is used). Is there a way to refactor this?

@ubertao
Copy link
Contributor Author

ubertao commented Sep 20, 2018

Forgot the fact that compliments content can be loaded from an URL. Patch submitted.

@MichMich
Copy link
Collaborator

Maybe a simpeler approach: how about we just add the white-space: pre-line; style to the wrapper? Then no further coding is nessecery.

@ubertao
Copy link
Contributor Author

ubertao commented Sep 24, 2018

@MichMich I'm not familiar with CSS, it's definitely simpler.

@MichMich MichMich merged commit 7117725 into MagicMirrorOrg:develop Sep 25, 2018
@MichMich
Copy link
Collaborator

Awesome work! Thanks! :)

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.

2 participants