mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
Merge branch 'main' into feature/bots
This commit is contained in:
commit
567996d06a
@ -1,3 +1,6 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
@ -9,3 +12,4 @@ export_presets.cfg
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
9
options/license/Bitstream-Charter
Normal file
9
options/license/Bitstream-Charter
Normal file
@ -0,0 +1,9 @@
|
||||
(c) Copyright 1989-1992, Bitstream Inc., Cambridge, MA.
|
||||
|
||||
You are hereby granted permission under all Bitstream propriety rights
|
||||
to use, copy, modify, sublicense, sell, and redistribute the 4 Bitstream
|
||||
Charter (r) Type 1 outline fonts and the 4 Courier Type 1 outline fonts for
|
||||
any purpose and without restriction; provided, that this notice is left
|
||||
intact on all copies of such fonts and that Bitstream's trademark is acknowledged
|
||||
as shown below on all unmodified copies of the 4 Charter Type 1 fonts.
|
||||
BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
|
5
options/license/Graphics-Gems
Normal file
5
options/license/Graphics-Gems
Normal file
@ -0,0 +1,5 @@
|
||||
LICENSE
|
||||
|
||||
This code repository predates the concept of Open Source, and predates most licenses along such lines. As such, the official license truly is:
|
||||
|
||||
EULA: The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes with no guarantee.
|
35
options/license/IJG-short
Normal file
35
options/license/IJG-short
Normal file
@ -0,0 +1,35 @@
|
||||
The authors make NO WARRANTY or representation, either express or
|
||||
implied, with respect to this software, its quality, accuracy,
|
||||
merchantability, or fitness for a particular purpose. This software is
|
||||
provided "AS IS", and you, its user, assume the entire risk as to its
|
||||
quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights
|
||||
Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to
|
||||
these conditions:
|
||||
|
||||
(1) If any part of the source code for this software
|
||||
is distributed, then this README file must be included, with this
|
||||
copyright and no-warranty notice unaltered; and any additions,
|
||||
deletions, or changes to the original files must be clearly indicated
|
||||
in accompanying documentation.
|
||||
|
||||
(2) If only executable code is
|
||||
distributed, then the accompanying documentation must state that "this
|
||||
software is based in part on the work of the Independent JPEG Group".
|
||||
|
||||
(3) Permission for use of this software is granted only if the user
|
||||
accepts full responsibility for any undesirable consequences; the
|
||||
authors accept NO LIABILITY for damages of any kind.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or
|
||||
company name in advertising or publicity relating to this software or
|
||||
products derived from it. This software may be referred to only as
|
||||
"the Independent JPEG Group's software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the
|
||||
basis of commercial products, provided that all warranty or liability
|
||||
claims are assumed by the product vendor.
|
28
options/license/MIT-Wu
Normal file
28
options/license/MIT-Wu
Normal file
@ -0,0 +1,28 @@
|
||||
Copyright (c) 2003-2005 Tom Wu
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
||||
INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
||||
THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
In addition, the following condition applies:
|
||||
|
||||
All redistributions must retain an intact copy of this copyright notice
|
||||
and disclaimer.
|
2
options/license/TPDL
Normal file
2
options/license/TPDL
Normal file
@ -0,0 +1,2 @@
|
||||
Copyright (C) 1996-2010 David Muir Sharnoff. Copyright (C) 2011 Google, Inc.
|
||||
License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to cpan@dave.sharnoff.org.
|
8
options/license/TTWL
Normal file
8
options/license/TTWL
Normal file
@ -0,0 +1,8 @@
|
||||
Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff.
|
||||
Copyright (C) 2005 Aristotle Pagaltzis
|
||||
Copyright (C) 2012-2013 Google, Inc.
|
||||
|
||||
This module may be modified, used, copied, and redistributed at your own risk.
|
||||
Although allowed by the preceding license, please do not publicly
|
||||
redistribute modified versions of this code with the name "Text::Tabs"
|
||||
unless it passes the unmodified Text::Tabs test suite.
|
@ -11,6 +11,8 @@ import (
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEmptyRepo(t *testing.T) {
|
||||
@ -21,7 +23,8 @@ func TestEmptyRepo(t *testing.T) {
|
||||
"commit/1ae57b34ccf7e18373",
|
||||
"graph",
|
||||
}
|
||||
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}, unittest.Cond("is_empty = ?", true))
|
||||
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 5})
|
||||
assert.True(t, emptyRepo.IsEmpty)
|
||||
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID})
|
||||
for _, subpath := range subpaths {
|
||||
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
||||
|
@ -18,7 +18,6 @@
|
||||
import {CalendarHeatmap} from 'vue3-calendar-heatmap';
|
||||
|
||||
export default {
|
||||
name: 'ActivityHeatmap',
|
||||
components: {CalendarHeatmap},
|
||||
props: {
|
||||
values: {
|
||||
|
@ -46,19 +46,13 @@ const luminance = (colorString) => {
|
||||
const luminanceThreshold = 0.179;
|
||||
|
||||
export default {
|
||||
name: 'ContextPopup',
|
||||
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
data: () => ({
|
||||
loading: false,
|
||||
issue: null,
|
||||
i18nErrorOccurred: i18n.error_occurred,
|
||||
i18nErrorMessage: null,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
createdAt() {
|
||||
return new Date(this.issue.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'});
|
||||
@ -107,7 +101,6 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$refs.root.addEventListener('us-load-context-popup', (e) => {
|
||||
const data = e.detail;
|
||||
@ -116,7 +109,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
load(data) {
|
||||
this.loading = true;
|
||||
|
@ -27,12 +27,9 @@ import {doLoadMoreFiles} from '../features/repo-diff.js';
|
||||
const {pageData} = window.config;
|
||||
|
||||
export default {
|
||||
name: 'DiffFileList',
|
||||
|
||||
data: () => {
|
||||
return pageData.diffFileInfo;
|
||||
},
|
||||
|
||||
watch: {
|
||||
fileListIsVisible(newValue) {
|
||||
if (newValue === true) {
|
||||
@ -44,15 +41,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
document.getElementById('show-file-list-btn').addEventListener('click', this.toggleFileList);
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
document.getElementById('show-file-list-btn').removeEventListener('click', this.toggleFileList);
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleFileList() {
|
||||
this.fileListIsVisible = !this.fileListIsVisible;
|
||||
|
@ -21,15 +21,12 @@ const {pageData} = window.config;
|
||||
const LOCAL_STORAGE_KEY = 'diff_file_tree_visible';
|
||||
|
||||
export default {
|
||||
name: 'DiffFileTree',
|
||||
components: {DiffFileTreeItem},
|
||||
|
||||
data: () => {
|
||||
const fileTreeIsVisible = localStorage.getItem(LOCAL_STORAGE_KEY) === 'true';
|
||||
pageData.diffFileInfo.fileTreeIsVisible = fileTreeIsVisible;
|
||||
return pageData.diffFileInfo;
|
||||
},
|
||||
|
||||
computed: {
|
||||
fileTree() {
|
||||
const result = [];
|
||||
@ -94,7 +91,6 @@ export default {
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// ensure correct buttons when we are mounted to the dom
|
||||
this.adjustToggleButton(this.fileTreeIsVisible);
|
||||
@ -125,7 +121,7 @@ export default {
|
||||
doLoadMoreFiles(this.link, this.diffEnd, () => {
|
||||
this.isLoadingNewData = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -43,11 +43,7 @@
|
||||
import {SvgIcon} from '../svg.js';
|
||||
|
||||
export default {
|
||||
name: 'DiffFileTreeItem',
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
@ -59,7 +55,6 @@ export default {
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
collapsed: false,
|
||||
}),
|
||||
|
@ -111,11 +111,7 @@ import {SvgIcon} from '../svg.js';
|
||||
const {csrfToken, pageData} = window.config;
|
||||
|
||||
export default {
|
||||
name: 'PullRequestMergeForm',
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
data: () => ({
|
||||
csrfToken,
|
||||
mergeForm: pageData.pullRequestMergeForm,
|
||||
@ -137,20 +133,17 @@ export default {
|
||||
showMergeStyleMenu: false,
|
||||
showActionForm: false,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
mergeButtonStyleClass() {
|
||||
if (this.mergeForm.allOverridableChecksOk) return 'green';
|
||||
return this.autoMergeWhenSucceed ? 'blue' : 'red';
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
mergeStyle(val) {
|
||||
this.mergeStyleDetail = this.mergeForm.mergeStyles.find((e) => e.name === val);
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.mergeStyleAllowedCount = this.mergeForm.mergeStyles.reduce((v, msd) => v + (msd.allowed ? 1 : 0), 0);
|
||||
|
||||
@ -158,15 +151,12 @@ export default {
|
||||
if (!mergeStyle) mergeStyle = this.mergeForm.mergeStyles.find((e) => e.allowed)?.name;
|
||||
this.switchMergeStyle(mergeStyle, !this.mergeForm.canMergeNow);
|
||||
},
|
||||
|
||||
mounted() {
|
||||
document.addEventListener('mouseup', this.hideMergeStyleMenu);
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
document.removeEventListener('mouseup', this.hideMergeStyleMenu);
|
||||
},
|
||||
|
||||
methods: {
|
||||
hideMergeStyleMenu() {
|
||||
this.showMergeStyleMenu = false;
|
||||
|
@ -44,7 +44,7 @@ function fallbackCopyToClipboard(text) {
|
||||
|
||||
// For all DOM elements with [data-clipboard-target] or [data-clipboard-text],
|
||||
// this copy-to-clipboard will work for them
|
||||
export default function initGlobalCopyToClipboardListener() {
|
||||
export function initGlobalCopyToClipboardListener() {
|
||||
document.addEventListener('click', (e) => {
|
||||
let target = e.target;
|
||||
// in case <button data-clipboard-text><svg></button>, so we just search
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default async function createColorPicker($els) {
|
||||
export async function createColorPicker($els) {
|
||||
if (!$els || !$els.length) return;
|
||||
|
||||
await Promise.all([
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import 'jquery.are-you-sure';
|
||||
import {mqBinarySearch} from '../utils.js';
|
||||
import createDropzone from './dropzone.js';
|
||||
import {createDropzone} from './dropzone.js';
|
||||
import {initCompColorPicker} from './comp/ColorPicker.js';
|
||||
import {showGlobalErrorMessage} from '../bootstrap.js';
|
||||
import {attachDropdownAria} from './aria.js';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import createColorPicker from '../colorpicker.js';
|
||||
import {createColorPicker} from '../colorpicker.js';
|
||||
|
||||
export function initCompColorPicker() {
|
||||
createColorPicker($('.color-picker'));
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import attachTribute from '../tribute.js';
|
||||
import {attachTribute} from '../tribute.js';
|
||||
import {handleGlobalEnterQuickSubmit} from './QuickSubmit.js';
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,6 @@ import $ from 'jquery';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
|
||||
const {appSubUrl} = window.config;
|
||||
|
||||
const looksLikeEmailAddressCheck = /^\S+@\S+$/;
|
||||
|
||||
export function initCompSearchUserBox() {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
export function initCompWebHookEditor() {
|
||||
|
@ -4,7 +4,7 @@ import ContextPopup from '../components/ContextPopup.vue';
|
||||
import {parseIssueHref} from '../utils.js';
|
||||
import {createTippy} from '../modules/tippy.js';
|
||||
|
||||
export default function initContextPopups() {
|
||||
export function initContextPopups() {
|
||||
const refIssues = $('.ref-issue');
|
||||
if (!refIssues.length) return;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {copyToClipboard} from './clipboard.js';
|
||||
import {showTemporaryTooltip} from '../modules/tippy.js';
|
||||
import {convertImage} from '../utils.js';
|
||||
|
||||
const {i18n} = window.config;
|
||||
|
||||
async function doCopy(content, btn) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default async function createDropzone(el, opts) {
|
||||
export async function createDropzone(el, opts) {
|
||||
const [{Dropzone}] = await Promise.all([
|
||||
import(/* webpackChunkName: "dropzone" */'dropzone'),
|
||||
import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import emojis from '../../../assets/emoji.json';
|
||||
|
||||
const {assetUrlPrefix} = window.config;
|
||||
const {customEmojis} = window.config;
|
||||
const {assetUrlPrefix, customEmojis} = window.config;
|
||||
|
||||
const tempMap = {...customEmojis};
|
||||
for (const {emoji, aliases} of emojis) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {svg} from '../svg.js';
|
||||
|
||||
|
||||
// Hides the file if newFold is true, and shows it otherwise. The actual hiding is performed using CSS.
|
||||
//
|
||||
// The fold arrow is the icon displayed on the upper left of the file box, especially intended for components having the 'fold-file' class.
|
||||
|
@ -1,7 +1,6 @@
|
||||
import {prettyNumber} from '../utils.js';
|
||||
|
||||
const {lang} = document.documentElement;
|
||||
|
||||
const dateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'long', day: 'numeric'});
|
||||
const shortDateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric'});
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'});
|
||||
|
@ -1,7 +1,8 @@
|
||||
import {createApp} from 'vue';
|
||||
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
|
||||
import {translateMonth, translateDay} from '../utils.js';
|
||||
export default function initHeatmap() {
|
||||
|
||||
export function initHeatmap() {
|
||||
const el = document.getElementById('user-heatmap');
|
||||
if (!el) return;
|
||||
|
||||
|
@ -34,7 +34,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function initImageDiff() {
|
||||
export function initImageDiff() {
|
||||
function createContext(image1, image2) {
|
||||
const size1 = {
|
||||
width: image1 && image1.width || 0,
|
||||
|
@ -2,7 +2,7 @@ import {createApp} from 'vue';
|
||||
import DiffFileTree from '../components/DiffFileTree.vue';
|
||||
import DiffFileList from '../components/DiffFileList.vue';
|
||||
|
||||
export default function initDiffFileTree() {
|
||||
export function initDiffFileTree() {
|
||||
const el = document.getElementById('diff-file-tree');
|
||||
if (!el) return;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
import {svg} from '../svg.js';
|
||||
|
||||
const {csrf} = window.config;
|
||||
|
||||
const threshold = 50;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
export default function initRepoGraphGit() {
|
||||
export function initRepoGraphGit() {
|
||||
const graphContainer = document.getElementById('git-graph-container');
|
||||
if (!graphContainer) return;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {createApp} from 'vue';
|
||||
import PullRequestMergeForm from '../components/PullRequestMergeForm.vue';
|
||||
|
||||
export default function initPullRequestMergeForm() {
|
||||
export function initRepoPullRequestMergeForm() {
|
||||
const el = document.getElementById('pull-request-merge-form');
|
||||
if (!el) return;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
import attachTribute from './tribute.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
|
@ -3,33 +3,28 @@ import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel,
|
||||
initRepoIssueCommentDelete,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete,
|
||||
initRepoIssueReferenceIssue, initRepoIssueStatusButton,
|
||||
initRepoIssueTitleEdit,
|
||||
initRepoIssueWipToggle, initRepoPullRequestUpdate,
|
||||
updateIssuesMeta,
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue,
|
||||
initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle,
|
||||
initRepoPullRequestUpdate, updateIssuesMeta,
|
||||
} from './repo-issue.js';
|
||||
import {initUnicodeEscapeButton} from './repo-unicode-escape.js';
|
||||
import {svg} from '../svg.js';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
import {initRepoBranchTagDropdown} from '../components/RepoBranchTagDropdown.js';
|
||||
import {
|
||||
initRepoCloneLink,
|
||||
initRepoCommonBranchOrTagDropdown,
|
||||
initRepoCommonFilterSearchDropdown,
|
||||
initRepoCloneLink, initRepoCommonBranchOrTagDropdown, initRepoCommonFilterSearchDropdown,
|
||||
initRepoCommonLanguageStats,
|
||||
} from './repo-common.js';
|
||||
import {initCitationFileCopyContent} from './citation.js';
|
||||
import {initCompLabelEdit} from './comp/LabelEdit.js';
|
||||
import {initRepoDiffConversationNav} from './repo-diff.js';
|
||||
import attachTribute from './tribute.js';
|
||||
import createDropzone from './dropzone.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {createDropzone} from './dropzone.js';
|
||||
import {initCommentContent, initMarkupContent} from '../markup/content.js';
|
||||
import {initCompReactionSelector} from './comp/ReactionSelector.js';
|
||||
import {initRepoSettingBranches} from './repo-settings.js';
|
||||
import initRepoPullRequestMergeForm from './repo-issue-pr-form.js';
|
||||
import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
|
@ -10,7 +10,7 @@ const $lfsSettings = $('#lfs_settings');
|
||||
const $lfsEndpoint = $('#lfs_endpoint');
|
||||
const $items = $('#migrate_items').find('input[type=checkbox]');
|
||||
|
||||
export default function initRepoMigration() {
|
||||
export function initRepoMigration() {
|
||||
checkAuth();
|
||||
setLFSSettingsVisibility();
|
||||
|
||||
|
@ -84,7 +84,7 @@ async function initRepoProjectSortable() {
|
||||
}
|
||||
}
|
||||
|
||||
export default function initRepoProject() {
|
||||
export function initRepoProject() {
|
||||
if (!$('.repository.projects').length) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import attachTribute from './tribute.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {createCommentEasyMDE} from './comp/EasyMDE.js';
|
||||
|
@ -35,7 +35,7 @@ async function checkCacheValidity() {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function initServiceWorker() {
|
||||
export async function initServiceWorker() {
|
||||
if (!('serviceWorker' in navigator)) return;
|
||||
|
||||
if (useServiceWorker) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
export default function initTableSort() {
|
||||
export function initTableSort() {
|
||||
for (const header of document.querySelectorAll('th[data-sortt-asc]') || []) {
|
||||
const sorttAsc = header.getAttribute('data-sortt-asc');
|
||||
const sorttDesc = header.getAttribute('data-sortt-desc');
|
||||
|
@ -49,7 +49,7 @@ function makeCollections({mentions, emoji}) {
|
||||
return collections;
|
||||
}
|
||||
|
||||
export default async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) {
|
||||
export async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) {
|
||||
if (!window.config.requireTribute || !elementOrNodeList) return;
|
||||
const nodes = Array.from('length' in elementOrNodeList ? elementOrNodeList : [elementOrNodeList]);
|
||||
if (!nodes.length) return;
|
||||
|
@ -6,16 +6,16 @@ import {initVueEnv} from './components/VueComponentLoader.js';
|
||||
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
|
||||
import {initDashboardRepoList} from './components/DashboardRepoList.js';
|
||||
|
||||
import attachTribute from './features/tribute.js';
|
||||
import initGlobalCopyToClipboardListener from './features/clipboard.js';
|
||||
import initContextPopups from './features/contextpopup.js';
|
||||
import initRepoGraphGit from './features/repo-graph.js';
|
||||
import initHeatmap from './features/heatmap.js';
|
||||
import initImageDiff from './features/imagediff.js';
|
||||
import initRepoMigration from './features/repo-migration.js';
|
||||
import initRepoProject from './features/repo-projects.js';
|
||||
import initServiceWorker from './features/serviceworker.js';
|
||||
import initTableSort from './features/tablesort.js';
|
||||
import {attachTribute} from './features/tribute.js';
|
||||
import {initGlobalCopyToClipboardListener} from './features/clipboard.js';
|
||||
import {initContextPopups} from './features/contextpopup.js';
|
||||
import {initRepoGraphGit} from './features/repo-graph.js';
|
||||
import {initHeatmap} from './features/heatmap.js';
|
||||
import {initImageDiff} from './features/imagediff.js';
|
||||
import {initRepoMigration} from './features/repo-migration.js';
|
||||
import {initRepoProject} from './features/repo-projects.js';
|
||||
import {initServiceWorker} from './features/serviceworker.js';
|
||||
import {initTableSort} from './features/tablesort.js';
|
||||
import {initAdminUserListSearchForm} from './features/admin/users.js';
|
||||
import {initAdminConfigs} from './features/admin/config.js';
|
||||
import {initMarkupAnchors} from './markup/anchors.js';
|
||||
@ -24,7 +24,7 @@ import {initRepoIssueContentHistory} from './features/repo-issue-content.js';
|
||||
import {initStopwatch} from './features/stopwatch.js';
|
||||
import {initFindFileInRepo} from './features/repo-findfile.js';
|
||||
import {initCommentContent, initMarkupContent} from './markup/content.js';
|
||||
import initDiffFileTree from './features/repo-diff-filetree.js';
|
||||
import {initDiffFileTree} from './features/repo-diff-filetree.js';
|
||||
|
||||
import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js';
|
||||
import {
|
||||
|
@ -1,15 +1,18 @@
|
||||
import {svg} from '../svg.js';
|
||||
|
||||
export function makeCodeCopyButton() {
|
||||
const button = document.createElement('button');
|
||||
button.classList.add('code-copy', 'ui', 'button');
|
||||
button.innerHTML = svg('octicon-copy');
|
||||
return button;
|
||||
}
|
||||
|
||||
export function renderCodeCopy() {
|
||||
const els = document.querySelectorAll('.markup .code-block code');
|
||||
if (!els.length) return;
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.classList.add('code-copy', 'ui', 'button');
|
||||
button.innerHTML = svg('octicon-copy');
|
||||
|
||||
for (const el of els) {
|
||||
const btn = button.cloneNode(true);
|
||||
const btn = makeCodeCopyButton();
|
||||
btn.setAttribute('data-clipboard-text', el.textContent);
|
||||
el.after(btn);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import {isDarkTheme} from '../utils.js';
|
||||
import {makeCodeCopyButton} from './codecopy.js';
|
||||
|
||||
const {mermaidMaxSourceCharacters} = window.config;
|
||||
|
||||
const iframeCss = `
|
||||
@ -58,7 +60,13 @@ export async function renderMermaid() {
|
||||
iframe.sandbox = 'allow-scripts';
|
||||
iframe.style.height = `${Math.ceil(parseFloat(heightStr))}px`;
|
||||
iframe.srcdoc = `<html><head><style>${iframeCss}</style></head><body>${svgStr}</body></html>`;
|
||||
el.closest('pre').replaceWith(iframe);
|
||||
const mermaidBlock = document.createElement('div');
|
||||
mermaidBlock.classList.add('mermaid-block');
|
||||
mermaidBlock.append(iframe);
|
||||
const btn = makeCodeCopyButton();
|
||||
btn.setAttribute('data-clipboard-text', source);
|
||||
mermaidBlock.append(btn);
|
||||
el.closest('pre').replaceWith(mermaidBlock);
|
||||
});
|
||||
} catch (err) {
|
||||
displayError(el, err);
|
||||
|
@ -6,6 +6,7 @@ export function createTippy(target, opts = {}) {
|
||||
placement: target.getAttribute('data-placement') || 'top-start',
|
||||
animation: false,
|
||||
allowHTML: false,
|
||||
hideOnClick: false,
|
||||
interactiveBorder: 30,
|
||||
ignoreAttributes: true,
|
||||
maxWidth: 500, // increase over default 350px
|
||||
@ -46,7 +47,7 @@ export function showTemporaryTooltip(target, content) {
|
||||
}
|
||||
|
||||
tippy.setContent(content);
|
||||
tippy.show();
|
||||
if (!tippy.state.isShown) tippy.show();
|
||||
tippy.setProps({
|
||||
onHidden: (tippy) => {
|
||||
if (oldContent) {
|
||||
|
@ -68,7 +68,6 @@ export const svgs = {
|
||||
'octicon-sync': octiconSync,
|
||||
};
|
||||
|
||||
|
||||
const parser = new DOMParser();
|
||||
const serializer = new XMLSerializer();
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
.markup .code-block {
|
||||
.markup .code-block,
|
||||
.markup .mermaid-block {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@ -26,7 +27,8 @@
|
||||
background: var(--color-secondary-dark-1) !important;
|
||||
}
|
||||
|
||||
.markup .code-block:hover .code-copy {
|
||||
.markup .code-block:hover .code-copy,
|
||||
.markup .mermaid-block:hover .code-copy {
|
||||
visibility: visible;
|
||||
animation: fadein .2s both;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user