From 5a443b6c4b2acd4f28cb33227b3b0c78ccf1ce92 Mon Sep 17 00:00:00 2001 From: Krishna Maurya Date: Sun, 6 Jun 2021 13:21:33 +0530 Subject: [PATCH] intro text spacing correction --- package-lock.json | 24 +++++++++++++++--------- package.json | 2 +- src/utils/getexperienceintrotext.js | 4 +++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 21b7a5b..5ee592f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3316,6 +3316,11 @@ "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -4414,9 +4419,9 @@ } }, "immer": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/immer/-/immer-7.0.15.tgz", - "integrity": "sha512-yM7jo9+hvYgvdCQdqvhCNRRio0SCXc8xDPzA25SvKWa7b1WVPjLwQs1VYU5JPXjcJPTqAa5NP5dqpORGYBQ2AA==" + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/immer/-/immer-8.0.4.tgz", + "integrity": "sha512-jMfL18P+/6P6epANRvRk6q8t+3gGhqsJ9EuJ25AXE+9bNTYtssvzeYbEd0mXRYWCmmXSIbnlpz6vd6iJlmGGGQ==" }, "import-lazy": { "version": "2.1.0", @@ -4823,7 +4828,8 @@ "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "dev": true }, "lodash.debounce": { "version": "4.0.8", @@ -6612,15 +6618,15 @@ "dev": true }, "slate": { - "version": "0.62.0", - "resolved": "https://registry.npmjs.org/slate/-/slate-0.62.0.tgz", - "integrity": "sha512-eV00ONY/wc0Xy8SragC04Iv5w2uZn2KE6eNACon1zojrwOs4RL+BUV8hZo2PKj2SBoxMJ4s/NGtqgTaUjBIRDw==", + "version": "0.63.0", + "resolved": "https://registry.npmjs.org/slate/-/slate-0.63.0.tgz", + "integrity": "sha512-np24XIRsGbwVgKQR6DWLorTRQD7arUKiztCKsepBNiYtMxHqjR76i2nJA6pdGn6Vj9q88Afi9eYwCsfnzy2hBA==", "requires": { "@types/esrever": "^0.2.0", "esrever": "^0.2.0", - "immer": "^7.0.0", + "fast-deep-equal": "^3.1.3", + "immer": "^8.0.1", "is-plain-object": "^3.0.0", - "lodash": "^4.17.4", "tiny-warning": "^1.0.3" }, "dependencies": { diff --git a/package.json b/package.json index 49a9910..60d544c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "mysql2": "2.1.0", "nodemailer": "6.4.11", "nodemailer-ses-transport": "1.5.1", - "slate": "^0.62.0", + "slate": "^0.63.0", "slugify": "1.4.0" } } diff --git a/src/utils/getexperienceintrotext.js b/src/utils/getexperienceintrotext.js index 895b61a..5ddf420 100644 --- a/src/utils/getexperienceintrotext.js +++ b/src/utils/getexperienceintrotext.js @@ -3,9 +3,11 @@ import { Node } from 'slate'; const FEATURED_TEXT_LENGTH = 140; const serialize = nodes => { + let nodeString = [] let text = "" for(const node of nodes || []) { - text += Node.string(node) + nodeString.push(Node.string(node)) + text = nodeString.join(" ") if(text.length>FEATURED_TEXT_LENGTH) { text = `${text.slice(0, FEATURED_TEXT_LENGTH).trim()}...` break;