In the definition of selectParentBlock you use the style attribute for icon:
defineCommand("selectParentBlock", {
label: "Select parent node",
run(pm) {
let node = nodeAboveSelection(pm)
if (!node) return false
pm.setNodeSelection(node)
},
select(pm) {
return nodeAboveSelection(pm)
},
menuGroup: "block", menuRank: 90,
icon: {text: "\u2b1a", style: "font-weight: bold; vertical-align: 20%"},
key: "Esc"
})
It is ignored if I try to use it. However the attribute css does work and that is what the getIcon uses.
export function getIcon(name, data) {
let node = document.createElement("div")
node.className = "ProseMirror-icon"
if (data.path) {
if (!svgBuilt[name]) buildSVG(name, data)
let svg = node.appendChild(document.createElementNS(SVG, "svg"))
svg.style.width = (data.width / data.height) + "em"
let use = svg.appendChild(document.createElementNS(SVG, "use"))
use.setAttributeNS(XLINK, "href", "#pm-icon-" + name)
} else {
node.textContent = data.text
if (data.css) node.style.cssText = data.css
}
return node
}
Should data.css be data.style instead?