summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/content_editor/extensions/code_block_highlight.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-10 18:09:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-10 18:09:05 +0000
commit20a86e7f6fd58882025b1c85b21e891d75220da5 (patch)
tree31d400a3790b2b3650415e5caf1cabfbe8d9092e /app/assets/javascripts/content_editor/extensions/code_block_highlight.js
parent04ac4180cb5ba0df460034c7e64862056fd498b3 (diff)
downloadgitlab-ce-20a86e7f6fd58882025b1c85b21e891d75220da5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/content_editor/extensions/code_block_highlight.js')
-rw-r--r--app/assets/javascripts/content_editor/extensions/code_block_highlight.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/content_editor/extensions/code_block_highlight.js b/app/assets/javascripts/content_editor/extensions/code_block_highlight.js
index 1d85bfcc965..8917417e55e 100644
--- a/app/assets/javascripts/content_editor/extensions/code_block_highlight.js
+++ b/app/assets/javascripts/content_editor/extensions/code_block_highlight.js
@@ -1,6 +1,6 @@
import { lowlight } from 'lowlight/lib/core';
import { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight';
-import { textblockTypeInputRule } from '@tiptap/core';
+import { mergeAttributes, textblockTypeInputRule } from '@tiptap/core';
import { VueNodeViewRenderer } from '@tiptap/vue-2';
import languageLoader from '../services/code_block_language_loader';
import CodeBlockWrapper from '../components/wrappers/code_block.vue';
@@ -13,6 +13,16 @@ export const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
export default CodeBlockLowlight.extend({
isolating: true,
exitOnArrowDown: false,
+
+ addOptions() {
+ return {
+ ...this.parent?.(),
+ HTMLAttributes: {
+ dir: 'auto',
+ },
+ };
+ },
+
addAttributes() {
return {
language: {
@@ -61,7 +71,7 @@ export default CodeBlockLowlight.extend({
return [
'pre',
{
- ...HTMLAttributes,
+ ...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
class: `content-editor-code-block ${gon.user_color_scheme} ${HTMLAttributes.class}`,
},
['code', {}, 0],