Skip to content

Commit

Permalink
package 21.10.24
Browse files Browse the repository at this point in the history
  • Loading branch information
sokomari committed Oct 21, 2024
1 parent cb4c7c3 commit a10728b
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 78 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.36.3](https://github.com/ajaxorg/ace/compare/v1.36.2...v1.36.3) (2024-10-21)


### Bug Fixes

* `readdirSync` options `recursive: true` was added only in NodeJs v20.1.0 ([#5645](https://github.com/ajaxorg/ace/issues/5645)) ([2953f72](https://github.com/ajaxorg/ace/commit/2953f72877a90691432373cfe9182e60ea9b2d8f))

### [1.36.2](https://github.com/ajaxorg/ace/compare/v1.36.1...v1.36.2) (2024-08-30)


Expand Down
11 changes: 10 additions & 1 deletion ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,13 @@ export namespace Ace {

export interface EditSession extends EventEmitter, OptionsProvider, Folding {
selection: Selection;
curOp?: {
docChanged?: boolean;
selectionChanged?: boolean;
command?: {
name?: string;
};
};

// TODO: define BackgroundTokenizer

Expand All @@ -518,7 +525,7 @@ export namespace Ace {
callback: (obj: { data: { first: number, last: number } }) => void): Function;
on(name: 'change', callback: () => void): Function;
on(name: 'changeTabSize', callback: () => void): Function;

on(name: "beforeEndOperation", callback: () => void): Function;

setOption<T extends keyof EditSessionOptions>(name: T, value: EditSessionOptions[T]): void;
getOption<T extends keyof EditSessionOptions>(name: T): EditSessionOptions[T];
Expand Down Expand Up @@ -626,6 +633,8 @@ export namespace Ace {
documentToScreenRow(docRow: number, docColumn: number): number;
getScreenLength(): number;
getPrecedingCharacter(): string;
startOperation(commandEvent: {command: {name: string}}): void;
endOperation(): void;
toJSON(): Object;
destroy(): void;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ace-builds",
"main": "./src-noconflict/ace.js",
"typings": "ace.d.ts",
"version": "1.36.2",
"version": "1.36.3",
"description": "Ace (Ajax.org Cloud9 Editor)",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
2 changes: 1 addition & 1 deletion src-min-noconflict/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ace.js

Large diffs are not rendered by default.

128 changes: 91 additions & 37 deletions src-noconflict/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ var reportErrorIfPathIsNotConfigured = function () {
reportErrorIfPathIsNotConfigured = function () { };
}
};
exports.version = "1.36.2";
exports.version = "1.36.3";

});

Expand Down Expand Up @@ -9988,6 +9988,7 @@ var EditSession = /** @class */ (function () {
this.$backMarkers = {};
this.$markerId = 1;
this.$undoSelect = true;
this.prevOp = {};
this.$foldData = [];
this.id = "session" + (++EditSession.$uid);
this.$foldData.toString = function () {
Expand All @@ -10004,12 +10005,73 @@ var EditSession = /** @class */ (function () {
text = new Document(/**@type{string}*/ (text));
this.setDocument(text);
this.selection = new Selection(this);
this.$onSelectionChange = this.onSelectionChange.bind(this);
this.selection.on("changeSelection", this.$onSelectionChange);
this.selection.on("changeCursor", this.$onSelectionChange);
this.$bidiHandler = new BidiHandler(this);
config.resetOptions(this);
this.setMode(mode);
config._signal("session", this);
this.destroyed = false;
this.$initOperationListeners();
}
EditSession.prototype.$initOperationListeners = function () {
var _this = this;
this.curOp = null;
this.on("change", function () {
if (!_this.curOp) {
_this.startOperation();
_this.curOp.selectionBefore = _this.$lastSel;
}
_this.curOp.docChanged = true;
}, true);
this.on("changeSelection", function () {
if (!_this.curOp) {
_this.startOperation();
_this.curOp.selectionBefore = _this.$lastSel;
}
_this.curOp.selectionChanged = true;
}, true);
this.$operationResetTimer = lang.delayedCall(this.endOperation.bind(this, true));
};
EditSession.prototype.startOperation = function (commandEvent) {
if (this.curOp) {
if (!commandEvent || this.curOp.command) {
return;
}
this.prevOp = this.curOp;
}
if (!commandEvent) {
commandEvent = {};
}
this.$operationResetTimer.schedule();
this.curOp = {
command: commandEvent.command || {},
args: commandEvent.args
};
this.curOp.selectionBefore = this.selection.toJSON();
this._signal("startOperation", commandEvent);
};
EditSession.prototype.endOperation = function (e) {
if (this.curOp) {
if (e && e.returnValue === false) {
this.curOp = null;
this._signal("endOperation", e);
return;
}
if (e == true && this.curOp.command && this.curOp.command.name == "mouse") {
return;
}
var currentSelection = this.selection.toJSON();
this.curOp.selectionAfter = currentSelection;
this.$lastSel = this.selection.toJSON();
this.getUndoManager().addSelection(currentSelection);
this._signal("beforeEndOperation");
this.prevOp = this.curOp;
this.curOp = null;
this._signal("endOperation", e);
}
};
EditSession.prototype.setDocument = function (doc) {
if (this.doc)
this.doc.off("change", this.$onChange);
Expand Down Expand Up @@ -10081,6 +10143,9 @@ var EditSession = /** @class */ (function () {
this.bgTokenizer.$updateOnChange(delta);
this._signal("change", delta);
};
EditSession.prototype.onSelectionChange = function () {
this._signal("changeSelection");
};
EditSession.prototype.setValue = function (text) {
this.doc.setValue(text);
this.selection.moveTo(0, 0);
Expand Down Expand Up @@ -11423,11 +11488,16 @@ var EditSession = /** @class */ (function () {
this.bgTokenizer.cleanup();
this.destroyed = true;
}
this.endOperation();
this.$stopWorker();
this.removeAllListeners();
if (this.doc) {
this.doc.off("change", this.$onChange);
}
if (this.selection) {
this.selection.off("changeCursor", this.$onSelectionChange);
this.selection.off("changeSelection", this.$onSelectionChange);
}
this.selection.detach();
};
return EditSession;
Expand Down Expand Up @@ -13885,46 +13955,27 @@ var Editor = /** @class */ (function () {
Editor.prototype.$initOperationListeners = function () {
this.commands.on("exec", this.startOperation.bind(this), true);
this.commands.on("afterExec", this.endOperation.bind(this), true);
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this, true));
this.on("change", function () {
if (!this.curOp) {
this.startOperation();
this.curOp.selectionBefore = this.$lastSel;
}
this.curOp.docChanged = true;
}.bind(this), true);
this.on("changeSelection", function () {
if (!this.curOp) {
this.startOperation();
this.curOp.selectionBefore = this.$lastSel;
}
this.curOp.selectionChanged = true;
}.bind(this), true);
};
Editor.prototype.startOperation = function (commandEvent) {
if (this.curOp) {
if (!commandEvent || this.curOp.command)
return;
this.prevOp = this.curOp;
}
this.session.startOperation(commandEvent);
};
Editor.prototype.endOperation = function (e) {
this.session.endOperation(e);
};
Editor.prototype.onStartOperation = function (commandEvent) {
this.curOp = this.session.curOp;
this.curOp.scrollTop = this.renderer.scrollTop;
this.prevOp = this.session.prevOp;
if (!commandEvent) {
this.previousCommand = null;
commandEvent = {};
}
this.$opResetTimer.schedule();
this.curOp = this.session.curOp = {
command: commandEvent.command || {},
args: commandEvent.args,
scrollTop: this.renderer.scrollTop
};
this.curOp.selectionBefore = this.selection.toJSON();
};
Editor.prototype.endOperation = function (e) {
Editor.prototype.onEndOperation = function (e) {
if (this.curOp && this.session) {
if (e && e.returnValue === false || !this.session)
return (this.curOp = null);
if (e == true && this.curOp.command && this.curOp.command.name == "mouse")
if (e && e.returnValue === false) {
this.curOp = null;
return;
}
this._signal("beforeEndOperation");
if (!this.curOp)
return;
Expand Down Expand Up @@ -13954,10 +14005,7 @@ var Editor = /** @class */ (function () {
if (scrollIntoView == "animate")
this.renderer.animateScrolling(this.curOp.scrollTop);
}
var sel = this.selection.toJSON();
this.curOp.selectionAfter = sel;
this.$lastSel = this.selection.toJSON();
this.session.getUndoManager().addSelection(sel);
this.$lastSel = this.session.selection.toJSON();
this.prevOp = this.curOp;
this.curOp = null;
}
Expand Down Expand Up @@ -14031,6 +14079,8 @@ var Editor = /** @class */ (function () {
this.session.off("changeOverwrite", this.$onCursorChange);
this.session.off("changeScrollTop", this.$onScrollTopChange);
this.session.off("changeScrollLeft", this.$onScrollLeftChange);
this.session.off("startOperation", this.$onStartOperation);
this.session.off("endOperation", this.$onEndOperation);
var selection = this.session.getSelection();
selection.off("changeCursor", this.$onCursorChange);
selection.off("changeSelection", this.$onSelectionChange);
Expand Down Expand Up @@ -14070,6 +14120,10 @@ var Editor = /** @class */ (function () {
this.selection.on("changeCursor", this.$onCursorChange);
this.$onSelectionChange = this.onSelectionChange.bind(this);
this.selection.on("changeSelection", this.$onSelectionChange);
this.$onStartOperation = this.onStartOperation.bind(this);
this.session.on("startOperation", this.$onStartOperation);
this.$onEndOperation = this.onEndOperation.bind(this);
this.session.on("endOperation", this.$onEndOperation);
this.onChangeMode();
this.onCursorChange();
this.onScrollTopChange();
Expand Down
Loading

0 comments on commit a10728b

Please sign in to comment.