Allows commenting outside edit mode when seamless editing is disabled. (#5422)
This commit is contained in:
@@ -578,6 +578,7 @@ h6 {
|
||||
border-radius: 2px;
|
||||
|
||||
&:hover {
|
||||
${props.readOnly ? "cursor: var(--pointer);" : ""}
|
||||
background: ${transparentize(0.5, props.theme.brand.marine)};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ export default class Extension {
|
||||
return {};
|
||||
}
|
||||
|
||||
get allowInReadOnly(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
keys(_options: {
|
||||
type?: NodeType | MarkType;
|
||||
schema: Schema;
|
||||
|
||||
@@ -205,7 +205,7 @@ export default class ExtensionManager {
|
||||
callback: CommandFactory,
|
||||
attrs: Record<string, any>
|
||||
) => {
|
||||
if (!view.editable) {
|
||||
if (!view.editable && !extension.allowInReadOnly) {
|
||||
return false;
|
||||
}
|
||||
view.focus();
|
||||
|
||||
@@ -27,6 +27,10 @@ export default class Comment extends Mark {
|
||||
};
|
||||
}
|
||||
|
||||
get allowInReadOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
keys({ type }: { type: MarkType }): Record<string, Command> {
|
||||
return this.options.onCreateCommentMark
|
||||
? {
|
||||
|
||||
@@ -19,6 +19,7 @@ export type MenuItem = {
|
||||
shortcut?: string;
|
||||
keywords?: string;
|
||||
tooltip?: string;
|
||||
label?: string;
|
||||
defaultHidden?: boolean;
|
||||
attrs?: Record<string, any>;
|
||||
visible?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user