ace-editor

How to add some known objects to ace editors syntax checker?

霸气de小男生 提交于 2019-12-12 03:22:26
问题 we're using the ACE editor to write javascript code that's interpreted on the server side. So the server has a JavaScript interface and can execute submitted code to accomplish some task from the outside. The server implements some new objects that are not known by ACE. So ACE shows a warning, if one of this unknown objects is used in code. What is the correct way to tell ACE, that there are some new objects, variables und functions? I already took a look into worker-javascript.js, but I DON

ACE Editor multiline regex

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:28:01
问题 I'm using ACE Editor to syntax highlight my website's BBCode system, and on the whole it's working well. The only thing that isn't is our equivalent to multiline comments: [nobbcode] I am a demo of [b]BBCode[/b]. Anything in here is shown as plain text, with code left intact, allowing people to show how it works. [/nobbcode] The rule for this is: { token:[ "meta.tag.punctuation.tag-open.xml", "meta.tag.tag-name.xml", "meta.tag.punctuation.tag-close.xml", "comment", "meta.tag.punctuation.end

Ace Editor API: How to select current line onCursorChange?

余生颓废 提交于 2019-12-11 19:27:27
问题 I want to always select the current line, when cursor position changes. And then remove that line with a keypress and append it to a div tag. I know how to add keybord commands. But i don't understand how to do something onCursorChange() , it seems to be different from Editor.on("change", function(Object e)) . and also i don't find how remove the selected line. onCursorChange() is mentioned here but not really described how to use it: http://ace.c9.io/#nav=api&api=editor // ACE Editor Setup

Ace Editor (javascript): Triggering a tab press event for Ace Editors event handlers (not just inserting '/t' or spaces)

删除回忆录丶 提交于 2019-12-11 13:39:13
问题 I am using Ace Editor to build a code replay program. I store all the keys pressed when you type code, and then I replay them in Ace Editor. I have finished storing and replaying all keyboard/mouse input, but am having issues replaying tab presses. Ace Editor handles tabs within a textarea DOM. The default behavior for a textarea when tab is pressed is to move to the next DOM, so I know they are using preventDefault() and using their own handler in order to allow softTab (insertion of 1,2,3,

Ace editor, how to remove all keyBindings but one?

妖精的绣舞 提交于 2019-12-11 06:26:52
问题 I recently had a textarea on my jsp page For it, I had my own shortcuts on the keyboard Then, I implemented the ace editor, and all my old keybindings didn't work then Then i searched for a while, and found this code: //I did this before, to add the ace editor var editor = ace.edit("fileInfo"); var JavaScriptMode = ace.require("ace/mode/javascript").Mode; editor.session.setMode(new JavaScriptMode()); //Then I found this for the keyBindings delete editor.keyBinding; The last line, disables all

How to load ace editor with requirejs from CDN?

旧巷老猫 提交于 2019-12-11 04:22:46
问题 I am trying to load the ace editor from a CDN with requirejs. Here is a plunkr which illustrates my problem. Ace is not defined in the following case: requirejs.config({ paths: { ace: ['//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace'] } }) $('h1').text("loading ace..."); requirejs([ 'ace'], function(ace) { $('h1').text("ace loaded.") console.log(ace) ace.edit('#editor') return }) 回答1: you need to define ace as a path to the folder that contains ace.js and require "ace/ace" requirejs.config({

Cannot edit CodeMirror or Ace in a taskpane of an add-in in Excel for Windows

梦想与她 提交于 2019-12-10 23:59:30
问题 I just realized that we cannot modify texts in CodeMirror or Ace in a taskpane of an add-in in Excel for Windows. I have made a test html page with this code, and link it to a manifest file of an Excel add-in. It works well in Excel Online (in Chrome and IE), Excel for Mac. However, in Excel for Windows, 1) textarea works well; 2) We could put the focus on CodeMirror, whereas we can NOT type anything; 3) When we put the focus on Excel then back on Ace, we can NOT type anything. I have not

Ace editor with rails 4 precompiled assets madness

痞子三分冷 提交于 2019-12-10 23:47:02
问题 I have been trying to integrate the Ace editor to a Rails 4 project and couldn't get it to work in production. The editor renders but -obviously enough, it can't load the mode-* files. I tried to add the whole ace tree to the compiled assets hoping it would somehow figure out it's already loaded, but it's still looking for "url/mode-html.js". Has anyone had any luck making Ace work in Rails with precompiled assets? Am I missing something? 回答1: This is the workaround I used (in my case for the

how to delete the content of ace editor on a validation error

别来无恙 提交于 2019-12-10 18:04:45
问题 My question is related to set focus on ace editor This time I want to delete the content whenever there is a validation error. I have the used the pattern like /^[0-4]$/ and /^([1-9][0-9]{0,3}|[1-5][0-9]{4}|60000)$/; to check the value between 0-4 and 1-60000 respectively. When user provides invalid data my text area is cleared but not the ace editor. I also tried $scope.close = function () { rowObj.entity.value = editor.getValue(); editor.setValue("",0); }; but that is not working. 回答1: to

How to do embedded highlightings in Ace editor if embedding requires proper brace nesting?

China☆狼群 提交于 2019-12-10 17:45:46
问题 Consider the following Razor code: <div>@(Model.GetSomething())</div> Obviously, the Razor block can only be properly identified if all parentheses are accounted for. If I do naive embed (based on what PHP does): var RazorLangHighlightRules = function() { CSharpHighlightRules.call(this); }; oop.inherits(RazorLangHighlightRules, CSharpHighlightRules); var RazorHighlightRules = function() { HtmlHighlightRules.call(this); var razorStartRules = [{ token : "meta.block-marker.razor", regex : "@\\("