From c86503005c3ae256abbebae1192a3b0e5137b89b Mon Sep 17 00:00:00 2001
From: Ruben Bimberg <ruben.bimberg@mni.thm.de>
Date: Wed, 7 Jul 2021 22:21:36 +0200
Subject: [PATCH] Limit the size of the tag cloud

Also denied keywords with less than 2 character.
---
 .../shared/tag-cloud/tag-cloud.component.ts   | 22 +++++++++----------
 src/app/utils/create-comment-keywords.ts      |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts
index 1e81f07f2..d2c8a44b9 100644
--- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts
+++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts
@@ -114,18 +114,18 @@ const getDefaultCloudParameters = (): CloudParameters => {
   const resDefaultColors = getResolvedDefaultColors();
   const minValue = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;
   const isMobile = minValue < 500;
-  const elements = isMobile ? 5 : -1;
+  const elements = isMobile ? 5 : 10;
   const weightSettings: CloudWeightSettings = [
-    { maxVisibleElements: elements, color: resDefaultColors[1], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[2], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[3], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[4], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[5], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[6], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[7], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[8], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[9], rotation: 0, allowManualTagNumber: isMobile },
-    { maxVisibleElements: elements, color: resDefaultColors[10], rotation: 0, allowManualTagNumber: isMobile },
+    { maxVisibleElements: elements, color: resDefaultColors[1], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[2], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[3], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[4], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[5], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[6], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[7], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[8], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[9], rotation: 0, allowManualTagNumber: true },
+    { maxVisibleElements: elements, color: resDefaultColors[10], rotation: 0, allowManualTagNumber: true },
   ];
   const mapValue = (current: number, minInputValue: number, maxInputValue: number, minOut: number, maxOut: number) => {
     const value = (current - minInputValue) * (maxOut - minOut) / (maxInputValue - minInputValue) + minOut;
diff --git a/src/app/utils/create-comment-keywords.ts b/src/app/utils/create-comment-keywords.ts
index 02f8ae6e3..773b0c3bb 100644
--- a/src/app/utils/create-comment-keywords.ts
+++ b/src/app/utils/create-comment-keywords.ts
@@ -5,7 +5,7 @@ export class CreateCommentKeywords {
 
   static isKeywordAcceptable(keyword: string) {
     const regex = /(^[ -@\[-`{-~]+$)/g;
-    return keyword.match(regex) === null && keyword.length;
+    return keyword.match(regex) === null && keyword.length > 1;
   }
 
   static isSpellingAcceptable(languagetoolService: LanguagetoolService, text: string, language: Language = 'auto') {
-- 
GitLab