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

Function formatBar

src/ide.ts:1960–1975  ·  view source on GitHub ↗
({editor}:EditorBarElem)

Source from the content-addressed store, hash-verified

1958interface EditorBarElem extends Elem { editor: Editor, active?: boolean }
1959
1960function formatBar({editor}:EditorBarElem):Elem {
1961 let doc = editor.cm.getDoc();
1962 let cursor = doc.getCursor("to");
1963 let bottom = editor.cm.cursorCoords(cursor, undefined).bottom;
1964 let left = editor.cm.cursorCoords(cursor, "local").left;
1965
1966 return {id: "format-bar", c: "format-bar", top: bottom, left: left, children: [
1967 {text: "B", click: () => editor.format({type: "strong"}, true)},
1968 {text: "I", click: () => editor.format({type: "emph"}, true)},
1969 {text: "code", click: () => editor.format({type: "code"}, true)},
1970 {text: "H1", click: () => editor.format({type: "heading", level: 1}, true)},
1971 {text: "H2", click: () => editor.format({type: "heading", level: 2}, true)},
1972 {text: "H3", click: () => editor.format({type: "heading", level: 3}, true)},
1973 {text: "block", click: () => editor.format({type: "code_block"}, true)},
1974 ]};
1975}
1976
1977//---------------------------------------------------------
1978// New Block

Callers 1

renderMethod · 0.85

Calls 4

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

Tested by

no test coverage detected