mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat: restore channel-tree member drag and drop
This commit is contained in:
1 parent
3476d4716a
commit
e800d75b7b
16 files changed
+118
-14
No files matched your search
@@ -35,8 +35,8 @@ test("the stable layout registry covers public skin hooks and excludes the admin
|
||||
const isNativeControl = /^<(?:button|a|input|select|textarea)\b/i.test(attributes);
|
||||
const hasButtonRole = /\brole="button"/.test(attributes);
|
||||
const keyboardAction = /@keydown\.(?:enter|space)\b/.test(attributes);
|
||||
const dragAction = /@(?:dragstart|dragover|dragleave|drop)\b|:draggable=/.test(attributes);
|
||||
if (isNativeControl || hasButtonRole || keyboardAction || dragAction) interactiveParts.add(part);
|
||||
// Native HTML drag gestures are desktop-only and do not make a row a 44px touch control.
|
||||
if (isNativeControl || hasButtonRole || keyboardAction) interactiveParts.add(part);
|
||||
}
|
||||
const registered = new Set(SKIN_LAYOUT_COMPONENTS.map((component) => component.selectorPart));
|
||||
for (const part of publicParts) assert.ok(registered.has(part), "Unregistered public layout hook: " + part);
|
||||
|
||||
@@ -301,7 +301,7 @@ test("trusted channel tree and server switcher widgets require scoped read and c
|
||||
children: [
|
||||
{ widget: "voice.server-switcher", part: "server-switcher" },
|
||||
{ widget: "voice.server-header", part: "server-header" },
|
||||
{ widget: "voice.channel-tree", part: "channel-tree", options: { layout: "server-sidebar", memberActions: true } },
|
||||
{ widget: "voice.channel-tree", part: "channel-tree", options: { layout: "server-sidebar", memberActions: true, memberDragDrop: true } },
|
||||
],
|
||||
};
|
||||
assert.deepEqual(parseSkinPluginDocument(document).components[0].root.children?.map(({ widget }) => widget), [
|
||||
@@ -309,7 +309,15 @@ test("trusted channel tree and server switcher widgets require scoped read and c
|
||||
"voice.server-header",
|
||||
"voice.channel-tree",
|
||||
]);
|
||||
assert.deepEqual(parseSkinPluginDocument(document).components[0].root.children?.[2]?.options, { layout: "server-sidebar", memberActions: true });
|
||||
assert.deepEqual(parseSkinPluginDocument(document).components[0].root.children?.[2]?.options, { layout: "server-sidebar", memberActions: true, memberDragDrop: true });
|
||||
|
||||
const invalidMemberDragDrop = structuredClone(document);
|
||||
invalidMemberDragDrop.components[0].root.children![2] = { widget: "voice.channel-tree", options: { memberDragDrop: "yes" } as never };
|
||||
errorCode(() => parseSkinPluginDocument(invalidMemberDragDrop), "SKIN_PLUGIN_WIDGET_OPTIONS_INVALID");
|
||||
|
||||
const memberDragDropOnWrongWidget = structuredClone(document);
|
||||
memberDragDropOnWrongWidget.components[0].root.children![2] = { widget: "voice.performance-panel", options: { memberDragDrop: true } };
|
||||
errorCode(() => parseSkinPluginDocument(memberDragDropOnWrongWidget), "SKIN_PLUGIN_WIDGET_OPTIONS_INVALID");
|
||||
|
||||
for (const missingPermission of [
|
||||
"session.status.read",
|
||||
|
||||
@@ -65,6 +65,8 @@ export interface SkinPluginWidgetOptions {
|
||||
screenShare?: boolean;
|
||||
/** Enable host member actions on member cards and a right-click menu on channel-tree rows. */
|
||||
memberActions?: boolean;
|
||||
/** Enable trusted host member drag-and-drop between channel-tree rows. */
|
||||
memberDragDrop?: boolean;
|
||||
/** Select a supported host presentation for audio controls or a channel tree. */
|
||||
layout?: "default" | "room-panel" | "server-sidebar";
|
||||
}
|
||||
@@ -440,7 +442,7 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
const supportedOptions = rawNode.widget === "voice.member-cards"
|
||||
? new Set(["screenShare", "memberActions"])
|
||||
: rawNode.widget === "voice.channel-tree"
|
||||
? new Set(["layout", "memberActions"])
|
||||
? new Set(["layout", "memberActions", "memberDragDrop"])
|
||||
: rawNode.widget === "voice.performance-panel"
|
||||
? new Set(["screenShare"])
|
||||
: rawNode.widget === "voice.audio-controls"
|
||||
@@ -450,6 +452,7 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
|| Object.keys(rawNode.options).some((key) => !supportedOptions.has(key))
|
||||
|| (rawNode.options.screenShare !== undefined && typeof rawNode.options.screenShare !== "boolean")
|
||||
|| (rawNode.options.memberActions !== undefined && typeof rawNode.options.memberActions !== "boolean")
|
||||
|| (rawNode.options.memberDragDrop !== undefined && typeof rawNode.options.memberDragDrop !== "boolean")
|
||||
|| (rawNode.options.layout !== undefined
|
||||
&& rawNode.options.layout !== "default"
|
||||
&& rawNode.options.layout !== "room-panel"
|
||||
@@ -459,6 +462,7 @@ export function parseSkinPluginDocument(input: unknown): SkinPluginDocument {
|
||||
options = {
|
||||
...(rawNode.options.screenShare !== undefined ? { screenShare: rawNode.options.screenShare } : {}),
|
||||
...(rawNode.options.memberActions !== undefined ? { memberActions: rawNode.options.memberActions } : {}),
|
||||
...(rawNode.options.memberDragDrop !== undefined ? { memberDragDrop: rawNode.options.memberDragDrop } : {}),
|
||||
...(rawNode.options.layout !== undefined ? { layout: rawNode.options.layout } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user