]> BookStack Code Mirror - bookstack/commitdiff
Comments: Fixed pointer display, Fixed translation test 5584/head
authorDan Brown <redacted>
Tue, 13 May 2025 11:03:15 +0000 (12:03 +0100)
committerDan Brown <redacted>
Tue, 13 May 2025 11:03:15 +0000 (12:03 +0100)
resources/js/services/__tests__/translations.test.ts
resources/js/services/translations.ts
resources/sass/_pages.scss
resources/views/pages/parts/pointer.blade.php

index 043f1745ff675e3f81d665e0b1f185cb1ae0d0a0..5014051ab0434274ce5bf564f57058d8a0a75faa 100644 (file)
@@ -58,6 +58,11 @@ describe('Translations Service', () => {
             expect(caseB).toEqual('an orange angry big dinosaur');
         });
 
+        test('it provides count as a replacement by default', () => {
+            const caseA = $trans.choice(`:count cats|:count dogs`, 4);
+            expect(caseA).toEqual('4 dogs');
+        });
+
         test('not provided replacements are left as-is', () => {
             const caseA = $trans.choice(`An :a dog`, 5, {});
             expect(caseA).toEqual('An :a dog');
index 821c34f18f753364264003d8ddcc0e26395884a5..f548a51d1d17d4094d6f2e51fb204989e4d5111d 100644 (file)
@@ -10,7 +10,7 @@ export class Translator {
      * to use. Similar format at Laravel's 'trans_choice' helper.
      */
     choice(translation: string, count: number, replacements: Record<string, string> = {}): string {
-        replacements = Object.assign({}, replacements, {count: String(count)});
+        replacements = Object.assign({}, {count: String(count)}, replacements);
         const splitText = translation.split('|');
         const exactCountRegex = /^{([0-9]+)}/;
         const rangeRegex = /^\[([0-9]+),([0-9*]+)]/;
index 621d08f45f2be4e844b80279dee17977f965c50b..83aec46f0935c62824d35e3f8c48bb2493f86206 100755 (executable)
@@ -158,11 +158,7 @@ body.tox-fullscreen, body.markdown-fullscreen {
   border-radius: 4px;
   box-shadow: 0 0 12px 1px rgba(0, 0, 0, 0.1);
   @include mixins.lightDark(background-color, #fff, #333);
-  width: 275px;
-
-  &.is-page-editable {
-    width: 328px;
-  }
+  width: 328px;
 
   &:before {
     position: absolute;
@@ -193,7 +189,8 @@ body.tox-fullscreen, body.markdown-fullscreen {
     border: 1px solid #DDD;
     @include mixins.lightDark(border-color, #ddd, #000);
     color: #666;
-    width: 180px;
+    width: auto;
+    flex: 1;
     z-index: 58;
     padding: 5px;
     border-radius: 0;
@@ -203,7 +200,8 @@ body.tox-fullscreen, body.markdown-fullscreen {
   }
   .input-group .button {
     line-height: 1;
-    margin: 0 0 0 -5px;
+    margin-inline-start: -1px;
+    margin-block: 0;
     box-shadow: none;
     border-radius: 0;
   }
index 77fc763827e05049168d477237d922c1284d7c5a..f6487b66600d4c6051b68ec99d38912fa99fedad 100644 (file)
@@ -6,21 +6,21 @@
          tabindex="-1"
          aria-label="{{ trans('entities.pages_pointer_label') }}"
          class="pointer-container">
-        <div class="pointer flex-container-row items-center justify-space-between gap-xs p-xs anim {{ userCan('page-update', $page) ? 'is-page-editable' : ''}}" >
-            <div refs="pointer@mode-section" class="flex-container-row items-center gap-xs">
+        <div class="pointer flex-container-row items-center justify-space-between gap-xs p-xs anim" >
+            <div refs="pointer@mode-section" class="flex flex-container-row items-center gap-xs">
                 <button refs="pointer@mode-toggle"
                         title="{{ trans('entities.pages_pointer_toggle_link') }}"
                         class="text-button icon px-xs">@icon('link')</button>
-                <div class="input-group">
+                <div class="input-group flex flex-container-row items-center">
                     <input refs="pointer@link-input" aria-label="{{ trans('entities.pages_pointer_permalink') }}" readonly="readonly" type="text" id="pointer-url" placeholder="url">
                     <button refs="pointer@link-button" class="button outline icon px-xs" type="button" title="{{ trans('entities.pages_copy_link') }}">@icon('copy')</button>
                 </div>
             </div>
-            <div refs="pointer@mode-section" hidden class="flex-container-row items-center gap-s">
+            <div refs="pointer@mode-section" hidden class="flex flex-container-row items-center gap-xs">
                 <button refs="pointer@mode-toggle"
                         title="{{ trans('entities.pages_pointer_toggle_include') }}"
                         class="text-button icon px-xs">@icon('include')</button>
-                <div class="input-group">
+                <div class="input-group flex flex-container-row items-center">
                     <input refs="pointer@include-input" aria-label="{{ trans('entities.pages_pointer_include_tag') }}" readonly="readonly" type="text" id="pointer-include" placeholder="include">
                     <button refs="pointer@include-button" class="button outline icon px-xs" type="button" title="{{ trans('entities.pages_copy_link') }}">@icon('copy')</button>
                 </div>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.