Remove answerbox-specific sharing feature
This commit is contained in:
parent
3feb827b16
commit
5ccdd9bbc2
|
@ -97,9 +97,3 @@
|
|||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
body:not(.cap-web-share) {
|
||||
[name="ab-share"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@ import registerEvents from 'utilities/registerEvents';
|
|||
import registerAnswerboxCommentEvents from './comment';
|
||||
import { answerboxDestroyHandler } from './destroy';
|
||||
import { answerboxReportHandler } from './report';
|
||||
import { shareEventHandler } from './share';
|
||||
import { answerboxSmileHandler } from './smile';
|
||||
import { answerboxSubscribeHandler } from './subscribe';
|
||||
|
||||
export default (): void => {
|
||||
registerEvents([
|
||||
{ type: 'click', target: '[name=ab-share]', handler: shareEventHandler, global: true },
|
||||
{ type: 'click', target: '[data-action=ab-submarine]', handler: answerboxSubscribeHandler, global: true },
|
||||
{ type: 'click', target: '[data-action=ab-report]', handler: answerboxReportHandler, global: true },
|
||||
{ type: 'click', target: '[data-action=ab-destroy]', handler: answerboxDestroyHandler, global: true },
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import noop from 'utilities/noop';
|
||||
|
||||
export function shareEventHandler(event: Event): void {
|
||||
event.preventDefault();
|
||||
const answerbox = (event.target as HTMLElement).closest('.answerbox');
|
||||
|
||||
navigator.share({
|
||||
url: answerbox.querySelector<HTMLAnchorElement>('.answerbox__answer-date > a, a.answerbox__permalink').href
|
||||
})
|
||||
.then(noop)
|
||||
.catch(noop)
|
||||
}
|
Loading…
Reference in New Issue