From c54e7283c976bf7f4394e3270a28e34655275275 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 15 Feb 2023 18:09:19 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../javascripts/behaviors/markdown/render_math.js | 49 ++++++++++++++++------ .../components/bold_text.vue | 26 ++++++++++++ .../components/states/merge_checks_failed.vue | 18 ++++---- .../components/states/mr_widget_archived.vue | 12 ++++-- .../components/states/mr_widget_checking.vue | 4 +- .../components/states/mr_widget_conflicts.vue | 31 ++++++++------ .../states/mr_widget_failed_to_merge.vue | 14 ++++--- .../components/states/mr_widget_merging.vue | 10 ++--- .../components/states/mr_widget_missing_branch.vue | 14 ++++--- .../components/states/mr_widget_not_allowed.vue | 15 ++++--- .../states/mr_widget_pipeline_blocked.vue | 16 +++---- .../components/states/mr_widget_rebase.vue | 34 ++++++++------- .../components/states/pipeline_failed.vue | 20 +++++---- .../components/states/sha_mismatch.vue | 6 ++- .../components/states/unresolved_discussions.vue | 12 ++++-- .../components/states/work_in_progress.vue | 15 ++++--- .../vue_merge_request_widget/constants.js | 20 ++++----- .../javascripts/vue_merge_request_widget/i18n.js | 2 +- .../javascripts/vue_shared/components/url_sync.vue | 18 +++++++- 19 files changed, 219 insertions(+), 117 deletions(-) create mode 100644 app/assets/javascripts/vue_merge_request_widget/components/bold_text.vue (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/behaviors/markdown/render_math.js b/app/assets/javascripts/behaviors/markdown/render_math.js index 097f2617c1d..9d33f051ad0 100644 --- a/app/assets/javascripts/behaviors/markdown/render_math.js +++ b/app/assets/javascripts/behaviors/markdown/render_math.js @@ -1,17 +1,19 @@ +import { escape } from 'lodash'; import { spriteIcon } from '~/lib/utils/common_utils'; import { differenceInMilliseconds } from '~/lib/utils/datetime_utility'; -import { s__ } from '~/locale'; +import { s__, sprintf } from '~/locale'; import { unrestrictedPages } from './constants'; -// Renders math using KaTeX in any element with the -// `js-render-math` class +// Renders math using KaTeX in an element. // -// ### Example Markup -// -// +// Typically for elements with the `js-render-math` class such as +// // +// See app/assets/javascripts/behaviors/markdown/render_gfm.js const MAX_MATH_CHARS = 1000; +const MAX_MACRO_EXPANSIONS = 1000; +const MAX_USER_SPECIFIED_EMS = 20; const MAX_RENDER_TIME_MS = 2000; // Wait for the browser to reflow the layout. Reflowing SVG takes time. @@ -74,13 +76,23 @@ class SafeMathRenderer { const { parentNode } = el; parentNode.replaceChild(wrapperElement, el); + let message; + if (text.length > MAX_MATH_CHARS) { + message = sprintf( + s__( + 'math|This math block exceeds %{maxMathChars} characters, and may cause performance issues on this page.', + ), + { maxMathChars: MAX_MATH_CHARS }, + ); + } else { + message = s__('math|Displaying this math block may cause performance issues on this page.'); + } + const html = `