Skip to content
Snippets Groups Projects
Commit e79555fd authored by Kasper Seweryn's avatar Kasper Seweryn :pancakes:
Browse files

Resolve @Sporiff's comments

parent be6ae174
No related branches found
No related tags found
1 merge request!1Implement all components
Pipeline #23642 passed
...@@ -91,7 +91,7 @@ const newline = async (event: KeyboardEvent) => { ...@@ -91,7 +91,7 @@ const newline = async (event: KeyboardEvent) => {
const isHeading1 = computed(() => currentLine.value.startsWith('# ')) const isHeading1 = computed(() => currentLine.value.startsWith('# '))
const isHeading2 = computed(() => currentLine.value.startsWith('## ')) const isHeading2 = computed(() => currentLine.value.startsWith('## '))
const isQuote = computed(() => currentLine.value.startsWith('> ')) const isQuote = computed(() => currentLine.value.startsWith('> '))
const isUnorderedList = computed(() => currentLine.value.startsWith('- ')) const isUnorderedList = computed(() => currentLine.value.startsWith('- ') || currentLine.value.startsWith('* '))
const isOrderedList = computed(() => /^\d+\. /.test(currentLine.value)) const isOrderedList = computed(() => /^\d+\. /.test(currentLine.value))
const isParagraph = computed(() => !isHeading1.value && !isHeading2.value && !isQuote.value && !isUnorderedList.value && !isOrderedList.value) const isParagraph = computed(() => !isHeading1.value && !isHeading2.value && !isQuote.value && !isUnorderedList.value && !isOrderedList.value)
...@@ -145,6 +145,7 @@ const newlineOperation = (regexp: RegExp, newLineHandler: (line: string, groups: ...@@ -145,6 +145,7 @@ const newlineOperation = (regexp: RegExp, newLineHandler: (line: string, groups:
newlineOperation(/^(\d+)\. /, (line, [lastNumber]) => splice(line.length, 0, `\n${+lastNumber + 1}. `)) newlineOperation(/^(\d+)\. /, (line, [lastNumber]) => splice(line.length, 0, `\n${+lastNumber + 1}. `))
newlineOperation(/^- /, (line) => splice(line.length, 0, `\n- `)) newlineOperation(/^- /, (line) => splice(line.length, 0, `\n- `))
newlineOperation(/^> /, (line) => splice(line.length, 0, `\n> `)) newlineOperation(/^> /, (line) => splice(line.length, 0, `\n> `))
newlineOperation(/^\* /, (line) => splice(line.length, 0, `\n* `))
// Inline operations // Inline operations
const inlineOperation = (chars: string) => async () => { const inlineOperation = (chars: string) => async () => {
...@@ -188,6 +189,8 @@ const focus = () => textarea.value.focus() ...@@ -188,6 +189,8 @@ const focus = () => textarea.value.focus()
<textarea <textarea
ref="textarea" ref="textarea"
@click="updateLineNumber" @click="updateLineNumber"
@mousedown.stop
@mouseup.stop
@keydown.left="updateLineNumber" @keydown.left="updateLineNumber"
@keydown.right="updateLineNumber" @keydown.right="updateLineNumber"
@keydown.up="updateLineNumber" @keydown.up="updateLineNumber"
......
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
top: 8px; top: 8px;
left: 8px; left: 8px;
right: 8px; right: 8px;
bottom: 40px; bottom: 42px;
overflow-y: auto;
background-color: inherit; background-color: inherit;
opacity: 0; opacity: 0;
transform: translateY(.5rem); transform: translateY(.5rem);
......
...@@ -21,10 +21,14 @@ showdown.extension('openExternalInNewTab', { ...@@ -21,10 +21,14 @@ showdown.extension('openExternalInNewTab', {
return text return text
} }
try {
const { hostname } = new URL(url) const { hostname } = new URL(url)
return hostname !== location.hostname return hostname !== location.hostname
? text.replace(matches[0], `href="${url}" target="_blank" rel="noopener noreferrer">`) ? text.replace(matches[0], `href="${url}" target="_blank" rel="noopener noreferrer">`)
: text : text
} catch {
return text.replace(matches[0], `href="${url}" target="_blank" rel="noopener noreferrer">`)
}
} }
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment