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