This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ukebako8008
ukebako8008

Hi Is it possible to access ace editor instance or just a function editor.insert('...') from codeeditor form widget?

laszlo.zenware.io
laszlo.zenware.io

3 years late but I had the same question and found the answer on stackoverflow

You can get a reference to the editor as follows:

ace.edit('CodeEditor-formDefaultGalleryOptions-default_gallery_options-code').getValue()

It will not re-instantiate the editor.

You will need to pass in the correct ID. The correct element will end in "-code" and will have a class of "editor-code" and "ace_editor". For me it looked like this:

<div class="editor-code ace_editor ace-twilight ace_dark" id="CodeEditor-formDefaultGalleryOptions-default_gallery_options-code" style="position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px;">...

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.