independant elements from p + delete p from li
This commit is contained in:
parent
048a1b67e6
commit
c321a17f3e
8 changed files with 36 additions and 19 deletions
|
|
@ -107,10 +107,10 @@ h2{
|
|||
h5{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}*/
|
||||
.marker-title img{
|
||||
width: 40px;
|
||||
} */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
|||
1772466016
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 1.5 MiB |
|
|
@ -1 +1 @@
|
|||
Uuid: eozkssgjffkkux34
|
||||
Uuid: rbrttd19ethtb0ue
|
||||
0
public/site/cache/index.html
vendored
0
public/site/cache/index.html
vendored
|
|
@ -22,6 +22,13 @@ function resolveFileUrl($field, $page) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprime les <p> imbriqués dans les <li> (générés par Kirby pour les listes "loose")
|
||||
*/
|
||||
function stripParagraphsInListItems($html) {
|
||||
return preg_replace('/<li>\s*<p>(.*?)<\/p>\s*<\/li>/s', '<li>$1</li>', $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Résout les images dans le contenu HTML
|
||||
*/
|
||||
|
|
@ -63,7 +70,7 @@ function parseBlocks($blocksField, $page) {
|
|||
switch ($block->type()) {
|
||||
case 'text':
|
||||
$blockData['content'] = [
|
||||
'text' => resolveImagesInHtml($block->text()->value(), $page)
|
||||
'text' => stripParagraphsInListItems(resolveImagesInHtml($block->text()->value(), $page))
|
||||
];
|
||||
break;
|
||||
|
||||
|
|
@ -87,7 +94,7 @@ function parseBlocks($blocksField, $page) {
|
|||
|
||||
case 'list':
|
||||
$blockData['content'] = [
|
||||
'text' => $block->text()->value()
|
||||
'text' => stripParagraphsInListItems($block->text()->value())
|
||||
];
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -306,9 +306,11 @@ export function useElementSettings({ margin, padding, basePopup }) {
|
|||
getValue: () => bold.value ? 'bold' : (INLINE_DEFAULTS[currentTag.value]?.fontWeight || null),
|
||||
skip: () => !bold.value && !INLINE_DEFAULTS[currentTag.value]?.fontWeight && !hasInCss('font-weight') },
|
||||
{ css: 'font-size', group: 'fontSize', special: true,
|
||||
getValue: () => `${fontSize.value}${fontSize.unit}` },
|
||||
getValue: () => `${fontSize.value}${fontSize.unit}`,
|
||||
skip: () => isIndependentElement.value && !settingEnabled.fontSize && !hasInCss('font-size') },
|
||||
{ css: 'line-height', group: 'lineHeight', special: true,
|
||||
getValue: () => `${lineHeight.value}${lineHeight.unit}` },
|
||||
getValue: () => `${lineHeight.value}${lineHeight.unit}`,
|
||||
skip: () => isIndependentElement.value && !settingEnabled.lineHeight && !hasInCss('line-height') },
|
||||
{ css: 'text-align', group: 'textAlign',
|
||||
getValue: () => textAlign.value,
|
||||
skip: () => !settingEnabled.textAlign && !hasInCss('text-align') },
|
||||
|
|
@ -345,6 +347,10 @@ export function useElementSettings({ margin, padding, basePopup }) {
|
|||
|
||||
const isInlineElement = computed(() => !!INLINE_DEFAULTS[currentTag.value]);
|
||||
|
||||
// Elements that don't inherit font-size/line-height from <p> — fully independent of TextSettings p-level
|
||||
const INDEPENDENT_TAGS = new Set(['li', 'ul', 'ol', 'dt', 'dd', 'dl', 'table', 'tr', 'td', 'th', 'caption', 'figure', 'figcaption', 'pre', 'blockquote']);
|
||||
const isIndependentElement = computed(() => INDEPENDENT_TAGS.has(currentTag.value));
|
||||
|
||||
// Check if the current selector has a CSS property in the store
|
||||
const hasInCss = (cssProp) => {
|
||||
if (!selector.value) return false;
|
||||
|
|
@ -642,28 +648,33 @@ export function useElementSettings({ margin, padding, basePopup }) {
|
|||
}
|
||||
}
|
||||
|
||||
// Fallback to TextSettings defaults only if the selector doesn't already have the value
|
||||
// Fallback to TextSettings defaults only if the selector doesn't already have the value.
|
||||
// Independent elements (li, ul, ol, table...) don't inherit from <p> — only body-level fallbacks apply.
|
||||
const independent = isIndependentElement.value;
|
||||
|
||||
if (!settingEnabled.font && !settingCache.font) {
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-family')) {
|
||||
const ff = stylesheetStore.extractValue('body', 'font-family');
|
||||
if (ff) fontFamily.value = (typeof ff === 'string' ? ff : ff.value).replace(/['"]/g, '');
|
||||
}
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-style')) {
|
||||
const fs = stylesheetStore.extractValue('p', 'font-style');
|
||||
if (fs) italic.value = (typeof fs === 'string' ? fs : fs.value) === 'italic';
|
||||
}
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-weight')) {
|
||||
const fw = stylesheetStore.extractValue('p', 'font-weight');
|
||||
if (fw) { const v = typeof fw === 'string' ? fw : fw.value; bold.value = v === 'bold' || parseInt(v) >= 700; }
|
||||
if (!independent) {
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-style')) {
|
||||
const fs = stylesheetStore.extractValue('p', 'font-style');
|
||||
if (fs) italic.value = (typeof fs === 'string' ? fs : fs.value) === 'italic';
|
||||
}
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-weight')) {
|
||||
const fw = stylesheetStore.extractValue('p', 'font-weight');
|
||||
if (fw) { const v = typeof fw === 'string' ? fw : fw.value; bold.value = v === 'bold' || parseInt(v) >= 700; }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!settingEnabled.fontSize && !settingCache.fontSize) {
|
||||
if (!independent && !settingEnabled.fontSize && !settingCache.fontSize) {
|
||||
if (!stylesheetStore.extractValue(selector.value, 'font-size')) {
|
||||
const data = stylesheetStore.extractValue('p', 'font-size');
|
||||
if (data && data.value !== undefined) { fontSize.value = data.value; fontSize.unit = data.unit; }
|
||||
}
|
||||
}
|
||||
if (!settingEnabled.lineHeight && !settingCache.lineHeight) {
|
||||
if (!independent && !settingEnabled.lineHeight && !settingCache.lineHeight) {
|
||||
if (!stylesheetStore.extractValue(selector.value, 'line-height')) {
|
||||
const data = stylesheetStore.extractValue('p', 'line-height');
|
||||
if (data && data.value !== undefined) { lineHeight.value = data.value; lineHeight.unit = data.unit; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue