mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Table insert controls remain accessible in read-only mode
closes #7249
This commit is contained in:
@@ -91,7 +91,7 @@ export default class PasteHandler extends Extension {
|
||||
},
|
||||
handlePaste: (view, event: ClipboardEvent) => {
|
||||
// Do nothing if the document isn't currently editable
|
||||
if (view.props.editable && !view.props.editable(view.state)) {
|
||||
if (!view.editable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@ const uploadPlugin = (options: Options) =>
|
||||
props: {
|
||||
handleDOMEvents: {
|
||||
paste(view, event: ClipboardEvent): boolean {
|
||||
if (
|
||||
(view.props.editable && !view.props.editable(view.state)) ||
|
||||
!options.uploadFile
|
||||
) {
|
||||
if (!view.editable || !options.uploadFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,10 +48,7 @@ const uploadPlugin = (options: Options) =>
|
||||
return true;
|
||||
},
|
||||
drop(view, event: DragEvent): boolean {
|
||||
if (
|
||||
(view.props.editable && !view.props.editable(view.state)) ||
|
||||
!options.uploadFile
|
||||
) {
|
||||
if (!view.editable || !options.uploadFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ export default class Placeholder extends Mark {
|
||||
return true;
|
||||
},
|
||||
handleKeyDown: (view, event: KeyboardEvent) => {
|
||||
if (!view.props.editable || !view.props.editable(view.state)) {
|
||||
if (!view.editable) {
|
||||
return false;
|
||||
}
|
||||
if (this.editor.props.template) {
|
||||
@@ -138,7 +138,7 @@ export default class Placeholder extends Mark {
|
||||
return false;
|
||||
},
|
||||
handleClick: (view, pos, event: MouseEvent) => {
|
||||
if (!view.props.editable || !view.props.editable(view.state)) {
|
||||
if (!view.editable) {
|
||||
return false;
|
||||
}
|
||||
if (this.editor.props.template) {
|
||||
|
||||
@@ -117,6 +117,10 @@ export default class TableCell extends Node {
|
||||
},
|
||||
},
|
||||
decorations: (state) => {
|
||||
if (!this.editor.view?.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { doc } = state;
|
||||
const decorations: Decoration[] = [];
|
||||
const rows = getCellsInColumn(0)(state);
|
||||
|
||||
@@ -104,6 +104,10 @@ export default class TableHeader extends Node {
|
||||
},
|
||||
},
|
||||
decorations: (state) => {
|
||||
if (!this.editor.view?.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { doc } = state;
|
||||
const decorations: Decoration[] = [];
|
||||
const cols = getCellsInRow(0)(state);
|
||||
|
||||
Reference in New Issue
Block a user