app/assets/builds/katalyst/content.js in katalyst-content-2.1.3 vs app/assets/builds/katalyst/content.js in katalyst-content-2.1.4
- old
+ new
@@ -169,11 +169,11 @@
let listElement = this.#childrenListElement;
if (!listElement) listElement = createChildrenList(this.node);
this.#expandedDescendants.forEach((child) =>
- listElement.appendChild(child.node)
+ listElement.appendChild(child.node),
);
}
/**
* Moves any collapsed children back into the parent container.
@@ -260,11 +260,11 @@
*/
get #collapsedDescendants() {
if (!this.hasCollapsedDescendants()) return [];
return Array.from(this.#childrenListElement.children).map(
- (node) => new Item(node)
+ (node) => new Item(node),
);
}
}
/**
@@ -426,11 +426,11 @@
const previous = item.previousItem;
if (previous && previous.depth < item.depth - 1) {
this.debug(
`invalid depth on item ${item.index}: ${item.depth} => ${
previous.depth + 1
- }`
+ }`,
);
item.depth = previous.depth + 1;
}
}
@@ -444,11 +444,11 @@
// if we're the first child, make sure our parent is a layout
// if we're a sibling, we know the previous item is valid so we must be too
const previous = item.previousItem;
if (previous && previous.depth < item.depth && !previous.isLayout) {
this.debug(
- `invalid parent for item ${item.index}: ${item.depth} => ${previous.depth}`
+ `invalid parent for item ${item.index}: ${item.depth} => ${previous.depth}`,
);
item.depth = previous.depth;
}
}
@@ -814,11 +814,14 @@
dragleave(event) {
// Safari doesn't support relatedTarget, so we count enter/leave pairs
// https://bugs.webkit.org/show_bug.cgi?id=66547
this.enterCount--;
- if (this.enterCount <= 0 && this.dragItem.dataset.hasOwnProperty("newItem")) {
+ if (
+ this.enterCount <= 0 &&
+ this.dragItem.dataset.hasOwnProperty("newItem")
+ ) {
this.cancelDrag(event);
}
}
/**
@@ -844,15 +847,15 @@
template.innerHTML = event.dataTransfer.getData("text/html");
item = template.content.querySelector("li");
this.element.replaceChild(item, placeholder);
requestAnimationFrame(() =>
- item.querySelector("[role='button'][value='edit']").click()
+ item.querySelector("[role='button'][value='edit']").click(),
);
}
- this.dispatch("drop", {target: item, bubbles: true, prefix: "content"});
+ this.dispatch("drop", { target: item, bubbles: true, prefix: "content" });
}
/**
* End an in-progress drag. If the item is a new item, remove it, otherwise
* reset the item's style and restore its original position in the list.
@@ -875,15 +878,15 @@
get dragItem() {
return this.element.querySelector("[data-dragging]");
}
reindex() {
- this.dispatch("reindex", {bubbles: true, prefix: "content"});
+ this.dispatch("reindex", { bubbles: true, prefix: "content" });
}
reset() {
- this.dispatch("reset", {bubbles: true, prefix: "content"});
+ this.dispatch("reset", { bubbles: true, prefix: "content" });
}
}
/**
* Swaps two list items. If target is a list, the item is appended.
@@ -923,12 +926,13 @@
/**
* Given an event target, return the closest drop target, if any.
*/
function dropTarget(e) {
- return e && (
- e.closest("[data-controller='content--editor--list'] > *") ||
- e.closest("[data-controller='content--editor--list']")
+ return (
+ e &&
+ (e.closest("[data-controller='content--editor--list'] > *") ||
+ e.closest("[data-controller='content--editor--list']"))
);
}
class NewItemController extends Controller {
static targets = ["template"];