MCPcopy Index your code
hub / github.com/witheve/Eve / newBlockBar

Function newBlockBar

src/ide.ts:1986–2008  ·  view source on GitHub ↗
(elem:EditorBarElem)

Source from the content-addressed store, hash-verified

1984 */
1985
1986function newBlockBar(elem:EditorBarElem):Elem {
1987 let {editor, active} = elem;
1988 let doc = editor.cm.getDoc();
1989 let cursor = doc.getCursor();
1990 let top = editor.cm.cursorCoords(cursor, undefined).top;
1991 let left = 0;
1992
1993 return {id: "new-block-bar", c: `new-block-bar ${active ? "active" : ""}`, top, left, children: [
1994 {c: "new-block-bar-toggle ion-plus", click: () => {
1995 elem.active = !elem.active;
1996 editor.cm.focus();
1997 editor.queueUpdate();
1998 }},
1999 {c: "flex-row controls", children: [
2000 {text: "Eve", click: () => editor.format({type: "code_block"}, true)},
2001 {text: "CSS", click: () => editor.format({type: "code_block", info: "css"}, true)},
2002 {text: "list", click: () => editor.format({type: "item"}, true)},
2003 {text: "H1", click: () => editor.format({type: "heading", level: 1}, true)},
2004 {text: "H2", click: () => editor.format({type: "heading", level: 2}, true)},
2005 {text: "H3", click: () => editor.format({type: "heading", level: 3}, true)}
2006 ]}
2007 ]};
2008}
2009
2010//---------------------------------------------------------
2011// Modals

Callers 1

renderMethod · 0.85

Calls 5

getDocMethod · 0.80
getCursorMethod · 0.80
cursorCoordsMethod · 0.80
focusMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected