-
Notifications
You must be signed in to change notification settings - Fork 5
Markdown Suggestions #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bf58eb8
adding a chrome panel
inkblotty 79d1649
building out some basic errors
inkblotty 5972cd1
fiddling
inkblotty 71fbe70
get devtools to output the id of the current active element
kendallgassner c5ae6f5
validating markdown -- but very messy and lots of errors
kendallgassner f5f01e5
merging with master + bumping manifest version
kendallgassner d0a947d
Start to make things look nicer
kendallgassner 94bc45b
clean up code a bit
kendallgassner 7557e0f
add tests
kendallgassner 5a4bfb2
cleaning
kendallgassner 650eeab
clean jest file
kendallgassner 06aa4a7
remove changes
kendallgassner 460a620
remove changes
kendallgassner dce50e6
clean up colors
kendallgassner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| presets: [["@babel/preset-env", { targets: { node: "current" } }]], | ||
| }; | ||
Empty file.
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| const getType = (element) => { | ||
| if ( | ||
| element.tagName === "TEXTAREA" && | ||
| element.getAttribute("name").includes("comment") | ||
| ) { | ||
| return "comment"; | ||
| } | ||
|
|
||
| if ( | ||
| element.tagName === "TEXTAREA" && | ||
| element.getAttribute("name").includes("issue") | ||
| ) { | ||
| return "issue"; | ||
| } | ||
| }; | ||
|
|
||
| chrome.runtime.onConnect.addListener(function (port) { | ||
| port.onMessage.addListener(function (msg) { | ||
| if (msg.request === "getTextAreas") { | ||
| const markdownTextAreas = | ||
| Array.from(document.querySelectorAll("textArea")) || []; | ||
| const results = []; | ||
|
|
||
| const codeMirrors = Array.from(document.querySelectorAll(".CodeMirror")); | ||
| [...markdownTextAreas, ...codeMirrors].forEach((textArea) => { | ||
| // ensure that textArea is not hidden and that the user has typed in a value | ||
| if (textArea.clientWidth && textArea.value) { | ||
| results.push({ | ||
| textAreaOutput: textArea.value, | ||
| type: getType(textArea), | ||
| id: textArea.id, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| port.postMessage({ results: results }); | ||
| } else if (msg.request === "focusComponent") { | ||
| ( | ||
| Array.from(document.getElementsByClassName("github-a11y-highlight")) || | ||
| [] | ||
| ).forEach((element) => { | ||
| element.classList.remove("github-a11y-highlight"); | ||
| }); | ||
|
|
||
| const textArea = document.getElementById(msg.id); | ||
| if (textArea) { | ||
| textArea.classList.add("github-a11y-highlight"); | ||
| textArea.focus(); | ||
| textArea.scrollIntoView(); | ||
| } | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .github-a11y-highlight { | ||
| border: 4px solid #58a6ff !important; | ||
| } |
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Mona's Markdown a11y</title> | ||
| </head> | ||
| <body> | ||
| <script src="devtools.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Create a tab in the devtools area | ||
| chrome.devtools.panels.create( | ||
| "Mona's Markdown a11y", | ||
| "./devtools-feedback/toast.png", | ||
| "./devtools-feedback/panel.html" | ||
| ); |
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| :root { | ||
| /* Feel free to customize colors to your preference */ | ||
| --github-a11y-light-blue: rgb(88, 166, 255); | ||
| --github-a11y-blue: rgb(13, 65, 157); | ||
| --github-a11y-blue-grey: rgba(88, 166, 255, 0.5); | ||
| --github-a11y-light-grey: rgb(33, 38, 45); | ||
| --github-a11y-background: rgb(13, 17, 23); | ||
| --github-a11y-font-color: rgb(201, 209, 217); | ||
| --github-a11y-border-color: rgba(240, 246, 252, 0.1); | ||
| --github-a11y-background-accent: rgba(33, 38, 45, 0.5); | ||
| } | ||
|
|
||
| body { | ||
| background-color: var(--github-a11y-background); | ||
| color: var(--github-a11y-font-color); | ||
| font-family: "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", | ||
| "Segoe UI Emoji"; | ||
| font-size: 14px; | ||
| } | ||
|
|
||
| ul { | ||
| list-style: none; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .divider { | ||
| border-top: 1px solid var(--github-a11y-border-color); | ||
| margin-bottom: 12px; | ||
| } | ||
|
|
||
| .feedbackGroup { | ||
| background-color: var(--github-a11y-background-accent); | ||
| padding: 16px; | ||
| border-radius: 4px; | ||
| margin-top: 12px; | ||
| } | ||
|
|
||
| a { | ||
| color: var(--github-a11y-light-blue); | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| a:hover { | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .topSection { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .heading { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| color: var(--github-a11y-light-blue); | ||
| } | ||
|
|
||
| .options { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 12px; | ||
| } | ||
|
|
||
| .monaLisa { | ||
| width: 65px; | ||
| } | ||
|
|
||
| .validationButton { | ||
| margin: 24px 0; | ||
| } | ||
|
|
||
| button { | ||
| text-decoration: none; | ||
| padding: 0.75em 1.25em; | ||
| border-radius: 6px; | ||
| font-size: 16px; | ||
| font-weight: 600; | ||
| display: inline-block; | ||
| cursor: pointer; | ||
| color: var(--github-a11y-light-blue); | ||
| background-color: var(--github-a11y-light-grey); | ||
| border: 1px solid var(--github-a11y-border-color); | ||
| } | ||
|
|
||
| button:hover { | ||
| background-color: var(--github-a11y-border-color); | ||
| text-decoration: none; | ||
| color: var(--github-a11y-light-blue); | ||
| border: 1px solid var(--github-a11y-border-color); | ||
| } | ||
|
|
||
| button:active { | ||
| color: rgb(255, 255, 255); | ||
| background-color: var(--github-a11y-blue); | ||
| border: 1px solid var(--github-a11y-blue); | ||
| } | ||
|
|
||
| button:disabled { | ||
| cursor: default; | ||
| color: var(--github-a11y-blue-grey); | ||
| background-color: var(--github-a11y-background); | ||
| border-color: var(--github-a11y-border-color); | ||
| } | ||
|
|
||
| .instructions { | ||
| font-size: 16px; | ||
| } | ||
|
|
||
| .main { | ||
| display: flex; | ||
| justify-content: center; | ||
| } |
This file contains hidden or 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 | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <link rel="stylesheet" href="panel.css" /> | ||
| <title>Mona's Markdown a11y</title> | ||
| </head> | ||
| <body> | ||
| <div class="topSection"> | ||
| <div class="heading"> | ||
| <img class="monaLisa" alt="" src="./toast.png" /> | ||
| <h1>Mona's Markdown A11y</h1> | ||
| </div> | ||
| <p>Get feedback on the Markdown you're writing in GitHub</p> | ||
| <div class="options"> | ||
| <button id="mona-validate-markdown" class="validationButton"> | ||
| Validate Markdown | ||
| </button> | ||
| <button id="mona-reset" class="validationButton">Reset</button> | ||
| </div> | ||
| </div> | ||
| <main id="main" class="main"></main> | ||
| <script type="module" src="utils.js"></script> | ||
| <script type="module" src="panel.js"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added for jest testing