-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
566 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/web/core/src/main/java/org/geoserver/web/wicket/js/codemirror/css/show-hint.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
.CodeMirror-hints { | |||
position: absolute; | |||
z-index: 10; | |||
overflow: hidden; | |||
list-style: none; | |||
|
|||
margin: 0; | |||
padding: 2px; | |||
|
|||
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | |||
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | |||
box-shadow: 2px 3px 5px rgba(0,0,0,.2); | |||
border-radius: 3px; | |||
border: 1px solid silver; | |||
|
|||
background: white; | |||
font-size: 90%; | |||
font-family: monospace; | |||
|
|||
max-height: 20em; | |||
overflow-y: auto; | |||
} | |||
|
|||
.CodeMirror-hint { | |||
margin: 0; | |||
padding: 0 4px; | |||
border-radius: 2px; | |||
max-width: 19em; | |||
overflow: hidden; | |||
white-space: pre; | |||
color: black; | |||
cursor: pointer; | |||
} | |||
|
|||
li.CodeMirror-hint-active { | |||
background: #08f; | |||
color: white; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/web/core/src/main/java/org/geoserver/web/wicket/js/codemirror/js/geocss-hint.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,53 @@ | |||
// CodeMirror, copyright (c) by Marijn Haverbeke and others | |||
// Distributed under an MIT license: http://codemirror.net/LICENSE | |||
|
|||
(function(mod) { | |||
if (typeof exports == "object" && typeof module == "object") // CommonJS | |||
mod(require("../../lib/codemirror"), require("../../mode/css/css")); | |||
else if (typeof define == "function" && define.amd) // AMD | |||
define(["../../lib/codemirror", "../../mode/css/css"], mod); | |||
else // Plain browser env | |||
mod(CodeMirror); | |||
})(function(CodeMirror) { | |||
"use strict"; | |||
|
|||
var pseudoClasses = {mark: 1, shield: 1, stroke: 1, fill: 1, symbol: 1, | |||
"nth-mark(n)": 1, "nth-shield(n)": 1, "nth-fill(n)": 1, | |||
"nth-symbol(n)": 1}; | |||
|
|||
CodeMirror.registerHelper("hint", "geocss", function(cm) { | |||
var cur = cm.getCursor(), token = cm.getTokenAt(cur); | |||
var inner = CodeMirror.innerMode(cm.getMode(), token.state); | |||
if (inner.mode.name != "css") return; | |||
|
|||
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start); | |||
if (/[^\w$_-]/.test(word)) { | |||
word = ""; start = end = cur.ch; | |||
} | |||
|
|||
var spec = CodeMirror.resolveMode("text/geocss"); | |||
|
|||
var result = []; | |||
function add(keywords) { | |||
for (var name in keywords) | |||
if (!word || name.lastIndexOf(word, 0) == 0) | |||
result.push(name); | |||
} | |||
|
|||
var st = inner.state.state; | |||
if (st == "pseudo" || token.type == "variable-3") { | |||
add(pseudoClasses); | |||
} else if (st == "block" || st == "maybeprop") { | |||
add(spec.propertyKeywords); | |||
} else if (st == "prop" || st == "parens" || st == "at" || st == "params") { | |||
add(spec.valueKeywords); | |||
add(spec.colorKeywords); | |||
} | |||
|
|||
if (result.length) return { | |||
list: result, | |||
from: CodeMirror.Pos(cur.line, start), | |||
to: CodeMirror.Pos(cur.line, end) | |||
}; | |||
}); | |||
}); |
Oops, something went wrong.