mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 07:36:37 +00:00
Adding tippy to new comments. Fixes #92
This commit is contained in:
parent
ac8affe80f
commit
2be380ef76
|
@ -485,6 +485,7 @@ export class Post extends Component<any, PostState> {
|
||||||
this.state.postRes.comments.unshift(data.comment_view);
|
this.state.postRes.comments.unshift(data.comment_view);
|
||||||
this.state.postRes.post_view.counts.comments++;
|
this.state.postRes.post_view.counts.comments++;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
setupTippy();
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
op == UserOperation.EditComment ||
|
op == UserOperation.EditComment ||
|
||||||
|
|
|
@ -52,7 +52,7 @@ import {
|
||||||
} from './interfaces';
|
} from './interfaces';
|
||||||
import { UserService, WebSocketService } from './services';
|
import { UserService, WebSocketService } from './services';
|
||||||
|
|
||||||
var Tribute;
|
var Tribute: any;
|
||||||
if (isBrowser()) {
|
if (isBrowser()) {
|
||||||
Tribute = require('tributejs');
|
Tribute = require('tributejs');
|
||||||
}
|
}
|
||||||
|
@ -635,8 +635,8 @@ function notify(info: NotifyInfo, router: any) {
|
||||||
body: info.body,
|
body: info.body,
|
||||||
});
|
});
|
||||||
|
|
||||||
notification.onclick = () => {
|
notification.onclick = (ev: Event): any => {
|
||||||
event.preventDefault();
|
ev.preventDefault();
|
||||||
router.history.push(info.link);
|
router.history.push(info.link);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -708,14 +708,14 @@ export function setupTribute() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var tippyInstance;
|
var tippyInstance: any;
|
||||||
if (isBrowser()) {
|
if (isBrowser()) {
|
||||||
tippyInstance = tippy('[data-tippy-content]');
|
tippyInstance = tippy('[data-tippy-content]');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupTippy() {
|
export function setupTippy() {
|
||||||
if (isBrowser()) {
|
if (isBrowser()) {
|
||||||
tippyInstance.forEach(e => e.destroy());
|
tippyInstance.forEach((e: any) => e.destroy());
|
||||||
tippyInstance = tippy('[data-tippy-content]', {
|
tippyInstance = tippy('[data-tippy-content]', {
|
||||||
delay: [500, 0],
|
delay: [500, 0],
|
||||||
// Display on "long press"
|
// Display on "long press"
|
||||||
|
|
Loading…
Reference in a new issue