import { Code } from "@thoughtsunificator/bbcode-parser-template"
/**
* @global
*/
class CenterCode extends Code {
/**
* @readonly
* @type {string}
*/
static tagName = "center"
/**
* @param {Node} node
* @returns {boolean}
*/
static testNode(node) {
return node.nodeName === "DIV" && node.getAttribute("align") === "center"
}
/**
* @param {Conversion} conversion
* @returns {BBNode}
*/
static createBBNode(conversion) {
const bbNode = conversion.bbDocument.createElement("center")
return bbNode
}
/**
* @param {Conversion} conversion
* @returns {Node}
*/
static createNode(conversion) {
const node = conversion.document.createElement("div")
node.align = "center"
return node
}
}
export default CenterCode