|
#1
|
|||
|
|||
|
Hello,
we are using 8.2. I am trying to integrate the Ace Editor into smartclient and I am having some issues. Has anyone tried to integrate it before? http://ace.ajax.org/ Its tagged to a div element and when I try to display it won't draw correctly (seems like it can't determine its size). I have tried overriding getInnerHTML on a canvas and returning the div with the correct id and I can see it does find the element and attaches the editor but the size of the editor is not set. Simple code that will display the ace editor: Code:
<body>
<div id="aceeditor"></div>
<script>
var container = document.getElementById("aceeditor");
var aceeditor = ace.edit("aceeditor");
aceeditor.getSession().setMode("ace/mode/javascript");
aceeditor.getSession().setValue("test code\n");
</script>
</body>
Code:
<body>
<script>
isc.defineClass("DevEditor", "Canvas");
isc.DevEditor.addProperties({
title: "Test",
height: "100%",
width: "100%",
getInnerHTML : function ()
{
return "<div id=\"aceeditor\"></div>";
}
});
var aLayout = isc.VLayout.create({width: "100%", height: "100%"});
var ldev = isc.SamDevEditor.create();
aLayout.addMember(ldev);
isc.Page.setEvent("load", function()
{
var container = document.getElementById("aceeditor");
var aceeditor = ace.edit("aceeditor");
aceeditor.getSession().setMode("ace/mode/javascript");
aceeditor.getSession().setValue("test code\n");
});
aLayout.draw();
</script>
</body>
Thanks! |
|
#2
|
|||
|
|||
|
With this particular code, the problem is the attempt to create() a SamDevEditor, when you gave the class the name "DevEditor". Was this just a transcription error..?
|
|
#3
|
|||
|
|||
|
Assuming it is a transcription error, you have a further issue - you're creating a DIV inside a 100% sized Canvas, but the DIV itself has no size setting that would cause it to fill the surround Canvas. So it's going to be minimum height.
See also the new docs on DOM-level integration added in 3.1, but which apply to older versions too. |
|
#4
|
|||
|
|||
|
yes, it was a transcription error...
Thanks for the help! |