Fassung 1.6.1: flexible Editorflaeche und passende Blockeigenschaften
CMS quality / php (8.2) (push) Canceled after 0s
CMS quality / php (8.4) (push) Canceled after 0s
CMS quality / browser (push) Canceled after 0s
CMS quality / mysql (push) Canceled after 0s

This commit is contained in:
kantarci committed 2026-09-14 08:57:42 +02:00
1 parent 05ea703655
commit b783d9d1e5
13 files changed
+276 -11

No files matched your search

+24
View File
@@ -4,6 +4,30 @@ import { readFileSync, readdirSync } from 'node:fs';
import { EditorHistory, createBlock, locate, insertBlock, insertBlockAt, moveBlockTo, dropList, insertionTarget, insertRowAt, CATEGORIES, labels as blockLabels, duplicateBlock, moveBlock, upgradeDocument, effectiveDesign, setDesign, insertPreset, insertRow, blockPath, insertMedia, setEffect, isPluginBlock, blockLabel, blockIcon, canContain, isContainer, setStyle, effectiveStyle, hoverStyle, resetStyleDevice, clearStyle, copyStyle, SCHEMA_VERSION } from '../public/assets/editor-model.js';
import { readFile } from 'node:fs/promises';
import { designCss } from '../scripts/build-design.mjs';
import { relevantProperty } from '../public/assets/editor-model.js';
test('sections start after the containing root, explicit placement can nest, undo restores the tree', () => {
const original = fixture();
const history = new EditorHistory(original);
const id = history.change(doc => insertBlock(doc, 'section', 't1'));
assert.equal(history.document.blocks[1].id, id);
assert.equal(locate(history.document.blocks, id).parent, null);
history.undo(); assert.deepEqual(history.document, original);
history.redo(); assert.equal(history.document.blocks[1].id, id);
const nested = history.change(doc => insertBlockAt(doc, 'section', 's1', 0));
assert.equal(locate(history.document.blocks, nested).parent.id, 's1');
});
test('design fields follow block type without hiding existing stored values', () => {
const text = createBlock('text'), image = createBlock('image');
assert.equal(relevantProperty(text, 'objectFit', { group: 'image' }), false);
assert.equal(relevantProperty(image, 'fontSize', { group: 'text' }), false);
assert.equal(relevantProperty(image, 'objectFit', { group: 'image' }), true);
assert.equal(relevantProperty(text, 'fontSize', { group: 'text' }), true);
assert.equal(relevantProperty(text, 'gridColumns', { group: 'layout' }), false);
image.style = { mobile: { fontSize: '14px' } };
assert.equal(relevantProperty(image, 'fontSize', { group: 'text' }), true);
});
function fixture() { return { schemaVersion: 1, title: 'Page', description: 'Description', blocks: [{ id: 's1', type: 'section', children: [{ id: 'h1', type: 'heading', props: { text: 'Hello', level: 1 } }, { id: 't1', type: 'text', props: { text: 'Body' } }] }, { id: 's2', type: 'section', children: [] }] }; }