mirror of https://github.com/fantasticit/think.git
feat: add taskItemClickable options
This commit is contained in:
parent
ffd3f80284
commit
253e07e6db
|
@ -50,6 +50,10 @@ export const Editor: React.FC<IProps> = ({ user, documentId, document }) => {
|
|||
getCollaborationExtension(provider),
|
||||
getCollaborationCursorExtension(provider, user),
|
||||
],
|
||||
editorProps: {
|
||||
// @ts-ignore
|
||||
taskItemClickable: true,
|
||||
},
|
||||
});
|
||||
const [loading, toggleLoading] = useToggle(true);
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ const CustomTaskItem = BuiltInTaskItem.extend({
|
|||
},
|
||||
|
||||
addProseMirrorPlugins() {
|
||||
const extensionThis = this;
|
||||
|
||||
return [
|
||||
new Plugin({
|
||||
props: {
|
||||
|
@ -86,6 +88,12 @@ const CustomTaskItem = BuiltInTaskItem.extend({
|
|||
if (view.editable) {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName.toLowerCase() !== 'span') return false;
|
||||
} else {
|
||||
// 非编辑模式,仅支持配置 taskItemClickable 可点击
|
||||
// @ts-ignore
|
||||
if (!extensionThis.editor.options.editorProps.taskItemClickable) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const parentElement = element.parentElement;
|
||||
|
|
Loading…
Reference in New Issue