diff --git a/client/assets/defaultStyles.css b/client/assets/defaultStyles.css
index 027ccdf2..e0ca79e2 100644
--- a/client/assets/defaultStyles.css
+++ b/client/assets/defaultStyles.css
@@ -52,4 +52,17 @@
text-indent: 0px !important;
text-align: start !important;
text-align-last: start !important;
-}
\ No newline at end of file
+}
+
+.default-style.less-spacing p {
+ margin-block-start: 0;
+}
+
+.default-style.less-spacing ul {
+ margin-block-start: 0;
+}
+
+.default-style.less-spacing ol {
+ margin-block-start: 0;
+}
+
diff --git a/client/assets/trix.css b/client/assets/trix.css
index 8f88c61f..7432b25f 100644
--- a/client/assets/trix.css
+++ b/client/assets/trix.css
@@ -446,7 +446,7 @@ trix-editor .attachment__metadata .attachment__size {
}
.trix-content {
- line-height: 1.5;
+ line-height: inherit;
}
.trix-content * {
@@ -455,6 +455,13 @@ trix-editor .attachment__metadata .attachment__size {
padding: 0;
}
+.trix-content p {
+ box-sizing: border-box;
+ margin-top: 0;
+ margin-bottom: 0.5em;
+ padding: 0;
+}
+
.trix-content h1 {
font-size: 1.2em;
line-height: 1.2;
@@ -560,4 +567,4 @@ trix-editor .attachment__metadata .attachment__size {
.trix-content .attachment-gallery.attachment-gallery--4 .attachment {
flex-basis: 50%;
max-width: 50%;
-}
\ No newline at end of file
+}
diff --git a/client/components/cards/BookMatchCard.vue b/client/components/cards/BookMatchCard.vue
index d5355e91..4fa24c1f 100644
--- a/client/components/cards/BookMatchCard.vue
+++ b/client/components/cards/BookMatchCard.vue
@@ -24,7 +24,7 @@
diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue
index a0cadc1d..714e326c 100644
--- a/client/pages/item/_id/index.vue
+++ b/client/pages/item/_id/index.vue
@@ -123,7 +123,7 @@
-
{{ description }}
+
@@ -804,8 +804,7 @@ export default {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
- max-height: 6.25rem;
- transition: all 0.3s ease-in-out;
+ max-height: calc(6 * 1lh);
}
#item-description.show-full {
-webkit-line-clamp: unset;
diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js
index f4323094..8fde7bc4 100644
--- a/server/finders/BookFinder.js
+++ b/server/finders/BookFinder.js
@@ -8,6 +8,7 @@ const AudiobookCovers = require('../providers/AudiobookCovers')
const CustomProviderAdapter = require('../providers/CustomProviderAdapter')
const Logger = require('../Logger')
const { levenshteinDistance, escapeRegExp } = require('../utils/index')
+const htmlSanitizer = require('../utils/htmlSanitizer')
class BookFinder {
#providerResponseTimeout = 30000
@@ -463,6 +464,12 @@ class BookFinder {
} else {
books = await this.getGoogleBooksResults(title, author)
}
+ books.forEach((book) => {
+ if (book.description) {
+ book.description = htmlSanitizer.sanitize(book.description)
+ book.descriptionPlain = htmlSanitizer.stripAllTags(book.description)
+ }
+ })
return books
}
diff --git a/server/models/Book.js b/server/models/Book.js
index 5a4eee54..527960ea 100644
--- a/server/models/Book.js
+++ b/server/models/Book.js
@@ -2,6 +2,7 @@ const { DataTypes, Model } = require('sequelize')
const Logger = require('../Logger')
const { getTitlePrefixAtEnd, getTitleIgnorePrefix } = require('../utils')
const parseNameString = require('../utils/parsers/parseNameString')
+const htmlSanitizer = require('../utils/htmlSanitizer')
/**
* @typedef EBookFileObject
@@ -579,6 +580,7 @@ class Book extends Model {
oldMetadataJSON.authorNameLF = this.authorNameLF
oldMetadataJSON.narratorName = (this.narrators || []).join(', ')
oldMetadataJSON.seriesName = this.seriesName
+ oldMetadataJSON.descriptionPlain = this.description ? htmlSanitizer.stripAllTags(this.description) : null
return oldMetadataJSON
}
diff --git a/server/providers/Audible.js b/server/providers/Audible.js
index 505b8f0e..e6816082 100644
--- a/server/providers/Audible.js
+++ b/server/providers/Audible.js
@@ -1,5 +1,4 @@
const axios = require('axios').default
-const htmlSanitizer = require('../utils/htmlSanitizer')
const Logger = require('../Logger')
const { isValidASIN } = require('../utils/index')
@@ -68,7 +67,7 @@ class Audible {
narrator: narrators ? narrators.map(({ name }) => name).join(', ') : null,
publisher: publisherName,
publishedYear: releaseDate ? releaseDate.split('-')[0] : null,
- description: summary ? htmlSanitizer.stripAllTags(summary) : null,
+ description: summary || null,
cover: image,
asin,
genres: genresFiltered.length ? genresFiltered : null,
diff --git a/server/providers/iTunes.js b/server/providers/iTunes.js
index 1ec051d1..57a47d0d 100644
--- a/server/providers/iTunes.js
+++ b/server/providers/iTunes.js
@@ -112,7 +112,7 @@ class iTunes {
artistId: data.artistId,
title: data.collectionName,
author,
- description: htmlSanitizer.stripAllTags(data.description || ''),
+ description: data.description || null,
publishedYear: data.releaseDate ? data.releaseDate.split('-')[0] : null,
genres: data.primaryGenreName ? [data.primaryGenreName] : null,
cover: this.getCoverArtwork(data)
diff --git a/server/utils/htmlSanitizer.js b/server/utils/htmlSanitizer.js
index 68d92c85..cab92392 100644
--- a/server/utils/htmlSanitizer.js
+++ b/server/utils/htmlSanitizer.js
@@ -1,11 +1,9 @@
const sanitizeHtml = require('../libs/sanitizeHtml')
-const { entities } = require("./htmlEntities");
+const { entities } = require('./htmlEntities')
function sanitize(html) {
const sanitizerOptions = {
- allowedTags: [
- 'p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br'
- ],
+ allowedTags: ['p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br', 'b', 'i'],
disallowedTagsMode: 'discard',
allowedAttributes: {
a: ['href', 'name', 'target']
@@ -34,6 +32,6 @@ function decodeHTMLEntities(strToDecode) {
if (entity in entities) {
return entities[entity]
}
- return entity;
+ return entity
})
}