feat: set title style through executeSetHtml api #626
This commit is contained in:
@@ -1235,7 +1235,10 @@ export function getElementListByHTML(
|
|||||||
}
|
}
|
||||||
} else if (/H[1-6]/.test(node.nodeName)) {
|
} else if (/H[1-6]/.test(node.nodeName)) {
|
||||||
const hElement = node as HTMLTitleElement
|
const hElement = node as HTMLTitleElement
|
||||||
const valueList = getElementListByHTML(hElement.innerHTML, options)
|
const valueList = getElementListByHTML(
|
||||||
|
replaceHTMLElementTag(hElement, 'div').outerHTML,
|
||||||
|
options
|
||||||
|
)
|
||||||
elementList.push({
|
elementList.push({
|
||||||
value: '',
|
value: '',
|
||||||
type: ElementType.TITLE,
|
type: ElementType.TITLE,
|
||||||
@@ -1478,3 +1481,16 @@ export function getIsBlockElement(element?: IElement) {
|
|||||||
element.imgDisplay === ImageDisplay.INLINE)
|
element.imgDisplay === ImageDisplay.INLINE)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function replaceHTMLElementTag(
|
||||||
|
oldDom: HTMLElement,
|
||||||
|
tagName: keyof HTMLElementTagNameMap
|
||||||
|
): HTMLElement {
|
||||||
|
const newDom = document.createElement(tagName)
|
||||||
|
for (let i = 0; i < oldDom.attributes.length; i++) {
|
||||||
|
const attr = oldDom.attributes[i]
|
||||||
|
newDom.setAttribute(attr.name, attr.value)
|
||||||
|
}
|
||||||
|
newDom.innerHTML = oldDom.innerHTML
|
||||||
|
return newDom
|
||||||
|
}
|
||||||
|
|||||||
@@ -1731,7 +1731,6 @@ window.onload = function () {
|
|||||||
|
|
||||||
instance.listener.saved = function (payload) {
|
instance.listener.saved = function (payload) {
|
||||||
console.log('elementList: ', payload)
|
console.log('elementList: ', payload)
|
||||||
console.log(instance.command.getControlList())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. 右键菜单注册
|
// 9. 右键菜单注册
|
||||||
|
|||||||
Reference in New Issue
Block a user