MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / filterSelectionMenuItems

Function filterSelectionMenuItems

src/cm/touchSelectionMenu.js:81–89  ·  view source on GitHub ↗
(items, options)

Source from the content-addressed store, hash-verified

79 * @param {{readOnly:boolean,hasSelection:boolean}} options
80 */
81export function filterSelectionMenuItems(items, options) {
82 const { readOnly, hasSelection } = options;
83 return items.filter((item) => {
84 if (readOnly && !item.readOnly) return false;
85 if (hasSelection && !["selected", "all"].includes(item.mode)) return false;
86 if (!hasSelection && item.mode === "selected") return false;
87 return true;
88 });
89}
90
91/**
92 * Detect which edge(s) should trigger drag auto-scroll.

Callers 1

#showMenuMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected