Skip to content

Commit

Permalink
Merge branch 'main' into cb/issue-193-delete-icon-on-element
Browse files Browse the repository at this point in the history
* main:
  Update DragMenuOption.svelte (#214)
  Update changelog
  v0.1.0-rc.1
  Update changelog
  Shared event handlers (#195)
  v0.1.0-rc.1 changelog
  Issue 203: Disable dragLeave trigger on drag placeholder (#208)
  • Loading branch information
cbroeren committed Aug 30, 2024
2 parents e718062 + 2ed25b1 commit 5d265db
Show file tree
Hide file tree
Showing 15 changed files with 453 additions and 315 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ npm-debug.log

# Ignore ssr build for svelte.
/priv/svelte/

# `direnv` local environment config
.envrc
49 changes: 32 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
# Changelog

## 0.1.0-rc.1 (2024-08-27)

### Enhancements

- [Event Handler] Added Event Handlers ([#195](https://github.com/BeaconCMS/beacon_live_admin/pull/195))
- [Visual Editor] Allow to reorder an element among its siblings with drag and drop ([#174](https://github.com/BeaconCMS/beacon_live_admin/pull/174))

### Fixes

- [Visual Editor] Disable dragLeave trigger on drag placeholder ([#208](https://github.com/BeaconCMS/beacon_live_admin/pull/208))
- [Visual Editor] Reset drag states when dropping, even on invalid targets ([#206](https://github.com/BeaconCMS/beacon_live_admin/pull/206))
- [Visual Editor] Disable interacting with iframes ([#198](https://github.com/BeaconCMS/beacon_live_admin/pull/198))
- Remove defunct reference to agent assigns ([#200](https://github.com/BeaconCMS/beacon_live_admin/pull/200))

## 0.1.0-rc.0 (2024-08-02)

### Enhancements
* Media Library
* Upload, preview, and display image location
* Sorting and pagination
* Error Page
* Components
* Sorting and pagination
* Layouts
* Sorting and pagination
* Pages
* Visual Editor with HEEx and 2-way sync support
* Sorting and pagination
* Live Data
* Custom Pages
* Router helper `~p` to generate paths with site prefixes
* Content management through the `Beacon.Content` API
* A/B Variants
* TailwindCSS compiler

- Media Library
- Upload, preview, and display image location
- Sorting and pagination
- Error Page
- Components
- Sorting and pagination
- Layouts
- Sorting and pagination
- Pages
- Visual Editor with HEEx and 2-way sync support
- Sorting and pagination
- Live Data
- Custom Pages
- Router helper `~p` to generate paths with site prefixes
- Content management through the `Beacon.Content` API
- A/B Variants
- TailwindCSS compiler
4 changes: 2 additions & 2 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beacon_live_admin",
"version": "0.1.0-rc.0",
"version": "0.1.0-rc.1",
"license": "MIT",
"repository": {},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions assets/svelte/components/PageAstNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
<style>
.dragged-element-placeholder {
outline: 2px dashed red;
/* Disable pointer events to block out any dragOver event triggers on the placeholder while dragging */
pointer-events: none;
}
:global(.embedded-iframe) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts" context="module">
import { get, writable, type Writable } from "svelte/store"
import { page, selectedDomElement, selectedElementMenu, parentOfSelectedAstElement } from "$lib/stores/page"
import { page, selectedDomElement, selectedAstElementId, selectedElementMenu, parentOfSelectedAstElement } from "$lib/stores/page"
import { dragElementInfo, type LocationInfo } from "$lib/stores/dragAndDrop"
import { getDragDirection, type Coords, type DragDirection } from "$lib/utils/drag-helpers"
import { live } from "$lib/stores/live"
let currentHandleCoords: Coords
let relativeWrapperRect: DOMRect
let dragHandleStyle: Writable<string> = writable("")
Expand Down Expand Up @@ -100,7 +100,12 @@
let parent = $parentOfSelectedAstElement
const selectedAstElement = parent.content.splice($dragElementInfo.selectedIndex, 1)[0]
parent.content.splice(newIndex, 0, selectedAstElement)
// Update the selectedAstElementId so the same item remains selected
$page.ast = [...$page.ast]
let parts = $selectedAstElementId.split('.');
parts[parts.length - 1] = newIndex.toString();
$selectedAstElementId = parts.join('.')
// Update in the server
$live.pushEvent("update_page_ast", { id: $page.id, ast: $page.ast })
}
}
Expand Down
20 changes: 12 additions & 8 deletions lib/beacon/live_admin/content.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,24 @@ defmodule Beacon.LiveAdmin.Content do
call(site, Beacon.Content, :delete_variant_from_page, [page, variant])
end

def change_page_event_handler(site, event_handler, attrs \\ %{}) do
call(site, Beacon.Content, :change_page_event_handler, [event_handler, attrs])
def change_event_handler(site, event_handler, attrs \\ %{}) do
call(site, Beacon.Content, :change_event_handler, [event_handler, attrs])
end

def create_event_handler_for_page(site, page, attrs) do
call(site, Beacon.Content, :create_event_handler_for_page, [page, attrs])
def list_event_handlers(site) do
call(site, Beacon.Content, :list_event_handlers, [site])
end

def update_event_handler_for_page(site, page, event_handler, attrs) do
call(site, Beacon.Content, :update_event_handler_for_page, [page, event_handler, attrs])
def create_event_handler(site, attrs) do
call(site, Beacon.Content, :create_event_handler, [attrs])
end

def delete_event_handler_from_page(site, page, event_handler) do
call(site, Beacon.Content, :delete_event_handler_from_page, [page, event_handler])
def update_event_handler(site, event_handler, attrs) do
call(site, Beacon.Content, :update_event_handler, [event_handler, attrs])
end

def delete_event_handler(site, event_handler) do
call(site, Beacon.Content, :delete_event_handler, [event_handler])
end

def component_categories(site) do
Expand Down
Loading

0 comments on commit 5d265db

Please sign in to comment.