|
1 | 1 | # @craftile/editor |
2 | 2 |
|
| 3 | +## 1.0.0 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [`b11cf71`](https://github.com/craftile/editor/commit/b11cf714d9e4d9fbb484a7a8e69355aa5f2f3016) Thanks [@eldomagan](https://github.com/eldomagan)! - fix(editor): add guard to clearSelectedBlock to prevent unnecessary events |
| 8 | + |
| 9 | + Add early return in `clearSelectedBlock()` when no block is selected, preventing unnecessary event emissions and state updates. |
| 10 | + |
| 11 | +- [`668c3d9`](https://github.com/craftile/editor/commit/668c3d90abcbbf6835c78be991d0896bad020500) Thanks [@eldomagan](https://github.com/eldomagan)! - feat: add region id support with name as display label |
| 12 | + |
| 13 | + This release adds support for optional `id` field on regions, allowing regions to have a unique identifier separate from their display name. |
| 14 | + |
| 15 | + ## Breaking Changes |
| 16 | + - **@craftile/core**: Renamed `regionName` to `regionId` in all engine events (`block:insert`, `block:move`, `block:duplicate`, `block:remove`) |
| 17 | + - **@craftile/core**: Engine methods now use `regionId` parameter instead of `regionName` |
| 18 | + - **@craftile/types**: `EngineEvents` interfaces now use `regionId` and `sourceRegionId` fields |
| 19 | + |
| 20 | + ## New Features |
| 21 | + - **@craftile/types**: Added optional `id` field to `Region` interface |
| 22 | + - **@craftile/core**: Added `getRegionId()` helper function that returns `region.id || region.name` |
| 23 | + - Regions now support both `id` (unique identifier) and `name` (display label) |
| 24 | + - Automatic fallback to `name` when `id` is not provided for backward compatibility |
| 25 | + |
| 26 | + ## Migration Guide |
| 27 | + |
| 28 | + If you have custom code using the engine API: |
| 29 | + |
| 30 | + ```typescript |
| 31 | + // Before |
| 32 | + engine.insertBlock(block, { regionName: 'main' }); |
| 33 | + |
| 34 | + // After |
| 35 | + engine.insertBlock(block, { regionId: 'main' }); |
| 36 | + ``` |
| 37 | + |
| 38 | + If you're listening to engine events: |
| 39 | + |
| 40 | + ```typescript |
| 41 | + // Before |
| 42 | + engine.on('block:insert', ({ regionName }) => { |
| 43 | + console.log(regionName); |
| 44 | + }); |
| 45 | + |
| 46 | + // After |
| 47 | + engine.on('block:insert', ({ regionId }) => { |
| 48 | + console.log(regionId); |
| 49 | + }); |
| 50 | + ``` |
| 51 | + |
| 52 | + If you're defining regions in your page data: |
| 53 | + |
| 54 | + ```typescript |
| 55 | + // Before (still works) |
| 56 | + regions: [{ name: 'main', blocks: [] }]; |
| 57 | + |
| 58 | + // After (recommended) |
| 59 | + regions: [{ id: 'main', name: 'Main Content', blocks: [] }]; |
| 60 | + ``` |
| 61 | + |
| 62 | +- Updated dependencies [[`668c3d9`](https://github.com/craftile/editor/commit/668c3d90abcbbf6835c78be991d0896bad020500)]: |
| 63 | + - @craftile/types@1.0.0 |
| 64 | + - @craftile/core@1.0.0 |
| 65 | + - @craftile/event-bus@1.0.0 |
| 66 | + - @craftile/messenger@1.0.0 |
| 67 | + |
3 | 68 | ## 0.11.0 |
4 | 69 |
|
5 | 70 | ### Minor Changes |
|
0 commit comments