Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
ui
Commits
e79555fd
Commit
e79555fd
authored
2 years ago
by
Kasper Seweryn
Browse files
Options
Downloads
Patches
Plain Diff
Resolve
@Sporiff
's comments
parent
be6ae174
No related branches found
No related tags found
1 merge request
!1
Implement all components
Pipeline
#23642
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/textarea/Textarea.vue
+4
-1
4 additions, 1 deletion
src/components/textarea/Textarea.vue
src/components/textarea/style.scss
+2
-1
2 additions, 1 deletion
src/components/textarea/style.scss
src/components/utils/Markdown.vue
+8
-4
8 additions, 4 deletions
src/components/utils/Markdown.vue
with
14 additions
and
6 deletions
src/components/textarea/Textarea.vue
+
4
−
1
View file @
e79555fd
...
@@ -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"
...
...
This diff is collapsed.
Click to expand it.
src/components/textarea/style.scss
+
2
−
1
View file @
e79555fd
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
src/components/utils/Markdown.vue
+
8
−
4
View file @
e79555fd
...
@@ -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">`
)
}
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment