Custom plugin that add input, radio and checkbox groups. #1298
SergiuPlesco
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue:
1 After the element is added into the editor the cursor jumps to the beginning of the editor container
2. After adding a table the cursor is not focused (expected to be at the end of the table and if enter key pressed to go to the line)
Below is how i am creating the plugin and how inserting elements in the editor itself.
`const InputTag = {
name: "InputTag",
display: "submenu",
add(core: CoreType, targetElement: HTMLElement) {
const listDiv = this.setSubmenu(core);
const self = this;
listDiv.querySelectorAll(".se-btn-list").forEach((btn: any) => {
btn.addEventListener("click", self.onClick.bind(core, core));
});
core.initMenuTarget(this.name, targetElement, listDiv);
},
setSubmenu(core: CoreType): HTMLElement {
const listDiv = core.util.createElement("DIV");
listDiv.className = "se-submenu se-list-layer";
listDiv.innerHTML =
'
'
' +- " +
" +- " +
" +- " +
"
'Input' +
"
"
'Textarea' +
"
"
'Group
"";
return listDiv;
},
onClick(core: CoreType, e: any) {
const targetValue = e.target.value;
},
};
export default InputTag;`
const generateRadioCheckbox = (formValues: any, elementID: string) => { const emptyBox = document.querySelector(
.${elementID}) as HTMLElement; if (!emptyBox) return; emptyBox.textContent = ""; emptyBox.className =
${emptyBox.className
} radio-group radioCollection select-group GROUP_TYPE ${
formValues.isRequired ? "required" : ""
}
; emptyBox.style.display = "inline-flex"; emptyBox.style.verticalAlign = "bottom"; if (formValues.isDisplayedOnRow) { emptyBox.className =
${emptyBox.className} row`;} else {
emptyBox.classList.remove("row");
}
};
`
Can anyone point me into the right direction to solve this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions