[incremental search] using dom.importCssString
This commit is contained in:
parent
724193dcbc
commit
20ff66cf04
1 changed files with 6 additions and 14 deletions
|
|
@ -186,23 +186,15 @@ exports.IncrementalSearch = IncrementalSearch;
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
var dom = require('./lib/dom');
|
||||||
function patchHighlightMarkerStyling(options) {
|
function patchHighlightMarkerStyling(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var id = 'incremental-search-highlight-style-patch',
|
var id = 'incremental-search-highlight-style-patch',
|
||||||
style = document.getElementById(id);
|
css = 'div.ace_selected-word {\n'
|
||||||
if (style) {
|
+ ' background-color: orange !important;\n'
|
||||||
if (options.enable) return;
|
+ ' border: 0 !important;\n'
|
||||||
style.parentNode.removeChild(style);
|
+ '}\n'
|
||||||
return;
|
dom.importCssString(css, id);
|
||||||
}
|
|
||||||
if (!options.enable) return;
|
|
||||||
style = document.createElement('style');
|
|
||||||
style.setAttribute('id', id);
|
|
||||||
style.textContent = "div.ace_selected-word {\n"
|
|
||||||
+ " background-color: orange !important;\n"
|
|
||||||
+ " border: 0 !important;"
|
|
||||||
+ "}\n"
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue