Skip to content

Commit

Permalink
Remove html-truncate, truncate with CSS instead (github#17630)
Browse files Browse the repository at this point in the history
* Remove html-truncate, truncate with CSS instead

* Update search.js
  • Loading branch information
heiskr authored Feb 2, 2021
1 parent bbd54fe commit e07c603
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
6 changes: 1 addition & 5 deletions javascripts/search.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { tags } from './hyperscript'
import { sendEvent } from './events'
import searchWithYourKeyboard from 'search-with-your-keyboard'
import truncate from 'html-truncate'

const maxContentLength = 300

let $searchInputContainer
let $searchResultsContainer
Expand Down Expand Up @@ -274,8 +271,7 @@ function tmplSearchResult ({ url, breadcrumbs, heading, title, content }) {
),
div(
{ class: 'search-result-content d-block text-gray' },
// Truncate without breaking inner HTML tags
markify(truncate(content, maxContentLength))
markify(content)
)
)
)
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"highlightjs-graphql": "^1.0.2",
"hot-shots": "^8.2.0",
"html-entities": "^1.2.1",
"html-truncate": "^1.2.2",
"imurmurhash": "^0.1.4",
"ioredis": "^4.19.4",
"ioredis-mock": "^5.2.0",
Expand Down
1 change: 0 additions & 1 deletion script/check-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const main = async () => {
'style-loader',
'webpack-cli',
'browser-date-formatter',
'html-truncate',
'search-with-your-keyboard',
'uuid',
'imurmurhash',
Expand Down
5 changes: 5 additions & 0 deletions stylesheets/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ mark,
}
}

.search-result-content {
max-height: 4rem;
overflow: hidden;
}

.search-result-title em {
font-style: normal;
text-decoration: underline;
Expand Down

0 comments on commit e07c603

Please sign in to comment.