import { Code } from "@thoughtsunificator/bbcode-parser-template"
/**
* @global
*/
class UnderlineCode extends Code {
/**
* @readonly
* @type {string}
*/
static tagName = "u"
/**
* @param {Node} node
* @returns {boolean}
*/
static testNode(node) {
return node.nodeName === "SPAN" && node.style.textDecoration === "underline"
}
/**
* @param {Conversion} conversion
* @returns {BBNode}
*/
static createBBNode(conversion) {
const bbNode = conversion.bbDocument.createElement("u")
return bbNode
}
/**
* @param {Conversion} conversion
* @returns {Node}
*/
static createNode(conversion) {
const node = conversion.document.createElement("span")
node.style.textDecoration = "underline"
return node
}
}
export default UnderlineCode