Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove usage of deprecated setCapture api #5058

Merged
merged 2 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ if (typeof process !== "undefined") {

"use strict";

var dom = require("./config");
var config = require("./config");
var assert = require("./test/assertions");

module.exports = {

"test: path resolution" : function() {
config.set("packaged", "true");
config.set("packaged", true);
var url = config.moduleUrl("kr_theme", "theme");
assert.equal(url, "theme-kr_theme.js");

Expand All @@ -38,7 +37,8 @@ module.exports = {
assert.equal(url, "_.js");

url = config.moduleUrl("ace/ext/textarea");
assert.equal(url, "a/b/ext-textarea.js");
assert.equal(url, "a/b/ext-textarea.js");
config.set("packaged", false);
},
"test: define options" : function() {
var o = {};
Expand Down
3 changes: 2 additions & 1 deletion src/css/editor.css.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = `/*
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this comment needed? maybe we could remove it as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is useful for generating the css code below it

styles = []
for (var i = 1; i < 16; i++) {
styles.push(".ace_br" + i + "{" + (
Expand All @@ -9,6 +9,7 @@ for (var i = 1; i < 16; i++) {
}
styles.join("\\n")
*/
module.exports = `
.ace_br1 {border-top-left-radius : 3px;}
.ace_br2 {border-top-right-radius : 3px;}
.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}
Expand Down
24 changes: 18 additions & 6 deletions src/ext/error_marker_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/*global CustomEvent*/

if (typeof process !== "undefined") {
require("amd-loader");
}
Expand All @@ -9,10 +7,14 @@ if (typeof process !== "undefined") {
var assert = require("./../test/assertions");
require("./../test/mockdom");
var ace = require("../ace");
var editor, changes, textarea;
var editor, changes;

module.exports = {
setUp: function() {
ace.config.setLoader(function(moduleName, cb) {
if (moduleName == "ace/ext/error_marker")
return cb(null, require("../ext/error_marker"));
});
if (!editor) {
editor = ace.edit(null);
document.body.appendChild(editor.container);
Expand All @@ -31,10 +33,10 @@ module.exports = {
if (editor) {
editor.destroy();
editor.container.remove();
editor = textarea = null;
editor = null;
}
},
"test: simple text input": function() {
"test: go to next error": function() {
editor.session.setValue("1\nerror 2 warning\n3\n4 info\n5\n6\n");
editor.execCommand("goToNextError");
editor.resize(true);
Expand All @@ -52,9 +54,19 @@ module.exports = {
type: type
};
}));

editor.execCommand("goToNextError");
editor.renderer.$loop._flush();
assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML));

editor.execCommand("goToNextError");
editor.renderer.$loop._flush();
assert.ok(/error_widget/.test(editor.container.innerHTML));
assert.ok(/error_widget\s+ace_info/.test(editor.container.innerHTML));

editor.execCommand("goToPreviousError");
editor.renderer.$loop._flush();
assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML));

editor.execCommand("insertstring", "\n");
editor.renderer.$loop._flush();
assert.notOk(/error_widget/.test(editor.container.innerHTML));
Expand Down
6 changes: 0 additions & 6 deletions src/mouse/default_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ function DefaultHandlers(mouseHandler) {
editor.selection.moveToPosition(pos);
if (!waitForClickSelection)
this.select();
if (editor.renderer.scroller.setCapture) {
editor.renderer.scroller.setCapture();
}
editor.setStyle("ace_selecting");
this.setState("select");
};
Expand Down Expand Up @@ -143,9 +140,6 @@ function DefaultHandlers(mouseHandler) {
this.selectByLinesEnd = function() {
this.$clickSelection = null;
this.editor.unsetStyle("ace_selecting");
if (this.editor.renderer.scroller.releaseCapture) {
this.editor.renderer.scroller.releaseCapture();
}
};

this.focusWait = function() {
Expand Down
8 changes: 6 additions & 2 deletions src/virtual_renderer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var EditSession = require("./edit_session").EditSession;
var VirtualRenderer = require("./virtual_renderer").VirtualRenderer;
var vim = require("./keyboard/vim");
var assert = require("./test/assertions");
require("./ext/error_marker");

function setScreenPosition(node, rect) {
node.style.left = rect[0] + "px";
Expand All @@ -23,6 +22,11 @@ function setScreenPosition(node, rect) {
var editor = null;
module.exports = {
setUp: function() {
require("./config").setLoader(function(moduleName, cb) {
if (moduleName == "ace/ext/error_marker")
return cb(null, require("./ext/error_marker"));
});

if (editor)
editor.destroy();
var el = document.createElement("div");
Expand Down Expand Up @@ -255,7 +259,7 @@ module.exports = {
}
]);
renderer.$loop._flush();
var context = renderer.$scrollDecorator.canvas.getContext();
var context = renderer.$scrollDecorator.canvas.getContext("2d");
var imageData = context.getImageData(0, 0, 50, 50);
var scrollDecoratorColors = renderer.$scrollDecorator.colors.light;
var values = [
Expand Down