Replace fomantic popup module with tippy.js (#20428)

- replace fomantic popup module with tippy.js
- fix chaining and add comment
- add 100ms delay to tooltips
- stopwatch improvments, raise default maxWidth
- update web_src/js/features/common-global.js
- use type=submit instead of js
This commit is contained in:
silverwind 2022-08-09 14:37:34 +02:00 committed by GitHub
parent 36f9ee5813
commit 1b2cd4c4e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 199 additions and 2129 deletions

View file

@ -4,6 +4,7 @@ import attachTribute from './tribute.js';
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initTooltip, showTemporaryTooltip} from '../modules/tippy.js';
const {appSubUrl, csrfToken} = window.config;
@ -278,7 +279,8 @@ export function initRepoPullRequestAllowMaintainerEdit() {
const promptTip = $checkbox.attr('data-prompt-tip');
const promptError = $checkbox.attr('data-prompt-error');
$checkbox.popup({content: promptTip});
initTooltip($checkbox[0], {content: promptTip});
$checkbox.checkbox({
'onChange': () => {
const checked = $checkbox.checkbox('is checked');
@ -288,14 +290,7 @@ export function initRepoPullRequestAllowMaintainerEdit() {
$.ajax({url, type: 'POST',
data: {_csrf: csrfToken, allow_maintainer_edit: checked},
error: () => {
$checkbox.popup({
content: promptError,
onHidden: () => {
// the error popup should be shown only once, then we restore the popup to the default message
$checkbox.popup({content: promptTip});
},
});
$checkbox.popup('show');
showTemporaryTooltip($checkbox[0], promptError);
},
complete: () => {
$checkbox.checkbox('set enabled');