Skip to content

Commit

Permalink
Merge pull request #4845 from nextcloud/backport/4844/stable27
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Oct 11, 2023
2 parents da21797 + a2da7b9 commit dd59a9a
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 25 deletions.
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/files-modal.js

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

2 changes: 1 addition & 1 deletion js/files-modal.js.map

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

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

26 changes: 22 additions & 4 deletions src/components/Editor/MarkdownContentEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ import MenuBar from '../Menu/MenuBar.vue'
import { Editor } from '@tiptap/core'
/* eslint-disable import/no-named-as-default */
import History from '@tiptap/extension-history'
import { EDITOR, IS_RICH_EDITOR, useLinkClickHook } from '../Editor.provider.js'
import { getCurrentUser } from '@nextcloud/auth'
import { ATTACHMENT_RESOLVER, EDITOR, IS_RICH_EDITOR, useLinkClickHook } from '../Editor.provider.js'
import { createMarkdownSerializer } from '../../extensions/Markdown.js'
import AttachmentResolver from '../../services/AttachmentResolver.js'
import markdownit from '../../markdownit/index.js'
import { RichText } from '../../extensions/index.js'
import ReadonlyBar from '../Menu/ReadonlyBar.vue'
Expand All @@ -55,12 +57,15 @@ export default {
const val = {}
Object.defineProperties(val, {
[IS_RICH_EDITOR]: {
get: () => true,
},
[EDITOR]: {
get: () => this.$editor,
},
[ATTACHMENT_RESOLVER]: {
get: () => this.$attachmentResolver,
},
[IS_RICH_EDITOR]: {
get: () => true,
},
})
return val
Expand All @@ -75,6 +80,14 @@ export default {
type: Boolean,
default: false,
},
relativePath: {
type: String,
default: '',
},
shareToken: {
type: String,
default: null,
},
showOutlineOutside: {
type: Boolean,
default: false,
Expand All @@ -97,6 +110,11 @@ export default {
created() {
this.$editor = this.createEditor()
this.$editor.setEditable(!this.readOnly)
this.$attachmentResolver = new AttachmentResolver({
currentDirectory: this.relativePath?.match(/.*\//),
user: getCurrentUser(),
shareToken: this.shareToken,
})
},
beforeDestroy() {
Expand Down
2 changes: 2 additions & 0 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ window.OCA.Text.createEditor = async function({
: h(MarkdownContentEditor, {
props: {
content: data.content,
relativePath: filePath,
shareToken,
readOnly: data.readOnly,
showOutlineOutside: data.showOutlineOutside,
},
Expand Down

0 comments on commit dd59a9a

Please sign in to comment.