diff --git a/README.md b/README.md index ba36005..70615a3 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ Usage: Install the VSCode extension "Quill". ## Boilerplate: -- ```*page```: Type in an HTML file and select the suggestion to create HTML boilerplate. +- ```*html```: Type in an HTML file and select the suggestion to create HTML boilerplate. - ```*element```: Type in a JS file and select the suggestion to create JS Custom Element boilerplate. ## Functions: Clone this repository into the top level of the project you are working on, so the HTML can find the "quill.js" functions. Use backticks with both to get HTML and CSS syntax highlighting. - ```addStyle```: Adds a style to a Quill style tag in the head. -- ```create```: Creates a parsed HTML element (which is not yet in the DOM) \ No newline at end of file +- ```html```: Creates a parsed HTML element (which is not yet in the DOM) \ No newline at end of file diff --git a/VSCode/.DS_Store b/VSCode/.DS_Store index 70f1ee5..fadc775 100644 Binary files a/VSCode/.DS_Store and b/VSCode/.DS_Store differ diff --git a/VSCode/package.json b/VSCode/package.json index 7ac1cc4..2a1c929 100644 --- a/VSCode/package.json +++ b/VSCode/package.json @@ -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": { diff --git a/VSCode/quill-1.0.3.vsix b/VSCode/quill-1.0.3.vsix new file mode 100644 index 0000000..a28c0b9 Binary files /dev/null and b/VSCode/quill-1.0.3.vsix differ diff --git a/VSCode/snippets-html.json b/VSCode/snippets-html.json index e744296..e1e54d1 100644 --- a/VSCode/snippets-html.json +++ b/VSCode/snippets-html.json @@ -1,21 +1,47 @@ { "*page": { - "prefix": "*page", + "prefix": "*html", "body": [ "", "", " ", - " Index", + " Quill", + " ", + " ", " ", - " ", + " ", " ", " ", "", - "", " ", "" ], diff --git a/VSCode/snippets-js.json b/VSCode/snippets-js.json index b1dee2a..798cc06 100644 --- a/VSCode/snippets-js.json +++ b/VSCode/snippets-js.json @@ -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": [ - "", - "", - " ", - " Index", - " ", - " ", - " ", - " ", - "", - "", - " ", - "" - ], - "description": "Use the DOM collection of functions" } } \ No newline at end of file diff --git a/deploy-howto.md b/deploy-howto.md new file mode 100644 index 0000000..a817a79 --- /dev/null +++ b/deploy-howto.md @@ -0,0 +1,5 @@ +# To Deploy Extension + +```vsce package``` + +```vsce publish``` \ No newline at end of file diff --git a/index.html b/index.html index adcf809..ea6c1e4 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,42 @@ - Index + Quill + + - + - diff --git a/quill.js b/quill.js index 2faf1f1..6671910 100644 --- a/quill.js +++ b/quill.js @@ -1,28 +1,22 @@ export function addStyle(cssString) { - if(quill.detectMobile() || quill.getSafariVersion() < 16.4) { - let container = document.querySelector("style#quillStyles"); - if(!container) { - container = document.createElement('style'); - container.id = "quillStyles"; - document.head.appendChild(container); - } + 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("{")).trim(); - primarySelector = primarySelector.replace(/\*/g, "all"); - let stylesheet = container.querySelector(`:scope > style#${primarySelector}`) - if(!stylesheet) { - stylesheet = document.createElement('style'); - stylesheet.id = primarySelector; - stylesheet.appendChild(document.createTextNode(cssString)); - container.appendChild(stylesheet); - } else { - stylesheet.innerText = cssString - } - return; - } - let stylesheet = new CSSStyleSheet(); - stylesheet.replaceSync(cssString) - document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet]; + let primarySelector = cssString.substring(0, cssString.indexOf("{")).trim(); + primarySelector = primarySelector.replace(/\*/g, "all"); + let stylesheet = container.querySelector(`:scope > style#${primarySelector}`) + if(!stylesheet) { + stylesheet = document.createElement('style'); + stylesheet.id = primarySelector; + stylesheet.appendChild(document.createTextNode(cssString)); + container.appendChild(stylesheet); + } else { + stylesheet.innerText = cssString + } } export function createElement(elementString) {