Skip to content

Commit dda0b5d

Browse files
authored
Merge pull request #163 from WebCoder49/sizing-with-v2-scroll
Sizing with v2 scroll
2 parents bf72dc2 + 5987088 commit dda0b5d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

code-input.css

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, co
3838
margin: 0px!important;
3939
padding: var(--padding, 16px)!important;
4040
border: 0;
41-
min-width: calc(100% - var(--padding) * 2);
42-
min-height: calc(100% - var(--padding) * 2);
41+
min-width: calc(100% - var(--padding, 16px) * 2);
42+
min-height: calc(100% - var(--padding, 16px) * 2);
4343
box-sizing: content-box; /* Make height, width work consistently no matter the box-sizing of ancestors; dialogs can be styled as wanted so are excluded. */
4444
overflow: hidden;
4545
resize: none;
@@ -57,8 +57,6 @@ code-input:not(.code-input_pre-element-styled) pre, code-input.code-input_pre-el
5757
/* Remove all margin and padding from others */
5858
margin: 0px!important;
5959
padding: 0px!important;
60-
width: 100%;
61-
height: 100%;
6260
}
6361

6462
code-input textarea, code-input pre, code-input pre * {
@@ -139,12 +137,12 @@ code-input:not(.code-input_registered)::after {
139137
content: "Use codeInput.registerTemplate to set up.";
140138
display: block;
141139
position: absolute;
142-
bottom: var(--padding);
143-
left: var(--padding);
144-
width: calc(100% - 2 * var(--padding));
140+
bottom: var(--padding, 16px);
141+
left: var(--padding, 16px);
142+
width: calc(100% - 2 * var(--padding, 16px));
145143

146144
border-top: 1px solid grey;
147-
outline: var(--padding) solid white;
145+
outline: var(--padding, 16px) solid white;
148146
background-color: white;
149147
}
150148

@@ -167,12 +165,16 @@ code-input .code-input_dialog-container {
167165

168166
margin: 0;
169167
padding: 0;
170-
width: 100%;
171168
height: 0;
169+
width: 100%;
172170

173171
/* Dialog boxes' text is based on text-direction */
174172
text-align: inherit;
175173
}
174+
code-input.code-input_pre-element-styled .code-input_dialog-container {
175+
width: calc(100% + 2 * var(--padding, 16px) - 2px);
176+
}
177+
176178
[dir=rtl] code-input .code-input_dialog-container, code-input[dir=rtl] .code-input_dialog-container {
177179
left: unset;
178180
right: 0;
@@ -212,5 +214,8 @@ code-input .code-input_dialog-container .code-input_keyboard-navigation-instruct
212214
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused) textarea,
213215
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused):not(.code-input_pre-element-styled) pre code,
214216
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused).code-input_pre-element-styled pre {
215-
padding-top: calc(var(--padding) + 3em)!important;
217+
padding-top: calc(var(--padding, 16px) + 3em)!important;
218+
}
219+
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused) textarea, code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused):not(.code-input_pre-element-styled) pre code, code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused).code-input_pre-element-styled pre {
220+
min-height: calc(100% - var(--padding, 16px) * 2 - 3em);
216221
}

plugins/prism-line-numbers.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://prismjs.com/plugins/line-numbers/
55
* Files: prism-line-numbers.css
66
*/
7-
/* Update padding to match line-numbers plugin */
7+
/* Update padding to match line-numbers plugin, and decrease width likewise */
88
code-input.line-numbers textarea, code-input.line-numbers.code-input_pre-element-styled pre,
99
.line-numbers code-input textarea, .line-numbers code-input.code-input_pre-element-styled pre {
1010
padding-left: max(3.8em, var(--padding, 16px))!important;
@@ -15,11 +15,6 @@ code-input.line-numbers, .line-numbers code-input {
1515
grid-template-columns: calc(100% - max(0em, calc(3.8em - var(--padding, 16px))));
1616
}
1717

18-
/* Make keyboard navigation still fill width */
19-
code-input.line-numbers .code-input_dialog-container .code-input_keyboard-navigation-instructions, .line-numbers code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions {
20-
width: calc(100% + max(3.8em, var(--padding, 16px)))!important;
21-
}
22-
2318
/* Override Prism styles so there's no display:inline, relatively-positioned code element which breaks offsetTop, used in FindAndReplace, in Firefox. */
2419
code-input pre[class*=language-].line-numbers>code {
2520
position: static;

tests/i18n.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!--Import Prism-->
99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css">
10-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
10+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js" data-manual></script>
1111
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
1212
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
1313
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.css">

0 commit comments

Comments
 (0)