I have a problem when I try to update a block of text after its creation, this is my code:
`$(document).ready(function(){
var text_to_insert = [
{
"type" : "paragraph",
"data" : {
"text" : "Initial text abcd"
}
}];
var text_to_insert_afeter_ceckbox = [
{
"type" : "paragraph",
"data" : {
"text" : "ABCD after ceckbo"
}
}];
var editor_IT = new EditorJS({
holder : 'box_with_text',
tools: {
table: {
class: Table,
inlineToolbar: true,
shortcut: 'CMD+ALT+T',
},
},
data: {
blocks: testo
},
onReady: function(){
},
onChange: function() {
console.log('something changed');
//save function;
},
minHeight : 0
});
$('input[type="checkbox"]').click(function(){
if($(this).is(":checked")){
console.log("Checkbox is checked.");
editor_IT.blocks.insert(text_to_insert_afeter_ceckbox);
}
else if($(this).is(":not(:checked)")){
console.log("Checkbox is unchecked.");
editor_IT.blocks.insert(text_to_insert);
}
});
});`
I tried to update the block of text using:
editor_IT.blocks.insert(text_to_insert);
But don’t wok
The aim would be is:
-
create a block of text with "acbd" for example
-
If user check or uncheck the checkbox I’m going to update the text in the editor area.
I have a problem when I try to update a block of text after its creation, this is my code:
I tried to update the block of text using:
editor_IT.blocks.insert(text_to_insert);But don’t wok
The aim would be is:
create a block of text with "acbd" for example
If user check or uncheck the checkbox I’m going to update the text in the editor area.