MCPcopy
hub / github.com/streetwriters/notesnook / injectNodeSelectionControls

Function injectNodeSelectionControls

packages/clipper/src/index.ts:269–357  ·  view source on GitHub ↗
(
  onDone?: () => void,
  onCancel?: () => void
)

Source from the content-addressed store, hash-verified

267}
268
269function injectNodeSelectionControls(
270 onDone?: () => void,
271 onCancel?: () => void
272) {
273 const controlContainer = document.createElement("div");
274 controlContainer.classList.add(CLASSES.nodeSelectionContainer);
275 setTimeout(() => {
276 document.body.appendChild(controlContainer);
277 }, 0);
278
279 app<{ isClipping: boolean }>({
280 init: {
281 isClipping: false
282 },
283 view: ({ isClipping }) =>
284 h(
285 "div",
286 {
287 style: {
288 padding: "10px",
289 backgroundColor: "white",
290 borderRadius: "5px",
291 boxShadow: "0px 0px 10px 0px #00000038"
292 }
293 },
294 [
295 h("p", { style: { marginBottom: "0px", fontSize: "18px" } }, [
296 text("Notesnook Web Clipper")
297 ]),
298 h(
299 "p",
300 {
301 style: {
302 margin: "0px",
303 marginBottom: "5px",
304 fontStyle: "italic"
305 }
306 },
307 [
308 isClipping
309 ? text("Clipping selected elements. Please wait...")
310 : text("Click on any element to select it.")
311 ]
312 ),
313 h(
314 "div",
315 {
316 style: {
317 display: "flex",
318 alignItems: "center"
319 }
320 },
321 [
322 h(
323 "button",
324 {
325 onclick: (state) => {
326 return [

Callers 1

enterNodeSelectionModeFunction · 0.85

Calls 7

dispatchFunction · 0.85
cleanupFunction · 0.70
hFunction · 0.50
textFunction · 0.50
createElementMethod · 0.45
addMethod · 0.45
appendChildMethod · 0.45

Tested by

no test coverage detected