Settings of Bespin embedded?

岁酱吖の 提交于 2019-12-25 04:36:29

问题


I guess most of you know the web-based code editor - Mozilla's Bespin project.

Two weeks ago they published their first release of an embedded version:

alt text http://img.skitch.com/20091121-xuamnt5ribje25fp666ixyd67k.png

Being in a alpha stage the documentation isn't really satisfying.

Although there is list of settings I wasn't able to change the syntax to js. How do you achieve this?

There is a bespin.setSetting method but I have no clue how to use it.

Only one sample code ( the one shown on the screen shot above ) uses js syntax highlighting. But it also uses Dojo and I would like to avoid using Dojo.

Is that possible somehow?


回答1:


Bespin seems to use some dojo commands somehow. However it does not require the dojo libraries.

JS (onload):

new bespin.editor.Component("editor", {
    language: "js",
    loadfromdiv: true
});

HTML (head):

<script src="https://bespin.mozilla.com/embed.js"></script>

HTML (body):

<div id="editor"></div>

Result: JS highlighted editor



来源:https://stackoverflow.com/questions/1774776/settings-of-bespin-embedded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!