mirror of https://github.com/onivim/oni.git
Snippets - add HTML snippets (#1650)
* Add html snippets * Fix bug in snippet buffer layer if the screen coordinates aren't available yet
This commit is contained in:
parent
92e5daed6a
commit
157340f0eb
|
@ -125,13 +125,20 @@ export class SnippetBufferLayerView extends React.PureComponent<
|
|||
const snippetEndPosition =
|
||||
this.props.snippetSession.position.line + this.props.snippetSession.lines.length
|
||||
|
||||
const startPositionInPixels = this.props.context.screenToPixel(
|
||||
this.props.context.bufferToScreen(types.Position.create(snippetStartPosition, 0)),
|
||||
const startScreenPosition = this.props.context.bufferToScreen(
|
||||
types.Position.create(snippetStartPosition, 0),
|
||||
)
|
||||
const endPositionInPixels = this.props.context.screenToPixel(
|
||||
this.props.context.bufferToScreen(types.Position.create(snippetEndPosition, 0)),
|
||||
const endScreenPosition = this.props.context.bufferToScreen(
|
||||
types.Position.create(snippetEndPosition, 0),
|
||||
)
|
||||
|
||||
if (!startScreenPosition || !endScreenPosition) {
|
||||
return null
|
||||
}
|
||||
|
||||
const startPositionInPixels = this.props.context.screenToPixel(startScreenPosition)
|
||||
const endPositionInPixels = this.props.context.screenToPixel(endScreenPosition)
|
||||
|
||||
const topOverlay: React.CSSProperties = {
|
||||
position: "absolute",
|
||||
top: "0px",
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "html",
|
||||
"version": "0.0.1",
|
||||
"description": "HTML extension for Oni",
|
||||
"engines": {
|
||||
"oni": "0.2.18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "html",
|
||||
"path": "snippets/html.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT"
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"HTML template": {
|
||||
"prefix": "html",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<head>",
|
||||
"\t<meta charset=\"utf-8\" />",
|
||||
"\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">",
|
||||
"\t<title>${1:Page Title}</title>",
|
||||
"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",
|
||||
"\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"${2:main.css}\" />",
|
||||
"\t<script src=\"${3:main.js}\"></script>",
|
||||
"</head>",
|
||||
"<body>",
|
||||
"\t$0",
|
||||
"</body>",
|
||||
"</html>"
|
||||
],
|
||||
"description": "Simple HTML5 starting point"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue