Skip to content

Commit 32b29fc

Browse files
committed
Comments: Fixed pointer display, Fixed translation test
1 parent 8f92b6f commit 32b29fc

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

resources/js/services/__tests__/translations.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ describe('Translations Service', () => {
5858
expect(caseB).toEqual('an orange angry big dinosaur');
5959
});
6060

61+
test('it provides count as a replacement by default', () => {
62+
const caseA = $trans.choice(`:count cats|:count dogs`, 4);
63+
expect(caseA).toEqual('4 dogs');
64+
});
65+
6166
test('not provided replacements are left as-is', () => {
6267
const caseA = $trans.choice(`An :a dog`, 5, {});
6368
expect(caseA).toEqual('An :a dog');

resources/js/services/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class Translator {
1010
* to use. Similar format at Laravel's 'trans_choice' helper.
1111
*/
1212
choice(translation: string, count: number, replacements: Record<string, string> = {}): string {
13-
replacements = Object.assign({}, replacements, {count: String(count)});
13+
replacements = Object.assign({}, {count: String(count)}, replacements);
1414
const splitText = translation.split('|');
1515
const exactCountRegex = /^{([0-9]+)}/;
1616
const rangeRegex = /^\[([0-9]+),([0-9*]+)]/;

resources/sass/_pages.scss

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,7 @@ body.tox-fullscreen, body.markdown-fullscreen {
158158
border-radius: 4px;
159159
box-shadow: 0 0 12px 1px rgba(0, 0, 0, 0.1);
160160
@include mixins.lightDark(background-color, #fff, #333);
161-
width: 275px;
162-
163-
&.is-page-editable {
164-
width: 328px;
165-
}
161+
width: 328px;
166162

167163
&:before {
168164
position: absolute;
@@ -193,7 +189,8 @@ body.tox-fullscreen, body.markdown-fullscreen {
193189
border: 1px solid #DDD;
194190
@include mixins.lightDark(border-color, #ddd, #000);
195191
color: #666;
196-
width: 180px;
192+
width: auto;
193+
flex: 1;
197194
z-index: 58;
198195
padding: 5px;
199196
border-radius: 0;
@@ -203,7 +200,8 @@ body.tox-fullscreen, body.markdown-fullscreen {
203200
}
204201
.input-group .button {
205202
line-height: 1;
206-
margin: 0 0 0 -5px;
203+
margin-inline-start: -1px;
204+
margin-block: 0;
207205
box-shadow: none;
208206
border-radius: 0;
209207
}

resources/views/pages/parts/pointer.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
tabindex="-1"
77
aria-label="{{ trans('entities.pages_pointer_label') }}"
88
class="pointer-container">
9-
<div class="pointer flex-container-row items-center justify-space-between gap-xs p-xs anim {{ userCan('page-update', $page) ? 'is-page-editable' : ''}}" >
10-
<div refs="pointer@mode-section" class="flex-container-row items-center gap-xs">
9+
<div class="pointer flex-container-row items-center justify-space-between gap-xs p-xs anim" >
10+
<div refs="pointer@mode-section" class="flex flex-container-row items-center gap-xs">
1111
<button refs="pointer@mode-toggle"
1212
title="{{ trans('entities.pages_pointer_toggle_link') }}"
1313
class="text-button icon px-xs">@icon('link')</button>
14-
<div class="input-group">
14+
<div class="input-group flex flex-container-row items-center">
1515
<input refs="pointer@link-input" aria-label="{{ trans('entities.pages_pointer_permalink') }}" readonly="readonly" type="text" id="pointer-url" placeholder="url">
1616
<button refs="pointer@link-button" class="button outline icon px-xs" type="button" title="{{ trans('entities.pages_copy_link') }}">@icon('copy')</button>
1717
</div>
1818
</div>
19-
<div refs="pointer@mode-section" hidden class="flex-container-row items-center gap-s">
19+
<div refs="pointer@mode-section" hidden class="flex flex-container-row items-center gap-xs">
2020
<button refs="pointer@mode-toggle"
2121
title="{{ trans('entities.pages_pointer_toggle_include') }}"
2222
class="text-button icon px-xs">@icon('include')</button>
23-
<div class="input-group">
23+
<div class="input-group flex flex-container-row items-center">
2424
<input refs="pointer@include-input" aria-label="{{ trans('entities.pages_pointer_include_tag') }}" readonly="readonly" type="text" id="pointer-include" placeholder="include">
2525
<button refs="pointer@include-button" class="button outline icon px-xs" type="button" title="{{ trans('entities.pages_copy_link') }}">@icon('copy')</button>
2626
</div>

0 commit comments

Comments
 (0)