Update some JS dependencies (#13222)
* Update some JS dependencies - Update selective dependencies that are compatible with webpack 4. We can not upgrade to webpack 5 yet because `license-webpack-plugin` is incompatible. - Enable a few new eslint rules and fix new issues * fix comment Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
965861043a
commit
58e1e5ba13
6 changed files with 878 additions and 697 deletions
|
@ -15,7 +15,7 @@ export const emojiKeys = Object.keys(tempMap).sort((a, b) => {
|
|||
return a.localeCompare(b);
|
||||
});
|
||||
|
||||
export const emojiMap = {};
|
||||
const emojiMap = {};
|
||||
for (const key of emojiKeys) {
|
||||
emojiMap[key] = tempMap[key];
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
|
|||
import {initNotificationsTable, initNotificationCount} from './features/notification.js';
|
||||
import {createCodeEditor} from './features/codeeditor.js';
|
||||
import {svg, svgs} from './svg.js';
|
||||
import {stripTags} from './utils.js';
|
||||
|
||||
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
|
||||
|
||||
|
@ -1325,25 +1326,26 @@ function initWikiForm() {
|
|||
element: $editArea[0],
|
||||
forceSync: true,
|
||||
previewRender(plainText, preview) { // Async method
|
||||
// FIXME: still send render request when return back to edit mode
|
||||
const render = function () {
|
||||
sideBySideChanges = 0;
|
||||
if (sideBySideTimeout !== null) {
|
||||
clearTimeout(sideBySideTimeout);
|
||||
sideBySideTimeout = null;
|
||||
}
|
||||
$.post($editArea.data('url'), {
|
||||
_csrf: csrf,
|
||||
mode: 'gfm',
|
||||
context: $editArea.data('context'),
|
||||
text: plainText,
|
||||
wiki: true
|
||||
}, (data) => {
|
||||
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`;
|
||||
renderMarkdownContent();
|
||||
});
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
// FIXME: still send render request when return back to edit mode
|
||||
const render = function () {
|
||||
sideBySideChanges = 0;
|
||||
if (sideBySideTimeout !== null) {
|
||||
clearTimeout(sideBySideTimeout);
|
||||
sideBySideTimeout = null;
|
||||
}
|
||||
$.post($editArea.data('url'), {
|
||||
_csrf: csrf,
|
||||
mode: 'gfm',
|
||||
context: $editArea.data('context'),
|
||||
text: plainText,
|
||||
wiki: true
|
||||
}, (data) => {
|
||||
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`;
|
||||
renderMarkdownContent();
|
||||
});
|
||||
};
|
||||
if (!simplemde.isSideBySideActive()) {
|
||||
render();
|
||||
} else {
|
||||
|
@ -3367,10 +3369,6 @@ function initTopicbar() {
|
|||
success: false,
|
||||
results: [],
|
||||
};
|
||||
const stripTags = function (text) {
|
||||
return text.replace(/<[^>]*>?/gm, '');
|
||||
};
|
||||
|
||||
const query = stripTags(this.urlData.query.trim());
|
||||
let found_query = false;
|
||||
const current_topics = [];
|
||||
|
|
|
@ -24,13 +24,7 @@ export function uniq(arr) {
|
|||
return Array.from(new Set(arr));
|
||||
}
|
||||
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
// generate a random string
|
||||
export function random(length) {
|
||||
let str = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
return str;
|
||||
// strip <tags> from a string
|
||||
export function stripTags(text) {
|
||||
return text.replace(/<[^>]*>?/gm, '');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue