Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into dts-generator
Browse files Browse the repository at this point in the history
# Conflicts:
#	ace.d.ts
  • Loading branch information
mkslanc committed May 29, 2024
2 parents 389e14e + a3277ea commit 1ee5cae
Show file tree
Hide file tree
Showing 57 changed files with 2,236 additions and 2,658 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.34.2](https://github.com/ajaxorg/ace/compare/v1.34.1...v1.34.2) (2024-05-27)

### [1.34.1](https://github.com/ajaxorg/ace/compare/v1.34.0...v1.34.1) (2024-05-24)


### Bug Fixes

* always set aria-label to text input in a11y mode ([#5563](https://github.com/ajaxorg/ace/issues/5563)) ([00346fd](https://github.com/ajaxorg/ace/commit/00346fde824beabb69f677631ad52815665eaef4))
* Folding for comments and different modes ([#5533](https://github.com/ajaxorg/ace/issues/5533)) ([f4d0e33](https://github.com/ajaxorg/ace/commit/f4d0e33dac270ce21df09a96a39f50e16d6354db))

## [1.34.0](https://github.com/ajaxorg/ace/compare/v1.33.3...v1.34.0) (2024-05-22)


### Features

* allow users to add arialabel to text input ([#5560](https://github.com/ajaxorg/ace/issues/5560)) ([8d7dfb6](https://github.com/ajaxorg/ace/commit/8d7dfb69392960aba61def982f4bea8f3a5caa70))

### [1.33.3](https://github.com/ajaxorg/ace/compare/v1.33.2...v1.33.3) (2024-05-21)


### Bug Fixes

* contrast completion meta contrast cloud editor themes ([#5558](https://github.com/ajaxorg/ace/issues/5558)) ([b8877f0](https://github.com/ajaxorg/ace/commit/b8877f0f725b3973961cb639127402c9f56609de))

### [1.33.2](https://github.com/ajaxorg/ace/compare/v1.33.1...v1.33.2) (2024-05-13)


### Bug Fixes

* Add soft wrap for ghost text ([#5540](https://github.com/ajaxorg/ace/issues/5540)) ([6a26b27](https://github.com/ajaxorg/ace/commit/6a26b277d0050b38cd766e00f93be4b9f3170f68))
* generator function's determination; wrong parameter highlighting ([#5538](https://github.com/ajaxorg/ace/issues/5538)) ([ceca6f7](https://github.com/ajaxorg/ace/commit/ceca6f7b38f6b3347988f17579ae6a2e758137dd))
* incorrect spans style ([#5539](https://github.com/ajaxorg/ace/issues/5539)) ([65a7f38](https://github.com/ajaxorg/ace/commit/65a7f38713cffb729dab530711351c0a17c5801f))
* not determined folding widgets for html tags ([#5548](https://github.com/ajaxorg/ace/issues/5548)) ([7a51992](https://github.com/ajaxorg/ace/commit/7a5199292f55dfa1a8ea8830ea1a9d98be097161))
* wrong token type ([#5535](https://github.com/ajaxorg/ace/issues/5535)) ([4041489](https://github.com/ajaxorg/ace/commit/4041489bb38ffe609d5f9b43b4a7637e47fc4739))

### [1.33.1](https://github.com/ajaxorg/ace/compare/v1.33.0...v1.33.1) (2024-04-23)


### Bug Fixes

* account for `this.popup` being potentially undefined in completion mousewheel listener ([#5537](https://github.com/ajaxorg/ace/issues/5537)) ([6c3a9a6](https://github.com/ajaxorg/ace/commit/6c3a9a66a7a0ab0dd493ad2c281c9dd343d5301f))

## [1.33.0](https://github.com/ajaxorg/ace/compare/v1.32.9...v1.33.0) (2024-04-12)


Expand Down
17 changes: 10 additions & 7 deletions ace-internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,10 @@ export namespace Ace {
closingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined;
}

type BehaviorAction = (state: string, action: string, editor: Editor, session: EditSession, text: string | Range) => ({ text: string, selection: number[] } | Range) & { [key: string]: any } | undefined;
type BehaviorAction = (state: string | string[], action: string, editor: Editor, session: EditSession, text: string | Range) => ({
text: string,
selection: number[]
} | Range) & { [key: string]: any } | undefined;
type BehaviorMap = Record<string, Record<string, BehaviorAction>>;

interface Behaviour {
Expand Down Expand Up @@ -877,21 +880,21 @@ export namespace Ace {

getTokenizer(): Tokenizer;

toggleCommentLines(state: any,
toggleCommentLines(state: string | string[],
session: EditSession,
startRow: number,
endRow: number): void;

toggleBlockComment(state: any,
toggleBlockComment(state: string | string[],
session: EditSession,
range: Range,
cursor: Point): void;

getNextLineIndent(state: any, line: string, tab: string): string;
getNextLineIndent(state: string | string[], line: string, tab: string): string;

checkOutdent(state: any, line: string, input: string): boolean;
checkOutdent(state: string | string[], line: string, input: string): boolean;

autoOutdent(state: any, doc: EditSession, row: number): void;
autoOutdent(state: string | string[], doc: EditSession, row: number): void;

// TODO implement WorkerClient types
createWorker(session: EditSession): any;
Expand All @@ -900,7 +903,7 @@ export namespace Ace {

getKeywords(append?: boolean): Array<string | RegExp>;

getCompletions(state: string,
getCompletions(state: string | string[],
session: EditSession,
pos: Point,
prefix: string): Completion[];
Expand Down
1 change: 1 addition & 0 deletions ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ declare module "ace-code" {
enableMultiselect: boolean;
enableKeyboardAccessibility: boolean;
enableCodeLens: boolean;
textInputAriaLabel: string;
}
interface EventsBase {
[key: string]: any;
Expand Down
2 changes: 1 addition & 1 deletion build
Submodule build updated 345 files
1 change: 0 additions & 1 deletion demo/autoresize.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
.ace_editor {
border: 1px solid lightgray;
margin: auto;
height: 200px;
width: 80%;
}
.scrollmargin {
Expand Down
5 changes: 4 additions & 1 deletion demo/kitchen-sink/docs/erlang.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
% Force the use of 'codeswitch/1' from the latest MODULE version
end.

codeswitch(Sum) -> loop(Sum).
codeswitch(Sum) -> loop(Sum).

% Print the data using the pretty print specifier
io:format("Here is the data: ~p~n", [Data]).
34 changes: 31 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1166,14 +1166,42 @@ <h1>Projects Using Ace</h1>
<img lazy-src="https://hardcoder.xyz/favicon.ico" style="width: 72px; left: 15px; top: -2px;">
<a href="https://hardcoder.xyz/?mkp=fncd">Funcdown</a>
</li>
<li>
<li>
<img lazy-src="https://sqltest.online/favicons/android-chrome-192x192.png" style="width: 72px; left: 15px; top: 0px;">
<a href="https://sqltest.online/">SQLtest.online</a>
</li>
<li>
<li>
<img lazy-src="https://hiren.js.org/H.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://hiren.js.org/">HirenJS Code Editor</a>
</li>
</li>
<li>
<img lazy-src="https://hyena-code.web.app/assets/universal/imgs/logo.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://hyena-code.web.app/">Hyena Code</a>
</li>
<li>
<img lazy-src="https://techcopes.com/logo.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://techcopes.com/">Techcopes</a>
</li>
<li>
<img lazy-src="https://media.geeksforgeeks.org/gfg-gg-logo.svg" style="width: 85px; left: 7px; top: -7px;">
<a href="https://www.geeksforgeeks.org/">Geeks for geeks</a>
</li>
<li>
<img lazy-src="https://jsonedit.com/assets/img/jsoneditlogo.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://jsonedit.com/">JSONEdit</a>
</li>
<li>
<img lazy-src="https://panel.bastify.com/dist/images/logo.svg" style="width: 85px; left: 7px; top: -7px;">
<a href="https://www.bastify.com/">Bastify</a>
</li>
<li>
<img lazy-src="https://htmlplayground.online/wp-content/uploads/2023/10/Logopit_1697790200715.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://htmlplayground.online/">Html playground</a>
</li>
<li>
<img lazy-src="https://xuantuyen.education/assets/img/logo.png" style="width: 85px; left: 7px; top: -7px;">
<a href="https://www.xuantuyen.education/">XUÂN TUYẾN Education</a>
</li>
<li id="add_your_site">
<p>+</p>
<a href="https://github.com/ajaxorg/ace/issues/new?assignees=&labels=website%2Cneeds-triage&projects=&template=add-to-website.yml&title=Add+project+%28project+name%29+to+the+list+of+projects+using+Ace+on+its+website">Your Site Here</a>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ace-code",
"description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
"version": "1.33.0",
"version": "1.34.2",
"homepage": "http://github.com/ajaxorg/ace",
"engines": {
"node": ">= 0.6.0"
Expand Down Expand Up @@ -46,8 +46,8 @@
"start": "node static.js",
"test": "node src/test/all.js",
"cover": "istanbul cover src/test/all.js",
"lint": "eslint \"src/**/*.js\"",
"fix": "eslint --fix \"src/**/*.js\"",
"lint": "eslint \"src/**/*.js\" \"*.js\"",
"fix": "npm run lint -- --fix",
"typecheck": "tsc -p tsconfig.json",
"update-types": "node ./tool/ace_declaration_generator.js",
"changelog": "standard-version",
Expand Down
2 changes: 1 addition & 1 deletion src/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class Autocomplete {
}

mousewheelListener(e) {
if (!this.popup.isMouseOver)
if (this.popup && !this.popup.isMouseOver)
this.detach();
}

Expand Down
4 changes: 2 additions & 2 deletions src/autocomplete/inline_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ module.exports = {
inline.show(editor, completions[3], "f");
editor.renderer.$loop._flush();
assert.strictEqual(getAllLines(), textBase + "function foo() {");
assert.strictEqual(editor.renderer.$ghostTextWidget.text, " console.log('test');\n }");
assert.strictEqual(editor.renderer.$ghostTextWidget.el.textContent, " console.log('test');\n }");
assert.strictEqual(editor.renderer.$ghostTextWidget.html, "<div> console.log('test');</div><div> }</div>");
assert.strictEqual(editor.renderer.$ghostTextWidget.el.innerHTML, "<div> console.log('test');</div><div> }</div>");
done();
},
"test: boundary tests": function(done) {
Expand Down
1 change: 0 additions & 1 deletion src/autocomplete/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ dom.importCssString(`
.ace_autocomplete .ace_line .ace_ {
flex: 0 1 auto;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ace_autocomplete .ace_completion-spacer {
Expand Down
3 changes: 2 additions & 1 deletion src/background_tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BackgroundTokenizer {
/**@type {false|number}*/
this.running = false;
this.lines = [];
/**@type {string[]|string[][]}*/
this.states = [];
this.currentLine = 0;
this.tokenizer = tokenizer;
Expand Down Expand Up @@ -176,7 +177,7 @@ class BackgroundTokenizer {
/**
* Returns the state of tokenization at the end of a row.
* @param {Number} row The row to get state at
* @returns {string}
* @returns {string | string[]}
**/
getState(row) {
if (this.currentLine == row)
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ var reportErrorIfPathIsNotConfigured = function() {
}
};

exports.version = "1.33.0";
exports.version = "1.34.2";


12 changes: 12 additions & 0 deletions src/css/editor-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,21 @@ module.exports = `
.ace_ghost_text {
opacity: 0.5;
font-style: italic;
}
.ace_ghost_text > div {
white-space: pre;
}
.ghost_text_line_wrapped::after {
content: "↩";
position: absolute;
}
.ace_lineWidgetContainer.ace_ghost_text {
margin: 0px 4px
}
.ace_screenreader-only {
position:absolute;
left:-10000px;
Expand Down
2 changes: 1 addition & 1 deletion src/edit_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class EditSession {
/**
* {:BackgroundTokenizer.getState}
* @param {Number} row The row to start at
* @returns {string}
* @returns {string | string[]}
* @related BackgroundTokenizer.getState
**/
getState(row) {
Expand Down
12 changes: 5 additions & 7 deletions src/edit_session/folding.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,36 +716,34 @@ function Folding() {
if (dir != 1) {
do {
token = iterator.stepBackward();
} while (token && re.test(token.type) && !/^comment.end/.test(token.type));
} while (token && re.test(token.type));
token = iterator.stepForward();
}

range.start.row = iterator.getCurrentTokenRow();
range.start.column = iterator.getCurrentTokenColumn() + (/^comment.start/.test(token.type) ? token.value.length : 2);
range.start.column = iterator.getCurrentTokenColumn() + token.value.length;

iterator = new TokenIterator(this, row, column);
var initState = this.getState(iterator.$row);

if (dir != -1) {
var lastRow = -1;
do {
token = iterator.stepForward();
if (lastRow == -1) {
var state = this.getState(iterator.$row);
if (!re.test(state))
if (initState.toString() !== state.toString())
lastRow = iterator.$row;
} else if (iterator.$row > lastRow) {
break;
}
} while (token && re.test(token.type) && !/^comment.start/.test(token.type));
} while (token && re.test(token.type));
token = iterator.stepBackward();
} else
token = iterator.getCurrentToken();

range.end.row = iterator.getCurrentTokenRow();
range.end.column = iterator.getCurrentTokenColumn();
if (!/^comment.end/.test(token.type)) {
range.end.column += token.value.length - 2;
}
return range;
}
};
Expand Down
10 changes: 10 additions & 0 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ class Editor {
? [new Range(0, 0, session.doc.getLength() - 1, 0)]
: this.selection.getAllRanges();

/**@type{string|string[]}*/
var prevLineState = "";
var prevLine = "";
var lineIndent = "";
Expand Down Expand Up @@ -2940,6 +2941,7 @@ config.defineOptions(Editor.prototype, "editor", {
// - Prevent tab-trapping.
// - Hide irrelevant elements from assistive technology.
// - On Windows, set more lines to the textarea.
// - set aria-label to the text input.
if (value){
this.renderer.enableKeyboardAccessibility = true;
this.renderer.keyboardFocusClassName = "ace_keyboard-focus";
Expand Down Expand Up @@ -2974,6 +2976,10 @@ config.defineOptions(Editor.prototype, "editor", {
gutterKeyboardHandler = new GutterKeyboardHandler(this);

gutterKeyboardHandler.addListener();

this.textInput.setAriaOptions({
setLabel: true
});
} else {
this.renderer.enableKeyboardAccessibility = false;

Expand Down Expand Up @@ -3003,6 +3009,10 @@ config.defineOptions(Editor.prototype, "editor", {
},
initialValue: false
},
textInputAriaLabel: {
set: function(val) { this.$textInputAriaLabel = val; },
initialValue: ""
},
customScrollbar: "renderer",
hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer",
Expand Down
10 changes: 10 additions & 0 deletions src/editor_commands_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,16 @@ module.exports = {

url = editor.findLinkAt(1, 5);
assert.equal(url, "https://www.google.com/");
},
"test handle events without deprecated keyCode property": function() {
var e = new CustomEvent("keydown");
e.code = "KeyA";
e.ctrlKey = true;
editor = new Editor(new MockRenderer());
editor.session.setValue("123");
assert.equal(editor.getSelectedText(), "");
editor.textInput.getElement().dispatchEvent(e);
assert.equal(editor.getSelectedText(), "123");
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/ext/inline_autocomplete_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var getAllLines = function() {
return node.textContent;
}).join("\n");
if (editor.renderer.$ghostTextWidget) {
return text + "\n" + editor.renderer.$ghostTextWidget.text;
return text + "\n" + editor.renderer.$ghostTextWidget.html;
}
return text;
};
Expand Down Expand Up @@ -358,7 +358,7 @@ module.exports = {
typeAndChange("u", "n");
editor.renderer.$loop._flush();
assert.strictEqual(autocomplete.isOpen(), true);
assert.equal(getAllLines(), "function foo() {\n console.log('test');\n}");
assert.equal(getAllLines(), "function foo() {\n<div> console.log('test');</div><div>}</div>");

typeAndChange("d");
editor.renderer.$loop._flush();
Expand Down
Loading

0 comments on commit 1ee5cae

Please sign in to comment.