I need to access TinyMCE content from Dart. The Dart js library should enable me to do so through TinyMCE's Javascript API. However, I'm stuck at how to initialize TinyMCE from Dart because I found no instruction on how to construct a TinyMCE instance in Javascript.
According to TinyMCE API, the following JS code should return TinyMCE content:
tinymce.activeEditor.getContent();
Thus, I believe this Dart code should do the same:
var content = js.tinymce.activeEditor.getContent();
However, running this code returns the following error:
Internal error: ...: Error: line 149 pos 20: identifier 'js.tinymce'
cannot be resolved var content =
js.tinymce.activeEditor.getContent();
The editor complains about the undefined tinymce
variable. Any idea how to fix this? Thanks.
The js-interop equivalent of JavaScript tinymce.activeEditor.getContent();
is :
js.context.tinymce.activeEditor.getContent();
Basically js.context
returns a reference on the JavaScript window
object.