Skip to content

Commit

Permalink
Add support of multi-columns descriptions
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Myakshin <molodchick@gmail.com>
  • Loading branch information
Koc committed Jun 16, 2024
1 parent 608fbf8 commit 535e017
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"crypto-js": "^4.2.0",
"debounce": "^2.1.0",
"markdown-it": "^14.1.0",
"markdown-it-container": "^4.0.0",
"p-debounce": "^4.0.0",
"p-queue": "^8.0.1",
"v-click-outside": "^3.2.0",
Expand Down
8 changes: 7 additions & 1 deletion src/mixins/ViewsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { showError } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import axios from '@nextcloud/axios'
import MarkdownIt from 'markdown-it'
import MarkdownItContainer from 'markdown-it-container'

import CancelableRequest from '../utils/CancelableRequest.js'
import OcsResponse2Data from '../utils/OcsResponse2Data.js'
Expand Down Expand Up @@ -65,7 +66,12 @@ export default {
cancelFetchFullForm: () => {},

// markdown renderer for descriptions
markdownit: new MarkdownIt({ breaks: true }),
markdownit: new MarkdownIt({ breaks: true })
.use(MarkdownItContainer, 'columns', {})
.use(MarkdownItContainer, 'column-single', {})
.use(MarkdownItContainer, 'column-double', {})
.use(MarkdownItContainer, 'column-triple', {})
.use(MarkdownItContainer, 'column-quad', {}),
}
},

Expand Down
44 changes: 44 additions & 0 deletions src/scssmixins/markdownOutput.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,49 @@
list-style-type: square;
}
}

.columns {
display: flex;
flex-direction: row;
justify-content: space-between;
column-gap: 2em;

img {
max-width: 100%;
height: auto;
}

.column-single {
flex: 1 1;
overflow: hidden;
}

.column-double {
flex: 2 1;
overflow: hidden;
}

.column-triple {
flex: 3 1;
overflow: hidden;
}

.column-quad {
flex: 4 1;
overflow: hidden;
}

@media (max-width: 512px) {
flex-direction: column;
column-gap: 0;

.column-single,
.column-double,
.column-triple,
.column-quad {
flex: 1 1 100%;
}
}
}
}
}

0 comments on commit 535e017

Please sign in to comment.