Ie multi cell and section selection.
Experiments
export const menu = (ctx, { React, Menu }) => {
const { filter, select, selectPosition } = lit.utils.unist;
const rc = React.createElement;
const secFromCell = (pos) => {
const secs = selectPosition.selectAll("section", ctx.selectedCell, lit.ast);
const last = secs.slice(-1)[0];
console.log("Sections", secs, last);
return last.position;
};
const selectAll = rc(
"span",
{ onClick: () => ctx.setSelectedCell(lit.ast.position) },
"Select All"
);
const selectSec = rc(
"span",
{
onClick: () => {
ctx.setSelectedCell(secFromCell(ctx.selectedCell));
},
},
"Select Section"
);
return rc(
Menu,
{
title: "Selection",
disabled: false,
},
[selectAll, selectSec]
);
};
const {filter, select, selectPosition} = lit.utils.unist
const is = t => node => {
console.log(node.type)
return node.type === t
}
// return lit.ast
// return filter.toString()
// filter(lit.ast, {cascade: false } , is('heading'))
return selectPosition