-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
I'm trying to use a select in a block and it's not triggering the onchange event.
Steps to reproduce:
I took the example from this page, and it's not working.
Expected behavior:
Screenshots:
Device, Browser, OS: Mac, Chrome, 15.6 (24G84)
Editor.js version: @editorjs/editorjs@2.31.0
Plugins you use with their versions:
I even used the example on the page and it still not working.
export default class SelectMenu {
static get toolbox() {
return {
title: 'Select',
icon: '<svg width="17" height="15" viewBox="0 0 336 276" xmlns="http://www.w3.org/2000/svg"><path d="M291 150V79c0-19-15-34-34-34H79c-19 0-34 15-34 34v42l67-44 81 72 56-29 42 30zm0 52l-43-30-56 30-81-67-66 39v23c0 19 15 34 34 34h178c17 0 31-13 34-29zM79 0h178c44 0 79 35 79 79v118c0 44-35 79-79 79H79c-44 0-79-35-79-79V79C0 35 35 0 79 0z"/></svg>'
};
}
constructor({ data }) {
this.data = data;
}
render() {
const wrapper = document.createElement('div');
const input = document.createElement('select');
var option = document.createElement("option");
option.setAttribute("value", "option1");
var textOption = document.createTextNode("option1");
option.appendChild(textOption);
input.appendChild(option);
option = document.createElement("option");
option.setAttribute("value", "option2");
textOption = document.createTextNode("option2");
option.appendChild(textOption);
input.appendChild(option);
option = document.createElement("option");
option.setAttribute("value", "option3");
textOption = document.createTextNode("option3");
option.appendChild(textOption);
input.appendChild(option);
wrapper.appendChild(input);
return wrapper;
}
save(blockContent) {
const input = blockContent.querySelector('select');
return {
selectValue: input.value
}
}
}