Keep empty region previews blank
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
function renderPreview(region, value) {
|
||||
var html = normalizePreviewValue(value !== undefined ? value : region).trim();
|
||||
if (!html) {
|
||||
return '<div class="slide-preview-placeholder">HTML</div>';
|
||||
return '';
|
||||
}
|
||||
if (/^<!doctype\b/i.test(html) || /^<html\b/i.test(html)) {
|
||||
return '<iframe class="slide-preview-html-frame" sandbox="" allowtransparency="true" scrolling="no" srcdoc="' + escapeHtml(buildHtmlDocument(html)) + '" title="HTML preview" loading="eager" style="width:100%;height:100%;border:0;display:block;background:transparent;overflow:hidden;"></iframe>';
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
var content = value && typeof value === 'object' && value.value !== undefined ? value : null;
|
||||
var src = String(content ? content.value : value || '').trim();
|
||||
if (!src) {
|
||||
return '<div class="slide-preview-placeholder">Image</div>';
|
||||
return '';
|
||||
}
|
||||
return '<img class="slide-preview-image" src="' + escapeHtml(src) + '" alt="" style="width:100%;height:100%;object-fit:contain;display:block;" />';
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@
|
||||
src = svgSrc || buildStyledQrSvgMarkup(value);
|
||||
}
|
||||
if (!src) {
|
||||
return '<div class="slide-preview-placeholder">QR Code</div>';
|
||||
return '';
|
||||
}
|
||||
if (/^data:image\//i.test(src)) {
|
||||
return '<img class="slide-preview-qr-code" src="' + escapeHtml(src) + '" alt="QR code preview" style="' + imageStyle + '" />';
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
function getPreviewFallback(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return '<div class="slide-preview-placeholder">RSS item</div>';
|
||||
return '';
|
||||
}
|
||||
|
||||
var title = String(item.title || '').trim();
|
||||
@@ -171,7 +171,7 @@
|
||||
summary.push('<p>' + sanitizePreviewHtml(description) + '</p>');
|
||||
}
|
||||
if (!summary.length) {
|
||||
return '<div class="slide-preview-placeholder">RSS item</div>';
|
||||
return '';
|
||||
}
|
||||
return summary.join('');
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
function renderPreview(value, disableAudio) {
|
||||
var content = value && typeof value === 'object' && value.value !== undefined ? value : null;
|
||||
var src = String(content ? content.value : value || '').trim();
|
||||
var label = src ? 'RTMP' : 'RTMP stream';
|
||||
if (!src) {
|
||||
return '';
|
||||
}
|
||||
var label = 'RTMP';
|
||||
if (disableAudio) {
|
||||
label += ' (muted)';
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
var rawValue = value && typeof value === 'object' && value.value !== undefined ? value.value : value;
|
||||
var raw = String(rawValue || '');
|
||||
if (!raw) {
|
||||
return '<div class="slide-preview-placeholder">Empty text</div>';
|
||||
return '';
|
||||
}
|
||||
|
||||
var style = styleOrContext && styleOrContext.style ? styleOrContext.style : styleOrContext || {};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
var content = value && typeof value === 'object' && value.value !== undefined ? value : null;
|
||||
var src = String(content ? content.value : value || '').trim();
|
||||
if (!src) {
|
||||
return '<div class="slide-preview-placeholder">Video</div>';
|
||||
return '';
|
||||
}
|
||||
return '<video class="slide-preview-video" src="' + escapeHtml(src) + '" autoplay loop muted playsinline preload="metadata" style="width:100%;height:100%;object-fit:contain;display:block;"></video>';
|
||||
}
|
||||
|
||||
@@ -148,10 +148,11 @@
|
||||
|
||||
function renderPreview(region, content, context) {
|
||||
var locations = context && context.weatherLocations ? context.weatherLocations : [];
|
||||
var value = String(content && content.value || '');
|
||||
if (!value.trim()) return '';
|
||||
var location = getLocationById(content && content.weather_location_id, locations);
|
||||
var snapshot = getSnapshot(location);
|
||||
var value = String(content && content.value || '');
|
||||
if (!location || !snapshot) return '<div class="template-region weather"><div class="slide-preview-placeholder">Select a weather location with cached data</div></div>';
|
||||
if (!location || !snapshot) return '';
|
||||
var weatherData = withWeatherUnits(snapshot, location);
|
||||
if (value) {
|
||||
var fontSize = Math.max(8, Number(content && content.font_size || region && (region.font_size || region.fontSize) || 32) || 32);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
function renderPreview(region, value) {
|
||||
var src = normalizePreviewValue(value !== undefined ? value : region).trim();
|
||||
if (!src) {
|
||||
return '<div class="slide-preview-placeholder">Webpage</div>';
|
||||
return '';
|
||||
}
|
||||
return '<iframe class="slide-preview-webpage-frame" src="' + escapeHtml(src) + '" title="Webpage preview" loading="eager" referrerpolicy="no-referrer" scrolling="no" style="width:100%;height:100%;border:0;display:block;background:#fff;overflow:hidden;"></iframe>';
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ export function createSlideFormPreviewHelpers(options) {
|
||||
}
|
||||
var raw = String(rawValue || '');
|
||||
if (!raw) {
|
||||
return '<div class="slide-preview-placeholder">Empty text</div>';
|
||||
return '';
|
||||
}
|
||||
return sanitizePreviewHtml(raw);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ export function createSlideFormRegionHelpers(options) {
|
||||
}
|
||||
|
||||
if (!item || typeof item !== 'object') {
|
||||
return '<div class="slide-preview-placeholder">RSS item</div>';
|
||||
return '';
|
||||
}
|
||||
|
||||
var title = String(item.title || '').trim();
|
||||
@@ -336,7 +336,7 @@ export function createSlideFormRegionHelpers(options) {
|
||||
summary.push('<p>' + sanitizePreviewHtml(description) + '</p>');
|
||||
}
|
||||
if (!summary.length) {
|
||||
return '<div class="slide-preview-placeholder">RSS item</div>';
|
||||
return '';
|
||||
}
|
||||
return summary.join('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user