Skip to content
Merged
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
9 changes: 5 additions & 4 deletions src/plugins/previewOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function previewOptions({ editor }) {
state: {
init(_, { doc }) {
if (!editor.options.editable) {
return { decorations: DecorationSet.create() }
return { linkParagraphs: [], decorations: DecorationSet.empty }
}
const linkParagraphs = extractLinkParagraphs(doc)
return {
Expand All @@ -36,10 +36,11 @@ export default function previewOptions({ editor }) {
}
},
apply(tr, value, _oldState, newState) {
if (!tr.docChanged) {
return value
}
// Always return empty decorations if editor is not editable
if (!editor.options.editable) {
return { linkParagraphs: [], decorations: DecorationSet.empty }
}
if (!tr.docChanged) {
return value
}
const linkParagraphs = extractLinkParagraphs(newState.doc)
Expand Down