Skip to content

Update main.scss#455

Open
WinterSilence wants to merge 1 commit intoyiisoft:masterfrom
WinterSilence:patch-3
Open

Update main.scss#455
WinterSilence wants to merge 1 commit intoyiisoft:masterfrom
WinterSilence:patch-3

Conversation

@WinterSilence
Copy link
Copy Markdown
Contributor

Add styles for preview sources

Q A
Is bugfix? no
New feature? no
Breaks BC? no
Tests pass? yes
Fixed issues no

File preview
@samdark
Copy link
Copy Markdown
Member

samdark commented May 4, 2021

Would you please post before/after screenshots? What does it fix?

@samdark samdark added the pr:missing usecase It is not clear what is the use case for the pull request. label May 4, 2021
@yiisoft yiisoft deleted a comment from yii-bot May 4, 2021
@WinterSilence
Copy link
Copy Markdown
Contributor Author

@samdark for example, check composer.json generated by "Generate extension". By default, all prepended whitespaces are combined.

@rob006
Copy link
Copy Markdown
Contributor

rob006 commented May 9, 2021

IMO this should be handled in the same way as for PHP code: wrap content in <code> tag and replace spaces by &nbsp;.

@WinterSilence
Copy link
Copy Markdown
Contributor Author

@rob006 it's too good idea, but we don't have function/method to do this.

@rob006
Copy link
Copy Markdown
Contributor

rob006 commented May 9, 2021

To do what?

@WinterSilence
Copy link
Copy Markdown
Contributor Author

WinterSilence commented May 9, 2021

@rob006 to

wrap content in <code> tag and replace spaces by &nbsp;

need replace only initial tabs\spaces in lines, in any case it's give same result (white-space: pre;)

@rob006
Copy link
Copy Markdown
Contributor

rob006 commented May 9, 2021

You can just replace

return nl2br(Html::encode($this->content));
to something like

return Html::tag('code', strtr(nl2br(Html::encode($this->content)), [
    ' ' => '&nbsp;',
    "\t" => '&nbsp;&nbsp;&nbsp;&nbsp;',
]));

At least you're sure nothing else is affected by this change (your PR affects all modals - are you sure modals contain only code?) and style is consistent with PHP code (currently proportional font is used for non-PHP code snippets).

@WinterSilence
Copy link
Copy Markdown
Contributor Author

WinterSilence commented May 9, 2021

@rob006

your PR affects all modals - are you sure modals contain only code?)

nope, all modals - .modal, i change styles only for #preview-modal

To represent multiple lines of code, wrap the <code> element within a <pre> element. The <code> element by itself only represents a single phrase of code or line of code.

wrap in <pre> is same to white-space: pre;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:missing usecase It is not clear what is the use case for the pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants