Skip to content

Commit e07c603

Browse files
authored
Remove html-truncate, truncate with CSS instead (#17630)
* Remove html-truncate, truncate with CSS instead * Update search.js
1 parent bbd54fe commit e07c603

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

javascripts/search.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { tags } from './hyperscript'
22
import { sendEvent } from './events'
33
import searchWithYourKeyboard from 'search-with-your-keyboard'
4-
import truncate from 'html-truncate'
5-
6-
const maxContentLength = 300
74

85
let $searchInputContainer
96
let $searchResultsContainer
@@ -274,8 +271,7 @@ function tmplSearchResult ({ url, breadcrumbs, heading, title, content }) {
274271
),
275272
div(
276273
{ class: 'search-result-content d-block text-gray' },
277-
// Truncate without breaking inner HTML tags
278-
markify(truncate(content, maxContentLength))
274+
markify(content)
279275
)
280276
)
281277
)

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"highlightjs-graphql": "^1.0.2",
5858
"hot-shots": "^8.2.0",
5959
"html-entities": "^1.2.1",
60-
"html-truncate": "^1.2.2",
6160
"imurmurhash": "^0.1.4",
6261
"ioredis": "^4.19.4",
6362
"ioredis-mock": "^5.2.0",

script/check-deps.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const main = async () => {
4242
'style-loader',
4343
'webpack-cli',
4444
'browser-date-formatter',
45-
'html-truncate',
4645
'search-with-your-keyboard',
4746
'uuid',
4847
'imurmurhash',

stylesheets/search.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ mark,
8989
}
9090
}
9191

92+
.search-result-content {
93+
max-height: 4rem;
94+
overflow: hidden;
95+
}
96+
9297
.search-result-title em {
9398
font-style: normal;
9499
text-decoration: underline;

0 commit comments

Comments
 (0)