Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable nested embedding fully #5439

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
max-nextcloud marked this conversation as resolved.
Show resolved Hide resolved
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
Loading