codex-team / codex-team/editor.js

<select /> not triggering editor.onChange (Old bug resurfaced)

Open
#2,975 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

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: ''
};
}

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
}
}
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.