mirror of
https://github.com/go-gitea/gitea
synced 2025-07-05 01:57:20 +00:00
Convert frontend code to typescript (#31559)
None of the frontend js/ts files was touched besides these two commands
(edit: no longer true, I touched one file in
61105d0618
because of a deprecation that was not showing before the rename).
`tsc` currently reports 778 errors, so I have disabled it in CI as
planned.
Everything appears to work fine.
This commit is contained in:
@ -1,17 +1,17 @@
|
||||
import '@github/markdown-toolbar-element';
|
||||
import '@github/text-expander-element';
|
||||
import $ from 'jquery';
|
||||
import {attachTribute} from '../tribute.js';
|
||||
import {hideElem, showElem, autosize, isElemVisible} from '../../utils/dom.js';
|
||||
import {initEasyMDEPaste, initTextareaUpload} from './EditorUpload.js';
|
||||
import {handleGlobalEnterQuickSubmit} from './QuickSubmit.js';
|
||||
import {renderPreviewPanelContent} from '../repo-editor.js';
|
||||
import {easyMDEToolbarActions} from './EasyMDEToolbarActions.js';
|
||||
import {initTextExpander} from './TextExpander.js';
|
||||
import {showErrorToast} from '../../modules/toast.js';
|
||||
import {POST} from '../../modules/fetch.js';
|
||||
import {initTextareaMarkdown} from './EditorMarkdown.js';
|
||||
import {DropzoneCustomEventReloadFiles, initDropzone} from '../dropzone.js';
|
||||
import {attachTribute} from '../tribute.ts';
|
||||
import {hideElem, showElem, autosize, isElemVisible} from '../../utils/dom.ts';
|
||||
import {initEasyMDEPaste, initTextareaUpload} from './EditorUpload.ts';
|
||||
import {handleGlobalEnterQuickSubmit} from './QuickSubmit.ts';
|
||||
import {renderPreviewPanelContent} from '../repo-editor.ts';
|
||||
import {easyMDEToolbarActions} from './EasyMDEToolbarActions.ts';
|
||||
import {initTextExpander} from './TextExpander.ts';
|
||||
import {showErrorToast} from '../../modules/toast.ts';
|
||||
import {POST} from '../../modules/fetch.ts';
|
||||
import {initTextareaMarkdown} from './EditorMarkdown.ts';
|
||||
import {DropzoneCustomEventReloadFiles, initDropzone} from '../dropzone.ts';
|
||||
|
||||
let elementIdCounter = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import {svg} from '../../svg.js';
|
||||
import {svg} from '../../svg.ts';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
import {createElementFromHTML} from '../../utils/dom.js';
|
||||
import {createElementFromHTML} from '../../utils/dom.ts';
|
||||
|
||||
const {i18n} = window.config;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {svg} from '../../svg.js';
|
||||
import {svg} from '../../svg.ts';
|
||||
|
||||
export function easyMDEToolbarActions(EasyMDE, editor) {
|
||||
const actions = {
|
@ -1,4 +1,4 @@
|
||||
import {removeAttachmentLinksFromMarkdown} from './EditorUpload.js';
|
||||
import {removeAttachmentLinksFromMarkdown} from './EditorUpload.ts';
|
||||
|
||||
test('removeAttachmentLinksFromMarkdown', () => {
|
||||
expect(removeAttachmentLinksFromMarkdown('a foo b', 'foo')).toBe('a foo b');
|
@ -1,12 +1,12 @@
|
||||
import {imageInfo} from '../../utils/image.js';
|
||||
import {replaceTextareaSelection} from '../../utils/dom.js';
|
||||
import {isUrl} from '../../utils/url.js';
|
||||
import {triggerEditorContentChanged} from './EditorMarkdown.js';
|
||||
import {imageInfo} from '../../utils/image.ts';
|
||||
import {replaceTextareaSelection} from '../../utils/dom.ts';
|
||||
import {isUrl} from '../../utils/url.ts';
|
||||
import {triggerEditorContentChanged} from './EditorMarkdown.ts';
|
||||
import {
|
||||
DropzoneCustomEventRemovedFile,
|
||||
DropzoneCustomEventUploadDone,
|
||||
generateMarkdownLinkForAttachment,
|
||||
} from '../dropzone.js';
|
||||
} from '../dropzone.ts';
|
||||
|
||||
let uploadIdCounter = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import {POST} from '../../modules/fetch.js';
|
||||
import {POST} from '../../modules/fetch.ts';
|
||||
|
||||
export function initCompReactionSelector() {
|
||||
for (const container of document.querySelectorAll('.issue-content, .diff-file-body')) {
|
@ -1,5 +1,5 @@
|
||||
import {matchEmoji, matchMention} from '../../utils/match.js';
|
||||
import {emojiString} from '../emoji.js';
|
||||
import {matchEmoji, matchMention} from '../../utils/match.ts';
|
||||
import {emojiString} from '../emoji.ts';
|
||||
|
||||
export function initTextExpander(expander) {
|
||||
expander?.addEventListener('text-expander-change', ({detail: {key, provide, text}}) => {
|
@ -1,5 +1,5 @@
|
||||
import {POST} from '../../modules/fetch.js';
|
||||
import {hideElem, showElem, toggleElem} from '../../utils/dom.js';
|
||||
import {POST} from '../../modules/fetch.ts';
|
||||
import {hideElem, showElem, toggleElem} from '../../utils/dom.ts';
|
||||
|
||||
export function initCompWebHookEditor() {
|
||||
if (!document.querySelectorAll('.new.webhook').length) {
|
Reference in New Issue
Block a user