Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7e9741c5
Commit
7e9741c5
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 33 files - 6 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
b282f7dd
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
107 additions
and
142 deletions
+107
-142
.prettierignore
.prettierignore
+0
-35
app/assets/javascripts/authentication/webauthn/authenticate.js
...ssets/javascripts/authentication/webauthn/authenticate.js
+2
-2
app/assets/javascripts/authentication/webauthn/register.js
app/assets/javascripts/authentication/webauthn/register.js
+2
-2
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+12
-12
app/assets/javascripts/badges/components/badge_form.vue
app/assets/javascripts/badges/components/badge_form.vue
+3
-3
app/assets/javascripts/badges/components/badge_settings.vue
app/assets/javascripts/badges/components/badge_settings.vue
+1
-1
app/assets/javascripts/badges/store/actions.js
app/assets/javascripts/badges/store/actions.js
+10
-10
app/assets/javascripts/badges/store/mutations.js
app/assets/javascripts/badges/store/mutations.js
+5
-5
app/assets/javascripts/batch_comments/components/preview_item.vue
...ts/javascripts/batch_comments/components/preview_item.vue
+1
-1
app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
...s/batch_comments/stores/modules/batch_comments/actions.js
+10
-10
app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js
...s/batch_comments/stores/modules/batch_comments/getters.js
+10
-10
app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js
...batch_comments/stores/modules/batch_comments/mutations.js
+7
-7
app/assets/javascripts/batch_comments/utils.js
app/assets/javascripts/batch_comments/utils.js
+2
-2
app/assets/javascripts/behaviors/autosize.js
app/assets/javascripts/behaviors/autosize.js
+1
-1
app/assets/javascripts/behaviors/bind_in_out.js
app/assets/javascripts/behaviors/bind_in_out.js
+1
-1
app/assets/javascripts/behaviors/copy_to_clipboard.js
app/assets/javascripts/behaviors/copy_to_clipboard.js
+1
-1
app/assets/javascripts/behaviors/gl_emoji.js
app/assets/javascripts/behaviors/gl_emoji.js
+1
-1
app/assets/javascripts/behaviors/load_startup_css.js
app/assets/javascripts/behaviors/load_startup_css.js
+1
-1
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
+6
-6
app/assets/javascripts/behaviors/markdown/highlight_current_user.js
.../javascripts/behaviors/markdown/highlight_current_user.js
+1
-1
app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
...ssets/javascripts/behaviors/markdown/marks/inline_diff.js
+1
-1
app/assets/javascripts/behaviors/markdown/marks/inline_html.js
...ssets/javascripts/behaviors/markdown/marks/inline_html.js
+3
-3
app/assets/javascripts/behaviors/markdown/nodes/code_block.js
...assets/javascripts/behaviors/markdown/nodes/code_block.js
+3
-3
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
+2
-2
app/assets/javascripts/behaviors/markdown/nodes/image.js
app/assets/javascripts/behaviors/markdown/nodes/image.js
+2
-2
app/assets/javascripts/behaviors/markdown/nodes/playable.js
app/assets/javascripts/behaviors/markdown/nodes/playable.js
+2
-2
app/assets/javascripts/behaviors/markdown/nodes/reference.js
app/assets/javascripts/behaviors/markdown/nodes/reference.js
+2
-2
app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
...assets/javascripts/behaviors/markdown/nodes/table_cell.js
+2
-2
app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
...ts/javascripts/behaviors/markdown/nodes/task_list_item.js
+1
-1
app/assets/javascripts/behaviors/markdown/render_math.js
app/assets/javascripts/behaviors/markdown/render_math.js
+2
-2
app/assets/javascripts/behaviors/markdown/render_mermaid.js
app/assets/javascripts/behaviors/markdown/render_mermaid.js
+4
-4
app/assets/javascripts/behaviors/markdown/render_metrics.js
app/assets/javascripts/behaviors/markdown/render_metrics.js
+2
-2
app/assets/javascripts/behaviors/markdown/schema.js
app/assets/javascripts/behaviors/markdown/schema.js
+2
-2
app/assets/javascripts/behaviors/markdown/serializer.js
app/assets/javascripts/behaviors/markdown/serializer.js
+2
-2
No files found.
.prettierignore
View file @
7e9741c5
...
...
@@ -10,41 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss
*.md
## reverent-lovelace
app/assets/javascripts/authentication/webauthn/authenticate.js
app/assets/javascripts/authentication/webauthn/register.js
app/assets/javascripts/awards_handler.js
app/assets/javascripts/badges/components/badge_form.vue
app/assets/javascripts/badges/components/badge_settings.vue
app/assets/javascripts/badges/store/actions.js
app/assets/javascripts/badges/store/mutations.js
app/assets/javascripts/batch_comments/components/preview_item.vue
app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js
app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js
app/assets/javascripts/batch_comments/utils.js
app/assets/javascripts/behaviors/autosize.js
app/assets/javascripts/behaviors/bind_in_out.js
app/assets/javascripts/behaviors/copy_to_clipboard.js
app/assets/javascripts/behaviors/gl_emoji.js
app/assets/javascripts/behaviors/load_startup_css.js
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
app/assets/javascripts/behaviors/markdown/highlight_current_user.js
app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
app/assets/javascripts/behaviors/markdown/marks/inline_html.js
app/assets/javascripts/behaviors/markdown/nodes/code_block.js
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
app/assets/javascripts/behaviors/markdown/nodes/image.js
app/assets/javascripts/behaviors/markdown/nodes/playable.js
app/assets/javascripts/behaviors/markdown/nodes/reference.js
app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
app/assets/javascripts/behaviors/markdown/render_math.js
app/assets/javascripts/behaviors/markdown/render_mermaid.js
app/assets/javascripts/behaviors/markdown/render_metrics.js
app/assets/javascripts/behaviors/markdown/schema.js
app/assets/javascripts/behaviors/markdown/serializer.js
## nice-swanson
app/assets/javascripts/behaviors/preview_markdown.js
app/assets/javascripts/behaviors/quick_submit.js
...
...
app/assets/javascripts/authentication/webauthn/authenticate.js
View file @
7e9741c5
...
...
@@ -39,11 +39,11 @@ export default class WebAuthnAuthenticate {
authenticate
()
{
navigator
.
credentials
.
get
({
publicKey
:
this
.
webauthnParams
})
.
then
(
resp
=>
{
.
then
(
(
resp
)
=>
{
const
convertedResponse
=
convertGetResponse
(
resp
);
this
.
renderAuthenticated
(
JSON
.
stringify
(
convertedResponse
));
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
this
.
flow
.
renderError
(
new
WebAuthnError
(
err
,
'
authenticate
'
));
});
}
...
...
app/assets/javascripts/authentication/webauthn/register.js
View file @
7e9741c5
...
...
@@ -39,8 +39,8 @@ export default class WebAuthnRegister {
.
create
({
publicKey
:
this
.
webauthnOptions
,
})
.
then
(
cred
=>
this
.
renderRegistered
(
JSON
.
stringify
(
convertCreateResponse
(
cred
))))
.
catch
(
err
=>
this
.
flow
.
renderError
(
new
WebAuthnError
(
err
,
'
register
'
)));
.
then
(
(
cred
)
=>
this
.
renderRegistered
(
JSON
.
stringify
(
convertCreateResponse
(
cred
))))
.
catch
(
(
err
)
=>
this
.
flow
.
renderError
(
new
WebAuthnError
(
err
,
'
register
'
)));
}
renderSetup
()
{
...
...
app/assets/javascripts/awards_handler.js
View file @
7e9741c5
...
...
@@ -56,13 +56,13 @@ export class AwardsHandler {
}
},
);
this
.
registerEventListener
(
'
on
'
,
$parentEl
,
'
click
'
,
this
.
toggleButtonSelector
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$parentEl
,
'
click
'
,
this
.
toggleButtonSelector
,
(
e
)
=>
{
e
.
stopPropagation
();
e
.
preventDefault
();
this
.
showEmojiMenu
(
$
(
e
.
currentTarget
));
});
this
.
registerEventListener
(
'
on
'
,
$
(
'
html
'
),
'
click
'
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$
(
'
html
'
),
'
click
'
,
(
e
)
=>
{
const
$target
=
$
(
e
.
target
);
if
(
!
$target
.
closest
(
`.
${
this
.
menuClass
}
`
).
length
)
{
$
(
'
.js-awards-block.current
'
).
removeClass
(
'
current
'
);
...
...
@@ -74,7 +74,7 @@ export class AwardsHandler {
});
const
emojiButtonSelector
=
`.js-awards-block .js-emoji-btn, .
${
this
.
menuClass
}
.js-emoji-btn`
;
this
.
registerEventListener
(
'
on
'
,
$parentEl
,
'
click
'
,
emojiButtonSelector
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$parentEl
,
'
click
'
,
emojiButtonSelector
,
(
e
)
=>
{
e
.
preventDefault
();
const
$target
=
$
(
e
.
currentTarget
);
const
$glEmojiElement
=
$target
.
find
(
'
gl-emoji
'
);
...
...
@@ -190,7 +190,7 @@ export class AwardsHandler {
(
promiseChain
,
categoryNameKey
)
=>
promiseChain
.
then
(
()
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
const
emojisInCategory
=
categoryMap
[
categoryNameKey
];
const
categoryMarkup
=
this
.
renderCategory
(
categoryLabelMap
[
categoryNameKey
],
...
...
@@ -213,7 +213,7 @@ export class AwardsHandler {
menu
.
dispatchEvent
(
new
CustomEvent
(
'
build-emoji-menu-finish
'
));
}
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
emojiContentElement
.
insertAdjacentHTML
(
'
beforeend
'
,
'
<p>We encountered an error while adding the remaining categories</p>
'
,
...
...
@@ -230,7 +230,7 @@ export class AwardsHandler {
<ul class="clearfix emoji-menu-list
${
opts
.
menuListClass
||
''
}
">
${
emojiList
.
map
(
emojiName
=>
`
(
emojiName
)
=>
`
<li class="emoji-menu-list-item">
<button class="emoji-menu-btn text-center js-emoji-btn" type="button">
${
this
.
emoji
.
glEmojiTag
(
emojiName
,
{
...
...
@@ -463,7 +463,7 @@ export class AwardsHandler {
const
className
=
'
pulse animated once short
'
;
$emoji
.
addClass
(
className
);
this
.
registerEventListener
(
'
on
'
,
$emoji
,
animationEndEventString
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$emoji
,
animationEndEventString
,
(
e
)
=>
{
$
(
e
.
currentTarget
).
removeClass
(
className
);
});
}
...
...
@@ -515,7 +515,7 @@ export class AwardsHandler {
this
.
frequentlyUsedEmojis
||
(()
=>
{
const
frequentlyUsedEmojis
=
uniq
((
Cookies
.
get
(
'
frequently_used_emojis
'
)
||
''
).
split
(
'
,
'
));
this
.
frequentlyUsedEmojis
=
frequentlyUsedEmojis
.
filter
(
inputName
=>
this
.
frequentlyUsedEmojis
=
frequentlyUsedEmojis
.
filter
(
(
inputName
)
=>
this
.
emoji
.
isEmojiNameValid
(
inputName
),
);
...
...
@@ -527,13 +527,13 @@ export class AwardsHandler {
setupSearch
()
{
const
$search
=
$
(
'
.js-emoji-menu-search
'
);
this
.
registerEventListener
(
'
on
'
,
$search
,
'
input
'
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$search
,
'
input
'
,
(
e
)
=>
{
const
term
=
$
(
e
.
target
).
val
().
trim
();
this
.
searchEmojis
(
term
);
});
const
$menu
=
$
(
`.
${
this
.
menuClass
}
`
);
this
.
registerEventListener
(
'
on
'
,
$menu
,
transitionEndEventString
,
e
=>
{
this
.
registerEventListener
(
'
on
'
,
$menu
,
transitionEndEventString
,
(
e
)
=>
{
if
(
e
.
target
===
e
.
currentTarget
)
{
// Clear the search
this
.
searchEmojis
(
''
);
...
...
@@ -583,7 +583,7 @@ export class AwardsHandler {
}
hideMenuElement
(
$emojiMenu
)
{
$emojiMenu
.
on
(
transitionEndEventString
,
e
=>
{
$emojiMenu
.
on
(
transitionEndEventString
,
(
e
)
=>
{
if
(
e
.
currentTarget
===
e
.
target
)
{
// eslint-disable-next-line @gitlab/no-global-event-off
$emojiMenu
.
removeClass
(
IS_RENDERED
).
off
(
transitionEndEventString
);
...
...
@@ -594,7 +594,7 @@ export class AwardsHandler {
}
destroy
()
{
this
.
eventListeners
.
forEach
(
entry
=>
{
this
.
eventListeners
.
forEach
(
(
entry
)
=>
{
entry
.
element
.
off
.
call
(
entry
.
element
,
...
entry
.
args
);
});
$
(
`.
${
this
.
menuClass
}
`
).
remove
();
...
...
app/assets/javascripts/badges/components/badge_form.vue
View file @
7e9741c5
...
...
@@ -48,7 +48,7 @@ export default {
},
helpText
()
{
const
placeholders
=
[
'
project_path
'
,
'
project_id
'
,
'
default_branch
'
,
'
commit_sha
'
]
.
map
(
placeholder
=>
`<code>%{
${
placeholder
}
}</code>`
)
.
map
(
(
placeholder
)
=>
`<code>%{
${
placeholder
}
}</code>`
)
.
join
(
'
,
'
);
return
sprintf
(
s__
(
'
Badges|Supported %{docsLinkStart}variables%{docsLinkEnd}: %{placeholders}
'
),
...
...
@@ -137,7 +137,7 @@ export default {
createFlash
(
s__
(
'
Badges|Badge saved.
'
),
'
notice
'
);
this
.
wasValidated
=
false
;
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
createFlash
(
s__
(
'
Badges|Saving the badge failed, please check the entered URLs and try again.
'
),
);
...
...
@@ -150,7 +150,7 @@ export default {
createFlash
(
s__
(
'
Badges|New badge added.
'
),
'
notice
'
);
this
.
wasValidated
=
false
;
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
createFlash
(
s__
(
'
Badges|Adding the badge failed, please check the entered URLs and try again.
'
),
);
...
...
app/assets/javascripts/badges/components/badge_settings.vue
View file @
7e9741c5
...
...
@@ -42,7 +42,7 @@ export default {
.
then
(()
=>
{
createFlash
(
s__
(
'
Badges|The badge was deleted.
'
),
'
notice
'
);
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
createFlash
(
s__
(
'
Badges|Deleting the badge failed, please try again.
'
));
throw
error
;
});
...
...
app/assets/javascripts/badges/store/actions.js
View file @
7e9741c5
...
...
@@ -2,7 +2,7 @@ import axios from '~/lib/utils/axios_utils';
import
types
from
'
./mutation_types
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
export
const
transformBackendBadge
=
badge
=>
({
export
const
transformBackendBadge
=
(
badge
)
=>
({
...
convertObjectPropsToCamelCase
(
badge
,
true
),
isDeleting
:
false
,
});
...
...
@@ -27,11 +27,11 @@ export default {
image_url
:
newBadge
.
imageUrl
,
link_url
:
newBadge
.
linkUrl
,
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
dispatch
(
'
receiveNewBadgeError
'
);
throw
error
;
})
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
dispatch
(
'
receiveNewBadge
'
,
transformBackendBadge
(
res
.
data
));
});
},
...
...
@@ -50,7 +50,7 @@ export default {
const
endpoint
=
`
${
state
.
apiEndpointUrl
}
/
${
badgeId
}
`
;
return
axios
.
delete
(
endpoint
)
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
dispatch
(
'
receiveDeleteBadgeError
'
,
badgeId
);
throw
error
;
})
...
...
@@ -78,11 +78,11 @@ export default {
const
endpoint
=
state
.
apiEndpointUrl
;
return
axios
.
get
(
endpoint
)
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
dispatch
(
'
receiveLoadBadgesError
'
);
throw
error
;
})
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
dispatch
(
'
receiveLoadBadges
'
,
res
.
data
.
map
(
transformBackendBadge
));
});
},
...
...
@@ -113,11 +113,11 @@ export default {
const
renderEndpoint
=
`
${
state
.
apiEndpointUrl
}
/render?
${
parameters
}
`
;
return
axios
.
get
(
renderEndpoint
)
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
dispatch
(
'
receiveRenderedBadgeError
'
);
throw
error
;
})
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
dispatch
(
'
receiveRenderedBadge
'
,
transformBackendBadge
(
res
.
data
));
});
},
...
...
@@ -142,11 +142,11 @@ export default {
image_url
:
badge
.
imageUrl
,
link_url
:
badge
.
linkUrl
,
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
dispatch
(
'
receiveUpdatedBadgeError
'
);
throw
error
;
})
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
dispatch
(
'
receiveUpdatedBadge
'
,
transformBackendBadge
(
res
.
data
));
});
},
...
...
app/assets/javascripts/badges/store/mutations.js
View file @
7e9741c5
import
types
from
'
./mutation_types
'
;
import
{
PROJECT_BADGE
}
from
'
../constants
'
;
const
reorderBadges
=
badges
=>
const
reorderBadges
=
(
badges
)
=>
badges
.
sort
((
a
,
b
)
=>
{
if
(
a
.
kind
!==
b
.
kind
)
{
return
a
.
kind
===
PROJECT_BADGE
?
1
:
-
1
;
...
...
@@ -31,7 +31,7 @@ export default {
},
[
types
.
RECEIVE_UPDATED_BADGE
](
state
,
updatedBadge
)
{
const
badges
=
state
.
badges
.
map
(
badge
=>
{
const
badges
=
state
.
badges
.
map
(
(
badge
)
=>
{
if
(
badge
.
id
===
updatedBadge
.
id
)
{
return
updatedBadge
;
}
...
...
@@ -77,13 +77,13 @@ export default {
},
[
types
.
RECEIVE_DELETE_BADGE
](
state
,
badgeId
)
{
const
badges
=
state
.
badges
.
filter
(
badge
=>
badge
.
id
!==
badgeId
);
const
badges
=
state
.
badges
.
filter
(
(
badge
)
=>
badge
.
id
!==
badgeId
);
Object
.
assign
(
state
,
{
badges
,
});
},
[
types
.
RECEIVE_DELETE_BADGE_ERROR
](
state
,
badgeId
)
{
const
badges
=
state
.
badges
.
map
(
badge
=>
{
const
badges
=
state
.
badges
.
map
(
(
badge
)
=>
{
if
(
badge
.
id
===
badgeId
)
{
return
{
...
badge
,
...
...
@@ -98,7 +98,7 @@ export default {
});
},
[
types
.
REQUEST_DELETE_BADGE
](
state
,
badgeId
)
{
const
badges
=
state
.
badges
.
map
(
badge
=>
{
const
badges
=
state
.
badges
.
map
(
(
badge
)
=>
{
if
(
badge
.
id
===
badgeId
)
{
return
{
...
badge
,
...
...
app/assets/javascripts/batch_comments/components/preview_item.vue
View file @
7e9741c5
...
...
@@ -47,7 +47,7 @@ export default {
}
return
sprintf
(
__
(
"
%{authorsName}'s thread
"
),
{
authorsName
:
this
.
discussion
.
notes
.
find
(
note
=>
!
note
.
system
).
author
.
name
,
authorsName
:
this
.
discussion
.
notes
.
find
(
(
note
)
=>
!
note
.
system
).
author
.
name
,
});
},
linePosition
()
{
...
...
app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
View file @
7e9741c5
...
...
@@ -11,8 +11,8 @@ export const saveDraft = ({ dispatch }, draft) =>
export
const
addDraftToDiscussion
=
({
commit
},
{
endpoint
,
data
})
=>
service
.
addDraftToDiscussion
(
endpoint
,
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
{
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
res
)
=>
{
commit
(
types
.
ADD_NEW_DRAFT
,
res
);
return
res
;
})
...
...
@@ -23,8 +23,8 @@ export const addDraftToDiscussion = ({ commit }, { endpoint, data }) =>
export
const
createNewDraft
=
({
commit
},
{
endpoint
,
data
})
=>
service
.
createNewDraft
(
endpoint
,
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
{
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
res
)
=>
{
commit
(
types
.
ADD_NEW_DRAFT
,
res
);
return
res
;
})
...
...
@@ -43,8 +43,8 @@ export const deleteDraft = ({ commit, getters }, draft) =>
export
const
fetchDrafts
=
({
commit
,
getters
})
=>
service
.
fetchDrafts
(
getters
.
getNotesData
.
draftsPath
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
commit
(
types
.
SET_BATCH_COMMENTS_DRAFTS
,
data
))
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
data
)
=>
commit
(
types
.
SET_BATCH_COMMENTS_DRAFTS
,
data
))
.
catch
(()
=>
flash
(
__
(
'
An error occurred while fetching pending comments
'
)));
export
const
publishSingleDraft
=
({
commit
,
dispatch
,
getters
},
draftId
)
=>
{
...
...
@@ -86,8 +86,8 @@ export const updateDraft = (
resolveDiscussion
,
position
:
JSON
.
stringify
(
position
),
})
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
commit
(
types
.
RECEIVE_DRAFT_UPDATE_SUCCESS
,
data
))
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
data
)
=>
commit
(
types
.
RECEIVE_DRAFT_UPDATE_SUCCESS
,
data
))
.
then
(
callback
)
.
catch
(()
=>
flash
(
__
(
'
An error occurred while updating the comment
'
)));
...
...
@@ -116,8 +116,8 @@ export const scrollToDraft = ({ dispatch, rootGetters }, draft) => {
export
const
expandAllDiscussions
=
({
dispatch
,
state
})
=>
state
.
drafts
.
filter
(
draft
=>
draft
.
discussion_id
)
.
forEach
(
draft
=>
{
.
filter
(
(
draft
)
=>
draft
.
discussion_id
)
.
forEach
(
(
draft
)
=>
{
dispatch
(
'
expandDiscussion
'
,
{
discussionId
:
draft
.
discussion_id
},
{
root
:
true
});
});
...
...
app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js
View file @
7e9741c5
import
{
parallelLineKey
,
showDraftOnSide
}
from
'
../../../utils
'
;
export
const
draftsCount
=
state
=>
state
.
drafts
.
length
;
export
const
draftsCount
=
(
state
)
=>
state
.
drafts
.
length
;
export
const
getNotesData
=
(
state
,
getters
,
rootState
,
rootGetters
)
=>
rootGetters
.
getNotesData
;
export
const
hasDrafts
=
state
=>
state
.
drafts
.
length
>
0
;
export
const
hasDrafts
=
(
state
)
=>
state
.
drafts
.
length
>
0
;
export
const
draftsPerDiscussionId
=
state
=>
export
const
draftsPerDiscussionId
=
(
state
)
=>
state
.
drafts
.
reduce
((
acc
,
draft
)
=>
{
if
(
draft
.
discussion_id
)
{
acc
[
draft
.
discussion_id
]
=
draft
;
...
...
@@ -15,7 +15,7 @@ export const draftsPerDiscussionId = state =>
return
acc
;
},
{});
export
const
draftsPerFileHashAndLine
=
state
=>
export
const
draftsPerFileHashAndLine
=
(
state
)
=>
state
.
drafts
.
reduce
((
acc
,
draft
)
=>
{
if
(
draft
.
file_hash
)
{
if
(
!
acc
[
draft
.
file_hash
])
{
...
...
@@ -55,10 +55,10 @@ export const hasParallelDraftRight = (state, getters) => (diffFileSha, line) =>
return
draftsForFile
?
Boolean
(
draftsForFile
[
rkey
])
:
false
;
};
export
const
shouldRenderDraftRowInDiscussion
=
(
state
,
getters
)
=>
discussionId
=>
export
const
shouldRenderDraftRowInDiscussion
=
(
state
,
getters
)
=>
(
discussionId
)
=>
typeof
getters
.
draftsPerDiscussionId
[
discussionId
]
!==
'
undefined
'
;
export
const
draftForDiscussion
=
(
state
,
getters
)
=>
discussionId
=>
export
const
draftForDiscussion
=
(
state
,
getters
)
=>
(
discussionId
)
=>
getters
.
draftsPerDiscussionId
[
discussionId
]
||
{};
export
const
draftForLine
=
(
state
,
getters
)
=>
(
diffFileSha
,
line
,
side
=
null
)
=>
{
...
...
@@ -75,10 +75,10 @@ export const draftForLine = (state, getters) => (diffFileSha, line, side = null)
return
{};
};
export
const
draftsForFile
=
state
=>
diffFileSha
=>
state
.
drafts
.
filter
(
draft
=>
draft
.
file_hash
===
diffFileSha
);
export
const
draftsForFile
=
(
state
)
=>
(
diffFileSha
)
=>
state
.
drafts
.
filter
(
(
draft
)
=>
draft
.
file_hash
===
diffFileSha
);
export
const
isPublishingDraft
=
state
=>
draftId
=>
export
const
isPublishingDraft
=
(
state
)
=>
(
draftId
)
=>
state
.
currentlyPublishingDrafts
.
indexOf
(
draftId
)
!==
-
1
;
export
const
sortedDrafts
=
state
=>
[...
state
.
drafts
].
sort
((
a
,
b
)
=>
a
.
id
>
b
.
id
);
export
const
sortedDrafts
=
(
state
)
=>
[...
state
.
drafts
].
sort
((
a
,
b
)
=>
a
.
id
>
b
.
id
);
app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js
View file @
7e9741c5
import
*
as
types
from
'
./mutation_types
'
;
const
processDraft
=
draft
=>
({
const
processDraft
=
(
draft
)
=>
({
...
draft
,
isDraft
:
true
,
});
...
...
@@ -11,7 +11,7 @@ export default {
},
[
types
.
DELETE_DRAFT
](
state
,
draftId
)
{
state
.
drafts
=
state
.
drafts
.
filter
(
draft
=>
draft
.
id
!==
draftId
);
state
.
drafts
=
state
.
drafts
.
filter
(
(
draft
)
=>
draft
.
id
!==
draftId
);
},
[
types
.
SET_BATCH_COMMENTS_DRAFTS
](
state
,
drafts
)
{
...
...
@@ -23,13 +23,13 @@ export default {
},
[
types
.
RECEIVE_PUBLISH_DRAFT_SUCCESS
](
state
,
draftId
)
{
state
.
currentlyPublishingDrafts
=
state
.
currentlyPublishingDrafts
.
filter
(
publishingDraftId
=>
publishingDraftId
!==
draftId
,
(
publishingDraftId
)
=>
publishingDraftId
!==
draftId
,
);
state
.
drafts
=
state
.
drafts
.
filter
(
d
=>
d
.
id
!==
draftId
);
state
.
drafts
=
state
.
drafts
.
filter
(
(
d
)
=>
d
.
id
!==
draftId
);
},
[
types
.
RECEIVE_PUBLISH_DRAFT_ERROR
](
state
,
draftId
)
{
state
.
currentlyPublishingDrafts
=
state
.
currentlyPublishingDrafts
.
filter
(
publishingDraftId
=>
publishingDraftId
!==
draftId
,
(
publishingDraftId
)
=>
publishingDraftId
!==
draftId
,
);
},
...
...
@@ -44,14 +44,14 @@ export default {
state
.
isPublishing
=
false
;
},
[
types
.
RECEIVE_DRAFT_UPDATE_SUCCESS
](
state
,
data
)
{
const
index
=
state
.
drafts
.
findIndex
(
draft
=>
draft
.
id
===
data
.
id
);
const
index
=
state
.
drafts
.
findIndex
(
(
draft
)
=>
draft
.
id
===
data
.
id
);
if
(
index
>=
0
)
{
state
.
drafts
.
splice
(
index
,
1
,
processDraft
(
data
));
}
},
[
types
.
TOGGLE_RESOLVE_DISCUSSION
](
state
,
draftId
)
{
state
.
drafts
=
state
.
drafts
.
map
(
draft
=>
{
state
.
drafts
=
state
.
drafts
.
map
(
(
draft
)
=>
{
if
(
draft
.
id
===
draftId
)
{
return
{
...
draft
,
...
...
app/assets/javascripts/batch_comments/utils.js
View file @
7e9741c5
import
{
getFormData
}
from
'
~/diffs/store/utils
'
;
export
const
getDraftReplyFormData
=
data
=>
({
export
const
getDraftReplyFormData
=
(
data
)
=>
({
endpoint
:
data
.
notesData
.
draftsPath
,
data
,
});
export
const
getDraftFormData
=
params
=>
({
export
const
getDraftFormData
=
(
params
)
=>
({
endpoint
:
params
.
notesData
.
draftsPath
,
data
:
getFormData
(
params
),
});
...
...
app/assets/javascripts/behaviors/autosize.js
View file @
7e9741c5
...
...
@@ -8,6 +8,6 @@ document.addEventListener('DOMContentLoaded', () => {
Autosize
(
autosizeEls
);
Autosize
.
update
(
autosizeEls
);
autosizeEls
.
forEach
(
el
=>
el
.
classList
.
add
(
'
js-autosize-initialized
'
));
autosizeEls
.
forEach
(
(
el
)
=>
el
.
classList
.
add
(
'
js-autosize-initialized
'
));
});
});
app/assets/javascripts/behaviors/bind_in_out.js
View file @
7e9741c5
...
...
@@ -30,7 +30,7 @@ class BindInOut {
static
initAll
()
{
const
ins
=
document
.
querySelectorAll
(
'
*[data-bind-in]
'
);
return
[].
map
.
call
(
ins
,
anIn
=>
BindInOut
.
init
(
anIn
));
return
[].
map
.
call
(
ins
,
(
anIn
)
=>
BindInOut
.
init
(
anIn
));
}
static
init
(
anIn
,
anOut
)
{
...
...
app/assets/javascripts/behaviors/copy_to_clipboard.js
View file @
7e9741c5
...
...
@@ -58,7 +58,7 @@ export default function initCopyToClipboard() {
* the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy
* data types to the intended values.
*/
$
(
document
).
on
(
'
copy
'
,
'
body > textarea[readonly]
'
,
e
=>
{
$
(
document
).
on
(
'
copy
'
,
'
body > textarea[readonly]
'
,
(
e
)
=>
{
const
{
clipboardData
}
=
e
.
originalEvent
;
if
(
!
clipboardData
)
return
;
...
...
app/assets/javascripts/behaviors/gl_emoji.js
View file @
7e9741c5
...
...
@@ -32,7 +32,7 @@ class GlEmoji extends HTMLElement {
const
isEmojiUnicode
=
this
.
childNodes
&&
Array
.
prototype
.
every
.
call
(
this
.
childNodes
,
childNode
=>
childNode
.
nodeType
===
3
);
Array
.
prototype
.
every
.
call
(
this
.
childNodes
,
(
childNode
)
=>
childNode
.
nodeType
===
3
);
if
(
emojiUnicode
&&
...
...
app/assets/javascripts/behaviors/load_startup_css.js
View file @
7e9741c5
...
...
@@ -8,7 +8,7 @@ export const loadStartupCSS = () => {
()
=>
{
document
.
querySelectorAll
(
'
link[media=print]
'
)
.
forEach
(
x
=>
x
.
dispatchEvent
(
new
Event
(
'
load
'
)));
.
forEach
(
(
x
)
=>
x
.
dispatchEvent
(
new
Event
(
'
load
'
)));
},
{
once
:
true
},
);
...
...
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
View file @
7e9741c5
...
...
@@ -10,10 +10,10 @@ export class CopyAsGFM {
const
isIOS
=
/
\b(
iPad|iPhone|iPod
)(?=
;
)
/
.
test
(
userAgent
);
if
(
isIOS
)
return
;
$
(
document
).
on
(
'
copy
'
,
'
.md
'
,
e
=>
{
$
(
document
).
on
(
'
copy
'
,
'
.md
'
,
(
e
)
=>
{
CopyAsGFM
.
copyAsGFM
(
e
,
CopyAsGFM
.
transformGFMSelection
);
});
$
(
document
).
on
(
'
copy
'
,
'
pre.code.highlight, table.code td.line_content
'
,
e
=>
{
$
(
document
).
on
(
'
copy
'
,
'
pre.code.highlight, table.code td.line_content
'
,
(
e
)
=>
{
CopyAsGFM
.
copyAsGFM
(
e
,
CopyAsGFM
.
transformCodeSelection
);
});
$
(
document
).
on
(
'
paste
'
,
'
.js-gfm-input
'
,
CopyAsGFM
.
pasteGFM
);
...
...
@@ -42,7 +42,7 @@ export class CopyAsGFM {
clipboardData
.
setData
(
'
text/x-gfm-html
'
,
html
);
CopyAsGFM
.
nodeToGFM
(
el
)
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
clipboardData
.
setData
(
'
text/x-gfm
'
,
res
);
})
.
catch
(()
=>
{
...
...
@@ -71,7 +71,7 @@ export class CopyAsGFM {
const
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
gfmHtml
;
CopyAsGFM
.
nodeToGFM
(
div
)
.
then
(
transformedGfm
=>
{
.
then
(
(
transformedGfm
)
=>
{
CopyAsGFM
.
insertPastedText
(
e
.
target
,
text
,
transformedGfm
);
})
.
catch
(()
=>
{});
...
...
@@ -79,7 +79,7 @@ export class CopyAsGFM {
}
static
insertPastedText
(
target
,
text
,
gfm
)
{
insertText
(
target
,
textBefore
=>
{
insertText
(
target
,
(
textBefore
)
=>
{
// If the text before the cursor contains an odd number of backticks,
// we are either inside an inline code span that starts with 1 backtick
// or a code block that starts with 3 backticks.
...
...
@@ -125,7 +125,7 @@ export class CopyAsGFM {
let
lineSelector
=
'
.line
'
;
if
(
target
)
{
const
lineClass
=
[
'
left-side
'
,
'
right-side
'
].
filter
(
name
=>
const
lineClass
=
[
'
left-side
'
,
'
right-side
'
].
filter
(
(
name
)
=>
target
.
classList
.
contains
(
name
),
)[
0
];
if
(
lineClass
)
{
...
...
app/assets/javascripts/behaviors/markdown/highlight_current_user.js
View file @
7e9741c5
...
...
@@ -9,7 +9,7 @@ export default function highlightCurrentUser(elements) {
return
;
}
elements
.
forEach
(
element
=>
{
elements
.
forEach
(
(
element
)
=>
{
if
(
parseInt
(
element
.
dataset
.
user
,
10
)
===
currentUserId
)
{
element
.
classList
.
add
(
'
current-user
'
);
}
...
...
app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
View file @
7e9741c5
...
...
@@ -19,7 +19,7 @@ export default class InlineDiff extends Mark {
{
tag
:
'
span.idiff.addition
'
,
attrs
:
{
addition
:
true
}
},
{
tag
:
'
span.idiff.deletion
'
,
attrs
:
{
addition
:
false
}
},
],
toDOM
:
node
=>
[
toDOM
:
(
node
)
=>
[
'
span
'
,
{
class
:
`idiff left right
${
node
.
attrs
.
addition
?
'
addition
'
:
'
deletion
'
}
`
},
0
,
...
...
app/assets/javascripts/behaviors/markdown/marks/inline_html.js
View file @
7e9741c5
...
...
@@ -19,14 +19,14 @@ export default class InlineHTML extends Mark {
parseDOM
:
[
{
tag
:
'
sup, sub, kbd, q, samp, var
'
,
getAttrs
:
el
=>
({
tag
:
el
.
nodeName
.
toLowerCase
()
}),
getAttrs
:
(
el
)
=>
({
tag
:
el
.
nodeName
.
toLowerCase
()
}),
},
{
tag
:
'
abbr
'
,
getAttrs
:
el
=>
({
tag
:
'
abbr
'
,
title
:
el
.
getAttribute
(
'
title
'
)
}),
getAttrs
:
(
el
)
=>
({
tag
:
'
abbr
'
,
title
:
el
.
getAttribute
(
'
title
'
)
}),
},
],
toDOM
:
node
=>
[
node
.
attrs
.
tag
,
{
title
:
node
.
attrs
.
title
},
0
],
toDOM
:
(
node
)
=>
[
node
.
attrs
.
tag
,
{
title
:
node
.
attrs
.
title
},
0
],
};
}
...
...
app/assets/javascripts/behaviors/markdown/nodes/code_block.js
View file @
7e9741c5
...
...
@@ -25,7 +25,7 @@ export default class CodeBlock extends BaseCodeBlock {
{
tag
:
'
pre.code.highlight
'
,
preserveWhitespace
:
'
full
'
,
getAttrs
:
el
=>
{
getAttrs
:
(
el
)
=>
{
const
lang
=
el
.
getAttribute
(
'
lang
'
);
if
(
!
lang
||
lang
===
''
)
return
{};
...
...
@@ -62,13 +62,13 @@ export default class CodeBlock extends BaseCodeBlock {
tag
:
'
.md-suggestion-diff
'
,
preserveWhitespace
:
'
full
'
,
getContent
:
(
el
,
schema
)
=>
[...
el
.
querySelectorAll
(
'
.line_content.new span
'
)].
map
(
span
=>
[...
el
.
querySelectorAll
(
'
.line_content.new span
'
)].
map
(
(
span
)
=>
schema
.
text
(
span
.
innerText
),
),
attrs
:
{
lang
:
'
suggestion
'
},
},
],
toDOM
:
node
=>
[
'
pre
'
,
{
class
:
'
code highlight
'
,
lang
:
node
.
attrs
.
lang
},
[
'
code
'
,
0
]],
toDOM
:
(
node
)
=>
[
'
pre
'
,
{
class
:
'
code highlight
'
,
lang
:
node
.
attrs
.
lang
},
[
'
code
'
,
0
]],
};
}
...
...
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
View file @
7e9741c5
...
...
@@ -20,14 +20,14 @@ export default class Emoji extends Node {
parseDOM
:
[
{
tag
:
'
gl-emoji
'
,
getAttrs
:
el
=>
({
getAttrs
:
(
el
)
=>
({
name
:
el
.
dataset
.
name
,
title
:
el
.
getAttribute
(
'
title
'
),
moji
:
el
.
textContent
,
}),
},
],
toDOM
:
node
=>
[
toDOM
:
(
node
)
=>
[
'
gl-emoji
'
,
{
'
data-name
'
:
node
.
attrs
.
name
,
title
:
node
.
attrs
.
title
},
node
.
attrs
.
moji
,
...
...
app/assets/javascripts/behaviors/markdown/nodes/image.js
View file @
7e9741c5
...
...
@@ -30,7 +30,7 @@ export default class Image extends BaseImage {
// Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter
{
tag
:
'
img[src]
'
,
getAttrs
:
el
=>
{
getAttrs
:
(
el
)
=>
{
const
imageSrc
=
el
.
src
;
const
imageUrl
=
imageSrc
&&
imageSrc
!==
placeholderImage
?
imageSrc
:
el
.
dataset
.
src
||
''
;
...
...
@@ -43,7 +43,7 @@ export default class Image extends BaseImage {
},
},
],
toDOM
:
node
=>
[
'
img
'
,
node
.
attrs
],
toDOM
:
(
node
)
=>
[
'
img
'
,
node
.
attrs
],
};
}
...
...
app/assets/javascripts/behaviors/markdown/nodes/playable.js
View file @
7e9741c5
...
...
@@ -42,11 +42,11 @@ export default class Playable extends Node {
},
{
tag
:
`
${
this
.
mediaType
}
[src]`
,
getAttrs
:
el
=>
({
src
:
el
.
src
,
alt
:
el
.
dataset
.
title
}),
getAttrs
:
(
el
)
=>
({
src
:
el
.
src
,
alt
:
el
.
dataset
.
title
}),
},
];
const
toDOM
=
node
=>
[
const
toDOM
=
(
node
)
=>
[
this
.
mediaType
,
{
src
:
node
.
attrs
.
src
,
...
...
app/assets/javascripts/behaviors/markdown/nodes/reference.js
View file @
7e9741c5
...
...
@@ -25,7 +25,7 @@ export default class Reference extends Node {
{
tag
:
'
a.gfm:not([data-link=true])
'
,
priority
:
HIGHER_PARSE_RULE_PRIORITY
,
getAttrs
:
el
=>
({
getAttrs
:
(
el
)
=>
({
className
:
el
.
className
,
referenceType
:
el
.
dataset
.
referenceType
,
originalText
:
el
.
dataset
.
original
,
...
...
@@ -34,7 +34,7 @@ export default class Reference extends Node {
}),
},
],
toDOM
:
node
=>
[
toDOM
:
(
node
)
=>
[
'
a
'
,
{
class
:
node
.
attrs
.
className
,
...
...
app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
View file @
7e9741c5
...
...
@@ -19,13 +19,13 @@ export default class TableCell extends Node {
parseDOM
:
[
{
tag
:
'
td, th
'
,
getAttrs
:
el
=>
({
getAttrs
:
(
el
)
=>
({
header
:
el
.
tagName
===
'
TH
'
,
align
:
el
.
getAttribute
(
'
align
'
)
||
el
.
style
.
textAlign
,
}),
},
],
toDOM
:
node
=>
[
node
.
attrs
.
header
?
'
th
'
:
'
td
'
,
{
align
:
node
.
attrs
.
align
},
0
],
toDOM
:
(
node
)
=>
[
node
.
attrs
.
header
?
'
th
'
:
'
td
'
,
{
align
:
node
.
attrs
.
align
},
0
],
};
}
...
...
app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
View file @
7e9741c5
...
...
@@ -23,7 +23,7 @@ export default class TaskListItem extends Node {
{
priority
:
HIGHER_PARSE_RULE_PRIORITY
,
tag
:
'
li.task-list-item
'
,
getAttrs
:
el
=>
{
getAttrs
:
(
el
)
=>
{
const
checkbox
=
el
.
querySelector
(
'
input[type=checkbox].task-list-item-checkbox
'
);
return
{
done
:
checkbox
&&
checkbox
.
checked
};
},
...
...
app/assets/javascripts/behaviors/markdown/render_math.js
View file @
7e9741c5
...
...
@@ -35,7 +35,7 @@ const RENDER_FLASH_MSG = sprintf(
// Wait for the browser to reflow the layout. Reflowing SVG takes time.
// This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object".
const
waitForReflow
=
fn
=>
{
const
waitForReflow
=
(
fn
)
=>
{
window
.
requestAnimationFrame
(
fn
);
};
...
...
@@ -122,7 +122,7 @@ class SafeMathRenderer {
render
()
{
// Replace math blocks with a placeholder so they aren't rendered twice
this
.
elements
.
forEach
(
el
=>
{
this
.
elements
.
forEach
(
(
el
)
=>
{
const
placeholder
=
document
.
createElement
(
'
span
'
);
placeholder
.
style
.
display
=
'
none
'
;
placeholder
.
setAttribute
(
'
data-math-style
'
,
el
.
getAttribute
(
'
data-math-style
'
));
...
...
app/assets/javascripts/behaviors/markdown/render_mermaid.js
View file @
7e9741c5
...
...
@@ -29,7 +29,7 @@ let mermaidModule = {};
function
importMermaidModule
()
{
return
import
(
/* webpackChunkName: 'mermaid' */
'
mermaid
'
)
.
then
(
mermaid
=>
{
.
then
(
(
mermaid
)
=>
{
let
theme
=
'
neutral
'
;
const
ideDarkThemes
=
[
'
dark
'
,
'
solarized-dark
'
,
'
monokai
'
];
...
...
@@ -59,7 +59,7 @@ function importMermaidModule() {
return
mermaid
;
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
flash
(
sprintf
(
__
(
"
Can't load mermaid module: %{err}
"
),
{
err
}));
// eslint-disable-next-line no-console
console
.
error
(
err
);
...
...
@@ -77,7 +77,7 @@ function fixElementSource(el) {
}
function
renderMermaidEl
(
el
)
{
mermaidModule
.
init
(
undefined
,
el
,
id
=>
{
mermaidModule
.
init
(
undefined
,
el
,
(
id
)
=>
{
const
source
=
el
.
textContent
;
const
svg
=
document
.
getElementById
(
id
);
...
...
@@ -170,7 +170,7 @@ function renderMermaids($els) {
elsProcessingMap
.
set
(
el
,
requestId
);
});
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
flash
(
sprintf
(
__
(
'
Encountered an error while rendering: %{err}
'
),
{
err
}));
// eslint-disable-next-line no-console
console
.
error
(
err
);
...
...
app/assets/javascripts/behaviors/markdown/render_metrics.js
View file @
7e9741c5
...
...
@@ -9,7 +9,7 @@ export default function renderMetrics(elements) {
const
wrapperList
=
[];
elements
.
forEach
(
element
=>
{
elements
.
forEach
(
(
element
)
=>
{
let
wrapper
;
const
{
previousElementSibling
}
=
element
;
const
isFirstElementInGroup
=
!
previousElementSibling
?.
urls
;
...
...
@@ -33,7 +33,7 @@ export default function renderMetrics(elements) {
).
then
(({
default
:
EmbedGroup
})
=>
{
const
EmbedGroupComponent
=
Vue
.
extend
(
EmbedGroup
);
wrapperList
.
forEach
(
wrapper
=>
{
wrapperList
.
forEach
(
(
wrapper
)
=>
{
// eslint-disable-next-line no-new
new
EmbedGroupComponent
({
el
:
wrapper
,
...
...
app/assets/javascripts/behaviors/markdown/schema.js
View file @
7e9741c5
...
...
@@ -2,7 +2,7 @@ import { Schema } from 'prosemirror-model';
import
editorExtensions
from
'
./editor_extensions
'
;
const
nodes
=
editorExtensions
.
filter
(
extension
=>
extension
.
type
===
'
node
'
)
.
filter
(
(
extension
)
=>
extension
.
type
===
'
node
'
)
.
reduce
(
(
ns
,
{
name
,
schema
})
=>
({
...
ns
,
...
...
@@ -12,7 +12,7 @@ const nodes = editorExtensions
);
const
marks
=
editorExtensions
.
filter
(
extension
=>
extension
.
type
===
'
mark
'
)
.
filter
(
(
extension
)
=>
extension
.
type
===
'
mark
'
)
.
reduce
(
(
ms
,
{
name
,
schema
})
=>
({
...
ms
,
...
...
app/assets/javascripts/behaviors/markdown/serializer.js
View file @
7e9741c5
...
...
@@ -2,7 +2,7 @@ import { MarkdownSerializer } from 'prosemirror-markdown';
import
editorExtensions
from
'
./editor_extensions
'
;
const
nodes
=
editorExtensions
.
filter
(
extension
=>
extension
.
type
===
'
node
'
)
.
filter
(
(
extension
)
=>
extension
.
type
===
'
node
'
)
.
reduce
(
(
ns
,
{
name
,
toMarkdown
})
=>
({
...
ns
,
...
...
@@ -12,7 +12,7 @@ const nodes = editorExtensions
);
const
marks
=
editorExtensions
.
filter
(
extension
=>
extension
.
type
===
'
mark
'
)
.
filter
(
(
extension
)
=>
extension
.
type
===
'
mark
'
)
.
reduce
(
(
ms
,
{
name
,
toMarkdown
})
=>
({
...
ms
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment