Skip to content

Commit

Permalink
Merge pull request #5439 from nextcloud/fix/handle-is-embedded
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Mar 7, 2024
2 parents b5e9ce2 + a4a572f commit 885810e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/EditorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ const loadSyntaxHighlight = async (language) => {
}
}

const createEditor = ({ language, onCreate, onUpdate = () => {}, extensions, enableRichEditing, session, relativePath }) => {
const createEditor = ({ language, onCreate, onUpdate = () => {}, extensions, enableRichEditing, session, relativePath, isEmbedded = false }) => {
let defaultExtensions
if (enableRichEditing) {
defaultExtensions = [
RichText.configure({
relativePath,
isEmbedded,
component: this,
extensions: [
Mention.configure({
Expand Down
2 changes: 2 additions & 0 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default {

return val
},
inject: ['isEmbedded'],
props: {
richWorkspace: {
type: Boolean,
Expand Down Expand Up @@ -542,6 +543,7 @@ export default {
}),
],
enableRichEditing: this.isRichEditor,
isEmbedded: this.isEmbedded,
})
this.hasEditor = true
if (!documentState && documentSource) {
Expand Down
1 change: 1 addition & 0 deletions src/components/Link/LinkBubbleView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
ref="referencelist"
:text="sanitizedHref"
:limit="1"
:interactive="false"
:display-fallback="true"
class="link-view-bubble__reference-list"
@loaded="onReferenceListLoaded" />
Expand Down
11 changes: 10 additions & 1 deletion src/components/ViewerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Editor v-if="!useSourceView"
:file-id="fileid"
:relative-path="filename"
:active="active"
:active="active || isEmbedded"
:autofocus="autofocus"
:share-token="shareToken"
:mime="mime"
Expand Down Expand Up @@ -54,6 +54,11 @@ export default {
PlainTextReader,
Editor: getEditorInstance,
},
provide() {
return {
isEmbedded: this.isEmbedded,
}
},
props: {
filename: {
type: String,
Expand Down Expand Up @@ -91,6 +96,10 @@ export default {
type: String,
default: undefined,
},
isEmbedded: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down
5 changes: 4 additions & 1 deletion src/extensions/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default Extension.create({
extensions: [],
component: null,
relativePath: null,
isEmbedded: false,
}
},

Expand Down Expand Up @@ -102,7 +103,9 @@ export default Extension.create({
TaskList,
TaskItem,
Callouts,
Preview,
Preview.configure({
isEmbedded: this.options.isEmbedded,
}),
Underline,
Image,
ImageInline,
Expand Down
1 change: 1 addition & 0 deletions src/nodes/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default Node.create({

addOptions() {
return {
isEmbedded: false,
relativePath: null,
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/nodes/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
:value.sync="value"
@update:value="convertToParagraph" />
<NcReferenceList :text="node.attrs.href"
:limit="1" />
:limit="1"
:interactive="!extension.options.isEmbedded" />
</NodeViewWrapper>
</template>

Expand Down

0 comments on commit 885810e

Please sign in to comment.