浏览代码

Merge pull request #537 from dariusk/fix-drop

Prevent dropping of external files onto editor
pull/603/head
Matt Baer 1年前
committed by GitHub
父节点
当前提交
4c1678f91e
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. +8
    -0
      prose/prose.js

+ 8
- 0
prose/prose.js 查看文件

@@ -83,6 +83,14 @@ class ProseMirrorView {
typingTimer = setTimeout(doneTyping, doneTypingInterval);
this.updateState(newState);
},
handleDOMEvents: {
drop: (view, event) => {
// If a file is dropped externally into the editor, do not insert anything. This will not trigger if an image has been inserted after upload and is dragged and dropped internally to change its position.
if (event.dataTransfer.files.length > 0) {
event.preventDefault();
}
}
},
});
// Editor is focused to the last position. This is a workaround for a bug:
// 1. 1 type something in an existing entry


正在加载...
取消
保存