I am new to dojo and I am trying to integrate orion editor(build downloaded from http://download.eclipse.org/orion/) in dojo but I get the error "orion" is undefined. The code looks like below:
HTML file for placing editor
<div data-dojo-attach-point="embeddedEditor"></div>
A JS file
require([ "dojo/_base/declare", "dijit/_WidgetBase", "editorBuild/code_edit/built-codeEdit-amd", "dijit/_TemplatedMixin", "dojo/text!orionEditor.html" ], function(declare,_WidgetBase, codeEditorAmd, _TemplatedMixin,template){ declare("orionEditor", [_WidgetBase, _TemplatedMixin], { templateString: template, postCreate: function(){ var codeEdit = new orion.codeEdit(); var contents = ''; codeEdit.create({parent: this.embeddedEditor, contentType: "application/javascript", contents: contents}). then(function(editorViewer) { if (editorViewer.settings) { editorViewer.settings.contentAssistAutoTrigger = true; editorViewer.settings.showOccurrences = true; } }); } }); });
The orion editor build is placed in editorBuild folder.
Standalone orion works fine - http://libingw.github.io/OrionCodeEdit/ When integrating with dojo I am not sure why orion is undefined. Any help would be much appreciated.
If you want using
orion
name in amd module then it has to be defined as parameter in function passed as require's callback.Check this guide - it has 2 solutions for using orion with amd modules.
Option 1 - define bundles once and use shorter name in all modules you need them:
Option 2 - nested require:
Note: you can replace
mCodeEdit
with any unique name (That wouldn't shadow other objects/modules)