diff options
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/custom-markup.service.ts')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/custom-markup.service.ts | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts index aa5dbe643..729cd296b 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts | |||
@@ -168,11 +168,15 @@ export class CustomMarkupService { | |||
168 | 168 | ||
169 | const model = { | 169 | const model = { |
170 | onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false, | 170 | onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false, |
171 | maxRows: this.buildNumber(data.maxRows) ?? -1, | ||
172 | |||
171 | sort: data.sort || '-publishedAt', | 173 | sort: data.sort || '-publishedAt', |
174 | count: this.buildNumber(data.count) || 10, | ||
175 | |||
172 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], | 176 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], |
173 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], | 177 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], |
174 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined, | 178 | |
175 | count: this.buildNumber(data.count) || 10 | 179 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined |
176 | } | 180 | } |
177 | 181 | ||
178 | this.dynamicElementService.setModel(component, model) | 182 | this.dynamicElementService.setModel(component, model) |
@@ -183,11 +187,16 @@ export class CustomMarkupService { | |||
183 | private containerBuilder (el: HTMLElement) { | 187 | private containerBuilder (el: HTMLElement) { |
184 | const data = el.dataset as ContainerMarkupData | 188 | const data = el.dataset as ContainerMarkupData |
185 | 189 | ||
190 | // Move inner HTML in the new element we'll create | ||
191 | const content = el.innerHTML | ||
192 | el.innerHTML = '' | ||
193 | |||
186 | const root = document.createElement('div') | 194 | const root = document.createElement('div') |
195 | root.innerHTML = content | ||
187 | 196 | ||
188 | const layoutClass = data.layout | 197 | const layoutClass = data.layout |
189 | ? 'layout-' + data.layout | 198 | ? 'layout-' + data.layout |
190 | : 'layout-row' | 199 | : 'layout-column' |
191 | 200 | ||
192 | root.classList.add('peertube-container', layoutClass) | 201 | root.classList.add('peertube-container', layoutClass) |
193 | 202 | ||
@@ -195,16 +204,23 @@ export class CustomMarkupService { | |||
195 | root.setAttribute('width', data.width) | 204 | root.setAttribute('width', data.width) |
196 | } | 205 | } |
197 | 206 | ||
198 | if (data.title) { | 207 | if (data.title || data.description) { |
199 | const titleElement = document.createElement('h4') | 208 | const headerElement = document.createElement('div') |
200 | titleElement.innerText = data.title | 209 | headerElement.classList.add('header') |
201 | root.appendChild(titleElement) | 210 | |
202 | } | 211 | if (data.title) { |
212 | const titleElement = document.createElement('h4') | ||
213 | titleElement.innerText = data.title | ||
214 | headerElement.appendChild(titleElement) | ||
215 | } | ||
216 | |||
217 | if (data.description) { | ||
218 | const descriptionElement = document.createElement('div') | ||
219 | descriptionElement.innerText = data.description | ||
220 | headerElement.append(descriptionElement) | ||
221 | } | ||
203 | 222 | ||
204 | if (data.description) { | 223 | root.insertBefore(headerElement, root.firstChild) |
205 | const descriptionElement = document.createElement('div') | ||
206 | descriptionElement.innerText = data.description | ||
207 | root.appendChild(descriptionElement) | ||
208 | } | 224 | } |
209 | 225 | ||
210 | return root | 226 | return root |