ace-editor

Ace editor trigger event using javascript

99封情书 提交于 2019-12-10 15:48:33
问题 Is there anything like editor.getSession.trigger('change') the reason I want this is because the editor goes in and out of new, so when It comes back into view I need it to do its normal 'change' thing, but I dont want to wait for user input? Currently I have editor.getSession().on('change', function(){ editorChangeHandler() }) and I just recall editorChangeHandler() when I need to, but editor.getSession.trigger('change') is much nicer. 回答1: editor.session._emit('change') would trigger

How to Keep Ace from Looking for Themes and Modes in Current Directory?

好久不见. 提交于 2019-12-10 14:48:52
问题 I've been working on an MVC web application that uses the Ace in-browser code editor provided by Cloud9. The ace.js script and a script that sets up ace's editor are both in a ScriptBundle together on my BundleConfig. The bundle is being loaded perfectly fine. On my local server, with debug set to true in the web.config, the script worked perfectly fine. However, after launching to a live server with debug set to false in the web.config, several errors appeared. After fixing a few minor

how to use npm packages in rails

て烟熏妆下的殇ゞ 提交于 2019-12-10 13:39:29
问题 I'm trying to use the Ace editor in my Ruby on Rails app, with majority of the view composed as React components. I'm using the react-rails gem and I'm not using flux at all. I found this react-ace package, but I have to use npm to install it. I've been able to get bower components working with bower-rails gem but never got npm packages to work. Is there a way to use this just through the asset pipeline (through vendor)? By the way, I'm not using browserify or ES6 so I don't even have import

Typing spaces in Ace Editor results in special characters

主宰稳场 提交于 2019-12-10 13:23:44
问题 I've installed ace editor into my site, and although when I tested it in a dev environment , now with the same code I am experiencing typing errors - specifically when hitting space or delete. When I click space strange characters appear instead. Here is an example of my code and an image of what I am seeing. $(function(){ var editor = ace.edit("editor"); editor.setTheme("ace/theme/chrome"); editor.getSession().setMode("ace/mode/html"); }); Can anybody help? 回答1: It turned out that this issue

Want to highlight/change color of certain words in Ace Editor?

女生的网名这么多〃 提交于 2019-12-10 11:00:16
问题 I am setting text using the following: var someString = 'Mark has solved the problem'; editor.getSession().setValue(someString); In above case, Need only 'Mark' to appear in blue color. Is there a way to load html tags in ace editor or manipulate styling of certain words? 回答1: You can create custom highlight rules to do this <!DOCTYPE html> <html lang="en"> <head> <title>ACE in Action</title> <meta charset="utf-8"> <style type="text/css" media="screen"> #editor { position: absolute; top: 0;

How to add emmet support in ace js code editor?

会有一股神秘感。 提交于 2019-12-09 06:44:47
问题 I am trying to embed ace code editor in my project. I am initializing my code editor with following code and now I want to enable emmet js features. I can see the ext-emmet.js extension is already their in the src directory of ace.js pre-packaged version I need help in enabling emmet extension features. So here is my initialization code. var e = ace.edit("editorId"); // id of the code editor div e.setTheme("ace/theme/monokai"); e.getSession().setMode("ace/mode/html"); e.setBehavioursEnabled

How do I find currently loaded mode (syntax) in Ace Editor?

冷暖自知 提交于 2019-12-08 22:13:20
问题 Well as the title says - how do I find out what the currently loaded mode is in Ace Editor? editor.getSession().getMode() does not really return anything I can use - have looked through the objects returned somewhat - but could not find anything. editor.getTheme() returns a string to me that I can use however - just seems funny if they did not do somewhat the same for mode 回答1: To retrieve the name of the mode you use: editor.getSession().getMode().$id 回答2: I tried Hugeen's answer and

ace editor onchange not working

不想你离开。 提交于 2019-12-08 12:30:57
问题 i'm working on a code playground using ace editor and i am trying to use ace editor onChange but nothing happens when I type. my code is <style> html{padding:0px} #editor { border-radius:5px; width:500px; height:100% }</style> <a href="#" onclick="update()">go</a> <div id="editor" onChange="update()"> function foo(items) { var x = "All this is syntax highlighted"; return x; } </div> <script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset=

How do I programmatically add a snippet in Ace Editor?

夙愿已清 提交于 2019-12-08 04:13:37
问题 I want to add my own custom code snippets to my ace editor input box. How would I go about adding them? From the documentation of Ace editor regarding snippets: Currently, the only way to add custom snippets to a project is to create a plugin (as described here). I saw a project called ace-snippet-extension but it has not been updated since 2016, and does more things than simply allowing me to add a snippet. Additionally, I am using ES6+/ES2015+, so the require statements are confusing as

Add Javascript into Custom Language - ACE Editor

[亡魂溺海] 提交于 2019-12-08 03:23:41
问题 I am using ACE editor for a custom metalanguage using JSON as base. But I want to add Javascript when the user types something like "custom" : function(param){ .... javascript code ..... } The idea is to highlight the javascript code using the styling already used for JS. I am not usng the JSON highligther, just use my own. I saw in the documentation something "Embedding a different highlighter" (https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode) But it doesnt works. Here