Input Element - Loading dynamic initial content

Having some trouble getting the initial content to populate in a text editor plugin. Initially, it works when the element is loaded via:
instance.data.element.editor.value(properties.initial_content);

After reseting the element / clearing its contents, I am unable to load any initial content:
instance.data.contentholder.value = ""; //this sets the value of the editor to null
instance.data.element.editor.value(properties.initial_content); //no longer works

The editor itself sits inside a popup, and its job is to load the text from repeating group when the user clicks an ā€œeditā€ button (e.g. each time the user clicks editā€¦the plugin element is cleared, and then loaded with new initial content). Iā€™ve tried setting the editor value to properties.initial_content in both initializeState_content and update functions without luck.

Any ideas?

1 Like

My best guess without looking at the code in detail is that the instance.data.element editor.value is only being initalized once at creation. Replace that with a let and see what happens.

1 Like

Good catch, thanks @AliFarahat I removed instance.data.element.editor.value out of itā€™s nested function and assigned it to a global variable. Problem solved :slight_smile:

Do you have any idea why this editor plugin is not initializing Bubbleā€™s reset function (via reset group, reset relevant inputs)? The element is set as an input form, yet the reset workflow actions do not initialize reset() in the pluginā€™s code. I had to create a custom function clear_editor() to wipe the elementā€™s input contents, and users (i.e. myself) have to access that via the element workflow action menu instead of using the built in ā€˜reset-relevant inputsā€™ action.

Did you use the same code in the default reset function? It should work but then again I have a plug-in that needed it own custom function

Both functions are identical, but the reset will not initiate (no luck even when console.log(ā€œtest resetā€) is the only line of active code). Are you also seeing this issue with a text editor element?

Try adding another bubble element like an input field with the plug-in element and resetting all of them after the workflow creates a thing

I tried that as well without any luck. For some reason, it doesnā€™t seem to register the element as an input.

Ya, I remember that i had to add my own action for a plugin.

Iā€™m asuming Bubble is just defining a class for input form elements and adding an event listener for reset from that class. I wonder why itā€™s not working.

Never really have it much thought. It should word as your defining your own reset code. It works fine when you create your own action