remove styles for occur-highlight from editor.css
This commit is contained in:
parent
98b3bded77
commit
771d861bd5
3 changed files with 33 additions and 37 deletions
|
|
@ -39,7 +39,8 @@ var occurStartCommands = [{
|
||||||
exec: function(editor, options) {
|
exec: function(editor, options) {
|
||||||
var alreadyInOccur = !!editor.session.$occur;
|
var alreadyInOccur = !!editor.session.$occur;
|
||||||
var occurSessionActive = new Occur().enter(editor, options);
|
var occurSessionActive = new Occur().enter(editor, options);
|
||||||
if (occurSessionActive && !alreadyInOccur) OccurKeyboardHandler.installIn(editor);
|
if (occurSessionActive && !alreadyInOccur)
|
||||||
|
OccurKeyboardHandler.installIn(editor);
|
||||||
},
|
},
|
||||||
readOnly: true
|
readOnly: true
|
||||||
}];
|
}];
|
||||||
|
|
@ -100,7 +101,8 @@ OccurKeyboardHandler.installIn = function(editor) {
|
||||||
OccurKeyboardHandler.uninstallFrom = function(editor) {
|
OccurKeyboardHandler.uninstallFrom = function(editor) {
|
||||||
editor.commands.removeCommands(occurCommands);
|
editor.commands.removeCommands(occurCommands);
|
||||||
var handler = editor.getKeyboardHandler();
|
var handler = editor.getKeyboardHandler();
|
||||||
if (handler.isOccurHandler) editor.keyBinding.removeKeyboardHandler(handler);
|
if (handler.isOccurHandler)
|
||||||
|
editor.keyBinding.removeKeyboardHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.commands = occurStartCommands;
|
exports.commands = occurStartCommands;
|
||||||
|
|
|
||||||
|
|
@ -209,14 +209,6 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_marker-layer .ace_occur-highlight {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 4;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_line .ace_fold {
|
.ace_line .ace_fold {
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,6 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* Creates a new `Occur` object.
|
* Creates a new `Occur` object.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|
@ -90,10 +88,11 @@ oop.inherits(Occur, Search);
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.exit = function(editor, options) {
|
this.exit = function(editor, options) {
|
||||||
var pos = options.translatePosition && editor.getCursorPosition(),
|
var pos = options.translatePosition && editor.getCursorPosition();
|
||||||
translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
|
var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
|
||||||
this.displayOriginalContent(editor);
|
this.displayOriginalContent(editor);
|
||||||
if (translatedPos) editor.moveCursorToPosition(translatedPos);
|
if (translatedPos)
|
||||||
|
editor.moveCursorToPosition(translatedPos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,9 +106,9 @@ oop.inherits(Occur, Search);
|
||||||
this.displayOccurContent = function(editor, options) {
|
this.displayOccurContent = function(editor, options) {
|
||||||
// this.setSession(session || new EditSession(""))
|
// this.setSession(session || new EditSession(""))
|
||||||
this.$originalSession = editor.session;
|
this.$originalSession = editor.session;
|
||||||
var found = this.matchingLines(editor.session, options),
|
var found = this.matchingLines(editor.session, options);
|
||||||
lines = found.map(function(foundLine) { return foundLine.content; }),
|
var lines = found.map(function(foundLine) { return foundLine.content; });
|
||||||
occurSession = new EditSession(lines.join('\n'));
|
var occurSession = new EditSession(lines.join('\n'));
|
||||||
occurSession.$occur = this;
|
occurSession.$occur = this;
|
||||||
occurSession.$occurMatchingLines = found;
|
occurSession.$occurMatchingLines = found;
|
||||||
editor.setSession(occurSession);
|
editor.setSession(occurSession);
|
||||||
|
|
@ -130,11 +129,12 @@ oop.inherits(Occur, Search);
|
||||||
* @return {Object} position in occur doc
|
* @return {Object} position in occur doc
|
||||||
**/
|
**/
|
||||||
this.originalToOccurPosition = function(session, pos) {
|
this.originalToOccurPosition = function(session, pos) {
|
||||||
var lines = session.$occurMatchingLines,
|
var lines = session.$occurMatchingLines;
|
||||||
nullPos = {row: 0, column: 0};
|
var nullPos = {row: 0, column: 0};
|
||||||
if (!lines) return nullPos;
|
if (!lines) return nullPos;
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (lines[i].row === pos.row) return {row: i, column: pos.column}
|
if (lines[i].row === pos.row)
|
||||||
|
return {row: i, column: pos.column};
|
||||||
}
|
}
|
||||||
return nullPos;
|
return nullPos;
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +148,8 @@ oop.inherits(Occur, Search);
|
||||||
**/
|
**/
|
||||||
this.occurToOriginalPosition = function(session, pos) {
|
this.occurToOriginalPosition = function(session, pos) {
|
||||||
var lines = session.$occurMatchingLines;
|
var lines = session.$occurMatchingLines;
|
||||||
if (!lines || !lines[pos.row]) return pos;
|
if (!lines || !lines[pos.row])
|
||||||
|
return pos;
|
||||||
return {row: lines[pos.row].row, column: pos.column};
|
return {row: lines[pos.row].row, column: pos.column};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,8 +159,8 @@ oop.inherits(Occur, Search);
|
||||||
var search = new Search();
|
var search = new Search();
|
||||||
search.set(options);
|
search.set(options);
|
||||||
return search.findAll(session).reduce(function(lines, range) {
|
return search.findAll(session).reduce(function(lines, range) {
|
||||||
var row = range.start.row,
|
var row = range.start.row;
|
||||||
last = lines[lines.length-1];
|
var last = lines[lines.length-1];
|
||||||
return last && last.row === row ?
|
return last && last.row === row ?
|
||||||
lines :
|
lines :
|
||||||
lines.concat({row: row, content: session.getLine(row)});
|
lines.concat({row: row, content: session.getLine(row)});
|
||||||
|
|
@ -169,19 +170,20 @@ oop.inherits(Occur, Search);
|
||||||
}).call(Occur.prototype);
|
}).call(Occur.prototype);
|
||||||
|
|
||||||
var dom = require('./lib/dom');
|
var dom = require('./lib/dom');
|
||||||
(function patchHighlightMarkerStyling() {
|
dom.importCssString(".ace_occur-highlight {\n\
|
||||||
var id = 'incremental-occur-highlighting',
|
border-radius: 4px;\n\
|
||||||
css = 'div.ace_occur-highlight {\n'
|
border: 8px solid rgba(87, 255, 8, 0.25);\n\
|
||||||
+ " border-radius: 4px;\n"
|
position: absolute;\n\
|
||||||
+ "border: 8px solid rgba(87, 255, 8, 0.25);\n"
|
z-index: 4;\n\
|
||||||
+ "box-shadow: 0 0 4px rgb(91, 255, 50);\n"
|
-moz-box-sizing: border-box;\n\
|
||||||
+ "}\n"
|
-webkit-box-sizing: border-box;\n\
|
||||||
+ '.ace_dark div.ace_occur-highlight {\n'
|
box-sizing: border-box;\n\
|
||||||
+ "border: 8px solid rgb(80, 140, 85);\n"
|
box-shadow: 0 0 4px rgb(91, 255, 50);\n\
|
||||||
+ "box-shadow: 0 0 4px rgb(60, 120, 70);\n"
|
}\n\
|
||||||
+ '}\n';
|
.ace_dark .ace_occur-highlight {\n\
|
||||||
dom.importCssString(css, id);
|
border: 8px solid rgb(80, 140, 85);\n\
|
||||||
})();
|
box-shadow: 0 0 4px rgb(60, 120, 70);\n\
|
||||||
|
}\n", "incremental-occur-highlighting");
|
||||||
|
|
||||||
exports.Occur = Occur;
|
exports.Occur = Occur;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue