323: Updated js and html templates for consistency and ease of use
This commit is contained in:
BIN
VSCode/.DS_Store
vendored
BIN
VSCode/.DS_Store
vendored
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
"name": "quill",
|
||||
"displayName": "Quill",
|
||||
"description": "HTML/CSS Syntax highlighting, best used with the Quill framework",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"publisher": "capturedsun",
|
||||
"icon": "docs/Quill.png",
|
||||
"engines": {
|
||||
|
||||
BIN
VSCode/quill-1.0.3.vsix
Normal file
BIN
VSCode/quill-1.0.3.vsix
Normal file
Binary file not shown.
@@ -1,21 +1,47 @@
|
||||
{
|
||||
"*page": {
|
||||
"prefix": "*page",
|
||||
"prefix": "*html",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html lang=\"en\">",
|
||||
" <head>",
|
||||
" <title>Index</title>",
|
||||
" <title>Quill</title>",
|
||||
" <link rel=\"icon\" href=\"\">",
|
||||
" <link rel=\"stylesheet\" href=\"\">",
|
||||
" <script type=\"module\">",
|
||||
" import * as quill from './Quill/quill.js';",
|
||||
" window.quill = {};",
|
||||
" Object.entries(quill).forEach(([name, exported]) => window[name] = exported);",
|
||||
" window.addStyle = function addStyle(cssString) {",
|
||||
" let container = document.querySelector(\"style#quillStyles\");",
|
||||
" if(!container) {",
|
||||
" container = document.createElement('style');",
|
||||
" container.id = \"quillStyles\";",
|
||||
" document.head.appendChild(container);",
|
||||
" }",
|
||||
"",
|
||||
" let primarySelector = cssString.substring(0, cssString.indexOf(\"{\"));",
|
||||
" primarySelector = primarySelector.replace(/\\*/g, \"all\");",
|
||||
" primarySelector = primarySelector.replace(/#/g, \"id-\");",
|
||||
" primarySelector = primarySelector.replace(/,/g, \"\");",
|
||||
" let stylesheet = container.querySelector(`:scope > style[id='${primarySelector}']`)",
|
||||
" if(!stylesheet) {",
|
||||
" stylesheet = document.createElement('style');",
|
||||
" stylesheet.id = primarySelector;",
|
||||
" stylesheet.appendChild(document.createTextNode(cssString));",
|
||||
" container.appendChild(stylesheet);",
|
||||
" } else {",
|
||||
" stylesheet.innerText = cssString",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" window.html = function html(elementString) {",
|
||||
" let parser = new DOMParser();",
|
||||
" let doc = parser.parseFromString(elementString, 'text/html');",
|
||||
" return doc.body.firstChild;",
|
||||
" }",
|
||||
" </script>",
|
||||
" <script type=\"module\" src=\"index.js\"></script>",
|
||||
" <script type=\"module\" src=\"\"></script>",
|
||||
" </head>",
|
||||
" <body>",
|
||||
"",
|
||||
"",
|
||||
" </body>",
|
||||
"</html>"
|
||||
],
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
"",
|
||||
" constructor() {",
|
||||
" super();",
|
||||
" quill.addStyle(this.css);",
|
||||
" addStyle(this.css);",
|
||||
" this.innerHTML = this.html;",
|
||||
" }",
|
||||
"",
|
||||
" connectedCallback() {",
|
||||
" ",
|
||||
" }",
|
||||
"",
|
||||
"}",
|
||||
@@ -44,28 +45,5 @@
|
||||
"export default Index;"
|
||||
],
|
||||
"description": "Custom Element Template"
|
||||
},
|
||||
|
||||
"*page": {
|
||||
"prefix": "*page",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html lang=\"en\">",
|
||||
" <head>",
|
||||
" <title>Index</title>",
|
||||
" <script type=\"module\">",
|
||||
" import * as quill from './Quill/quill.js';",
|
||||
" window.quill = {};",
|
||||
" Object.entries(quill).forEach(([name, exported]) => window[name] = exported);",
|
||||
" </script>",
|
||||
" <script type=\"module\" src=\"index.js\"></script>",
|
||||
" </head>",
|
||||
" <body>",
|
||||
"",
|
||||
"",
|
||||
" </body>",
|
||||
"</html>"
|
||||
],
|
||||
"description": "Use the DOM collection of functions"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user